mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Fix that allows speedup usage of Yolo-DLL
This commit is contained in:
@ -3,6 +3,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#define OPENCV
|
#define OPENCV
|
||||||
|
|
||||||
|
@ -51,20 +51,20 @@ public:
|
|||||||
{
|
{
|
||||||
if(mat.data == NULL)
|
if(mat.data == NULL)
|
||||||
throw std::runtime_error("file not found");
|
throw std::runtime_error("file not found");
|
||||||
std::shared_ptr<image_t> image_ptr(new image_t, [](image_t *img) { free_image(*img); delete img; });
|
auto image_ptr = mat_to_image(mat);
|
||||||
*image_ptr = mat_to_image(mat);
|
|
||||||
return detect(*image_ptr, thresh);
|
return detect(*image_ptr, thresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
static std::shared_ptr<image_t> mat_to_image(cv::Mat img)
|
||||||
static image_t mat_to_image(cv::Mat img)
|
|
||||||
{
|
{
|
||||||
|
std::shared_ptr<image_t> image_ptr(new image_t, [](image_t *img) { free_image(*img); delete img; });
|
||||||
std::shared_ptr<IplImage> ipl_small = std::make_shared<IplImage>(img);
|
std::shared_ptr<IplImage> ipl_small = std::make_shared<IplImage>(img);
|
||||||
image_t im_small = ipl_to_image(ipl_small.get());
|
*image_ptr = ipl_to_image(ipl_small.get());
|
||||||
rgbgr_image(im_small);
|
rgbgr_image(*image_ptr);
|
||||||
return im_small;
|
return image_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
static image_t ipl_to_image(IplImage* src)
|
static image_t ipl_to_image(IplImage* src)
|
||||||
{
|
{
|
||||||
unsigned char *data = (unsigned char *)src->imageData;
|
unsigned char *data = (unsigned char *)src->imageData;
|
||||||
|
Reference in New Issue
Block a user