EDIT: So embarrissing! Just found out I missed a lot of "}" in the code... I will get back, when I have something intelligent to ask...
This is my first post here, so please let me know, if there are any problems in the way, I´m posting...
I´m trying to program 9 different image filters that alters an image by pressing 9 different letters on the keyboard. (Right now its the same filter for all 9 letters, but I will get back to that later...)
I get this error when compiling:
1>c:\users\thomas\documents\visual studio 2008\projects\filtersforimageprocessing\filtersforimageprocessing\main.cpp(37) : error C2360: initialization of 'q' is skipped by 'case' label
Why do I get the following warning on line 33 and all lines similar to line 33:
1>c:\users\thomas\documents\visual studio 2008\projects\filtersforimageprocessing\filtersforimageprocessing\main.cpp(32) : warning C4244: '=' : conversion from 'float' to 'char', possible loss of data
Is this the correct forum to ask OpenCV related questions?
1>c:\users\thomas\documents\visual studio 2008\projects\filtersforimageprocessing\filtersforimageprocessing\main.cpp(37) : error C2360: initialization of 'q' is skipped by 'case' label
you can avoid this by
1 2 3 4 5 6 7 8 9 10
case'a':
{ // <--- note the '{'
for( int y = 0; y < h; y++)
for( int x = 0; x < w; x++)
for( int q = 0; q < nc; q++) {
img->imageData[y*ws+x*nc+q] = (unsignedchar)img->imageData[y*ws+x*nc+q] * 1.1f;
}
} // <--- note the '}'
break;
1>c:\users\thomas\documents\visual studio 2008\projects\filtersforimageprocessing\filtersforimageprocessing\main.cpp(32) : warning C4244: '=' : conversion from 'float' to 'char', possible loss of data
an expression like this (unsignedchar)img->imageData[y*ws+x*nc+q] * 1.1f; results in a floating number and img->imageData[y*ws+x*nc+q] is obviously a char.
So if you want to avoid that warning write: img->imageData[y*ws+x*nc+q] = (unsignedchar)(img->imageData[y*ws+x*nc+q] * 1.1f); note the '()'
if you're sure that it is what you want because that's indeed a 'possible loss of data'
Is this the correct forum to ask OpenCV related questions?