我正在尝试在 OpenCV 中使用 drawmatches
函数。
它以左右
格式放置图像。我希望图像以 top-down
格式放置,然后绘制火柴以更加清晰。
有什么方法可以在 OpenCV 中完成吗?或者,我将不得不编写一个新函数?
最佳答案
恐怕您必须编写自己的函数。我觉得应该不会太复杂。
作为起点,看看https://github.com/Itseez/opencv/blob/2.4/modules/features2d/src/draw.cpp我们有函数 _prepareImgAndDrawKeypoints
static void _prepareImgAndDrawKeypoints( const Mat& img1, const vector<KeyPoint>& keypoints1,
const Mat& img2, const vector<KeyPoint>& keypoints2,
Mat& outImg, Mat& outImg1, Mat& outImg2,
const Scalar& singlePointColor, int flags )
{
Size size( img1.cols + img2.cols, MAX(img1.rows, img2.rows) );
例如尺寸应该改为
Size size( MAX(img1.cols + img2.cols), img1.rows + img2.rows );
然后您可以继续研究该函数(以及其他函数)并完成您的任务。也许您也可以通过您的新功能为 OpenCV 做出贡献。
关于OpenCV:在顶部和底部配置中绘制匹配项?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20358217/