Using yolo to detect features on satellite images Google Maps API, I get the coordinates (x,y) of each features. The reference (0, 0) is the top left corner. Yolo provides also the width and height of the bounding box. I have the GPS position of the center of the image.
I would like to get the GPS coordinates for the center of each feature.
def getGPSPosition(centerLat, centerLong, zoomLevel, x, y):
# calculate degrees per pixel ratio at the given zoom level
degreesPerPixel = 180 / pow(2,zoomLevel);
imageSize = 640
# calculate offset in degrees
deltaX = (x-imageSize/2) * degreesPerPixel
deltaY = (y-imageSize/2) * degreesPerPixel
# calculate gps position based on the center coordinates
gpsLat = centerLat + deltaY
gpsLong = centerLong + deltaX
return (gpsLat, gpsLong)
I'm supposed to get the coordinate of the upper left corner of the bounding box. I miss the target... The result is approx 50m away from the correct point.
from Getting the GPS position of coordinates (x,y) on a Google maps API satellite image in function of the zoom level
No comments:
Post a Comment