OpenCV imrite gives washed-out result for jpeg images -


i using opencv 3.0 , whenever read image , write result washed-out image.

code:

cv::mat img = cv::imread("dir/frogimage.jpg",-1); cv::imwrite("dir/result.jpg",img); 

does know whats causing this?

original: enter image description here

result: enter image description here

you can try increase compression quality parameter shown in opencv documentation of cv::imwrite :

cv::mat img = cv::imread("dir/frogimage.jpg",-1);  std::vector<int> compression_params; compression_params.push_back(cv_imwrite_jpeg_quality); compression_params.push_back(100);  cv::imwrite("dir/result.jpg",img, compression_params); 

without specifying compression quality manually, quality of 95% applied.

but 1. don't know jpeg compression quality original image had (so maybe might increase image size) , 2. (afaik) still introduce additional minor artifacts, because after lossy compression method.

update problem seems not because of compression artifacts because of image adobe rgb 1998 color format. opencv interprets color values are, instead should scale color values fit "real" rgb color space. browser , image viewers apply color format correctly, while others don't (e.g. irfanview). used gimp verify. using gimp can decide on startup how interpret color values format, either getting desired or "washed out" image. opencv doesn't care such things, since it's not photo editing library, neither on reading nor on writing, color format handled.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -