Suppose, I have a image, A, and I have to set some of the LSBs to zero.
Say, Bit 0 to Bit 3 is set to zero. To do so, I have implemented the following code:
%%
A = imread('image.jpg'); % Reading a RGB image
tic;I = dec2bin(A); %converting the image into binary
I(:, 5:8) = '0'; % replacing the 4 LSB bits (Bit 0 to Bit 3) to zero
J = bin2dec(I); % converting back to the original format
J = uint8(reshape(J, size(A))); %reshaping the output image to the input image size
toc;%%%%%
This code performs the required task. However, it takes around 4.2 seconds for a single image. I need to perform this on more than 200 images.
So, is there any other efficient way to perform above said task?
Any support will be much appreciated. Thank you in advance.
Best Answer