Help getting coordinates from image location..!
1 view (last 30 days)
Show older comments
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 Comments
Answers (0)
See Also
Categories
Find more on Line Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!