什么类型网站,慢慢来建站公司,淘宝网站建设需求分析,如何接推广的单子若该文为原创文章#xff0c;转载请注明出处 本文章博客地址#xff1a;https://hpzwl.blog.csdn.net/article/details/143105881
长沙红胖子Qt#xff08;长沙创微智科#xff09;博文大全#xff1a;开发技术集合#xff08;包含Qt实用技术、树莓派、三维、OpenCV、Op…若该文为原创文章转载请注明出处 本文章博客地址https://hpzwl.blog.csdn.net/article/details/143105881
长沙红胖子Qt长沙创微智科博文大全开发技术集合包含Qt实用技术、树莓派、三维、OpenCV、OpenGL、ffmpeg、OSG、单片机、软硬结合等等持续更新中…
Qt开发专栏项目实战点击传送门 需求 1.打开图片 2.矫正识别角点 3.opencv摄像头操作子线程处理 4.支持设置棋盘格的行列角点数 背景 深入研究图像拼接细分支算法产出的效果查看工具验证算法单步思路。 相关博客 《项目实战QtOpencv相机标定工具v1.3.0支持打开摄像头、视频文件和网络地址支持标定过程查看、删除和动态评价误差率支持追加标定等等》 《OpenCV开发笔记〇使用mingw530_32编译openCV3.4.1源码搭建Qt5.9.3的openCV开发环境》 《OpenCV开发笔记三OpenCV图像的概念和基本操作》 《OpenCV开发笔记四OpenCV图片和视频数据的读取与存储》 《OpenCV开发笔记六OpenCV基础数据结构、颜色转换函数和颜色空间》 《OpenCV开发笔记四十六红胖子8分钟带你深入了解仿射变化图文并茂浅显易懂程序源码》 《OpenCV开发笔记七十六相机标定一识别棋盘并绘制角点》 《OpenCV开发笔记七十七相机标定二通过棋盘标定计算相机内参矩阵矫正畸变摄像头图像》 DemoaffineTool_v1.1.0 windows运行包 CSDN粉丝0积分下载https://download.csdn.net/download/qq21497936/89908724 QQ群博客首页扫码进入QQ技术群点击“文件”搜索“affineTool”群内与博文同步更新 模块化部署 关键源码
AffineManager.h
#ifndef AFFINEMANAGER_H
#define AFFINEMANAGER_H// opencv
#include opencv/highgui.h
#include opencv/cxcore.h
#include opencv2/core/core.hpp
#include opencv2/highgui/highgui.hpp
#include opencv2/opencv.hpp
#include opencv2/xphoto.hpp
#include opencv2/dnn/dnn.hpp
// opencv_contrib
#include opencv2/xphoto.hpp
#include opencv2/ximgproc.hpp
#include opencv2/calib3d.hpp
#include opencv2/features2d.hpp
#include opencv2/xfeatures2d.hpp
#include opencv2/xfeatures2d/nonfree.hpp#include cvui.h#include QImage
#include QTimerclass AffineManager: public QObject
{Q_OBJECT
public:explicit AffineManager(QObject *parent 0);~AffineManager();public slots:void testOpencvEnv(); // 测试环境public:cv::Point2f getLeftBottomOffsetPoint() const;cv::Point2f getCenterTopOffsetPoint() const;cv::Point2f getRightBottomOffsetPoint() const;int getChessboardColCornerCount() const;int getChessboardRowCornerCount() const;public:void setLeftBottomOffsetPoint(const cv::Point2f offsetPoint);void setRightBottomOffsetPoint(const cv::Point2f offsetPoint);void setCenterTopOffsetPoint(const cv::Point2f offsetPoint);void setChessboardColCornerCount(int chessboardColCornerCount);void setChessboardRowCornerCount(int chessboardRowCornerCount);signals:void signal_srcImage(QImage image);void signal_srcImage(cv::Mat mat);void signal_resultImage(QImage image);void signal_resultImage(cv::Mat mat);void signal_inited(bool result);public slots:void slot_openImage(QString filePath);void slot_initImage();void slot_affineImage();protected:void initControl();protected:bool findChessboard(int rowCornerCount, int colCornerCount, cv::Mat mat, std::vectorcv::Point2f vectorPoint2fCorners);public:static QImage mat2Image(cv::Mat mat); // cv::Mat 转 QImageprivate:cv::Mat _mat; // 缓存一帧cv::Mat _resultMat; // 结果int _chessboardColCornerCount; // 一列多少个角点int _chessboardRowCornerCount; // 一行多少个角点private: // 计算内参和畸变系数cv::Mat _cameraMatrix; // 相机矩阵接收输出cv::Mat _distCoeffs; // 畸变系数接收输出std::vectorcv::Mat _rotate; // 旋转量接收输出std::vectorcv::Mat _translate; // 偏移量接收输出cv::Point2f _leftBottomPoint; // 仿射三点对应原始cv::Point2f _rightBottomPoint;// 仿射三点对应原始cv::Point2f _centerTopPoint; // 仿射三点对应原始cv::Point2f _leftBottomOffsetPoint; // 仿射三点对应偏移cv::Point2f _rightBottomOffsetPoint;// 仿射三点对应偏移cv::Point2f _centerTopOffsetPoint; // 仿射三点对应偏移
};#endif // AffineManager_H
AffineManager.cpp
...void AffineManager::slot_affineImage()
{cv::Point2f srcTraingle[3];cv::Point2f dstTraingle[3];srcTraingle[0] _leftBottomPoint;srcTraingle[1] _rightBottomPoint;srcTraingle[2] _centerTopPoint;dstTraingle[0] _leftBottomPoint _leftBottomOffsetPoint;dstTraingle[1] _rightBottomPoint _rightBottomOffsetPoint;dstTraingle[2] _centerTopPoint _centerTopOffsetPoint;cv::Mat mat cv::getAffineTransform(srcTraingle, dstTraingle);std::cout srcTraingle[0] srcTraingle[1] srcTraingle[2] endl;std::cout dstTraingle[0] dstTraingle[1] dstTraingle[2] endl;cv::warpAffine(_mat, _resultMat, mat, cv::Size(_mat.cols, _mat.rows));QImage image mat2Image(_resultMat);emit signal_resultImage(image);
}
...入坑 算法的研究优化过程中思路需要开拓编写代码查看效果逐步研究出算法的优化路径坑多暂时未记录。 本文章博客地址https://hpzwl.blog.csdn.net/article/details/143105881