想做一个有关opencv的dll,但是头文件存在Net类型,Mat类型导致发布dll时需要引用opencv.hpp,还有不需要暴露的成员函数,私有成员变量。
如下,能否举例说明 需隐藏Net net,void canny_crop函数应该如何实现
#pragma once
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/opencv_world453.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/ippicvmt.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/libprotobuf.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/ippiw.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/libjpeg-turbo.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/ittnotify.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/ade.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/zlib.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/libopenjp2.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/libpng.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/quirc.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/IlmImf.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/libtiff.lib" )
#pragma comment( lib,"D:/opencv32/install/x86/vc14/staticlib/libwebp.lib" )
#include "stdafx.h"
#define _DLL_EXPORTS
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <opencv2/opencv.hpp>
#include <opencv2/dnn.hpp>
#include <opencv2/dnn/all_layers.hpp>
#include <string>
#include <vector>
#include <algorithm>
#include <array>
#include<cmath>
#include<windows.h>
#include <string>
using std::string;
using namespace std;
using namespace cv;
using namespace dnn;
class _declspec(dllexport) ocr
//class ocr
{
private:
//string _model_path;
int crop_mode = 1;
int thresh_mode = 1;
int bitwise_mode2 = 0;
double blur1 = 3;
double blur2 = 11;
int morph_xx, morph_yy;
int morph_x = 1;
int morph_y = 1;
int morph_x2 = 1;
int morph_y2 = 5;
int iteration = 1;
int canny_max = 300;
int min_width = 8;
string model_path;
dnn::Net net;
int rect_thresh = 0;
int blocksize = 31;
int C = 10;
int a = 3;
int c = 5;
int b = -5;
int d = 10;
int softmax_thresh = 0.9;
int _h = 1;
int _w = 1;
int _channel = 16;
int RGB_mode = 0;//0为默认bgr
//unsigned char * img
int showimg = 1;
public:
~ocr() {
delete this->net0;
}
*/
ocr(void);
~ocr(void);
void canny_crop(Mat &frame, Mat &output, vector<int>&result, vector<double>&softmax, int &flag2, vector<Rect> &digit_rect, int bitwise_mode2, int morph_x = 1, int morph_y = 9, //9
int iteration = 1, int padding = 0, int canny_max = 300);
//void crec(unsigned char *input, double &cdigits, double &minpercent, unsigned char *coutput, unsigned char *crect, unsigned char * ccanny, unsigned char * cthreshimg);//unsigned char图像,参数同上
void ocr::crec(unsigned char *cinput, int h, int w, double &cdigits, double &minpercent, unsigned char *coutput, int &h1, int &w1);
//传出灰度图像,h1,w1为图像属性
//, unsigned char *crect, int &h2, int &w2, unsigned char * ccanny, int &h3, int &w3, unsigned char * cthreshimg, int &h4, int &w4);//unsigned char图像,参数同上
};