필터 지우기
필터 지우기

How to change pixel value of boundary pixel?

조회 수: 1 (최근 30일)
missC
missC 2014년 2월 25일
댓글: M.S. Khan 2019년 8월 19일
Hi, I need to change the boundary pixel into value ('2') of my binary image, How can I do this?. After that, I need to do some operation on the internal line (junction). Thanks

채택된 답변

Image Analyst
Image Analyst 2014년 2월 25일
편집: Image Analyst 2014년 2월 25일
It won't be binary if you set a value of 2. Binary images are only true/false, or 1/0 if viewing as a number. However if you use an int32, uint8, or double image you can set the edges to 2. Assuming your definition of boundary is the top and bottom lines and the left and right columns, you can do this:
grayImage(:,1) = 2;
grayImage(:,end) = 2;
grayImage(1,:) = 2;
grayImage(end,:) = 2;
If, instead, you want to set the white pixels of the image to 2, assuming you can do this
binaryImage = grayImage > 0; % All white pixels.
grayImage(binaryImage) = 2; % Change from 1 or 255 or whatever, into 2.
  댓글 수: 1
M.S. Khan
M.S. Khan 2019년 8월 19일
Hi Community members;
i want to repeat the same question.
if i want to keep the boundary of closed binary image as 1 but want to fill the interior with any other number using imfil(bW,'holes').
Please anyone can help me.
Regards and greetings

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by