How can I convert some pixels of a satellite image (raster) into point (shapefile)?
조회 수: 4 (최근 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!