1

I am currently using OpenCV in Java, but if need be I can switch to something else.

I have a set of known points in world coordinates as well as known in image coordinates. These points are not obtained with a calibration target. They are probably quite inaccurate. I can assume that they are close to coplanar.

I am trying to obtain a homography and lens correction from this. The camera is cheap(ish) and so there are lens issues.

I have been struggling to get the OpenCV functions to help me here without a calibration target. There are a lot of similar questions asked (the most similar I found was this one: Correct lens distortion using single calibration image in Matlab), but none quite fit the bill.

I was thinking I could iteratively find the homography, correct, find the lens distortion, correct and repeat until I got an OK result. Even so, I can't seem to do these separately in OpenCV.

I am quite new to OpenCV, so please be gentle.

Community
  • 1
  • 1
timbo
  • 1,533
  • 1
  • 15
  • 26

2 Answers2

1

openCV have this functionality

Camera calibration

Function "calibrateCamera" take as input world coordinates and corresponding image coordinates, and return camera intrinsic (also distortion)

minorlogic
  • 1,872
  • 1
  • 17
  • 24
  • Thanks, I was using CalibrateCamera2 which has pretty much the same functionality. I wasn't having much luck with it; I thought it might be because I didn't have "several views of a calibration pattern". I will try CalibrateCamera and CalibrateCamera2 again. I'd post code, but I don't think I'm even there yet! – timbo Mar 26 '15 at 11:51
1

At a minimum you need to "see" features that are known to be collinear, regardless of whether they are the images of coplanar points. That is because the error signal that you need to minimize in order to estimate (and remove) the lens's radial distortion is, by definition, the deviation of collinear points from straight lines.

See also this answer.

Community
  • 1
  • 1
Francesco Callari
  • 11,300
  • 2
  • 25
  • 40
  • So one could calculate camera distortion coefficients and iterate with the stopping criterion/constraint that the target object should be a rectangle with orthogonal pairs of lines? (If the OP is targeting a rectangle?)? – jtlz2 Jul 04 '19 at 07:20