From a723e1c62a27aeb39aaf7fcdeb3beb4e89fba32d Mon Sep 17 00:00:00 2001
From: Alexey <AlexeyAB@users.noreply.github.com>
Date: Wed, 15 Aug 2018 20:52:09 +0000
Subject: [PATCH] Merge pull request #766 from HotChick91/AlexeyAB-mask
---
src/yolo_v2_class.hpp | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/src/yolo_v2_class.hpp b/src/yolo_v2_class.hpp
index 6f7e47b..199b1c9 100644
--- a/src/yolo_v2_class.hpp
+++ b/src/yolo_v2_class.hpp
@@ -1,13 +1,13 @@
#pragma once
#ifdef YOLODLL_EXPORTS
#if defined(_MSC_VER)
-#define YOLODLL_API __declspec(dllexport)
+#define YOLODLL_API __declspec(dllexport)
#else
#define YOLODLL_API __attribute__((visibility("default")))
#endif
#else
#if defined(_MSC_VER)
-#define YOLODLL_API __declspec(dllimport)
+#define YOLODLL_API __declspec(dllimport)
#else
#define YOLODLL_API
#endif
@@ -71,7 +71,7 @@
YOLODLL_API int get_net_height() const;
YOLODLL_API int get_net_color_depth() const;
- YOLODLL_API std::vector<bbox_t> tracking_id(std::vector<bbox_t> cur_bbox_vec, bool const change_history = true,
+ YOLODLL_API std::vector<bbox_t> tracking_id(std::vector<bbox_t> cur_bbox_vec, bool const change_history = true,
int const frames_story = 10, int const max_dist = 150);
std::vector<bbox_t> detect_resized(image_t img, int init_w, int init_h, float thresh = 0.2, bool use_mean = false)
@@ -96,8 +96,14 @@
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::Size network_size = cv::Size(get_net_width(), get_net_height());
cv::Mat det_mat;
- cv::resize(mat, det_mat, cv::Size(get_net_width(), get_net_height()));
+ if (mat.size() != network_size)
+ cv::resize(mat, det_mat, network_size);
+ else
+ det_mat = mat; // only reference is copied
+
return mat_to_image(det_mat);
}
@@ -298,7 +304,7 @@
std::vector<bbox_t> result_bbox_vec;
- if (err_cpu.cols == cur_bbox_vec.size() && status_cpu.cols == cur_bbox_vec.size())
+ if (err_cpu.cols == cur_bbox_vec.size() && status_cpu.cols == cur_bbox_vec.size())
{
for (size_t i = 0; i < cur_bbox_vec.size(); ++i)
{
--
Gitblit v1.10.0