#include<opencv2/imgproc/imgproc.hpp>
#include<opencv2/highgui/highgui.hpp>
#include<opencv2/core/core.hpp>
#include<iostream>
#include<algorithm>
using namespace std;
using namespace cv;
//旋转文本图像矫正
int main()
{
//imread中0表示灰度返回,1表示原图返回
Mat src = imread("E:\\研究生\\学习材料\\学习书籍\\OpenCV图像处理编程实例-源码-20160801\\《OpenCV图像处理编程实例-源码-20160801\\images\\text.jpg",0);
if (!src.data)
return -1;
//src = src.rowRange(0,365);
imshow("src", src);
int nRows = src.rows;
int nCols = src.cols;
cout << "src rows: " << nRows << endl;
cout << "src cols: " << nCols << endl;
//获取DFT最佳尺寸
int cRows = getOptimalDFTSize(nRows);
int cCols = getOptimalDFTSize(nCols);
cout << "DFT rows: " << cRows << endl;
cout << "DFT cols: " << cCols << endl;
//图像拷贝,超出边界的填充0
Mat sizeCon
opencv实现旋转文本矫正
最新推荐文章于 2024-06-04 11:30:36 发布