Help getting coordinates from image location..!
이전 댓글 표시
I get xy coordinates of green pixels from an image in a z matrix (1082x2). However, I want to extract certain coordinates from the z matrix that meet a certain location criteria.
D=imread('image.jpg');
r = D(:,:,1);
g = D(:,:,2);
b = D(:,:,3);
re = r >= 0 & r <= 60;
gr = g >= 180 & g <= 255;
bl = b >= 0 & b <= 60;
o = re & gr & bl;
[y, x] = find(o);
z=[x, y];
%Not working - Coordinate Location Criteria based on Image
width = z(:,1)>=40 & z(:,1)<=120;
height = z(:,2)>=5 & z(:,2)<=25;
o = width & height;
[b, a] = find(o);
t = [a, b]
%Overall goal is to get the designated green points in order to find the euclidean distance them and %another set of coordinates from another part of the image which I already have and input them into the code below:
X = [xvalue, yvalue ; xvalue2, yvalue2];
d = pdist(X,'euclidean')
답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!