필터 지우기
필터 지우기

How to logical AND gray scale image with a constant?

조회 수: 2 (최근 30일)
Jes
Jes 2015년 8월 4일
댓글: Jes 2015년 8월 4일
ANDing an 8-bit gray level image with a constant value of 240 (11110000 in binary)?

채택된 답변

Image Analyst
Image Analyst 2015년 8월 4일
Use bitand():
n1 = uint8(170); % Some number
n2 = uint8(240);
% Show what they are
dec2bin(n1)
dec2bin(n2)
% And them
out = bitand(n1, n2)
% Show result
dec2bin(out)
ans =
10101010
ans =
11110000
out =
160
ans =
10100000
It works for images as well as individual numbers.
  댓글 수: 1
Jes
Jes 2015년 8월 4일
Thank you very much. Could you please tell me What could be the effect of anding 240 with grayscale image? clc; clear all; close all; I=imread('cameraman.tif'); n1 = uint8(I); % Some number n2 = uint8(240); figure;imshow(I); out = bitand(n1, n2); figure; imshow(out);

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by