| | |
| | | extern "C" YOLODLL_API int detect_image(const char *filename, bbox_t_container &container); |
| | | extern "C" YOLODLL_API int detect_mat(const uint8_t* data, const size_t data_length, bbox_t_container &container); |
| | | extern "C" YOLODLL_API int dispose(); |
| | | extern "C" YOLODLL_API int get_device_count(); |
| | | extern "C" YOLODLL_API int get_device_name(int gpu, char* deviceName); |
| | | |
| | | class Detector { |
| | | std::shared_ptr<void> detector_gpu_ptr; |
| | |
| | | std::shared_ptr<image_t> mat_to_image_resize(cv::Mat mat) const |
| | | { |
| | | if (mat.data == NULL) return std::shared_ptr<image_t>(NULL); |
| | | cv::Mat det_mat; |
| | | cv::resize(mat, det_mat, cv::Size(get_net_width(), get_net_height())); |
| | | return mat_to_image(det_mat); |
| | | |
| | | cv::Size s = mat.size(); |
| | | if (get_net_width() != s.width || get_net_height() != s.height) { |
| | | cv::Mat det_mat; |
| | | cv::resize(mat, det_mat, cv::Size(get_net_width(), get_net_height())); |
| | | return mat_to_image(det_mat); |
| | | } |
| | | |
| | | return mat_to_image(mat); |
| | | } |
| | | |
| | | static std::shared_ptr<image_t> mat_to_image(cv::Mat img_src) |