Your image is of type 'uint8'. This means the range of intensities is between 0 and 255 (included). If you sum two uint8 and the result is greater than 255, the sum gets clamped to 255. If you subtract two uint8 and the result is less than 0, you'll get 0.
The simplest way to fix that problem is to convert your original image to double:
I = double(imread('fruit1.bmp'));
I have no idea what this notation mean:
and I've never heard of Arnold's transform. I assume it's this, in which case your notation is missing the mod. But if that's what you're trying to implement, then your code has many problems:
- Your current code depends on the red and green intensity of the 1st pixel only, since the only thing that influences the result of the loop is the value of x(1) and y(1) before the loop. As a transform, that's hardly useful.
- The cat transformation described in the wikipedia article I've linked, alters the location of the pixels (jhence the use of x, y) not the colour of the pixels (what you're currently doing).
Best Answer