Merge pull request #1212 from tinohager/master

optimize performance - detect method
This commit is contained in:
Alexey 2018-07-15 01:54:52 +03:00 committed by GitHub
commit 0ae1cd81d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -96,11 +96,17 @@ public:
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 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)
{
cv::Mat img;