how i can crop an RS image according to coordinates of points from shp file?

1 view (last 30 days)
hi everyone,i have a RS image and shp file,which have same coordinate and projection.Now,i had get coordinates of points from shp file,the next step is to crop a RS image according to the coordinates of points and then named with attributions of shp points. i know there is a function 'imcrop' to crop images,but how i can read all the points and crop the RS image by it.
point=shaperead('D:export_point\amenity_point.shp','UseGeoCoords',true);
[A, R] = geotiffread('D:11.tif');
row = [1 187];
col = [1 187];
subImage = A(row(1):row(2), col(1):col(2), :);
xi = col + [-.5 .5];
yi = row + [-.5 .5];
[xlim, ylim] = R.intrinsicToWorld(xi, yi);
subR = R;
subR.RasterSize = size(subImage);
subR.XLimWorld = sort(xlim);
subR.YLimWorld = sort(ylim);
info = geotiffinfo('D:11.tif');

Answers (0)

Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!