-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathpyclassification.h
47 lines (37 loc) · 961 Bytes
/
pyclassification.h
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
43
44
45
46
47
// PyClassification class: parts classification using external Python method
// Author: @ZC
// Date: created on 31 JuL 2018
#ifndef PYCLASSIFICATION_H
#define PYCLASSIFICATION_H
#include <iostream>
#include <QDebug>
#include <QString>
// To handle SLOTs error
#pragma push_macro("slots")
#undef slots
#include "Python.h"
#pragma pop_macro("slots")
#include "numpy/ndarrayobject.h"
#include "opencv2/opencv.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/core/core.hpp"
#include "py_cv_wrapper/pycvconverter.h"
using namespace cv;
using namespace std;
class PyClassification
{
public:
PyClassification();
~PyClassification();
QString process(cv::Mat image);
private:
void PyInit();
void PyClose();
bool is_processed = false;
PyObject* pModule = nullptr;
PyObject* pFunc = nullptr;
//PyObject* pParam = nullptr;
PyObject* pNDArray = nullptr;
PyObject* pResult = nullptr;
};
#endif // PYCLASSIFICATION_H