How to sub-sample a portion of an image - using an ellipse shape sample.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Noam Josef
el 11 de Sept. de 2016
Editada: Image Analyst
el 12 de Sept. de 2016
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 comentarios
Respuesta aceptada
Image Analyst
el 12 de Sept. de 2016
Editada: Image Analyst
el 12 de Sept. de 2016
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 comentarios
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!