필터 지우기
필터 지우기

Efficient way to set specific range of pixels to zero.

조회 수: 1 (최근 30일)
Ivan Shorokhov
Ivan Shorokhov 2015년 4월 23일
댓글: Ivan Shorokhov 2015년 4월 24일
Hello everybody,
I have gray image with pixels from 0 to 255. And I would like to set pixel from 90 to 100 to zero.
I've wrote following code:
new_gray=gray;
new_gray(gray>90&gray<100) = 255;figure;imshow(new_gray);
And it seems to be working fine, but I'm wondering, if there are any other ways of doing it?
Thanks in advance.

채택된 답변

Image Analyst
Image Analyst 2015년 4월 23일
You could use intlut(). Something like
lut = gray(256);
% Make gray levels 91 through 99 be 0
lut(92:100) ;
new_gray = intlut(grayImage, lut);
DON'T name your image gray. That is the name of a built-in function that creates a colormap.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Red에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by