• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ ofxCvGrayscaleImage类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中ofxCvGrayscaleImage的典型用法代码示例。如果您正苦于以下问题:C++ ofxCvGrayscaleImage类的具体用法?C++ ofxCvGrayscaleImage怎么用?C++ ofxCvGrayscaleImage使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了ofxCvGrayscaleImage类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: checkForCommonFill

void testApp :: checkForCommonFill ( ofxCvGrayscaleImage& imageOut, ofxCvGrayscaleImage& image1, ofxCvGrayscaleImage& image2 )
{
	int noPixels;
	noPixels = imageOut.width * imageOut.height;

	unsigned char* imageOutPixels;
	unsigned char* image1Pixels;
	unsigned char* image2Pixels;
	
	imageOutPixels	= new unsigned char[ noPixels ];
	image1Pixels	= image1.getPixels();
	image2Pixels	= image2.getPixels();
	
	for( int i=0; i<noPixels; i++ )
	{
		if
		( 
			image1Pixels[ i ] == 255 &&
			image2Pixels[ i ] == 255
		)
		{
			imageOutPixels[ i ] = 255;
		}
		else
		{
			imageOutPixels[ i ] = 0;
		}
	}
	
	imageOut.setFromPixels( imageOutPixels, imageOut.width, imageOut.height );
	
	delete[] imageOutPixels;
}
开发者ID:MrMdR,项目名称:julapy,代码行数:33,代码来源:testApp.cpp


示例2: performMorphologicalOpen

//--------------------------------------------------------------
void DepthHoleFiller::performMorphologicalOpen ( ofxCvGrayscaleImage &input){
	
	// Clean up the holes using morphological close. 
	// http://homepages.inf.ed.ac.uk/rbf/HIPR2/open.htm
	
	input.erode();
	input.dilate();
}
开发者ID:Akira-Hayasaka,项目名称:MiraiHakuSourceForBeyondInteractionVer2,代码行数:9,代码来源:DepthHoleFiller.cpp


示例3: calc

void ofxCvOpticalFlowLK::calc( ofxCvGrayscaleImage & pastImage,
							  ofxCvGrayscaleImage & currentImage,					   
							  int size
							  )
{
	cvCalcOpticalFlowLK( pastImage.getCvImage(), currentImage.getCvImage(),
						cvSize( size, size), vel_x, vel_y );
}
开发者ID:wlstks7,项目名称:fuckyoubody,代码行数:8,代码来源:ofxCvOpticalFlowLK.cpp


示例4: absDiff

//--------------------------------------------------------------------------------
void ofxCvGrayscaleImage::absDiff( ofxCvGrayscaleImage& mom ) {
    if( matchingROI(getROI(), mom.getROI()) ) {
        cvAbsDiff( cvImage, mom.getCvImage(), cvImageTemp );
        swapTemp();
        flagImageChanged();
    } else {
        ofLog(OF_LOG_ERROR, "in *=, ROI mismatch");
    }
}
开发者ID:madshobye,项目名称:moodCam,代码行数:10,代码来源:ofxCvGrayscaleImage.cpp


示例5: calc

void ofCvOpticalFlowBM::calc( ofxCvGrayscaleImage & pastImage,
                              ofxCvGrayscaleImage & currentImage,
                              int size
                            )
{

    cvCalcOpticalFlowBM(pastImage.getCvImage(), currentImage.getCvImage(),
                        block, shift, max_range, 0, vel_x, vel_y);
}
开发者ID:heavyside,项目名称:refractiveindex,代码行数:9,代码来源:ofCvOpticalFlowBM.cpp


示例6: addWeighted

//--------------------------------------------------------------------------------
void ofxCvFloatImage::addWeighted( ofxCvGrayscaleImage& mom, float f ) {
	if( matchingROI(getROI(), mom.getROI()) ) {
        convertGrayToFloat(mom.getCvImage(), cvImageTemp);
        cvAddWeighted( cvImageTemp, f, cvImage, 1.0f-f,0, cvImage );
        flagImageChanged();
    } else {
        ofLog(OF_LOG_ERROR, "in addWeighted, ROI mismatch");
    }
}
开发者ID:dopuskh3,项目名称:ofx-projects,代码行数:10,代码来源:ofxCvFloatImage.cpp


示例7: convertToGrayscalePlanarImages

