I want to get information about coordinate what I choose.
If I click road, It talks it's on line, If I click no-road, It talks it's not on line.
but It's not worked I expecting.
My code is below.
A = imread('C.jpg'); %C is my linetracer map.
ww = A(:,:,1); %C is only constituted with only black & white, so I choose just first dimension.
imshow(ww); %It show my linetracer map.
[xi, yi] = getpts; %If I double-click somewhere of map, it save on xi and yi.
xi = round(xi);
yi = round(yi);
B = ww < 240; %If under 240, It is possibly black, so I choose that area.
[row, col] = find(B == 1); %I make matrix using coordinate where color is black.
C = [row, col];
alpha = 1;
while alpha < 31235 %this number is how many black-colored coordinate has.
if C(alpha,1) == xi
if C(alpha, 2) == yi
fprintf("it's on line.")
alpha = alpha+1;
if alpha == 31235
fprintf("it's not on line.")
=> Then problem has happen. anywhere I clicked, It always shows me "it's not on line."
How can I get correct judgement?