Fast Parsing of Line Segments in a BW Mask

버전 1.0.0.0 (3.96 KB) 작성자: Jonathan Sullivan
Quickly determines the portions of a line/curve that are inside and outside of a binary mask.
다운로드 수: 577
업데이트 날짜: 2011/9/12

라이선스 보기

LINEINMASK determines portions of the line in and out of a mask

[inX inY] = LINEINMASK(XS,YS,BW,XV,YV) computes a the segments of the
line specified by verticies XV and YV that are inside the mask BW.
Points XS and YS specify the limits (or pixel values) of the
coordinates of the matrix BW.

[inX inY] = LINEINMASK(BW,XV,YV) assumes XS=1:N and YS=1:M where
[M,N]=SIZE(BW).

[inX inY] = LINEINMASK(...,METHOD) Uses the given method to create the
polygon from the mask.
Inner | Outer | {Exact}

[inX inY outX outY] = LINEINMASK(...) outputs the segments of the line
both in and out of the mask.

Example:
I = imread('rice.png');
level = graythresh(I);
bw = im2bw(I,level);
bw = bwareaopen(bw, 50);
[a b] = size(bw);
xv = b*rand(10,1);
yv = a*rand(10,1);
[inX inY outX outY] = lineinmask(bw,xv,yv,'exact');
figure
imagesc(bw)
colormap(bone)
hold on;
h1 = plot(inX,inY,'r');
h2 = plot(outX,outY,'b');
legend([h1 h2],'Inside Mask','Outside Mask');

By J Sullivan, August 2011

인용 양식

Jonathan Sullivan (2024). Fast Parsing of Line Segments in a BW Mask (https://www.mathworks.com/matlabcentral/fileexchange/32863-fast-parsing-of-line-segments-in-a-bw-mask), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2011a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Region and Image Properties에 대해 자세히 알아보기
도움

받음: Curve intersections

Community Treasure Hunt

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

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0