Skip to content
firepick1 (pixel) edited this page Oct 31, 2014 · 9 revisions

The undistort stage gives you access to OpenCV undistort, which allows you to apply the intrinsic camera matrix and distortion coefficients returned by OpenCV calibrateCamera. The intrinsic camera matrix and distortion coefficients can be:

  1. Specified in the undistort stage itself
  2. Computed and obtained from a preceding camera calibration stage (see op-matchGrid).
  3. Provided externally as FireSight pipeline arguments

The undistort stage is normally used only for removing intrinsic distortion. Use other stages for removing extrinisic distortion (e.g., op-warpPerspective)

  • cameraMatrix JSON array [v11,v12,v13,v21,v22,v23,v31,v32.v33] representing a 3x3 cameraMatrix. Default is [1,0,0,0,1,0,0,0,1]
  • distCoeffs JSON array of 4,5, or 8 radial/tangential distortion coefficients. Default is [].
  • model Name of stage whose model has a JSON "calibrate" object having cameraMatrix and distCoeffs.

Stage Model

{}

Example: Cutting-corners calibration pipeline

firesight -i img/cal-grid.png -p json/matchGrid.json -Dtemplate=img/cross32.png -Dcalibrate=ellipse -Dscale=[0.85,0.85]

This example shows how undistort can be applied to remove distortion in the center of an image. Notice that extrinsic perspective foreshortening is present in both images, but is lessened by undistort because of the different x- and y-focal lengths that are part of the intrinsic camera matrix (i.e., 157.2 vs. 156.7):

...
  "cameraMatrix":[
	157.24943374708459, 0.0,                201.69831718976516,
	0.0,                156.67200025317413, 207.69154501963604,
	0.0,                0.0,                1.0
  ],
  "distCoeffs":[
	-0.004237833051241255,
	0.015224317198337892,
	0.00053565532320704154,
	-0.0013002127252612144,
	-0.0086531013078221357
  ],
...

Distorted image

Undistorted image

See Also

Clone this wiki locally