How can I convert some pixels of a satellite image (raster) into point (shapefile)?
5 ビュー (過去 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!