資源簡介
基于C++和OpenCV實(shí)現(xiàn)的逆透視變換(Inverse Perspective Mapping)源碼,基于CMake構(gòu)建,Linux/Windows/Mac均可使用。
車道線檢測(cè)等算法中可以使用。
代碼片段和文件信息
#include?“IPM.h“
using?namespace?cv;
using?namespace?std;
//?Public
IPM::IPM(?const?cv::Size&?_origSize?const?cv::Size&?_dstSize?const?std::vector&?_origPoints?const?std::vector&?_dstPoints?)
:?m_origSize(_origSize)?m_dstSize(_dstSize)?m_origPoints(_origPoints)?m_dstPoints(_dstPoints)
{
assert(?m_origPoints.size()?==?4?&&?m_dstPoints.size()?==?4?&&?“Orig.?points?and?Dst.?points?must?vectors?of?4?points“?);
m_H?=?getPerspectiveTransform(?m_origPoints?m_dstPoints?);
m_H_inv?=?m_H.inv();
createMaps();
}
void?IPM::drawPoints(?const?std::vector&?_points?cv::Mat&?_img?)?const
{
assert(_points.size()?==?4);
line(_img?Point(static_cast(_points[0].x)?static_cast(_points[0].y))?Point(static_cast(_points
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2020-08-16?04:53??IPM\
?????文件?????????442??2013-12-19?13:08??IPM\CMakeLists.txt
?????文件????????4684??2014-02-22?07:54??IPM\IPM.cpp
?????文件????????1671??2014-02-22?07:36??IPM\IPM.h
?????文件????????2779??2014-02-22?07:55??IPM\main.cpp
評(píng)論
共有 條評(píng)論