c++ - 如何应用相机校准将图像中的二维点转换为方位矢量?
问题描述
我试图通过使用 EPNP 算法 OpenGV(不是 OpenCV)的 2D-3D 点对应来找出相机绝对旋转和平移。但是我的问题是我有 2D 和 3D 点,但是如果您查看存储库中绝对姿势查找算法的测试代码,它需要点的方位矢量。您会发现它生成随机 3D 点,并通过以下代码使用旋转和平移生成相机参考系中点的方位矢量。请检查以下代码。
for( size_t i = 0; i < (size_t) gt.cols(); i++ )
gt.col(i) = generateRandomPoint( maxDepth, minDepth );
//create the 2D3D-correspondences by looping through the cameras
size_t numberCams = camOffsets.size();
size_t camCorrespondence = 0;
for( size_t i = 0; i < (size_t) gt.cols(); i++ )
{
//get the camera transformation
translation_t camOffset = camOffsets[camCorrespondence];
rotation_t camRotation = camRotations[camCorrespondence];
//store the point
points.push_back(gt.col(i));
//project the point into the viewpoint frame
point_t bodyPoint = rotation.transpose()*(gt.col(i) - position);
//project the point into the camera frame
bearingVectors.push_back(camRotation.transpose()*(bodyPoint - camOffset));
//normalize the bearing-vector to 1
bearingVectors[i] = bearingVectors[i] / bearingVectors[i].norm();
//add noise
if( noise > 0.0 )
bearingVectors[i] = addNoise(noise,bearingVectors[i]);
//push back the camera correspondence
camCorrespondences.push_back(camCorrespondence++);
if(camCorrespondence > (numberCams-1) )
camCorrespondence = 0;
}
方位矢量是从图像中获得的输入/测量值。有关方位矢量的详细说明,您可以在此处查看。
所以我正在寻找一种方法来应用相机校准将二维点转换为方位矢量。
解决方案
推荐阅读
- javascript - 如果其他列的值匹配,则获取列的总和
- sql-server - T-SQL 使用潜在客户进行投影
- python - 是否可以停止(取消)urlretrieve 进程?
- angular - 在formcontrol angular 5中验证十进制数模式的问题
- sass - 覆盖多个 scss 文件中的变量
- java - 如何在 RxJava 中正确转换多播 observables
- ios - AVAudioPlayer 导致应用程序崩溃
- java - Apache Ignite 和 Yardstick
- java - 循环外的 Java 对象引用
- json - Haskell (Aeson) : 如何从 JSON 构造带有附加值的记录