Difference between revisions of "Example Detect Calibration Target"

From BoofCV
Jump to navigationJump to search
(Added example)
 
(Added image)
Line 3: Line 3:
<center>
<center>
<gallery heights=300 widths=610 >
<gallery heights=300 widths=610 >
Image:Calib_mono.jpg|Left uncalibrated.  Right calibrated with lens distortion removedNumbers are super imposed on the image to show calibration points.
Image:Example_chess_calibration_points.jpg|Red dots are detected calibration points on a chessboard targetThe entire target must be visible for detection to work.
</gallery>
</gallery>
</center>
</center>

Revision as of 20:19, 12 May 2012

Detecting Calibration Targets

BoofCV provides fully automated calibration target detection. Once detected calibration point locations are returned with a high level of precision. While intended for camera calibration, they can also be used for other applications, such as augmented reality. In this example it is demonstrated how to detect different types of grid based targets.

Example File: ExampleDetectCalibrationPoints.java

Concepts:

  • Calibration targets

Relevant Applets:

Related Examples/Tutorials:

Example Code

<syntaxhighlight lang="java"> /**

* Example that demonstrates how to detect targets used for camera calibration.  The point features which
* are detected inside the targets are found to a high level of precision.  It is assumed that a single 
* image only shows a single target and that the entire target is visible.  If these conditions are not 
* meet the detector is likely to fail.
*
* @author Peter Abeles
*/

public class ExampleDetectCalibrationPoints {

public static void main( String args[] ) {

// load the test image // String directory = "../data/evaluation/calibration/stereo/Bumblebee2_Square"; String directory = "../data/evaluation/calibration/stereo/Bumblebee2_Chess";

BufferedImage orig = UtilImageIO.loadImage(directory+"/left01.jpg"); ImageFloat32 input = ConvertBufferedImage.convertFrom(orig,(ImageFloat32)null);

// To select different types of detectors add or remove comments below PlanarCalibrationDetector detector;

// For chessboard targets, tune RADIUS parameter for your images // detector = FactoryPlanarCalibrationTarget.detectorSquareGrid( 3, 4); detector = FactoryPlanarCalibrationTarget.detectorChessboard( 3, 4, 6);

// process the image and check for failure condition if( !detector.process(input) ) throw new RuntimeException("Target detection failed!");

// Ordered observations of calibration points on the target List<Point2D_F64> points = detector.getPoints();

// render and display the results Graphics2D g2 = orig.createGraphics(); for( Point2D_F64 p : points ) VisualizeFeatures.drawPoint(g2,(int)p.x,(int)p.y,3,Color.RED);

ShowImages.showWindow(orig,"Calibration Points"); } } </syntaxhighlight">