Hi,there are 2 formulae which i am finding it difficult to represent in Matlab. Let there be two RGB images A and B of same size with m,n representing rows and column and the third dimension d=3. The formula1 basically calculates the rate of change of pixels if A be the original image and B be the distorted version. Formula2 calculates the average rate of change of pixels.
1.
Formula1= { sum(C(m,n,d)) / (m * n)} * 100
where C(m,n)=0, if A(m,n)=B(m,n)
=1, if A(m,n) != B(m,n)
Sum over all rows and column including the third dimension.
I have tried something like this : Formula1= sum(sum(abs(double(A)-double(B))./(m*n),1),2);
But this does not give any error. However,this is not the correct way to represent,since the if conditions are not incorporated.The problem area is how to incorporate the condition by checking if A==B or not and if A!=B.
2.
Formula2 ={ 1/ (m*n)} * sum { norm (A - B) / 255} * 100
Again, here also it will be summation over all the dimension. I dont know how to form the norm of a matrix.
I had posted the same question earlier,but i guess there were too many issues in representation for which it went unanswered for many days. I have deleted that question and asked afresh.Please help.
EDIT
Formula3 is ={ 1/ (m*n)} * sum {(A - B) / 255} * 100
I tried out like thisC = double(sum(A-B,3)); r=reshape(100*(C/255)/(m*n),[1 3])
But there is an error saying dimension should be same and reshape does not work.