import cv2
import numpy as np
import os
from osgeo import gdal
from pyproj import Proj,Transformer, transform
res_dir = "/home/ktxx/uav_camp/output"
dir_list = os.listdir(res_dir)
dir_list.sort()
# print(dir_list[-1])
#tif图片路径
# img_path = '/home/ktxx/uav_camp/output/24-06-25_14-54-13大疆智图解算/mosaicing/ortho/ortho.tif'
# img_path = '/home/ktxx/uav_camp/output/24-06-26_15-43-57-4k/mosaicing/ortho/ortho.tif'
# img_path = '/home/ktxx/uav_camp/output/24-06-26_10-28-12抽帧航线/mosaicing/ortho/ortho.tif'
img_path = os.path.join(res_dir, dir_list[-1]) + "/mosaicing/ortho/ortho.tif"
print(img_path)
img = cv2.imread(img_path)
dataset = gdal.Open(img_path) # 打开tif
geo_information = dataset.GetGeoTransform()
# 获取投影信息
projection = dataset.GetProjection()
print(projection)
col = dataset.RasterXSize
row = dataset.RasterYSize
band = dataset.RasterCount
dem = dataset.Ge