Ask Your Question
2

imwrite Compression parameters

asked 2013-03-01 08:55:57 -0600

Lucas gravatar image

Hi, Do you know how compression parameters works in imwrite. I mean if I choose CV_IMWRITE_JPEG_QUALITY equal to 100 for a jpeg saving or CV_IMWRITE_PNG_COMPRESSION equal to 0 for a png saving, will I have a lossless compression? Thanks

Lucas

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
1

answered 2013-03-01 09:50:11 -0600

Guanta gravatar image
  • The jpg-format is lossy by definition, even if you chose a quality level of 100.
  • With png it's the other way around, i.e. here you can always chose the highest compression level but the image is saved/loaded losless. However, afaik, the saving/loading time raises with higher compression.
edit flag offensive delete link more

Comments

1

Lossless jpeg actually exists, that's why I was wondering. If imwrite(test.jpg,CV_IMWRITE_JPEG_QUALITY,100) is lossy, is it possible to have a lossless jpeg compression with OpenCV?

Lucas gravatar imageLucas ( 2013-03-04 10:25:43 -0600 )edit
1

To cite wikipedia: "Lossless JPEG was developed as a late addition to JPEG in 1993, using a completely different technique from the lossy JPEG standard.[...] It is not supported by the standard Independent JPEG Group libraries, although Ken Murchison of Oceana Matrix Ltd. wrote a patch that extends the IJG library to support Lossless JPEG. Lossless JPEG has some popularity in medical imaging, and is used in DNG and some digital cameras to compress raw images, but otherwise was never widely adopted.". I extremly doubt that your system's jpeg library (afaik OpenCV uses the system's libraries for IO) uses losless jpeg! Afaik it also doesn't use JPEG2000. By the way, your downvote is not understandable and discourages me and others to help you further.

Guanta gravatar imageGuanta ( 2013-03-05 03:26:05 -0600 )edit

Just came across this: http://stackoverflow.com/questions/7982409/is-jpeg-lossless-when-quality-is-set-to-100 . They basically say the same, i.e. it depends on the library the System and thus OpenCV uses for compression.

Guanta gravatar imageGuanta ( 2013-03-05 03:50:14 -0600 )edit
0

answered 2013-09-10 21:10:22 -0600

facesad gravatar image

jpeg is not a high resolution compression and it is lossy, png or tiff can be lossless. here are some method you can save and have compression parameter working for you in bulk. which help you save a lot of time and efforts.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-03-01 08:55:57 -0600

Seen: 16,417 times

Last updated: Sep 10 '13