필터 지우기
필터 지우기

How to draw line and hold it?

조회 수: 4 (최근 30일)
Josh Hwa
Josh Hwa 2019년 4월 9일
편집: Josh Hwa 2019년 7월 19일
Hi, I am working on image processing and I would like to make stop and hold on. Anyone can help on this?

채택된 답변

A. Sawas
A. Sawas 2019년 4월 9일
편집: A. Sawas 2019년 4월 9일
Add this code after the line N=size(M); (you don't need N in this code anymore)
% round to the nearest integer
S1_x=round(S(1,1));
S1_y=round(S(1,2));
% find the x-index of the black point to the left of the click location
i1 = find(M(S1_y,(1:S1_x))==0, 1, 'last');
% find the x-index of the black point to the right of the click location
i2 = S1_x+find(M(S1_y,(S1_x+1:end))==0, 1, 'first');
% plot a line between the two points
plot([i1,i2], [S1_y,S1_y], 'm-.');
hold on

추가 답변 (0개)

카테고리

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by