我正在尝试在我的iOS程序中实现自动透视校正,当我使用我在教程中找到的测试图像时,一切都按预期工作.但是当我拍照时,我得到了一个奇怪的结果.
我正在使用本教程中的代码
当我给它一个看起来像这样的图像:

我得到了这个结果:

以下是dst给我带来帮助的原因.

我用它来调用包含代码的方法.
quadSegmentation(Img, bw, dst, quad);
当我从教程中获得如此多的绿线时,有人能告诉我吗?我怎么能够解决这个问题并正确裁剪图像只包含卡?
我正在做一个实时的运动检测程序.我发现在使用背景减法后我的不同图像中有很多轮廓.我想问一下,是否有任何方法可以将这些轮廓合并在一起,或者使更大的矩形包含所有轮廓?
现在我已经完成了这个案例
http://singhgaganpreet.files.wordpress.com/2012/07/motioncolour.jpg
我的代码在这里
#include <iostream>
#include <OpenCV/cv.h>
#include <OPenCV/highgui.h>
using namespace cv;
using namespace std;
CvRect rect;
CvSeq* contours = 0;
CvMemStorage* storage = NULL;
CvCapture *cam;
IplImage *currentFrame, *currentFrame_grey, *differenceImg, *oldFrame_grey;
bool first = true;
int main(int argc, char* argv[])
{
//Create a new movie capture object.
cam = cvCaptureFromCAM(0);
//create storage for contours
storage = cvCreateMemStorage(0);
//capture current frame from webcam
currentFrame = cvQueryFrame(cam);
//Size of the image.
CvSize imgSize;
imgSize.width = currentFrame->width;
imgSize.height = currentFrame->height;
//Images …Run Code Online (Sandbox Code Playgroud)