Mapping two sets of co-ordinates with two different colours onto blank white screen
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Manny Kins
el 29 de Nov. de 2021
Comentada: Manny Kins
el 30 de Nov. de 2021
Hi, I have a blank Screen with dimensions:
Screen = 255*ones(1024,1280,3);
Where 1024 and 1280 are the height and width and 3 is the RGB component.
If I have two separate co-ordinate systems:
r1 = [randi([1 1000],1,1500)', randi([1 1000],1,1500)']; %1500 xy positions within the Screen (wanted in Blue)
r2 = [randi([1 1000],1,1500)', randi([1 1000],1,1500)']; %1500 xy positions within the Screen (wanted in Red)
Is there a quick way (without for loop, and without using plot) to map these co-ordinates onto the Screen, with r1 being blue and r2 being red?
Below is a crude image I've made using paint to give a little more context of what I'm trying to achieve (of course with way more dots!):
Any help would be greatly appreaciated! The reason I wanted to find a quick way is because I'll be doing something like this over many iterations so was wondering if there was a fast non-for-loopy way of mapping.
For example in the next iteration I wanted to keep this Screen with the blue and red dots and then overlay a new set of blue and red dots.
Many Thanks
0 comentarios
Respuesta aceptada
yanqi liu
el 30 de Nov. de 2021
yes,sir,may be use
clc
clear all
close all
Screen = 255*ones(1024,1280,3);
r1 = [randi([1 1000],1,1500)', randi([1 1000],1,1500)']; %1500 xy positions within the Screen (wanted in Blue)
r2 = [randi([1 1000],1,1500)', randi([1 1000],1,1500)']; %1500 xy positions within the Screen (wanted in Red)
Screen1 = insertShape(uint8(Screen),'FilledCircle',[r1 ones(size(r1,1),1)],'color','blue');
Screen2 = insertShape(uint8(Screen),'FilledCircle',[r2 ones(size(r2,1),1)],'color','red');
figure; imshow(Screen1); title('blue');
figure; imshow(Screen2); title('red');
Más respuestas (0)
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!