52 lines
1.5 KiB
C++
52 lines
1.5 KiB
C++
#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 monocularCalibration(
|
||
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);
|
||
|
||
/*Brief: 拟合棋盘格角点平面*/
|
||
void fitChessboardPlane(
|
||
const 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);
|