How to sub-sample a portion of an image - using an ellipse shape sample.
1 次查看(过去 30 天)
显示 更早的评论
Im trying to subsample a matrix, where my sample shape is an ellipse. My matrix is a 2100 pixels X 500 pixels, and i want to create an ellipse at the center-top of this matrix. Not just drew an ellipse but average the values inside it. What would you suggest? Thank you in advance. In the following code i did it for a rectangular and i want to have an ellipse instead:
% create the elongated dichromatic image PatchWidth=700; background=zeros(2100,500); background=background+180; background((2100/2)-round(PatchWidth/2):((2100/2)+(round(PatchWidth/2))),1:500)=30; background_fig=imshow(uint8(background)); hold on rectangle('Position',[200 1 100 RectWidth],'EdgeColor','r')
0 个评论
采纳的回答
Image Analyst
2016-9-12
编辑:Image Analyst
2016-9-12
Make an elliptical mask using the FAQ: http://matlab.wikia.com/wiki/FAQ#How_do_I_create_an_ellipse.3F
Then extract all the values inside the ellipse and get their average like this:
averageValueInsideEllipse = mean(yourImage(ellipticalMask));
0 个评论
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!