//--------------------------------------------------------------------------------
void ofxCvColorImage::convertToGrayscalePlanarImages(ofxCvGrayscaleImage& red, ofxCvGrayscaleImage& green, ofxCvGrayscaleImage& blue){
	if( red.width == width && red.height == height &&
        green.width == width && green.height == height &&
        blue.width == width && blue.height == height )
    {
        cvCvtPixToPlane(cvImage, red.getCvImage(), green.getCvImage(), blue.getCvImage(), NULL);
	} else {
        ofLog(OF_LOG_ERROR, "in convertToGrayscalePlanarImages, images are different sizes");
	}     
}
开发者ID:6301158,项目名称:ofx-dev,代码行数:11,代码来源:ofxCvColorImage.cpp


示例8: resetRoiMask

void testApp::resetRoiMask(ofxCvGrayscaleImage img){
    int w = img.getWidth();
    int h = img.getHeight();

    roiMask[0] = ofPoint(0,0);
    roiMask[1] = ofPoint(w-1,0);
    roiMask[2] = ofPoint(w-1,h-1);
    roiMask[3] = ofPoint(0,h-1);
    
}
开发者ID:miguelespada,项目名称:madMapperCV,代码行数:10,代码来源:testApp.cpp


示例9: addWeighted

//--------------------------------------------------------------------------------
void ofxCvFloatImage::addWeighted( ofxCvGrayscaleImage& mom, float f ) {
	if( pushSetBothToTheirIntersectionROI(*this,mom) ) {
        convertGrayToFloat(mom.getCvImage(), cvImageTemp);
        cvAddWeighted( cvImageTemp, f, cvImage, 1.0f-f,0, cvImage );
        popROI();       //restore prevoius ROI
        mom.popROI();   //restore prevoius ROI           
        flagImageChanged();
    } else {
        ofLog(OF_LOG_ERROR, "in addWeighted, ROI mismatch");
    }
}
开发者ID:6301158,项目名称:ofx-dev,代码行数:12,代码来源:ofxCvFloatImage.cpp


示例10: setFromGrayscalePlanarImages

//--------------------------------------------------------------------------------
void ofxCvColorImage::setFromGrayscalePlanarImages( ofxCvGrayscaleImage& red, ofxCvGrayscaleImage& green, ofxCvGrayscaleImage& blue){     
	if( red.width == width && red.height == height &&
        green.width == width && green.height == height &&
        blue.width == width && blue.height == height )
    {
         cvCvtPlaneToPix(red.getCvImage(), green.getCvImage(), blue.getCvImage(),NULL, cvImage);
         flagImageChanged();
	} else {
        ofLog(OF_LOG_ERROR, "in setFromGrayscalePlanarImages, images are different sizes");
	}     
}
开发者ID:6301158,项目名称:ofx-dev,代码行数:12,代码来源:ofxCvColorImage.cpp


示例11: performMorphologicalClose

//--------------------------------------------------------------
void DepthHoleFiller::performMorphologicalClose ( ofxCvGrayscaleImage &input, int diameter){
	
	// Clean up the holes using morphological close. 
	// use a "larger structural element" by repeated passes.
	// http://homepages.inf.ed.ac.uk/rbf/HIPR2/close.htm
	
	for (int i=0; i<diameter; i++){
		input.dilate();
	}
	for (int i=0; i<diameter; i++){
		input.erode();
	}
}
开发者ID:Akira-Hayasaka,项目名称:MiraiHakuSourceForBeyondInteractionVer2,代码行数:14,代码来源:DepthHoleFiller.cpp


示例12: convertToGrayscalePlanarImage

