本文整理汇总了C++中ofxCvGrayscaleImage类的典型用法代码示例。如果您正苦于以下问题:C++ ofxCvGrayscaleImage类的具体用法?C++ ofxCvGrayscaleImage怎么用?C++ ofxCvGrayscaleImage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ofxCvGrayscaleImage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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();
}
示例3: calc
void ofxCvOpticalFlowLK::calc( ofxCvGrayscaleImage & pastImage,
ofxCvGrayscaleImage & currentImage,
int size
)
{
cvCalcOpticalFlowLK( pastImage.getCvImage(), currentImage.getCvImage(),
cvSize( size, size), vel_x, vel_y );
}
示例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");
}
}
示例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);
}
示例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");
}
}
示例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");
}
}
示例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);
}
示例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");
}
}
示例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");
}
}
示例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();
}
}
示例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";
}
}
示例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");
}
}
示例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";
}
}
示例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());
}