camAlgo/camCalib/sourceCode/MonoLaserCalibrate.h

83 lines
2.4 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <opencv2/opencv.hpp>
#include <vector>
#define ENABLE_FISH_EYE 0
#define ENABLE_DEBUG 1
#define ENABLE_GEN_IMAGE 0
/*Breif角点检测函数*/
void detectCorners(const cv::Mat& img,
const cv::Size& patternSize,
std::vector<cv::Point2f>& corners);
/*Breif圆形网格函数*/
void detectCirclePoints(const cv::Mat& img,
const cv::Size& patternSize,
std::vector<cv::Point2f>& corners);
/*Breif二维码标定板角点函数*/
void detectCharucoCorners(const cv::Mat& img,
const cv::Size& patternSize,
float sqSize,
float mkSize,
std::vector<int>& markerIds,
std::vector<std::vector<cv::Point2f> >& markerCorners,
std::vector<int>& charucoIds,
std::vector<cv::Point2f>& charucoCorners);
/*Breif棋盘格单目相机标定函数*/
void monocularCalibration_chessboard(
const std::vector<std::vector<cv::Point2f>>& imagePoints,
const cv::Size& imageSize,
const cv::Size& patternSize,
const float squareSize,
cv::Mat& cameraMatrix,
cv::Mat& distCoeffs,
std::vector<double>& reprojectionError);
/*Breif二维码标定板单目相机标定函数*/
void monocularCalibration_charuco(
std::vector<std::vector<int>>& charucoIds,
std::vector<std::vector<cv::Point2f>>& charucoCorners,
const cv::Size& imageSize,
const cv::Size& patternSize,
const float squareSize,
cv::Mat& cameraMatrix,
cv::Mat& distCoeffs,
std::vector<double>& reprojectionError);
/*Brief: 拟合棋盘格角点平面*/
void fitChessboardPlane_chessboard(
std::vector<cv::Point2f>& corners,
const cv::Mat& cameraMatrix,
const cv::Mat& distCoeffs,
const cv::Size& patternSize,
const float squareSize,
cv::Vec4f& planeEquation);
/*Brief: 拟合二维码标定板角点平面*/
void fitChessboardPlane_charuco(
std::vector<int>& charucoIds,
std::vector<cv::Point2f>& corners,
const cv::Mat& cameraMatrix,
const cv::Mat& distCoeffs,
const cv::Size& patternSize,
const float squareSize,
cv::Vec4f& planeEquation);
/*Brief: 激光线检测函数*/
std::vector<cv::Point2f> detectLaserLine(
const cv::Mat& inputImage);
/*Breif: 根据棋盘格平面和2d坐标计算3d值*/
std::vector<cv::Point3f> project2DTo3D(
const std::vector<cv::Point2f>& imagePoints,
const cv::Vec4f& planeEquation, // [a,b,c,d] for ax+by+cz+d=0
const cv::Mat& cameraMatrix, // 相机内参K
const cv::Mat& distCoeffs); // 畸变系数D
/*Breif: 拟合平面方程*/
cv::Vec4f fitPlaneToPoints(const std::vector<cv::Point3f>& points);