I have an image (5×5)pixels with 3 values which value 0, 128, and 255.
I want to check the pixels of the index (1,1) to (1,5).
If there is pixel value 0 (black), then the pixels of the index (1,1) to (1,5) is changed to 128 (gray), if none, then the pixels are changed to 255 (white).
I want to do these steps again, checking of the index (2,1) to (2,5), (3,1) to (3,5), through to the bottom.
from the above problems, I get a solution like this:
mask = repmat(any(I == 0,2),5,1);
I(mask) = 128;
I(~mask) = 255;
but if I want to check pixels vertically, from the index (1,1) to (5,1), then to the right, the index (1,2) to (5,2), until the end.
what’s the solution?
Thank You
Regards, Wahyu
You could just transpose your matrix/image, use the solution you were given in your previous question and then transpose again to get back to the original matrix/image: