Failing to read pixel of grayscale image as float
I am trying read\write pixels of a grayscale image as floats but get an exception no matter what I do. Can someone please show me how it's suppose to be done?
no code as text = no answer possible
As LBerger said it is hard to know what your are trying. I assume you are trying something like:
Which throws an exception since you can't extract a float from an 8u image. Most grayscale images are single channel, unsigned 8bit. If you want a float image you can convert with:
then the at access method works.
Thanks LBerger and Chris. You are both right, A question should contain the relevant code. Sorry.
Anyway Chris did show me the right direction (Had ''CV_16F" and somehow failed to see that). But i thought seeing the pixel as a float will give values in the [0,1] range...Is there a way to get that?
Take a look at OpenCV's normalize function link text