//-------------------------------------------------------------------------------- void ofxCvImage::operator *= ( ofxCvImage& mom ) { if( !mom.bAllocated ){ ofLogError("ofxCvImage") << "operator*=: mom needs to be allocated"; return; } if( !bAllocated ){ ofLogNotice("ofxCvImage") << "operator*=: allocating to match dimensions: " << mom.getWidth() << " " << mom.getHeight(); allocate(mom.getWidth(), mom.getHeight()); } if( mom.getCvImage()->nChannels == cvImage->nChannels && mom.getCvImage()->depth == cvImage->depth ) { if( matchingROI(getROI(), mom.getROI()) ) { float scalef = 1.0f / 255.0f; cvMul( cvImage, mom.getCvImage(), cvImageTemp, scalef ); swapTemp(); flagImageChanged(); } else { ofLogError("ofxCvImage") << "operator*=: region of interest mismatch"; } } else { ofLogError("ofxCvImage") << "operator*=: images type mismatch"; } }
//-------------------------------------------------------------------------------- void ofxCvImage::operator &= ( ofxCvImage& mom ) { if( !mom.bAllocated ){ ofLogError("ofxCvImage") << "operator&=: source image not allocated"; return; } if( !bAllocated ){ ofLogNotice("ofxCvImage") << "operator&=: allocating to match dimensions: " << mom.getWidth() << " " << mom.getHeight(); allocate(mom.getWidth(), mom.getHeight()); } if( mom.getCvImage()->nChannels == cvImage->nChannels && mom.getCvImage()->depth == cvImage->depth ) { if( matchingROI(getROI(), mom.getROI()) ) { cvAnd( cvImage, mom.getCvImage(), cvImageTemp ); swapTemp(); flagImageChanged(); } else { ofLogError("ofxCvImage") << "operator&=: region of interest mismatch"; } } else { ofLogError("ofxCvImage") << "operator&=: images need to have matching type"; } }
//-------------------------------------------------------------------------------- void ofxCvImage::operator *= ( ofxCvImage& mom ) { if( !mom.bAllocated ){ ofLog(OF_LOG_ERROR, "in *=, mom needs to be allocated"); return; } if( !bAllocated ){ ofLog(OF_LOG_NOTICE, "in *=, allocating to match dimensions"); allocate(mom.getWidth(), mom.getHeight()); } if( mom.getCvImage()->nChannels == cvImage->nChannels && mom.getCvImage()->depth == cvImage->depth ) { if( matchingROI(getROI(), mom.getROI()) ) { float scalef = 1.0f / 255.0f; cvMul( cvImage, mom.getCvImage(), cvImageTemp, scalef ); swapTemp(); flagImageChanged(); } else { ofLog(OF_LOG_ERROR, "in *=, ROI mismatch"); } } else { ofLog(OF_LOG_ERROR, "in *=, images need to have matching type"); } }
//-------------------------------------------------------------------------------- void ofxCvFloatImage::operator *= ( ofxCvImage& mom ) { if( mom.getWidth() == 0 || mom.getHeight() == 0 ){ ofLog(OF_LOG_ERROR, "in *=, mom width or height is 0"); return; } if( !bAllocated ){ ofLog(OF_LOG_ERROR, "in *=, image is not allocated"); return; } if( mom.getCvImage()->nChannels == cvImage->nChannels && mom.getCvImage()->depth == cvImage->depth ){ if( matchingROI(getROI(), mom.getROI()) ) { cvMul( cvImage, mom.getCvImage(), cvImageTemp ); swapTemp(); flagImageChanged(); } else { ofLog(OF_LOG_ERROR, "in *=, ROI mismatch"); } } else { ofLog(OF_LOG_ERROR, "in *=, images need to have matching type"); } }
//-------------------------------------------------------------------------------- void ofxCvFloatImage::operator &= ( ofxCvImage& mom ) { if( mom.getWidth() == 0 || mom.getHeight() == 0 ){ ofLog(OF_LOG_ERROR, "in &=, mom width or height is 0"); return; } if( !bAllocated ){ ofLog(OF_LOG_ERROR, "in &=, image is not allocated"); return; } if( mom.getCvImage()->nChannels == cvImage->nChannels && mom.getCvImage()->depth == cvImage->depth ){ if( matchingROI(getROI(), mom.getROI()) ) { //this is doing it bit-wise; probably not what we want cvAnd( cvImage, mom.getCvImage(), cvImageTemp ); swapTemp(); flagImageChanged(); } else { ofLog(OF_LOG_ERROR, "in &=, ROI mismatch"); } } else { ofLog(OF_LOG_ERROR, "in &=, images need to have matching type"); } }