我可以从 rotation/translation 个向量创建一个变换矩阵吗?

Can I create a transformation matrix from rotation/translation vectors?

我正在尝试对包含已知大小元素的图像进行校正。给定这张图片:

我可以使用 aruco:: estimatePoseBoard 其中 returns 旋转和平移向量。有没有办法使用该信息来消除与标记板在同一平面上的所有内容? (不幸的是,我的线性代数充其量只是初级的。)

澄清

我知道如何对标记板进行校正。我想要做的是在与标记板相同的平面上对其他东西(在本例中为云形物体)进行校正。我正在尝试确定这是否可行,如果可行,该怎么做。我已经可以在我想要校正的对象周围放置四个标记,并使用检测到的角作为 getPerspectiveTransform 的输入以及它们之间的已知距离。但是对于我们的实际应用程序,用户可能很难准确放置标记。如果他们可以在框架中放置一个标记板并让软件对其他对象进行校正,那就容易多了。

自从您标记了 OpenCV: 从图像中我可以看到你已经检测到所有黑框的角。因此,只需以某种方式获得点的最大边界:

然后是这样的:

std::vector<cv::Point2f> src_points={/*Fill your 4 corners here*/};
std::vector<cv::Point2f> dst_points={cv:Point2f(0,0), cv::Point2f(width,0), cv::Point2f(width,height),cv::Point2f(0,height)}; 
auto H=v::getPerspectiveTransform(src_points,dst_points);
cv::Mat copped_image;
cv::warpPerspective(full_image,copped_image,H,cv::Size(width,height));

我假设调用 getPerspectiveTransform 时的目标点必须是输出图像的角(正如 Humam 的建议)。一旦我意识到目标点可能在输出图像中的某处,我就有了答案。

float boardX = 1240;
float boardY = 1570;
float boardWidth = 1730;
float boardHeight = 1400;

vector<Point2f> destinationCorners;
destinationCorners(Point2f(boardX+boardWidth, boardY));
destinationCorners(Point2f(boardX+boardWidth, boardY+boardHeight));
destinationCorners(Point2f(boardX, boardY+boardHeight));
destinationCorners(Point2f(boardX, boardY));

Mat h = getPerspectiveTransform(detectedCorners, destinationCorners);

Mat bigImage(image.size() * 3, image.type(), Scalar(0, 50, 50));

warpPerspective(image, bigImage, h, bigImage.size());

这固定了棋盘的视角及其平面中的所有内容。 (纸板的波纹是由于原始照片中的纸没有平放。)