How to sub-sample a portion of an image - using an ellipse shape sample.
2 ビュー (過去 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!