I have an image and I've selected 10 pixels that I want put a marker on them
rasterpoints = xlsread('coordinates_sat3.xlsx'); %# 10 pair of coordinates of pixels on my image
diff_win_spr %# 10x1 vector with positive and negative values
now I want differ the kind of marker to insert in my image depending the cellvalue in diff_win_spr be positive or negative
marker1 = 'o';
marker2 = '+';
for ii=1:10
if diff_win_spr(ii)<0;
for ii=1:10;
rastermarkers=insertMarker(a,rasterpoints(ii,:),marker1,'size', 10);%%% if diff_win_spr is negative I want marker1 in the rasterpoint position on the image a
end
else diff_win_spr(ii)>0;
for ii=1:10;
rastermarkers=insertMarker(a,rasterpoints(ii,:),marker2,'size', 10);%%% if diff_win_spr is positive I want marker2 in the rasterpoint position on the image a
end
end
end
my output image only show me the 10th marker (with the right symbol bytheway)
c=imshow(rastermarkers)
%imwrite(b,'sat_mark.tif','WriteMode','append');
You overwrite rastermarkers
on each iteration, using the same unmodified images as an Input. Change your code to:
marker1 = 'o';
marker2 = '+';
for ii=1:10
if diff_win_spr(ii)<0;
a=insertMarker(a,rasterpoints(ii,:),marker1,'size', 10);
else diff_win_spr(ii)>0;
a=insertMarker(a,rasterpoints(ii,:),marker2,'size', 10);
end
end
Your output is now a