如何用YOLO的动态库DLL
先编译Yolo为(C++)DLL库(yolo_cpp_)。
使用MSVS2015,打开build\darknet\yolo_cpp_。
设置x64-Release,然后build yolo_cpp_dll。
前提是已经安装CUDA 9.1。为了使用cuDNN,需要在 properties -> C/C++ -> Preprocessor -> Preprocessor Definitions中设置CUDNN;
然后,其API的使用方式:
class Detector {
public:
Detector(std::string cfg_filename, std::string weight_filename, int gpu_id = 0);
~Detector();
std::vector
std::vector
static image_t load_image(std::string image_filename);
static void free_image(image_t m);
std::vector
};
1、打开vs2015软件 2、左上文件选项->新建->项目 3、选择模板->Visual C++ -> Win32 ->Win32控制台应用程序 4、修改名称->确定->下一步->附加选项中选择空项目->完成中上视图选项->解决方案资源管理器
你可以使用MFC的CImage类,该类的头文件是atlimage.h 下面是示例代码: CDC *pDC = GetDC();CImage Image;(strPath);if (()){ MessageBox(_T("没加载成功")); return -1;}if (() == 32) //确认该图像包含Alph先实现一个播放器功能,单步播放,然后截取图片。
再看看别人怎么说的。