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

FireSight wrapper for OpenCV warpAffine:

  • angle Rotate image counter-clockwise by given angle in degrees. Default 0
  • cx Center of rotation. Default is center of image
  • cy Center of rotation. Default is center of image
  • dx Translation after rotation. Default is 0
  • dy Translation after rotation. Default is 0
  • width Width of output image. Default is width of original image. FireSight: If -1, width will be automatically computed to show full image (vs. cropping it).
  • height Height of output image. Default is height of original image. FireSight: If -1, height will be automatically computed to show full image (vs. cropping it).
  • scale Size scale of output image. Default is 1
  • reflect JSON array [x,y] of reflection vector. Default is [0,0]. Only x-, y- and xy-axis reflections are supported because of a bug in OpenCV.
  • borderValue Color to use for background. Default is [0,0,0] BGR
  • borderMode Specifies how border of transformed image should be filled: BORDER_CONSTANT fills with borderValue; BORDER_REPLICATE replicates border pixels; BORDER_REFLECT fills with a mirror image of source image doubling the border value; BORDER_REFLECT_101 fills with a mirror image of source image without doubling the border value; BORDER_WRAP fills with repeated copies of the source image.

Stage Model

{}

Example: Rotate a duck by 30 degrees and scale it by 0.5 pipeline

firesight -i img/duck.jpg -p json/warpAffine-rotate.json -o target/warpAffine-rotate.jpg

 

Example: Rotate a duck by 30 degrees with BORDER_REPLICATE pipeline

firesight -i img/duck.jpg -p json/warpAffine-rotate2.json -o target/warpAffine-rotate2.jpg

The choice of border fill when rotating an image can strongly influence the use of that image as a template for matching. Using BORDER_REPLICATE can greatly improve matching accuracy. Notice that rotation destroys image information and replaces it with replicated borders:

 

Example: Translate a duck by (50,50) pixels pipeline

firesight -i img/duck.jpg -p json/warpAffine-translate.json -o target/warpAffine-translate.jpg

 

Example: Flip a duck pipeline

firesight -i img/duck.png -p json/fliph.json -o target/fliph.png

 

Clone this wiki locally