111,048
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Colle.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
using System.Runtime.InteropServices;
using System.IO;
namespace WindowsFormsApplication3
{
public partial class Form1 : Form
{
[DllImport("smallT_BJ.dll", EntryPoint = "?smallTarget@@YA?AV?$Point_@H@cv@@PBD@Z",
ExactSpelling = true,CallingConvention = CallingConvention.Cdecl)]
// EntryPoint 这个比较复杂的部分是通过dependency查询到的函数名,与之前定义的函数名smallTarget多了很多字符
public static extern Point smallTarget(string path);
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string path = " C:\\1.bmp";
Point point = new Point();
point = smallTarget(path);
}
}
}
#include <windows.h>
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <opencv2\opencv.hpp>
#include <fstream>
#include <memory>
#include <stdlib.h>
#include <math.h>
#include <time.h>
using namespace std;
using namespace cv;
#ifdef SMALLT_BJ_EXPORTS
#define SMALLT_BJ_API __declspec(dllexport)
#else
#define SMALLT_BJ_API __declspec(dllimport)
#endif
SMALLT_BJ_API Mat filters(Mat source, int thresholdin);
SMALLT_BJ_API Mat filterspatial2(Mat source, int th);
SMALLT_BJ_API void cmedian(Mat src, Mat dst, int innerbox_size, int outerbox_size);
SMALLT_BJ_API Mat prefilter(Mat source);
SMALLT_BJ_API vector<Mat> getSuspects(Mat& frame, Mat src, int box_size, vector<Point>& LeftUpPoints, vector<vector<Point>>& cont);
SMALLT_BJ_API Point smallTarget(const char* file);
[DllImport("smallT_BJ.dll", EntryPoint = "test", CallingConvention = CallingConvention.Cdecl)]
public static extern Point test(string path);