imwrite image is darker than ofstream version

asked 2016-02-18 10:15:53 -0600

I have the following code

http://pastebin.com/W9hqfF39

and

http://pastebin.com/W9hqfF39

both are getting an image from a thermal imaging camera; one is saving the image using ofstream and the other with opencv. The opencv image is a lot darker, almost black. Any idea what I'm doing wrong?

Thanks

edit retag flag offensive close merge delete

Comments

3

Please post the code here, otherwise the question (and its answers) will get useless as soon as the link don't work anymore.

FooBar gravatar imageFooBar ( 2016-02-18 11:01:55 -0600 )edit
2

Your image is 16 bits (cv::Mat img(h,w,CV_16UC1);).

Not sure that pgm image file accepts 16 bits image format. You could try to save to another format that accepts 16 bits depth or in binary format maybe ?

Eduardo gravatar imageEduardo ( 2016-02-18 11:03:17 -0600 )edit