How can I convert some pixels of a satellite image (raster) into point (shapefile)?
2 次查看(过去 30 天)
显示 更早的评论
I have a raster image (satellite image) that I need to convert some pixels (for example, pixels >1) in the image to point (shapefile). How can I do this?
0 个评论
回答(1 个)
gmflores
2022-10-11
Read the image and select some pixels (uses Mapping Toolbox)
[img,R] = readgeoraster('boston.tif','OutputType','double','Bands',1);
idx = find(img < 5);
Get the location of the pixels (X, Y), create a mappoint vector, and write the shapefile
[X,Y] = meshgrid(linspace(R.XWorldLimits(1), R.XWorldLimits(2), R.RasterSize(2)), linspace(R.YWorldLimits(1), R.YWorldLimits(2), R.RasterSize(1)));
shp = mappoint(X(idx), Y(idx), 'pixValue', img(idx));
shapewrite(shp,'boston_points');
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!