Assigning property/value to image color, Oklahoma state
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
djr
el 28 de Mzo. de 2015
Comentada: djr
el 30 de Mzo. de 2015
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 comentarios
Image Analyst
el 28 de Mzo. de 2015
Attach your original image and what you want your output indexed image to look like. And why do I need a grid?
Respuesta aceptada
Chad Greene
el 30 de Mzo. de 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;
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!