Can anyone please help me to fix this error in the coding of fractal image compression ? Your help is greatly appreciated. Thank you.

%Create psnr object
_
hpsnr = vision.PSNR;
psnr = step(hpsnr, I,outim);%calculate psnr
fprintf('PSNR= %f\n',psnr);%display psnr
Undefined variable "vision"
Error in main (line 74)
hpsnr = vision.PSNR;
*Below is the completed source code.

 Accepted Answer

I tried this same code in MATLAB 2013b. It is working fine. You can try with PSNR function attached.

6 Comments

hpsnr = vision.PSNR;
psnr = step(hpsnr, I,outim);%calculate psnr
replace this as
PSNR(I,outim);
I'm using the MATLAB R2017a.
Do you mean replace this code ""psnr = step(hpsnr, I,outim);""
as ""PSNR(I,outim);""
Finally, it's work. Thank you so much for your help.Greatly appreciate it. The complete code is attached.
i am using this code for RGb image,but i am not getting the result.error is shown in : m=m+((X(i,j)-Y(i,j))^2); can you suggest me the right way to do this for RGB image
Dear Magum,
I have used your code with big size image but have an error with m=m+((I(i,j)-outim(i,j))^2);
Could you please suggest any soluation
Best Regards,
Noor
The code assumes that I is a 2D array which is quite unlikely for any jpg.
In particular it uses size(I) with 2 outputs. When I has more than two dimensions then the second output will be the product of all of the remaining dimensions . size() with only one input argument is designed so that the product of the outputs is equal to the number of elements in the array . So for rgb with only two outputs the second output will be 3 times the number of columns .

Sign in to comment.

More Answers (0)

Categories

Find more on Fractals in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!