From: karthik on
how to convert x,y co-ordinates to a BLACK AND WHITE image..

i have a set of co-ordinates.. i have to set 1 for those positions and 0 to remaining positions.. finally i need an BW image with 1 set for those positions

how to do this
From: ImageAnalyst on
karthik :
Use the sub2ind() function:

a=magic(8) % Create sample data
x = [2 4 7 3 1 5] % list of the x coordinates (columns) of pixels we
want to set
y = [1 4 2 5 7 4] % list of the y coordinates (rows) of pixels we
want to set

linearIndexes = sub2ind(size(a), y, x) % Take note rows = y,
columns=x;
a(linearIndexes) = 1;
a % Show in command window.