Commit 045bfea0 authored by luroth's avatar luroth
Browse files

zwischenstand

parent cfef6dc1
......@@ -9,8 +9,6 @@ from joblib import Parallel, delayed
import multiprocessing
from itertools import repeat
import csv
from urllib import request
import urllib3
import os
import sys
import getopt
......@@ -106,7 +104,6 @@ def ray_trace(line_vector, line_point, plane_point, plane_normal):
return Psi
def intersect_line_with_planes(plane_normales, plane_points, line_vector, line_point, corners):
treshold= 1000
# create corner polygons
corners_poly1_normale = get_polygon_normale([corners[0], corners[1], corners[2]])
point_poly1 = corners[0]
......@@ -140,19 +137,17 @@ def intersect_line_with_planes(plane_normales, plane_points, line_vector, line_p
hit = point_in_poly(intersect_point[0], intersect_point[1], [(p1_x, p1_y), (p2_x, p2_y), (p3_x, p3_y)] )
if hit:
#print(".", end="\n")
print(".", end="", flush=True)
#print(".", end="", flush=True)
return intersect_point.tolist()
else:
#print("_", end="")
treshold -= 1
if treshold<0: return [None, None, None]
pass
print("?", end="")
return [None, None, None]
print("?")
return [np.nan, np.nan, np.nan]
def main(argv):
camera_position_file = ''
......@@ -188,6 +183,7 @@ def main(argv):
epsg = getWKT_PRJ("2056")
# Load DEM
print("loading DEM")
DEM_stl = mesh.Mesh.from_file(DEM_stl_file)
DEM_normales = DEM_stl.normals
......@@ -265,7 +261,6 @@ def main(argv):
sensor_pixels_vectors = np.array([np.dot(rotation_matrix(y_axis, phi_rad), sensor_corner) for sensor_corner in sensor_pixels_vectors])
sensor_pixels_vectors = np.array([np.dot(rotation_matrix(x_axis, omega_rad), sensor_corner) for sensor_corner in sensor_pixels_vectors])
print("calculate ground points for corners")
sensor_corner_vectors = sensor_pixels_vectors[corner_index]
......@@ -303,25 +298,25 @@ def main(argv):
#ground_pixel_coords = np.array(ground_pixel_coords)
ground_pixel_coords= np.array(Parallel(n_jobs=multiprocessing.cpu_count())(delayed(intersect_line_with_planes)(DEM_normales, DEM_points, sensor_pixels_vector, focal_point, ground_corner_coords) for sensor_pixels_vector in sensor_pixels_vectors))
print("\ncalculating view angles")
ground_pixel_angle_xy = np.arctan((Y-ground_pixel_coords[:,1] / X-ground_pixel_coords[:,0]))
print("calculating view angles")
ground_pixel_angle_xy = np.arctan(((Y-ground_pixel_coords[:,1]) / (X-ground_pixel_coords[:,0])))
ground_pixel_angle_z = np.arctan( (Z-ground_pixel_coords[:,2]) / np.sqrt( (X-ground_pixel_coords[:,0])*(X-ground_pixel_coords[:,0]) + (Y-ground_pixel_coords[:,1])*(Y-ground_pixel_coords[:,1]) ) )
# interpolating
print("interpolating")
grid_x, grid_y = np.mgrid[0:sensor_resolution_x, 0:sensor_resolution_y]
grid_y, grid_x = np.mgrid[0:sensor_resolution_y, 0:sensor_resolution_x]
ground_pixel_coords_x = ground_pixel_coords[:,0]
ground_pixel_coords_x_interpol = griddata(sensor_pixels_xy, ground_pixel_coords_x, (grid_x, grid_y), method='cubic')
ground_pixel_coords_x_interpol = griddata(sensor_pixels_xy, ground_pixel_coords_x, (grid_x, grid_y), method='linear')
ground_pixel_coords_y = ground_pixel_coords[:,1]
ground_pixel_coords_y_interpol = griddata(sensor_pixels_xy, ground_pixel_coords_y, (grid_x, grid_y), method='cubic')
ground_pixel_coords_y_interpol = griddata(sensor_pixels_xy, ground_pixel_coords_y, (grid_x, grid_y), method='linear')
ground_pixel_coords_z = ground_pixel_coords[:,2]
ground_pixel_coords_z_interpol = griddata(sensor_pixels_xy, ground_pixel_coords_z, (grid_x, grid_y), method='cubic')
ground_pixel_coords_z_interpol = griddata(sensor_pixels_xy, ground_pixel_coords_z, (grid_x, grid_y), method='linear')
ground_pixel_angle_xy_interpol = griddata(sensor_pixels_xy, ground_pixel_angle_xy, (grid_x, grid_y), method='cubic')
ground_pixel_angle_z_interpol = griddata(sensor_pixels_xy, ground_pixel_angle_z, (grid_x, grid_y), method='cubic')
ground_pixel_angle_xy_interpol = griddata(sensor_pixels_xy, ground_pixel_angle_xy, (grid_x, grid_y), method='linear')
ground_pixel_angle_z_interpol = griddata(sensor_pixels_xy, ground_pixel_angle_z, (grid_x, grid_y), method='linear')
print("create overview file")
plt.figure(figsize=(10,7))
......@@ -329,27 +324,27 @@ def main(argv):
plt.subplot(231)
plt.imshow(ground_pixel_coords_x_interpol)
plt.title('X coord')
plt.colorbar()
plt.colorbar(orientation='horizontal')
plt.subplot(232)
plt.imshow(ground_pixel_coords_y_interpol)
plt.title('Y coord')
plt.colorbar()
plt.colorbar(orientation='horizontal')
plt.subplot(233)
plt.imshow(ground_pixel_coords_z_interpol)
plt.title('Z coord')
plt.colorbar()
plt.colorbar(orientation='horizontal')
plt.subplot(234)
plt.imshow(ground_pixel_angle_xy_interpol)
plt.title('xy view angle')
plt.colorbar()
plt.colorbar(orientation='horizontal')
plt.subplot(235)
plt.imshow(ground_pixel_angle_z_interpol)
plt.title('z view angle')
plt.colorbar()
plt.colorbar(orientation='horizontal')
plt.savefig(os.path.join(output_directory, 'overview_' + PhotoID + '.png'), dpi = 80)
......
/corners_DSC01522.dbf
/corners_DSC01522.prj
/corners_DSC01522.shp
/corners_DSC01522.shx
# Cameras (40)
# PhotoID, X, Y, Z, Omega, Phi, Kappa, r11, r12, r13, r21, r22, r23, r31, r32, r33
DSC01559.JPG 2693838.2249414884000000 1256291.6695900483000000 606.2659902529953800 3.2391989978125375 -2.4811975101507655 141.3994590158930300 -0.7807818978777267 0.6248019338709072 0.0014735595100694 -0.6233020705908802 -0.7787398538597858 -0.0711250223730069 -0.0432915320077411 -0.0564516026487568 0.9974663201405898
DSC01518.JPG 2693775.2436063010000000 1256295.7234344794000000 607.0859311561650900 4.2298653063595717 -1.6345979613024908 141.9575462861694500 -0.7872338809641010 0.6162236268224308 0.0230490435378355 -0.6159944212199316 -0.7841126326325563 -0.0756191270246058 -0.0285252465041340 -0.0737280210764592 0.9968703472468359
DSC01519.JPG 2693780.2975193672000000 1256302.2680021233000000 606.7392743338602900 3.6281021142269836 -3.1463353095933284 142.4684652532244500 -0.7918227792912077 0.6107313552295478 -0.0048885514242441 -0.6082796877782650 -0.7893129380420881 -0.0835518238923801 -0.0548863155251336 -0.0631846308752865 0.9964914424064210
DSC01520.JPG 2693786.2141234782000000 1256310.0950113330000000 606.8090010659472000 2.7787812806211063 -1.3090272913737455 141.0244127303900300 -0.7772111456690808 0.6291106127351771 0.0127542930703687 -0.6288250535211670 -0.7758033033819735 -0.0520412002717013 -0.0228448486941101 -0.0484672199077620 0.9985634889592930
......@@ -24,7 +25,6 @@ DSC01555.JPG 2693815.7670268025000000 1256262.8524445090000000 605.9532385542594
DSC01556.JPG 2693821.4706252441000000 1256270.1127185251000000 605.9480323143780000 2.9547975753224720 -2.5433343851202617 141.7453104791557100 -0.7844927266848520 0.6201313148343269 -0.0028834251187219 -0.6185483188017117 -0.7828059652150874 -0.0679175833731669 -0.0443749826607585 -0.0514973124106851 0.9976867683438194
DSC01557.JPG 2693826.7810471952000000 1256277.0784053046000000 606.0726412936527400 3.0477884214251554 -2.7958473702761362 140.9248471261188600 -0.7753957628306100 0.6314609494758963 -0.0042988686111739 -0.6295888962403807 -0.7735870135367442 -0.0719788456292566 -0.0487773791337340 -0.0531055719703723 0.9973968946766094
DSC01558.JPG 2693832.5871858522000000 1256284.3929151888000000 606.0570709865461400 3.0779742731664643 -2.6373680715026651 140.9282611449503400 -0.7755350538487709 0.6313018583975042 -0.0018286157720418 -0.6296253217367261 -0.7736801151042286 -0.0706472484972442 -0.0460145029279752 -0.0536380748737726 0.9974996854356031
DSC01559.JPG 2693838.2249414884000000 1256291.6695900483000000 606.2659902529953800 3.2391989978125375 -2.4811975101507655 141.3994590158930300 -0.7807818978777267 0.6248019338709072 0.0014735595100694 -0.6233020705908802 -0.7787398538597858 -0.0711250223730069 -0.0432915320077411 -0.0564516026487568 0.9974663201405898
DSC01560.JPG 2693843.6417116039000000 1256298.1965677084000000 606.0512052832803000 3.7538560832988588 -2.8577253314317730 140.7379844547648400 -0.7732970834061888 0.6340371611603134 0.0029153152921850 -0.6320806880132036 -0.7705330454646842 -0.0821756027521207 -0.0498560391150151 -0.0653888684310197 0.9966136017780780
DSC01561.JPG 2693849.3903369997000000 1256305.4174054214000000 606.1605968254447100 3.9313230658472436 -2.0348188914569865 140.6268505767512800 -0.7725434959089622 0.6347574595862103 0.0161094515244838 -0.6339683054817114 -0.7696676707412831 -0.0754709497776160 -0.0355068243216288 -0.0685174730659855 0.9970178640883247
DSC01562.JPG 2693855.2630546615000000 1256312.1454448558000000 606.3427498311724500 3.6234327989437380 -3.1040758544633169 140.0843659160338700 -0.7658647813893119 0.6430010352696576 -0.0008973681797123 -0.6407175124998304 -0.7632609685319169 -0.0831490414361477 -0.0541498458310995 -0.0631059629343239 0.9965367186604814
......@@ -39,4 +39,4 @@ DSC01570.JPG 2693855.9202470165000000 1256269.3920606317000000 606.2737138549332
DSC01571.JPG 2693850.1915417779000000 1256262.2130745866000000 605.9340896774451700 3.7839628931562652 -3.7715169122288823 142.2105562389323300 -0.7885564315528780 0.6148561723236330 -0.0114298561724267 -0.6114344013806230 -0.7858851331940409 -0.0923716960594754 -0.0657778615106273 -0.0658516877544922 0.9956589919018327
DSC01572.JPG 2693844.9654546883000000 1256255.3065335231000000 605.7887106412084700 3.7649086190476715 -2.3677656863780587 141.7923583149678800 -0.7851035376499745 0.6193099894738113 0.0082202255104507 -0.6179851342141506 -0.7824007260195379 -0.0770939544608954 -0.0413135457182506 -0.0656067135440211 0.9969899448229851
DSC01573.JPG 2693839.3328808229000000 1256248.3533806487000000 605.9585870792581100 5.1505099125563900 -2.7886858453094319 141.6918229296024700 -0.7837586541417525 0.6208153434507229 0.0176261565314074 -0.6191569291080333 -0.7788121168352018 -0.1004807633738021 -0.0486525353442037 -0.0896660248189503 0.9947828581141456
DSC01574.JPG 2693833.7150236052000000 1256240.7259823503000000 606.4019043570782500 4.2269616589310166 -2.4461508128996110 142.2554727971560700 -0.7900274993758747 0.6129642549293154 0.0114617803526124 -0.6115839535353040 -0.7866714205036576 -0.0843394566077144 -0.0426804171492004 -0.0736403309451161 0.9963711575764646
DSC01574.JPG 2693833.7150236052000000 1256240.7259823503000000 606.4019043570782500 4.2269616589310166 -2.4461508128996110 142.2554727971560700 -0.7900274993758747 0.6129642549293154 0.0114617803526124 -0.6115839535353040 -0.7866714205036576 -0.0843394566077144 -0.0426804171492004 -0.0736403309451161 0.9963711575764646
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment