opencv to dll p

asked 2014-04-11 07:03:37 -0600

somes gravatar image

updated 2014-04-11 07:11:26 -0600

berak gravatar image

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;   
};
edit retag flag offensive close merge delete

Comments

1

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

berak gravatar imageberak ( 2014-04-11 07:14:28 -0600 )edit