Hi, I have implemented simple template matching for gpu. I am using Visual Studio 2015 with Cuda 9.1. now I want to make dll file and import it from python. But I am having problems to make dll file. Python is throwing error “AttributeError: function ‘matchTemplate’ not found”
Here is the kernel.cuh
#ifndef KERNEL_H
#define KERNEL_H
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#ifdef __cplusplus
extern "C" {
#endif
void __declspec(dllexport) matchTemplate(int *img, int *temp,int img_w, int img_h, int temp_w, int temp_h);
#ifdef __cplusplus
}
#endif
#endif
This is main.cu file, I did not includ global function below.
#include "iostream"
using namespace std;
void matchTemplate(int *img, int *temp, int img_w, int img_h, int temp_w, int temp_h) {
//some code
}
Here is how I am calling this funtion
import ctypes as ct
import cv2
image = cv2.imread('....',0)
temp = cv2.imread('....',0)
img_w,img_h = image.shape[::-1]
temp_w, temp_h = temp.shape[::-1]
match = ct.cdll.LoadLibrary('cuda.dll')
match.matchTemplate(image.flatten(),temp.flatten(),img_w, img_h,temp_w,temp_h)
I am not good at C/C++. Please, tell me how to make it work, what I am doing wrong.
Thanks.