I am writing pgm using opencv using python as follows...
cv.SaveImage("a.pgm",np.array(image.astype(np.uint16)))
So, I am casting my data to be unsigned 16 bits. The prob is that the maximum value of the gray level is set to 65535 while the pgm is written, my data has a maximum value of 1103.
What i guess is that when we are saving the pgms in opencv the value is calculated by the datatype and set to max, not based on the actual data.
Could someoone help in telling that how to do it so that the correct value of the max gray level is written.
Thanks a lot.