diff options
Diffstat (limited to 'rotord/src/cvimage.cpp')
| -rw-r--r-- | rotord/src/cvimage.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/rotord/src/cvimage.cpp b/rotord/src/cvimage.cpp index 21e4e2f..b255848 100644 --- a/rotord/src/cvimage.cpp +++ b/rotord/src/cvimage.cpp @@ -176,11 +176,13 @@ namespace Rotor { } Image & Image::operator=(const Image &other) { //can be optimised? was trying to use other.data.clone() - setup(other.w,other.h); - //for (int i=0;i<h*w*3;i++) { - // rgb.data[i]=other.rgb.data[i]; - //} - memcpy(rgb.data,other.rgb.data,h*w*3); //saves ~2.4 ms copying a 640x360 image + if (setup(other.w,other.h)){ + //for (int i=0;i<h*w*3;i++) { + // rgb.data[i]=other.rgb.data[i]; + //} + memcpy(rgb.data,other.rgb.data,h*w*3); //saves ~2.4 ms copying a 640x360 image + + } return *this; } //channel rearrangement @@ -245,6 +247,6 @@ namespace Rotor { cv::resize(rgb,mip,cv::Size(nw,nh),0,0,cv::INTER_AREA ); mipmaps[level]=mip; return mipmaps[level]; - + } } |
