display/store sector of image

Hello, I have a simple question (with hopefully a simple answer). How do you display only a sector of an image (as in part of a pie slice). I have a picture of the US that is a polar projection. I need to display/store certain sections of this image, defined by the longitudes and latitudes, and then do some image processing on that section. Is there a way to specify the radius limits and the angle limits to only display the desired portion?
Any and all help is appreciated! Thanks, Trevor

답변 (2개)

Walter Roberson
Walter Roberson 2011년 9월 28일

0 개 추천

I can think of two ways:
A) create a patch() object that was in the shape you wanted, with a grid of internal vertices, configured to color according to vertex (no color interpolation), and configured with per-vertex coloring in the CData property
B) create a rectangular patch with face coloring set to texture map, and set the CData property to a rectangular grid that encloses the portion of the map that you want to show; set the patch AlphaData property to have Alpha of 0 for everything outside of the map sector.
There might be a built-in solution that handles a fair bit of this, somewhere in the Mapping Toolbox, but I have not looked at that toolbox much.
Image Analyst
Image Analyst 2011년 9월 28일

0 개 추천

If you know what pixel positions on your image correspond to the latitudes and longitudes then you can use those pixel positions in poly2mask() and then use the binary mask it creates to zero out stuff outside of your sector. Then you can either (1) leave it like that and save it to disk or a variable, (2) crop a rectangular portion and save that to disk or a variable, or (3) extract only the pixel values inside the sector (not the black pixels outside the sector but inside the bounding box) and save them to disk or a variable, depending on exactly what you mean by "store."

카테고리

도움말 센터File Exchange에서 Polar Plots에 대해 자세히 알아보기

질문:

2011년 9월 28일

Community Treasure Hunt

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

Start Hunting!

Translated by