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

Applies a perspective transformation to an image.

Reference: Geometric Image Transformations: warpPerspective()

The perspective matrix can be:

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

Example

{"op":"warpPerspective","borderMode":"BORDER_CONSTANT","borderValue":[0,0,0]}
  • borderMode pixel extrapolation method (BORDER_CONSTANT or BORDER_REPLICATE).
  • borderValue value used in case of a constant border; by default, it equals [0,0,0].
  • model Name of stage whose model has a JSON "calibrate" object having cameraMatrix and distCoeffs.

NOTE: Currently, this stage is written with the flags parameter hard-coded to INTER_LINEAR.

Stage Model

{}

Example: A different perspective pipeline

firesight -i img/cal-grid.png -p json/matchGrid-perspective.json -Dtemplate=img/cross32.png

In this example, we used op-matchGrid to give us a perspective matrix that makes a dramatic difference.

...
"perspective":[
1.0405136564383939,    0.026744906574870872, -2.943810346145538,
0.024529984309304427,  1.097007339310166,    -14.050588819421538,
-1.7780681696463529e-5,0.00027266213560320576,1.0
],
...

Distorted image

Undistorted image

Clone this wiki locally