|
|
@ -97,14 +97,14 @@ public: |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (mat.data == NULL) return std::shared_ptr<image_t>(NULL); |
|
|
|
if (mat.data == NULL) return std::shared_ptr<image_t>(NULL); |
|
|
|
|
|
|
|
|
|
|
|
cv::Size s = mat.size(); |
|
|
|
cv::Size network_size = cv::Size(get_net_width(), get_net_height()); |
|
|
|
if (get_net_width() != s.width || get_net_height() != s.height) { |
|
|
|
|
|
|
|
cv::Mat det_mat; |
|
|
|
cv::Mat det_mat; |
|
|
|
cv::resize(mat, det_mat, cv::Size(get_net_width(), get_net_height())); |
|
|
|
if (mat.size() != network_size) |
|
|
|
return mat_to_image(det_mat); |
|
|
|
cv::resize(mat, det_mat, network_size); |
|
|
|
} |
|
|
|
else |
|
|
|
|
|
|
|
det_mat = mat; // only reference is copied
|
|
|
|
|
|
|
|
|
|
|
|
return mat_to_image(mat); |
|
|
|
return mat_to_image(det_mat); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static std::shared_ptr<image_t> mat_to_image(cv::Mat img_src) |
|
|
|
static std::shared_ptr<image_t> mat_to_image(cv::Mat img_src) |
|
|
|