How to use logic operators in Image Processing

13 ビュー (過去 30 日間)
Badar Ali
Badar Ali 2022 年 4 月 20 日
回答済み: DGM 2022 年 4 月 22 日
How to use “bitand” to reduce the gray levels in the image to 16, 4 and 2.
How to use “bitxor” to calculate the negative of the image.
How to use “bitcmp” to invert all the bits of each pixel of the image.
How to use “bitor” to make 7 bit (MSB) of each pixel true (or 1) in the 8-bit image matrix and store it at the corresponding location of the new image matrix of same size and display new image.
  2 件のコメント
Rik
Rik 2022 年 4 月 20 日
Looks like homework to me. What have you tried?
Badar Ali
Badar Ali 2022 年 4 月 21 日
I dont know how to exactly implement these. Firstly for the bitand operator we need 2 images, first one would be the orignal image what about the second image would it be a mask or orignal image converted to bits. And how would we change the grey levels exactly!

サインインしてコメントする。

回答 (1 件)

DGM
DGM 2022 年 4 月 22 日
This should be a start.
% read the image
A = imread('cameraman.tif');
% quantize intensity
G2 = bitand(A,uint8(128));
G4 = bitand(A,uint8(255-63));
G16 = bitand(A,uint8(255-15));
imshow([G2 G4 G16])
% calculate 1-A
Ac = bitxor(A,255);
imshow(Ac)

製品


リリース

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by