Forum

Author Topic: Photoscan Distortion Coefficients  (Read 2299 times)

aspirisha

  • Newbie
  • *
  • Posts: 2
    • View Profile
Photoscan Distortion Coefficients
« on: October 19, 2017, 05:16:28 PM »
Hello, everyone!

Has anybody ever managed to use PhotoScan distortion coefficients to undistort photos outside of PhotoScan in OpenCV? If so, I am really interested to know, how.

I have tried two approaches already with not very successful results.

First, I just used the coefficients with OpenCV undistort method. However, the results were weird - it's definitely that OpenCV uses a different approach to undistortion than PhotoScan.

I have found this paper https://hal-amu.archives-ouvertes.fr/hal-01458821/document about transforming coefficients from PhotoScan to PhotoModeler and vice versa. Using similar idea, I tried to apply inverse distortion coefficients derived from the ones provided by PhotoScan, but the results were still far from what Export Undistort Photos produces. By the way, as I understand, PhotScan when undistorting images also scales them so that no blank pixels are present in the image, for the resolution of the image persists. Am I right?

OpenCV as I understand now uses coefficients exactly as is described in PhotoScan manual (e.g. here http://www.agisoft.com/pdf/photoscan-pro_1_2_en.pdf, in Appendix C, chapter Frame Camera), i.e., we take color for pixel (x,y) as the color of pixel (x', y') from distorted image.



Marburg

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Photoscan Distortion Coefficients
« Reply #1 on: June 13, 2018, 01:42:06 AM »
On the off chance that someone finds this by Google, I am now using:

[lower case is OpenCV, UPPER CASE is Photoscan]

k = [ F+B1;    B2;   CX + width/2;
        0       ;    F;      CY + height/2;
        0       ;    0;      1 ]

k1 = K1
k2 = K2
k3 = K3

Photoscan's K4 doesn't map to Opencv

p1 = P2  <!! note
p2 = P1  <!! note


This is correct for Photoscan P3 = P4 = 0