Mapping two sets of co-ordinates with two different colours onto blank white screen
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
yanqi liu
on 30 Nov 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');
More Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!