Reputation: 35
I want to extract the least significant bit (LSB) of each pixel in an image. I want to know what is the value of LSB in each pixel, whether it is 1 or 0. How do I do this in MATLAB?
Upvotes: 1
Views: 1146
Reputation: 104545
You can use the bitget function and specify the bit position of 1, denoting the LSB of each pixel. Assuming your image is stored in A, simply do:
bitget
A
B = bitget(A, 1);
B will be the same size as A which tells you the LSB of each pixel in the image.
B
Upvotes: 3