mirror of
https://github.com/pjreddie/darknet.git
synced 2023-08-10 21:13:14 +03:00
Merge pull request #1212 from tinohager/master
optimize performance - detect method
This commit is contained in:
@ -96,9 +96,15 @@ public:
|
|||||||
std::shared_ptr<image_t> mat_to_image_resize(cv::Mat mat) const
|
std::shared_ptr<image_t> mat_to_image_resize(cv::Mat mat) const
|
||||||
{
|
{
|
||||||
if (mat.data == NULL) return std::shared_ptr<image_t>(NULL);
|
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()));
|
cv::Size s = mat.size();
|
||||||
return mat_to_image(det_mat);
|
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)
|
static std::shared_ptr<image_t> mat_to_image(cv::Mat img_src)
|
||||||
|
Reference in New Issue
Block a user