Rob174 / detection_nappe_hydrocarbures_IMT_cefrem

0 stars 0 forks source link

Extract th captured image: transform matrix problem #21

Closed Rob174 closed 3 years ago

Rob174 commented 3 years ago

Make the inverse transform:

Exemple: Transform matrix: M = [[0.00017966305682390432, -0.0, 23.70719634263147], [-0.0, -0.00017966305682390432, 40.38637265914473], [0.0, 0.0, 1.0 ]]

Image input shape (with margins): (10600, 18441)

Cut the last line (as there are no 3rd dimension in the input) Point (0,0) is mapped to (0,0) Point (10599, 18440) is mapped to ( 1.90424874e+00, -3.31298677e+00, 9.95997286e+05) Point (10599, 0) is mapped to [1.90424874e+00, 0.00000000e+00, 2.51272574e+05] Point (0, 18440) is mapped to [ 0.00000000e+00, -3.31298677e+00, 7.44724712e+05]

Rob174 commented 3 years ago

to be verified: if M is a transformation matrix it is composed of:

Rob174 commented 3 years ago

Applying an additionnal scaling matrix would not improve the result as we can see that the y coordinate is negative

Rob174 commented 3 years ago

to obtain the coordinate take a pixel coordinates, put it into the following vector : (pos_x,pos_y, 1 ) ( not (pos_x,pos_y, 0 ))and multiply the confusion matrix by this vector

Then we can do m.dot(point_coord) to obtain the coordinates (inversed : lon,lat not lat,lon)

Rob174 commented 3 years ago

Or edge detection (canny possible with opencv) Then use https://docs.opencv.org/3.4/dd/d49/tutorial_py_contour_features.html to calculate the area of each polygon and take the biggest