Assigning property/value to image color, Oklahoma state
1 回表示 (過去 30 日間)
古いコメントを表示
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 件のコメント
Image Analyst
2015 年 3 月 28 日
Attach your original image and what you want your output indexed image to look like. And why do I need a grid?
採用された回答
Chad Greene
2015 年 3 月 30 日
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;
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!