# How to calculate linear index of fuzziness of an image?

i am trying to calculate linear index of fuzziness of an image using this formula: i have to see a positive value according to the paper. But i see a negative value, so i think i am doing something wrong. here is my try.

q=(pi/2)*(1-output_image/255); %I is output image and 255 is maximum gray level
y= sum(sum(min(q,1-q)))/(width*height); %M*N is width*height

• can you provide your full script? the snippet seems to work OK for me – MimSaad Dec 23 '19 at 21:36
• sure (0bin.net/paste/… – beyblade41 Dec 23 '19 at 23:33
• do you think the 'output_image' should be cast into uint8 before being used in the formula? – MimSaad Dec 24 '19 at 6:05
• output_image is double in this formula. when i cast it to uint8 , y equals to 0. – beyblade41 Dec 24 '19 at 9:59