how to add color to certain areas of a .png image?
5 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Tash Dee
il 29 Mar 2015
Commentato: Image Analyst
il 29 Mar 2015
Hi all, i have been given a black and white image of a race track with 16 points marked on it. im supposed to mark these points with a red dot. how can i do this?
thank you in advance
2 Commenti
Geoff Hayes
il 29 Mar 2015
Tash - do you know the coordinates of these 16 points, or are you supposed to determine the points using an algorithm? Please clarify your question.
If you know the points/coordinates, then you could use
plot(X,Y,'ro')
which will plot a red circle given the coordinates defined in the X and Y arrays.
Risposta accettata
Image Analyst
il 29 Mar 2015
Do you want to add color to an area (like your subject says), or to points (like the body of your question says)? If it's to points, just use
plot(x,y,'r.', 'MarkerSize', 50);
Or if it's to areas, see my attached demos.
5 Commenti
Image Analyst
il 29 Mar 2015
It's not too hard. See my Image Segmentation Tutorial http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862. Basically these are the steps:
- threshold the image: binaryImage = grayImage > 128
- label the image with bwlabel
- measure the blobs with regionprops - get area, perimeter, and centroid
- size filter the blobs to get blobs of only the size of the small white spots.
- Get rid of the spots in the numbers 6, 8, 9, and 10 by finding the larger round blobs and filling them in.
- If you want the red spots in the overlay, use plot.
- If you want an RGB image, then create separate R, G, and B color channels, and then use cat() to create an RGB image of just the spot
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!