Locate points inside region based on coordinates

Hi guys, MATLAB rookie here. I have a matrix of points distribution coordinates and binary image of a structure. What I want to do is to select the points that located inside the structure of the binary image and extract those points. I read about using "&" but clearly it didn't work when I try it. Could you guys share some insights?

 채택된 답변

KSSV
KSSV 2016년 11월 10일

0 개 추천

doc inpolygon.

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 11월 11일

0 개 추천

You need to turn your (x,y) points into a binary image first. THEN you can use & and find() after that if you want to:
pointsImage = false(size(binaryImage));
for k = 1 : length(x)
thisRow = round(y(k));
thisCol = round(x(k));
pointsImage(thisRow, thisCol) = true;
end
% Find intersection.
% This will be an image of only the points inside blobs in binaryImage.
pointsInside = binaryImage & pointsImage;
% Find rows and columns of points inside
[rows, columns] = find(pointsInside); % or [y, x] = find(pointsInside);

카테고리

도움말 센터File Exchange에서 Geometric Transformation and Image Registration에 대해 자세히 알아보기

질문:

2016년 11월 10일

답변:

2016년 11월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by