//--------------------------------------------------------------------------------
void ofxCvColorImage::convertToGrayscalePlanarImage (ofxCvGrayscaleImage& grayImage, int whichPlane){
	if( !bAllocated ){
		ofLogError("ofxCvColorImage") << "convertToGrayscalePlanarImage(): image not allocated";	
		return;	
	}
	
	if( !grayImage.bAllocated ){
		grayImage.allocate(width, height);
	} 
		
	ofRectangle roi = getROI();
    ofRectangle grayRoi = grayImage.getROI();
   
	if( grayRoi.width == roi.width && grayRoi.height == roi.height ){

		switch (whichPlane){
				
			case 0:
				cvCvtPixToPlane(cvImage, grayImage.getCvImage(), NULL, NULL, NULL);
				grayImage.flagImageChanged();
				break;
			case 1:
				cvCvtPixToPlane(cvImage, NULL, grayImage.getCvImage(), NULL, NULL);
				grayImage.flagImageChanged();
				break;
			case 2:
				cvCvtPixToPlane(cvImage, NULL, NULL, grayImage.getCvImage(), NULL);
				grayImage.flagImageChanged();
				break;
		}
			
	} else {
		ofLogError("ofxCvColorImage") << "convertToGrayscalePlanarImages(): image size or region of interest mismatch";
	}
}
开发者ID:AnnaKolla,项目名称:openFrameworks,代码行数:36,代码来源:ofxCvColorImage.cpp


示例13: addWeighted

//--------------------------------------------------------------------------------
void ofxCvShortImage::addWeighted( ofxCvGrayscaleImage& mom, float f ) {
	if( !bAllocated ){
		ofLog(OF_LOG_ERROR, "in addWeighted, image is not allocated");		
		return;	
	}
	
	if( matchingROI(getROI(), mom.getROI()) ) {
        convertGrayToShort(mom.getCvImage(), cvImageTemp);
        cvAddWeighted( cvImageTemp, f, cvImage, 1.0f-f,0, cvImage );
        flagImageChanged();
    } else {
        ofLog(OF_LOG_ERROR, "in addWeighted, ROI mismatch");
    }
}
开发者ID:3snail,项目名称:openFrameworks,代码行数:15,代码来源:ofxCvShortImage.cpp


示例14: ofLogError

//--------------------------------------------------------------------------------
void ofxCvGrayscaleImage::absDiff( ofxCvGrayscaleImage& mom,
                                   ofxCvGrayscaleImage& dad ) {

	if( !mom.bAllocated ){
		ofLogError("ofxCvGrayscaleImage") << "absDiff(): first source image (mom) not allocated";
		return;	
	}
	if( !dad.bAllocated ){
		ofLogError("ofxCvGrayscaleImage") << "absDiff(): second source image (dad) not allocated";
		return;	
	}	
	if( !bAllocated ){
		ofLogNotice("ofxCvGrayscaleImage") << "absDiff(): allocating to match dimensions: "
			<< mom.getWidth() << " " << mom.getHeight();
		allocate(mom.getWidth(), mom.getHeight());
	}
									   
    ofRectangle roi = getROI();
    ofRectangle momRoi = mom.getROI();
    ofRectangle dadRoi = dad.getROI();
    if( (momRoi.width == roi.width && momRoi.height == roi.height ) &&
        (dadRoi.width == roi.width && dadRoi.height == roi.height ) )
    {
        cvAbsDiff( mom.getCvImage(), dad.getCvImage(), cvImage );
        flagImageChanged();
    } else {
        ofLogError("ofxCvGrayscaleImage") << "absDiff(): source image size mismatch between first (mom) & second (dad) image";
    }
}
开发者ID:omarieclaire,项目名称:closer,代码行数:30,代码来源:ofxCvGrayscaleImage.cpp


示例15:

//--------------------------------------------------------------
void DepthHoleFiller::performProperClose		  ( ofxCvGrayscaleImage &input, int diameter){
	
	// http://homepages.inf.ed.ac.uk/rbf/HIPR2/close.htm 
	// Defined as Max(f, O(C(O(f))))
	
	ofxCv8uC1_Temp1 = input; // temp copy of original
	
	performMorphologicalOpen	(input, diameter);
	performMorphologicalClose	(input, diameter);
	performMorphologicalOpen	(input, diameter);
	
	cvMax(input.getCvImage(), 
		  ofxCv8uC1_Temp1.getCvImage(), 
		  input.getCvImage());
}
开发者ID:Akira-Hayasaka,项目名称:MiraiHakuSourceForBeyondInteractionVer2,代码行数:16,代码来源:DepthHoleFiller.cpp


示例16: drawPupilImageWithScanLine

