Crb*_*gan 3 c++ camera opencv camera-calibration
我试图使用OpenCv来校正图像的失真,然后计算给定像素坐标的真实世界坐标.我无法在线或在OpenCv书中找到任何有关如何执行此操作的示例.
我用国际象棋棋盘图像完成了相机校准.现在,我只需要一个基本功能,我可以给出像素坐标,它将根据相机矩阵,失真系数,旋转和平移向量给出真实世界坐标.
有谁知道如何做到这一点?
看看这个findHomography()功能.如果您知道现实世界中一组点的位置,您可以使用此函数创建转换矩阵,您可以将其与函数一起使用perspectiveTransform()
std::vector<Point2f> worldPoints;
std::vector<Point2f> cameraPoints;
//insert somepoints in both vectors
Mat perspectiveMat_= findHomography(cameraPoints, worldPoints, CV_RANSAC);
//use perspective transform to translate other points to real word coordinates
std::vector<Point2f> camera_corners;
//insert points from your camera image here
std::vector<Point2f> world_corners;
perspectiveTransform(camera_corners, world_corners, perspectiveMat_);
Run Code Online (Sandbox Code Playgroud)
您可以在此处找到有关此功能的更多信息