本文整理汇总了C++中ofxCvGrayscaleImage::getCvImage方法的典型用法代码示例。如果您正苦于以下问题:C++ ofxCvGrayscaleImage::getCvImage方法的具体用法?C++ ofxCvGrayscaleImage::getCvImage怎么用?C++ ofxCvGrayscaleImage::getCvImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofxCvGrayscaleImage
的用法示例。
在下文中一共展示了ofxCvGrayscaleImage::getCvImage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: convertToGrayscalePlanarImages
//--------------------------------------------------------------------------------
void ofxCvColorImage::convertToGrayscalePlanarImages(ofxCvGrayscaleImage& red, ofxCvGrayscaleImage& green, ofxCvGrayscaleImage& blue){
if( !bAllocated ){
ofLogError("ofxCvColorImage") << "convertToGrayscalePlanarImages(): image not allocated";
return;
}
ofRectangle roi = getROI();
ofRectangle redRoi = red.getROI();
ofRectangle greenRoi = green.getROI();
ofRectangle blueRoi = blue.getROI();
if( !red.bAllocated ){
red.allocate(width, height);
}
if( !green.bAllocated ){
green.allocate(width, height);
}
if( !blue.bAllocated ){
blue.allocate(width, height);
}
if( redRoi.width == roi.width && redRoi.height == roi.height &&
greenRoi.width == roi.width && greenRoi.height == roi.height &&
blueRoi.width == roi.width && blueRoi.height == roi.height )
{
cvCvtPixToPlane(cvImage, red.getCvImage(), green.getCvImage(), blue.getCvImage(), NULL);
red.flagImageChanged();
green.flagImageChanged();
blue.flagImageChanged();
} else {
ofLogError("ofxCvColorImage") << "convertToGrayscalePlanarImages(): image size or region of interest mismatch";
}
}
示例2: 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");
}
}
示例3: absDiff
//--------------------------------------------------------------------------------
void ofxCvGrayscaleImage::absDiff( ofxCvGrayscaleImage& mom,
ofxCvGrayscaleImage& dad ) {
if( !mom.bAllocated ){
ofLog(OF_LOG_ERROR, "in absDiff, mom needs to be allocated");
return;
}
if( !dad.bAllocated ){
ofLog(OF_LOG_ERROR, "in absDiff, dad needs to be allocated");
return;
}
if( !bAllocated ){
ofLog(OF_LOG_NOTICE, "in absDiff, allocating to match dimensions");
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 {
ofLog(OF_LOG_ERROR, "in absDiff, images are different sizes");
}
}
示例4: 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";
}
}
示例5: absDiff
//--------------------------------------------------------------------------------
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";
}
}
示例6: calc
void ofxCvOpticalFlowLK::calc( ofxCvGrayscaleImage & pastImage,
ofxCvGrayscaleImage & currentImage,
int size
)
{
cvCalcOpticalFlowLK( pastImage.getCvImage(), currentImage.getCvImage(),
cvSize( size, size), vel_x, vel_y );
}
示例7: calc
void ofCvOpticalFlowBM::calc( ofxCvGrayscaleImage & pastImage,
ofxCvGrayscaleImage & currentImage,
int size
)
{
cvCalcOpticalFlowBM(pastImage.getCvImage(), currentImage.getCvImage(),
block, shift, max_range, 0, vel_x, vel_y);
}
示例8: 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");
}
}
示例9: 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");
}
}
示例10: absDiff
//--------------------------------------------------------------------------------
void ofxCvGrayscaleImage::absDiff( ofxCvGrayscaleImage& mom,
ofxCvGrayscaleImage& dad ) {
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 {
ofLog(OF_LOG_ERROR, "in absDiff, images are different sizes");
}
}
示例11:
//--------------------------------------------------------------
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());
}
示例12: setFromGrayscalePlanarImages
//--------------------------------------------------------------------------------
void ofxCvColorImage::setFromGrayscalePlanarImages( ofxCvGrayscaleImage& red, ofxCvGrayscaleImage& green, ofxCvGrayscaleImage& blue){
ofRectangle roi = getROI();
ofRectangle redRoi = red.getROI();
ofRectangle greenRoi = green.getROI();
ofRectangle blueRoi = blue.getROI();
if( redRoi.width == roi.width && redRoi.height == roi.height &&
greenRoi.width == roi.width && greenRoi.height == roi.height &&
blueRoi.width == roi.width && blueRoi.height == roi.height )
{
cvCvtPlaneToPix(red.getCvImage(), green.getCvImage(), blue.getCvImage(),NULL, cvImage);
flagImageChanged();
} else {
ofLog(OF_LOG_ERROR, "in setFromGrayscalePlanarImages, ROI/size mismatch");
}
}
示例13: 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;
}
}
示例14:
//--------------------------------------------------------------------------------
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;
}
}
示例15: 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);
}