Trying to change pixels in an image based on values I have obtained in a previous Array.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a matrix that I have called IMAGE1 and consists of the following values:
[1225 534; 532 212; 1315 440; 39 1 ; 1542 503; 1509 902]
These values represent x and y positions of a satelite.
I am trying to create an image that has a black background and the above coordinates are red.
I have tried the following to accomplish this:
IMAGEPIC1 = zeros(1600)
IMAGEPic1(IMAGE1(:,1),IMAGE1(:,2)) = 1 %to change the pixels to red
figure,imshow(IMAGEPic1)
I end up with a black image with a grid of points because I believe Matlab is referencing every combination of IMAGE1's x and y values.
I have tried using sub2ind with no better results.
Is there a better way to produce an image with a black background and red pixels at the referenced coordinates?
Any help you can provide is appreciated.
0 comentarios
Respuestas (1)
KALYAN ACHARJYA
el 13 de Mayo de 2020
Editada: KALYAN ACHARJYA
el 13 de Mayo de 2020
image1=[1225 534;532 212;1315 440;39 1;1542 503;1509 902];
max1=max(image1(:));
image2=uint8(zeros(max1,max1);
image2(image1(:,1),image1(:,2))=255;
image2(:,:,2:3)=0;
imshow(image2);
%Please observe carefully, see red pixels
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!