C++ 翘曲透视图
我尝试使用下面的代码获取反向透视图,以便将实时捕获的帧捕获到相机平面:C++ 翘曲透视图,c++,image-processing,opencv,C++,Image Processing,Opencv,我尝试使用下面的代码获取反向透视图,以便将实时捕获的帧捕获到相机平面: Mat dst; dst=dst.zeros(frame.cols,frame.rows,frame.type()); if(Found){ Mat mmat; mmat.create(3,3,CV_32FC1); mmat=getPerspectiveTransform(templPoints,imgPoints); cout<< mmat<
Mat dst;
dst=dst.zeros(frame.cols,frame.rows,frame.type());
if(Found){
Mat mmat;
mmat.create(3,3,CV_32FC1);
mmat=getPerspectiveTransform(templPoints,imgPoints);
cout<< mmat<<endl<<endl;
warpPerspective(frame,dst,Homo,dst.size(),INTER_LINEAR );
imshow("out",dst);
}
matdst;
dst=dst.zero(frame.cols、frame.rows、frame.type());
如果(找到){
Mat-mmat;
mmat.创建(3,3,CV_32FC1);
mmat=getPerspectiveTransform(模板点、imgPoints);
你需要提供更多的细节。
为什么要同时调用findHomography和getPerspectiveTransform?既然您同时调用了这两个函数,我假设TemplePoints和imgPoints的大小都是4,在这种情况下,对findHomography的调用是多余的(而RANSAC根本不为您做任何事情)
您是否查看过(例如,使用matlab或倍频程,或手动)mmat*TempPoints的值?它们应该等于imgPoints,并且都在[0,dst.width]x[0,dst.height]范围内。您需要提供更多详细信息。
为什么要同时调用findHomography和getPerspectiveTransform?既然您同时调用了这两个函数,我假设TemplePoints和imgPoints的大小都是4,在这种情况下,对findHomography的调用是多余的(而RANSAC根本不为您做任何事情)
您是否查看过(例如,使用matlab或倍频程,或手动)mmat*TempPoints的值?它们应等于imgPoints,并且都在[0,dst.width]x[0,dst.height]范围内您看到的图像通常是以错误的顺序将源点发送到getPerspectiveTransform
的结果。这意味着这些点相互交叉,将出现三角形。请检查点的顺序,确保它们与目标点的顺序相匹配。您看到的图像EEG通常是以错误的顺序将源点发送到getPerspectiveTransform
的结果。这意味着这些点相互交叉,将出现三角形。检查点的顺序,确保它们与目标点的顺序匹配