5

我是 OpenCV 的新手。我正在使用 2 个网络摄像头进行立体声项目。我可以将网络摄像头捕获的视频显示为左右视频。我想做以下事情:当我单击左帧上的任何点时,我想在右侧图像上找到匹配点(使用块匹配或任何其他算法将点投影到第二个视图上)。所以我可以计算差异。我怎样才能做到这一点?提前致谢。

4

1 回答 1

3

OpenCV's StereoVar object would probably be a good starting point.

You can create a StereoVar object like this:

StereoVar myStereoVar(int levels, double pyrScale,
                                int nIt, int minDisp, int maxDisp,
                                int poly_n, double poly_sigma, float fi,
                                float lambda, int penalization, int cycle,
                                int flags);

then match pairs of images like this:

// disp will hold correspondences for each pixel in your pair of images.
myStereoVar(InputArray left, InputArray right, OutputArray disp); 

You might have to transform your cv::Mat into an InputArray, but this should be pretty simple.

As for clicking on the pixels to see the correspondence, I bet it's possible, but let's worry about this after getting correspondence computation up and running.

于 2012-11-05T06:50:52.087 回答