opencv to dll p
try to write some opencv
this is what I ended up with very simple but I can't seem to get it to run when called externally - can anyone point to where I might be going wrong - tks M
#include "stdafx.h"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/core/core.hpp"
#include <iostream>
#include <stdio.h>
using namespace std;
using namespace cv;
extern "C" {
_declspec (dllexport) double adaptiveThreshold(unsigned __int8 *Igray, unsigned __int8 *Iat, double fixed_threshold, int adaptive_method, int threshold_type, int block_size, double offset);
} //extern "C"
_declspec (dllexport) double adaptiveThreshold(unsigned __int8 *Igray,
unsigned __int8 *Iat,
double fixed_threshold,
int adaptive_method,
int threshold_type,
int block_size,
double offset)
{
// allocate memory for example for Mat
// Mat src_baseR(rows,cols,CV_8U,&base_imageR[0]);
fixed_threshold = 255;
threshold_type = 0; //fixed_threshold invert(0=off|1=on)
adaptive_method = 0; //adaptive_type(0=mean|1=gaussian) use gaussion looks interesting
block_size = 17;
offset = 10;
//Mat Iat;
// Use the Adaptive method for testing
adaptiveThreshold(Igray,Iat,fixed_threshold,adaptive_method,threshold_type,block_size,offset);
return 0;
};
apart from the _declspec (dllexport) issue ( you either need all the #ifndef LALA_EXPORTS magic there, or (more simple), a .def file),
your adaptiveThreshold function calls itself, not the opencv one. you sure did not want recursion there