How to sub-sample a portion of an image - using an ellipse shape sample.

2 ビュー (過去 30 日間)
Noam Josef
Noam Josef 2016 年 9 月 11 日
編集済み: Image Analyst 2016 年 9 月 12 日
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')

採用された回答

Image Analyst
Image Analyst 2016 年 9 月 12 日
編集済み: Image Analyst 2016 年 9 月 12 日
Then extract all the values inside the ellipse and get their average like this:
averageValueInsideEllipse = mean(yourImage(ellipticalMask));

その他の回答 (0 件)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by