I have the following function:
function [ result ] = SSD( i1, i2 )if size(i1) == size(i2) [r, c] = size(i1) result = -(sum(sum((double(i1) - double(i2)).^2)) / (r*c));else result = 'invalid';end
I would like to pass it to images that contain gray values only and the error:
Subscript indices must either be real positive integers or logicals.
Popes up. For debugging purpuse I tried calling the function in this way:
SSD(zeros(3), ones(3));
The error is still there. But if I call the function in this way:
SSD(ones(3), ones(3));
No error. What is happening? Why doesn't the function like zero values?
Best Answer