Как найти координаты широты / долготы на изображении, если у нас есть широта / долгота 4 углов - PullRequest
0 голосов
/ 04 ноября 2019

У меня есть изображение. Я знаю широту и длину всех 4 углов. Я хочу найти широту и длину определенной точки.

На изображении ниже я знаю широту / длину всех 4 углов (красная точка). Я хочу найти широту / длинную синюю точку. Я знаю координаты пикселей синей точки на этом изображении. Допустим, это 200px слева и 233px снизу (сверху).

enter image description here

1 Ответ

0 голосов
/ 04 ноября 2019

Я получил ответ: Вот код Python

def GetLatandLong(top_Left_Lat, top_Left_Long, bottom_Right_Lat, bottom_Right_Long,img_Width,img_Height, target_Top, target_Left):
    diff_Between_Top_Bottom_Lat = bottom_Right_Lat - top_Left_Lat
    percentage_Of_Total_Lat_In_Picture = diff_Between_Top_Bottom_Lat/90*100
    image_Size_Height_Required_To_Cover_Entire_Earth = img_Height/percentage_Of_Total_Lat_In_Picture*100
    top_Left_Percentage_Of_Lat = top_Left_Lat/90*100
    top_Left_Pixel_In_Image = image_Size_Height_Required_To_Cover_Entire_Earth*top_Left_Percentage_Of_Lat/100
    target_Pixel_In_Whole_Earth_Image = top_Left_Pixel_In_Image + target_Top
    percentage_Of_Target_In_Image = target_Pixel_In_Whole_Earth_Image/image_Size_Height_Required_To_Cover_Entire_Earth*100    
    target_Lat = percentage_Of_Target_In_Image*90/100


    diff_Between_Top_Bottom_Long = bottom_Right_Long - top_Left_Long
    percentage_Of_Total_Long_In_Picture = diff_Between_Top_Bottom_Long/180*100
    image_Size_Width_Required_To_Cover_Entire_Earth = img_Width/percentage_Of_Total_Long_In_Picture*100
    top_Left_Percentage_Of_Long = top_Left_Long/180*100
    top_Left_Pixel_In_Image = image_Size_Width_Required_To_Cover_Entire_Earth*top_Left_Percentage_Of_Long/100
    target_Pixel_In_Whole_Earth_Image = top_Left_Pixel_In_Image + target_Left
    percentage_Of_Target_In_Image = target_Pixel_In_Whole_Earth_Image/image_Size_Width_Required_To_Cover_Entire_Earth*100    
    target_Long = percentage_Of_Target_In_Image*180/100






    return target_Lat,target_Long


target_Lat,target_Long = GetLatandLong(52.871983, 8.642317, 52.869069, 8.659905,1200,218, 180, 650)

print(target_Lat,target_Long)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...