Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Does imdecode return modified image?

Hi guys,

I prepared a grayscale image of dimensions 256x1 and made it contain a gradient of gray (i.e. the left most pixel starts with value 0 (black), the next pixel 1, then 2, 3 and so on until the right most pixel ends with 255 (white)).

When I call imdecode(new Mat(bytes), 6) on this image I would expect to get back a Mat-object that contains just those values. But instead I get a Mat-object with slightly modified values as if it was filtered by Photoshop through a gradation curve similar to the following one (sorry, I am neither allowed to upload an image nor to publish a link, yet). You'll need to follow the link by copy-paste. Gradation Curve: www.dropbox.com/s/qs6myb5j03i8vfa/opencvForumQuestion0GradationCurve.jpg?dl=0

Is this intentional (if so why?), is it a bug or am I doing something wrong?

I very much appreciate your help. Thank you.

Kind regards Thomas