-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocumentprocessormodule.cpp
More file actions
42 lines (35 loc) · 1.01 KB
/
Copy pathdocumentprocessormodule.cpp
File metadata and controls
42 lines (35 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "documentprocessormodule.h"
#include <opencv2/core/core.hpp>
#include <opencv2/imgcodecs/imgcodecs.hpp>
#include <opencv2/highgui/highgui_c.h>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <QDebug>
using namespace cv;
DocumentProcessorModule::DocumentProcessorModule()
{
}
DocumentProcessorModule::~DocumentProcessorModule()
{
}
QImage DocumentProcessorModule::preliminaryProcessing(QString objRecogPath)
{
return QImage();
}
QImage DocumentProcessorModule::getGrayscale(QString imagePath)
{
//IplImage *img = cvLoadImage(imagePath.toStdString());
Mat image;
image = imread("C:\Temp\lena.jpg", IMREAD_COLOR);
if (image.empty()) {
qDebug() << "dont load image getGrayscale, documentProcessorModule";
return QImage();
}
Mat gray;
cv::cvtColor(image, gray, COLOR_RGB2GRAY);
QImage retImage((uchar*)gray.data, gray.cols, gray.rows, QImage::Format_RGB888);
/*namedWindow("Result window", WINDOW_AUTOSIZE);
imshow("Result window", gray);
waitKey(0);*/
return retImage;
}