Hi
I have this weird problem in my code.
The code looks like this
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
template<typename T>
Image<T> Image<T>::rotate(float deg)const{
...code that works fine ...
Image<T> rotated_img(newW,newH,channels);
for(uint16_t x = 0;x<newW;x++)for(uint16_t y = 0;y<newH;y++){
oldx = (x-newW/2.0)*cos(deg) + (y-newH/2.0)*sin(deg) + width/2.0;
oldy = (y-newH/2.0)*cos(deg) - (x-newW/2.0)*sin(deg) + height/2.0;
for(int c = 0;c<channels;c++){
T p = getInterpolatedPixel(oldx,oldy,c,LINEAR,ZERO_PADDING);
rotated_img.setPixel(x,y,c,p);
}
}
return rotated_img;
The code is correct. But when the debugger stops at the return statement and I tell the debugger to run next line it jumps up to "Image<T> rotated_img(newW,newH,channels);" and returns and empty image. (The image is correct after the for loops but not after the return)
*Edit: I using newest version of MinGW and Code::Blocks*