How to plot the PSNR vs BITRATE for a single image?

3 次查看(过去 30 天)
Hi,
I have a doubt on how to plot PSNR vs BITRATE for a single image(lossless image). I have tried following code
for i=1:100
imwrite(bit_rate,'image.jpg','compression ratio',i,'mode,'lossless')
end
plot(bit_rate,PSNR,'b-','LineWidth',3)
but i am getting following error:
Error using imwrite
Too many output arguments.
Error in calic_enc (line 355)
a=imwrite(psnr_err_dec,'1.jpg','cr_ac',i,'mode','lossless')
Thank you in advance, please any one response as soon as possible.
  2 个评论
no ur
no ur 2018-12-30
PSNR and MSE according to bitrate???? code matlab
Image Analyst
Image Analyst 2018-12-30
no, see Walter's answer below. You should save a bunch of images, noting the number of bits, and PSNR for each. Then you'll have points where you can make up a PSNR vs. bits plot. I'm not sure what you mean by "rate". The way I described will only work on saved images, not streaming videos "live" in "real time".

请先登录,再进行评论。

回答(1 个)

Walter Roberson
Walter Roberson 2017-5-29
imwrite() writes to a file; it never returns any value, so you cannot assign the result to something.
There is no option named 'cr_ac' for imwrite()
There is no option named 'compression ratio' for imwrite(). However, JPEG2000 images support an option 'compressionratio'. Regular JPEG images do not support that option, but do support an option 'Quality'.
You could consider looping, using imwrite() with 'Quality', i, then imread() the resulting file, calculating the psnr against the original image and storing that.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by