Sanik
Sanik

Reputation: 35

Extraction of the least significant bit of a pixel

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

Answers (1)

rayryeng
rayryeng

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:

B = bitget(A, 1);

B will be the same size as A which tells you the LSB of each pixel in the image.

Upvotes: 3

Related Questions