matlab只按遥感tif影像行列号批量标记控制点,控制点输出为shape文件
时间: 2024-05-02 20:18:46 浏览: 166
以下是一个matlab脚本示例,可以按行列号批量标记遥感tif影像的控制点,并将输出保存为shape文件:
```matlab
% 读取遥感tif影像
img = imread('image.tif');
% 设置控制点标记半径
radius = 5;
% 手动选择控制点位置
figure;
imshow(img);
title('Select control points by clicking on the image');
hold on;
[x,y] = ginput();
plot(x,y,'ro');
% 将控制点行列号转换为投影坐标
info = imfinfo('image.tif');
x_proj = info.ModelPixelScaleTag(1) * x + info.ModelTiepointTag(4);
y_proj = info.ModelPixelScaleTag(2) * y + info.ModelTiepointTag(5);
% 创建shape文件
shp = shapewrite(struct('Geometry','Point','X',x_proj,'Y',y_proj),'control_points.shp');
% 显示控制点
figure;
imshow(img);
title('Control points');
hold on;
plot(x,y,'ro');
for i = 1:length(x)
rectangle('Position',[x(i)-radius,y(i)-radius,radius*2,radius*2],'Curvature',[1,1],'EdgeColor','r');
end
```
该脚本将遥感tif影像读入并显示,然后提示用户手动在影像上选择控制点位置。选择完毕后,将控制点行列号转换为投影坐标,并创建一个包含这些点的shape文件。最后,再次显示遥感tif影像,并将控制点标记为红色圆圈。
阅读全文
相关推荐
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)