Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Not loosing the quality of pictures saved with cv2.imwrite()

I am wondering seriously about the effects of cv2.imwrite() function of OpenCV.

I noticed that when I read pictures with cv2.imread() and save them again with cv2.imwrite() function, their quality is not the same any more for the human eyes.

I ask you how can I keep the quality of the image the same as the original after saving it using cv2.imwrite() function.

I ask this question because I have really a serious issue in a larger program and when I checked the quality of the pictures saved by this function, I guesses that my problem comes certainly from this function.

For example, I draw using the mouse movements small red (Red=255) squares on picture . When I save the picture and count the number of pixels that have Red color equal to 255 I get very few of them only even if I draw a lot of them in pure red color. But when I check the image by my eyes, I notice the red pixels I drawed are not correctly saved in the correct red color I chosed (255).

Any one does know how to resolve this problem ? I mean to save the pictures using OpenCV without degrading its quality.