Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

fixed get*Ref from float and short

  • Loading branch information...
commit 0ff95bd485c5e2bbea16e41b0963f49533ccd129 1 parent 1480ca8
@kylemcdonald authored
View
8 addons/ofxOpenCv/src/ofxCvFloatImage.cpp
@@ -484,9 +484,7 @@ float* ofxCvFloatImage::getPixelsAsFloats(){
ofFloatPixels & ofxCvFloatImage::getFloatPixelsRef(){
if( !bAllocated ){
ofLog(OF_LOG_WARNING, "in getPixelsAsFloats, image is not allocated");
- }
-
- if(bFloatPixelsDirty) {
+ } else if(bFloatPixelsDirty) {
if( cvImage->width*cvImage->depth/8 == cvImage->widthStep ){
floatPixels.setFromExternalPixels((float*)cvImage->imageData,width,height,1);
}else{
@@ -510,9 +508,7 @@ float* ofxCvFloatImage::getRoiPixelsAsFloats(){
ofFloatPixels & ofxCvFloatImage::getRoiFloatPixelsRef(){
if( !bAllocated ){
ofLog(OF_LOG_WARNING, "in getRoiFloatPixelsRef, image is not allocated");
- }
-
- if(bFloatPixelsDirty) {
+ } else if(bFloatPixelsDirty) {
ofRectangle roi = getROI();
float * roi_ptr = (float*)cvImage->imageData + ((int)(roi.y)*cvImage->widthStep/(cvImage->depth/8)) + (int)roi.x;
floatPixels.setFromAlignedPixels(roi_ptr,roi.width,roi.height,cvImage->nChannels,cvImage->widthStep);
View
8 addons/ofxOpenCv/src/ofxCvShortImage.cpp
@@ -404,9 +404,7 @@ void ofxCvShortImage::scaleIntoMe( ofxCvImage& mom, int interpolationMethod ){
ofShortPixels & ofxCvShortImage::getShortPixelsRef(){
if( !bAllocated ){
ofLog(OF_LOG_WARNING, "in getShortPixelsRef, image is not allocated");
- }
-
- if(bShortPixelsDirty) {
+ } else if(bShortPixelsDirty) {
//Note this possible introduces a bug where pixels doesn't contain the current image.
//Also it means that modifying the pointer return by get pixels - affects the internal cvImage
@@ -425,9 +423,7 @@ ofShortPixels & ofxCvShortImage::getShortPixelsRef(){
ofShortPixels & ofxCvShortImage::getRoiShortPixelsRef(){
if( !bAllocated ){
ofLog(OF_LOG_WARNING, "in getRoiShortPixelsRef, image is not allocated");
- }
-
- if(bShortPixelsDirty) {
+ } else if(bShortPixelsDirty) {
ofRectangle roi = getROI();
unsigned short * roi_ptr = (unsigned short*)cvImage->imageData + ((int)(roi.y)*cvImage->widthStep/(cvImage->depth/8) + (int)roi.x * cvImage->nChannels);
shortPixels.setFromAlignedPixels(roi_ptr,roi.width,roi.height,cvImage->nChannels,cvImage->widthStep);
Please sign in to comment.
Something went wrong with that request. Please try again.