Below is my code. So if I perform the operations outside of the nested for loop (meaning as a simple script where I input each value individually) I get the correct values for the pixels in the outImage. However, when I try to compute it within the nested for loop, the program doesn't stop executing, and when I click pause, it doesn't throw an error, rather it opens a new script with some chunk of code.
Does anybody have any idea of what do? I thought this would work.
inImage = imread('rose_copy.jpg');
[row,col] = size(inImage);
outImage = zeros(row,col);
pixel = uint8(inImage(y,x));
mask = uint8(256 - power(2,(8 - n)));
pixel2 = uint8(bitand(pixel,mask));
fin = bitsra(pixel2,8 - n);
outImage(y,x) = uint8(fin);
outImage = uint8(outImage);