网站网站做维护犯罪,新华网站建设,如何在线制作印章,做网站金山Qt图像处理时需要OpenCv中Mat与QImage互转,具体代码如下
创建EditPhoto,头文件,使用前需要配置好opencv
#include QObject
#include QImage
#include QDebug#includeopencv2/core/core.hpp
#includeopencv2/highgui/highgui.hpp
…Qt图像处理时需要OpenCv中Mat与QImage互转,具体代码如下
创建EditPhoto,头文件,使用前需要配置好opencv
#include QObject
#include QImage
#include QDebug#includeopencv2/core/core.hpp
#includeopencv2/highgui/highgui.hpp
#includeopencv2/imgproc/imgproc.hpp
#includeopencv2/imgcodecs/imgcodecs.hpp#includeopencv2/opencv.hpp
#include iostream
using namespace std;
class EditPhoto: public QObject
{Q_OBJECT
public:
explicit EditPhoto(QObject *parent = 0); ~EditPhoto();static QImage MatToImage(cv::Mat m); //Mat转QImagestatic cv::Mat ImageToMat(const QImage image); //QImage转Mat
};
#endif // EDITPHOTO_H
.cpp文件
#include "editphoto.h"EditPhoto::EditPhoto(QOb