Converting Cartesian Coordinates to Binary image
显示 更早的评论
Hello
I have two vectors of X and Y cartesian values in +/-, how to convert them to a binary image of 0's and 1's
Thank you.
I attached my plot.
2 个评论
Aditya Verma
2020-6-14
Hi, Could you specify how you want to map X and Y coordinates to the binary image. If I understand it correctly you want to create a 2-D matrix with binary values (Binary Image).
Mohanad Alkhodari
2020-6-14
采纳的回答
更多回答(1 个)
Thiago Henrique Gomes Lobato
2020-6-14
This is an general example you could use:
Cartesian = [ 10,1;
15,10];
imSize=20;
binaryImage= false(imSize);
Cartesian(:,2) = imSize-(Cartesian(:,2)-1); % Comment if you want zero at the top-left corner
for idx=1:size(Cartesian,1)
binaryImage(Cartesian(idx,2),Cartesian(idx,1)) = true; % Note that X-Y index are inverted in indexing
end
figure,imshow(binaryImage)
类别
在 帮助中心 和 File Exchange 中查找有关 Region and Image Properties 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


