You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
category: imgcodecsquestion (invalid tracker)ask questions and other "no action" items here: https://forum.opencv.org
Type in any number for cin.
Then the 'x.png' file is created but stays empty and I get this error:
libpng warning: Invalid color type/bit depth combination in IHDR
libpng error: Invalid IHDR data
But if I remove any one of the four lines marked with an arrow, the error disappears and the 'x.png' is written properly.
I don't know how to begin to understand this bug. How can a variable declaration or use of cin here affect libpng?
My environment:
Windows 7 SP1
Visual Studio 2015, compiling for x64
OpenCV 3.1.0 pre-built binaries
category: imgcodecsquestion (invalid tracker)ask questions and other "no action" items here: https://forum.opencv.org
Activity
alalek commentedon Feb 5, 2016
Does this work for you?
or this?
janismac commentedon Feb 6, 2016
No, neither of those have any effect.
What does help is replacing
x.pngwithx.jpgorx.bmpso thatimwriteuses a different routine to save the image.Maybe this is a bug in libpng, or in how OpenCV uses libpng?
Btw,
IMWRITE_PNG_COMPRESSIONdoes not exist, I usedCV_IMWRITE_PNG_COMPRESSIONwhich you probably meant?alalek commentedon Feb 6, 2016
CV_flags are C defines.IMWRITE_PNG_COMPRESSIONis defined here