I'm trying to perform the XOR operation between a 4x4 block of an image and a pseudo-random matrix of size 4x4.
2 views (last 30 days)
pic = imread('Spiderman.png');
grey_pic = rgb2gray(pic);
pseudo_randommat = randi(255,4,4);
fprintf('The Pseudo-Random Matrix generated:\n')
fprintf('Intensities of a 4x4 size pixel block from the original pic:\n')
fprintf('Performing XOR operation on the two blocks:\n')
decimal_tobinaryofPRS = dec2bin(pseudo_randommat);
decimal_tobinaryofPic = dec2bin(pixel_values);
performing_xor = xor(decimal_tobinaryofPRS,decimal_tobinaryofPic);
after_xor = bin2dec(performing_xor);
I created a pseudo random matrix of size 4x4 and considered a 4x4 block of an image. I'm trying to perform XOR operation between them. So I tried to convert the intensity values of both matrices to binary and perform the XOR and convert it back to decimal and print the output. But my code doesn't seem to work. If you know the solution to this problem please share it with me. Thank you.