Difference between revisions of "Example Detect Calibration Target"
From BoofCV
Jump to navigationJump to searchm |
m |
||
Line 7: | Line 7: | ||
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. | 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: [https://github.com/lessthanoptimal/BoofCV/blob/v0. | Example File: [https://github.com/lessthanoptimal/BoofCV/blob/v0.19/examples/src/boofcv/examples/calibration/ExampleDetectCalibrationPoints.java ExampleDetectCalibrationPoints.java] | ||
Concepts: | Concepts: | ||
Line 44: | Line 44: | ||
// For chessboard targets, tune RADIUS parameter for your images | // For chessboard targets, tune RADIUS parameter for your images | ||
// detector = FactoryPlanarCalibrationTarget.detectorSquareGrid( new ConfigSquareGrid(5,7)); | // detector = FactoryPlanarCalibrationTarget.detectorSquareGrid( new ConfigSquareGrid(5,7,30,30)); | ||
detector = FactoryPlanarCalibrationTarget.detectorChessboard( new ConfigChessboard(5,7)); | detector = FactoryPlanarCalibrationTarget.detectorChessboard( new ConfigChessboard(5,7,30)); | ||
// process the image and check for failure condition | // process the image and check for failure condition | ||
Line 52: | Line 52: | ||
// Ordered observations of calibration points on the target | // Ordered observations of calibration points on the target | ||
List<Point2D_F64> points = detector. | List<Point2D_F64> points = detector.getDetectedPoints(); | ||
// render and display the results | // render and display the results | ||
Line 59: | Line 59: | ||
VisualizeFeatures.drawPoint(g2,(int)p.x,(int)p.y,3,Color.RED); | VisualizeFeatures.drawPoint(g2,(int)p.x,(int)p.y,3,Color.RED); | ||
ShowImages.showWindow(orig,"Calibration Points"); | ShowImages.showWindow(orig,"Calibration Points", true); | ||
} | } | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 21:09, 15 September 2015
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
/**
* Example that demonstrates how to detect calibration targets. Calibration points are found on the
* targets 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 then the target is likely
* to not be detected.
*
* @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( new ConfigSquareGrid(5,7,30,30));
detector = FactoryPlanarCalibrationTarget.detectorChessboard( new ConfigChessboard(5,7,30));
// 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.getDetectedPoints();
// 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", true);
}
}