How can I convert some pixels of a satellite image (raster) into point (shapefile)?

조회 수: 4 (최근 30일)
naeim mj
naeim mj 2021년 12월 12일
답변: gmflores 2022년 10월 11일
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?

답변 (1개)

gmflores
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');

카테고리

Help CenterFile Exchange에서 Data Import and Export에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by