opencv之WarpPerspective透视变化
2017-04-05 17:05
429 查看
// opencv2.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <opencv2/opencv.hpp> #include "opencv2/highgui/highgui.hpp" #include "opencv2/imgproc/imgproc.hpp" #include "opencv2/features2d/features2d.hpp" #include "cv.h" #include "highgui.h" #include <cxcore.h> using namespace cv; using namespace std; int main(int argc, char **argv) { CvPoint2D32f srcTri[4], dstTri[4]; CvMat* warp_mat = cvCreateMat(3, 3, CV_32FC1); IplImage* src = NULL; IplImage* dst = NULL; src = cvLoadImage("test.jpg", 1); dst = cvCloneImage(src); dst->origin = src->origin; cvZero(dst); srcTri[0].x = 0; srcTri[0].y = 0; srcTri[1].x = src->width - 1; srcTri[1].y = 0; srcTri[2].x = 0; srcTri[2].y = src->height - 1; srcTri[3].x = src->width - 1; srcTri[3].y = src->height - 1; dstTri[0].x = src->width * 0.05; dstTri[0].y = src->height * 0.33; dstTri[1].x = src->width * 0.9; dstTri[1].y = src->height * 0.25; dstTri[2].x = src->width * 0.2; dstTri[2].y = src->height * 0.7; dstTri[3].x = src->width * 0.8; dstTri[3].y = src->height * 0.9; cvGetPerspectiveTransform(srcTri, dstTri, warp_mat); cvWarpPerspective(src, dst, warp_mat); cvNamedWindow("src", 1); cvShowImage("src", src); cvNamedWindow("Affine_Transform", 1); cvShowImage("Affine_Transform", dst); cvWaitKey(0); cvReleaseImage(&src); cvReleaseImage(&dst); cvReleaseMat(&warp_mat); return 0; }
相关文章推荐
- opencv3_java 图像透视视角转换Perspective warpPerspective
- opencv之透视变换cvWarpPerspective
- OpenCV3_C++_Perspective()透视形式投影 实例
- opencv学习--透视变化
- [OpenCv]使用getPerspectiveTransform()函数实现Perspective Effect(透视效果)
- opencv中检测视频内容是否变化,并且能够进行人脸检测。
- 日记:opencv3.0以后的版本变化
- opencv霍夫变化检测直线和圆
- C/C++ OpenCV图像的尺寸变化
- Opencv--像素值变化后的图像显示
- Eclipse RCP开发设置透视图(Perspective)
- opencv 鸟瞰图变化实例
- 关于OPencv里仿射变化和透射变换的理解
- 透视校正插值(Perspective-Correct Interpolation)
- opencv透视N点法函数详解
- 基于OpenCV实现图像线性变化
- [置顶] OpenCV3.3人脸识别模块的API的变化
- 图像变换 - 图像拉伸、收缩、扭曲、旋转 - 透视变换(cvWarpPerspective)
- 【OpenCV学习笔记】之五 RGB图像归一化处理函数,消除线性变化的光照影响
- eclipse定制调试透视图(perspective)