2

I'm using a physical camera in Unity where I set the focal length f and sensor size sx and sy. Can these parameters and image resolution be used to create a camera calibration matrix? I probably need the focal length in terms of pixels and the cx and cy parameters that denote the deviation of the image plane center from the camera's optical axis. Is cx = w/2 and cy = h/2 correct in this case (w: width, h: height)?

I need the calibration matrix to compute a homography in OpenCV using the camera pose from Unity.

chronosynclastic
  • 1,585
  • 3
  • 19
  • 40

1 Answers1

0

Yes, that's possible. I have done that with multiple different camera models( pinhole model, fisheye lens, polynominal lens model, etc).

Calibrate your camera with opencv and put the calibration parameters to the shader. You need to write a custom shader. Have a look at my previous question. Camera lens distortion in OpenGL

You don't need homography here.

@Tuebel gave me a nice piece of code and I have successfully adapted it to real camera models.

The hardest part will be managing the difference between opengl camera coordinate and opencv camera coordinate. The camera calibration parameters are of course calibrated based on the opencv camera coordinate.

Chanoh Park
  • 254
  • 2
  • 16