0

I have some questions. I try to follow some coding from Mathworks:

I = imread('cameraman.tif');
ssimValues = zeros(1,10);
qualityFactor = 10:10:100;
for i = 1:10
    imwrite(I,'compressedImage.jpg','jpg','quality',qualityFactor(i));
    ssimValues(i) = ssim(imread('compressedImage.jpg'),I);
end

I just change the image file which is a.jpg and b.jpg but I get this error from MATLAB:

Undefined function 'ssim' for input arguments of type 'uint8'
Error in SSIMTesting (line 6)
ssimValues(i) = ssim(imread('logohalal1.jpg'),i);

Why is that ? Can someone help me explain the code and the error ? Sorry because I'm new in MATLAB.

Thank you.

am304
  • 13,758
  • 2
  • 22
  • 40

1 Answers1

0

MATLAB release notes for the Image Processing Toolbox shows that this function was new to R2014a. If you have an older version of MATLAB, or you don't have that toolbox, you don't have it. This sort of issue can be avoided by using only examples found in the help on your local installation of MATLAB rather than the online help.

To check your version of MATLAB and installed toolboxes, type ver at the command line.
To check if a function can be found on your MATLAB path, you can use which, e.g. which ssim

nkjt
  • 7,825
  • 9
  • 22
  • 28
  • I'm using 2013b version. This version cannot support the code ? or i just need to find the image processing toolbox ? – Akmal Rahmat Nov 05 '14 at 13:22
  • 2
    The version you have doesn't have that function. MATLAB introduces new functions all the time, and the only (legitimate) way of acquiring them is to upgrade. – nkjt Nov 05 '14 at 14:35