필터 지우기
필터 지우기

Find coordinate of non zero element in image .

조회 수: 2 (최근 30일)
Alina tom
Alina tom 2018년 5월 24일
댓글: KSSV 2018년 5월 24일
I have a binary Image . and I want to get the coordinates(x1,y1) for first non zero element and coordinates of last non zero element (x1,y2) from each column of the image . and then want to plot them . can any one help me.

답변 (1개)

KSSV
KSSV 2018년 5월 24일
편집: KSSV 2018년 5월 24일
I = imread('assd.jpg') ;
% I = imcrop(I) ;
I1 = rgb2gray(I) ;
[y,x] = find(I) ;
imshow(I1)
hold on
plot(x,y,'.r')
YOu may have to crop the image, if you want to remove the unnecessary white background around the image.
  댓글 수: 2
Alina tom
Alina tom 2018년 5월 24일
Sir I want to get the coordinates of 1st and last non zero elements from each column .
KSSV
KSSV 2018년 5월 24일
I = imread('image.jpg') ;
I = imcrop(I) ;
I1 = rgb2gray(I) ;
[m,n] = size(I1) ;
hold on
for i = 1:m
[y,x] = find(I1(i,:)) ;
if ~isempty(x)
plot(x(1),i,'.r') ;
plot(x(end),i,'*b') ;
end
end

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

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by