QVPR / Patch-NetVLAD

Code for the CVPR2021 paper "Patch-NetVLAD: Multi-Scale Fusion of Locally-Global Descriptors for Place Recognition"
MIT License
525 stars 74 forks source link

How to convert pose to utm #30

Closed DonMuv closed 3 years ago

DonMuv commented 3 years ago

Hi, How to convert ground truth camera pose to utmQ or utmDb, I only have poses data, can you help me

Tobias-Fischer commented 3 years ago

Hi,

utmQ and utmDb are simply N*2 numpy arrays where each row contains the x & y coordinates of a query / reference place. The posDistThr scalar is the ground truth tolerance (typically in meters). See https://github.com/QVPR/Patch-NetVLAD/blob/4edee2f3e4e0173b101ae5b4506151e7cdb899d0/patchnetvlad/tools/datasets.py#L64-L65

https://github.com/QVPR/Patch-NetVLAD/blob/4edee2f3e4e0173b101ae5b4506151e7cdb899d0/patchnetvlad/tools/datasets.py#L93-L102

https://github.com/QVPR/Patch-NetVLAD/blob/4edee2f3e4e0173b101ae5b4506151e7cdb899d0/patchnetvlad/tools/datasets.py#L120-L124

https://github.com/QVPR/Patch-NetVLAD/blob/259874bd5ccec9c319e6ed8efb3bbdcf6a6f0391/feature_match.py#L153-L160

for relevant code snippets.

DonMuv commented 3 years ago

But my ground truth file, the poses of the images come in the format of a 7 feature vector (t_x, t_y, t_z, q_x, q_y, q_z, q_w), with t corresponding to the translation vector and q to the rotation expressed in form of a quaternion.

such as [ 4.45019497e+00 8.69529027e+00 4.75170998e-01 6.67300280e-01 -2.33674360e-01 2.27086490e-01 6.69730062e-01] [... ... ] ...

pose matrix of shape = (n, 7)

Tobias-Fischer commented 3 years ago

Hi, Simply modify the get_positives() method above to define your desired ground truth tolerance. In our case, it's simply the Euclidean distance in the plane; if you want to use this simply disregard everything except for t_x and t_y (sth like utmQ = utmQ[:, :2] and the same for utmDb)

Alternatively, you could adapt get_positives to separately have some tolerance for position (based on t) and orientation (based on q). You should be able to use some code from e.g. kapture to do this. utmQ and utmDb will be a bit confusing naming of the variables, as they will contain a matrix of size N*7, but otherwise everything else should work the same.

Tobias-Fischer commented 3 years ago

Feel free to re-open if you have more questions.