Visboundaries usage- red outline

hi i wrote this code
BW = imread('picture'.png)
B = bwboundaries(BW);
figure;
imshow(BW);
hold on;
visboundaries(B)
when i run this, the figure comes out and the boundaries show up but there is a red outline on the border of the image itself. how do i get rid of this line? I have attached a picture to show which line i mean
thank you very much!

답변 (2개)

Image Analyst
Image Analyst 2016년 3월 16일

0 개 추천

bwboundaries() is meant to work on a binary image, not a gray scale one. So, because you passed it a gray scale image, it took the white part as the foreground region and visboundaries() drew the boundaries around the white regions. To fix, try this
grayImage = imread('picture'.png)
BW = grayImage < 250; % or some value that works.

댓글 수: 3

Sang Wan Kim
Sang Wan Kim 2016년 3월 16일
편집: Sang Wan Kim 2016년 3월 16일
oh sorry about that! wrong picture. i did the bwboundaries on a binary image and i just showed it on the greyimage! i have attached a picture of it showing on the the binary image.
Image Analyst
Image Analyst 2016년 3월 16일
Again, it's outlining the white areas because white is foreground. If you don't want that, then invert BW before you call bwboundaries(). See what I did. I took the dark areas, not the bright areas.
Sang Wan Kim
Sang Wan Kim 2016년 3월 16일
ah i see!! that makes sense.... Thank you very much

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

hupaa san
hupaa san 2016년 8월 3일

0 개 추천

Hi, I run matlab example of 'activecontour' command on matlab version R2013a. but when I write 'visboundaries' command it show me this error:
Undefined function 'visboundaries' for input arguments of type 'char'.
and when I enter 'doc visboundaries' in command line window,there is no doc for 'visboundaries' in my matlab too. could u please guide me?
Thanks

댓글 수: 1

Image Analyst
Image Analyst 2016년 8월 3일
You can get it when you upgrade. It was introduced in R2015a. Please upgrade, or else use plot().

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

카테고리

도움말 센터File Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

태그

질문:

2016년 3월 16일

댓글:

2016년 8월 3일

Community Treasure Hunt

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

Start Hunting!

Translated by