#include <iostream>
#include <windows.h>
#include "opencv2\opencv.hpp"

using namespace std;

typedef double (*ptr_DLL_Add)(double,double);
typedef cv::Mat (*ptr_DLL_threshold)(cv::Mat);
typedef void (*ptr_DLL_showPic)(cv::Mat src);

typedef void (*test)(uchar* p, int x, int y);

HINSTANCE hinstDLL;

int main()
{
    ptr_DLL_Add add_(0);
    ptr_DLL_threshold thre(0);
    ptr_DLL_showPic show(0);

    hinstDLL = LoadLibrary("dll_pack.dll");

//    if(hinstDLL != 0)
//    {
//        add_ = (ptr_DLL_Add)GetProcAddress(hinstDLL, "DLL_Add");
//        thre = (ptr_DLL_threshold)GetProcAddress(hinstDLL, "DLL_threshold");
//        show = (ptr_DLL_showPic)GetProcAddress(hinstDLL, "DLL_showPic");
//
//        cout<<add_(3.4,0.2)<<endl;
//
//        show(cv::imread("20100812133.jpg", 0 ));
//
//        cv::imshow("aaa",thre(cv::imread("20100812133.jpg", 0 )));
//        cv::waitKey();
//
//        FreeLibrary(hinstDLL);
//    }


    test tt(0);
    tt = (test)GetProcAddress(hinstDLL, "test");

    cv::Mat asd=cv::imread("20100812133.jpg", 0 );

    tt(asd.data,asd.cols,asd.rows);

    return 0;
}
