当前位置: 首页>>代码示例>>Java>>正文


Java Calib3d.calibrateCamera方法代码示例

本文整理汇总了Java中org.opencv.calib3d.Calib3d.calibrateCamera方法的典型用法代码示例。如果您正苦于以下问题:Java Calib3d.calibrateCamera方法的具体用法?Java Calib3d.calibrateCamera怎么用?Java Calib3d.calibrateCamera使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opencv.calib3d.Calib3d的用法示例。


在下文中一共展示了Calib3d.calibrateCamera方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: calibrate

import org.opencv.calib3d.Calib3d; //导入方法依赖的package包/类
public void calibrate() {
    ArrayList<Mat> rvecs = new ArrayList<Mat>();
    ArrayList<Mat> tvecs = new ArrayList<Mat>();
    Mat reprojectionErrors = new Mat();
    ArrayList<Mat> objectPoints = new ArrayList<Mat>();
    objectPoints.add(Mat.zeros(mCornersSize, 1, CvType.CV_32FC3));
    calcBoardCornerPositions(objectPoints.get(0));
    for (int i = 1; i < mCornersBuffer.size(); i++) {
        objectPoints.add(objectPoints.get(0));
    }

    Calib3d.calibrateCamera(objectPoints, mCornersBuffer, mImageSize,
            mCameraMatrix, mDistortionCoefficients, rvecs, tvecs, mFlags);

    mIsCalibrated = Core.checkRange(mCameraMatrix)
            && Core.checkRange(mDistortionCoefficients);

    mRms = computeReprojectionErrors(objectPoints, rvecs, tvecs, reprojectionErrors);
    Log.i(TAG, String.format("Average re-projection error: %f", mRms));
    Log.i(TAG, "Camera matrix: " + mCameraMatrix.dump());
    Log.i(TAG, "Distortion coefficients: " + mDistortionCoefficients.dump());
}
 
开发者ID:xunqun,项目名称:OpenCV-AndroidSamples-master,代码行数:23,代码来源:CameraCalibrator.java

示例2: runCalibration

import org.opencv.calib3d.Calib3d; //导入方法依赖的package包/类
private boolean runCalibration() {
	Mat frame = getFrame();
	
	Mat cameraMatrix = Mat.eye(3, 3, CvType.CV_64F);
	List<Mat> objectPoints = calcBoardCornerPositions();
	Mat distCoeffs = Mat.zeros(8, 1, CvType.CV_64F);
	List<Mat> rvecs = new LinkedList<>();
	List<Mat> tvecs = new LinkedList<>();
	
	Calib3d.calibrateCamera(objectPoints, _calibrationPoints, frame.size(), cameraMatrix,
			distCoeffs, rvecs, tvecs, Calib3d.CALIB_FIX_K4 | Calib3d.CALIB_FIX_K5);
	
	boolean ok = Core.checkRange(frame) && Core.checkRange(distCoeffs);
	
	if (ok) {
		_cameraMatrix = cameraMatrix;
		_distCoeefs = distCoeffs;
	}
	
	frame.release();
	
	return ok;
}
 
开发者ID:lumannnn,项目名称:AudioRacer,代码行数:24,代码来源:OpenCVCamera.java

示例3: makeCalibrationOfPatterns

import org.opencv.calib3d.Calib3d; //导入方法依赖的package包/类
private void makeCalibrationOfPatterns() {
    cameraMatrix = new Mat();
    distCoeff = new Mat();
    rvecs = new ArrayList<>();
    tvecs = new ArrayList<>();
    Calib3d.calibrateCamera(cornersModelFromAllImages, cornersFromAllImages,
            images.get(0).size(), cameraMatrix, distCoeff, rvecs, tvecs);
}
 
开发者ID:PawelTypiak,项目名称:Checkerboard-IMU-Comparator,代码行数:9,代码来源:CheckerboardPatternComputingInitializer.java


注:本文中的org.opencv.calib3d.Calib3d.calibrateCamera方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。