void thresholdCalculator::drawPupilImageWithScanLine(int x, int y, int w, int h, ofxCvGrayscaleImage & img) {
	
	ofEnableAlphaBlending();
	
	ofPushMatrix();
	ofTranslate(x, y, 0);
	
	ofSetColor(255, 255, 255);
	img.draw(0, 0, w, h);
	
	ofSetColor(255, 255, 255,80);
	ofLine(0, scanY, w, scanY);				
	ofLine(scanX, 0, scanX, h);
	
	ofSetColor(255, 0, 0, 50);
	ofFill();
	ofCircle(whiteLocMin.x * (img.width / roi.width), whiteLocMin.y * (img.height / roi.height), 10);
	
	ofDisableAlphaBlending();
	
	ofSetColor(255, 255, 255);
	ofDrawBitmapString("imgBeforeThreshold", 1, h + 12);
	
	ofPopMatrix();
	
}
开发者ID:BluntBlade,项目名称:eyewriter,代码行数:26,代码来源:thresholdCalculator.cpp


示例17: cvConvert

// Set Pixel Data - Arrays
//--------------------------------------------------------------------------------
void ofxCvFloatImage::operator =	( ofxCvGrayscaleImage& mom ) {
	if( mom.width == width && mom.height == height ) {
        cvConvert( mom.getCvImage(), cvImage );
	} else {
        cout << "error in =, images are different sizes" << endl;
	}
}
开发者ID:heavyside,项目名称:refractiveindex,代码行数:9,代码来源:ofxCvFloatImage.cpp


示例18: findBlobs

//----------------------------------------------------------------------------------
void ofxCvBlobFinder::findBlobs(ofxCvGrayscaleImage image, bool find_holes) {
    
    CvMemStorage *stor = cvCreateMemStorage();
    IplImage *img = image.getCvImage();
    CvSeq *contours;
    
    _width = img->width;
    _height = img->height;
    
    // CV_RETR_EXTERNAL to not find holes
    int mode = (find_holes)?CV_RETR_LIST:CV_RETR_EXTERNAL;
    
    cvFindContours(img, stor, &contours, sizeof(CvContour), mode, CV_CHAIN_APPROX_SIMPLE);
    
    blobz.clear();
    while (contours) {
        ofxCvComplexBlob b =  ofxCvComplexBlob(contours);
        b.setApproxFactor(approxFactor);
        b.getApproxPoints();
        b.getHullPoints();
        blobz.push_back( b );
        contours = contours->h_next;
    }
    
    // sort blobs
    sort(blobz.begin(),  blobz.end(), sort_blob_func);
}
开发者ID:Mystfit,项目名称:Sonoromancer,代码行数:28,代码来源:ofxCvBlobFinder.cpp


示例19:

//--------------------------------------------------------------------------------
void ofxCvColorImage::operator =	( ofxCvGrayscaleImage& mom ) {
	if( mom.width == width && mom.height == height ) {
		cvCvtColor( mom.getCvImage(), cvImage, CV_GRAY2RGB );
	} else {
        cout << "error in =, images are different sizes" << endl;
	}
}
开发者ID:heavyside,项目名称:refractiveindex,代码行数:8,代码来源:ofxCvColorImage.cpp


示例20: convertToGrayscalePlanarImage

//--------------------------------------------------------------------------------
void ofxCvColorImage::convertToGrayscalePlanarImage (ofxCvGrayscaleImage& grayImage, int whichPlane){
	
	ofRectangle roi = getROI();
    ofRectangle grayRoi = grayImage.getROI();
   
	if( grayRoi.width == roi.width && grayRoi.height == roi.height ){

		switch (whichPlane){
				
			case 0:
				cvCvtPixToPlane(cvImage, grayImage.getCvImage(), NULL, NULL, NULL);
				grayImage.flagImageChanged();
				break;
			case 1:
				cvCvtPixToPlane(cvImage, NULL, grayImage.getCvImage(), NULL, NULL);
				grayImage.flagImageChanged();
				break;
			case 2:
				cvCvtPixToPlane(cvImage, NULL, NULL, grayImage.getCvImage(), NULL);
				grayImage.flagImageChanged();
				break;
		}
			
	} else {
    
		ofLog(OF_LOG_ERROR, "in convertToGrayscalePlanarImages, ROI/size mismatch");
	
	}
	
}
开发者ID:madshobye,项目名称:moodCam,代码行数:31,代码来源:ofxCvColorImage.cpp



注:本文中的ofxCvGrayscaleImage类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ ofxCvImage类代码示例发布时间:2022-05-31
下一篇:
C++ ofxCvColorImage类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap