Assigning property/value to image color, Oklahoma state
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello,
I have a very simple image (attached) that has white background and several filled circles of different colors. I am interested in the part of the image that is inside the line boundary (approximate boundaries for Oklahoma state). How can create matrices/grids that will have different numbers based on the color of the circles. For instance, the matrix/grid for red circles (color) should have value 5 for red color and 0 for whatever is not red; green should have 3 inside and 0 outside, etc.
Thanks, DjR
3 Kommentare
Image Analyst
am 28 Mär. 2015
Attach your original image and what you want your output indexed image to look like. And why do I need a grid?
Akzeptierte Antwort
Chad Greene
am 30 Mär. 2015
Assuming you have data in x and y coordinates (switch x and y with lon and lat, if you're using geocoordinates), start by preallocating some empty matrix the size of your full x,y grid:
MyMap = zeros(mapheightpx,mapwidthpx);
where mapheightpx and mapwidthpx are the size of the categorical data map you'll be creating. Set red circle areas to 5 and green to 3:
red = inpolygon(gridx,gridy,redcircleoutlinex,redcircleoutliney);
MyMap(red) = 5;
green = inpolygon(gridx,gridy,greencircleoutlinex,greencircleoutliney);
MyMap(green) = 3;
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Import, Export, and Conversion finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!