小编Joh*_*ong的帖子

GIS/GEOTiff/GDAL/Python如何从像素获取坐标

我正在研究从GEOTiff文件中检测对象并返回对象坐标的项目,这些输出将用于无人机飞到那些坐标

我使用tensorflow和YOLO v2(图像检测器框架)和OpenCV来检测我在GEOTiff中需要的对象

import cv2
from darkflow.net.build import TFNet
import math
import gdal

# initial stage for YOLO v2 
options = {
    'model': 'cfg/yolo.cfg',
    'load': 'bin/yolov2.weights',
    'threshold': 0.4,
}
tfnet = TFNet(options)

# OpenCV read Image
img = cv2.imread('final.tif', cv2.IMREAD_COLOR)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

#Predict the image
result = tfnet.return_predict(img)

#Calculate the center and radius of each objects
i = 0
while i < len(result):
    tl = (result[i]['topleft']['x'], result[i]['topleft']['y'])
    br = (result[i]['bottomright']['x'], result[i]['bottomright']['y'])
    point = (int((result[i]['topleft']['x']+result[i]['bottomright']['x'])/2), int((result[i]['topleft']['y']+result[i]['bottomright']['y'])/2))
    radius = int(math.hypot(result[i]['topleft']['x'] …
Run Code Online (Sandbox Code Playgroud)

python geocoding geolocation gdal geotiff

3
推荐指数
1
解决办法
3594
查看次数

标签 统计

gdal ×1

geocoding ×1

geolocation ×1

geotiff ×1

python ×1