From a02ba15ef6459cfe1b8c6c742819facb11729e5c Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Thu, 16 Jul 2020 17:25:29 +0800 Subject: [PATCH] fix cv Exception --- deploy/lite/db_post_process.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/deploy/lite/db_post_process.cc b/deploy/lite/db_post_process.cc index ff9caa2f..eac4d6d2 100644 --- a/deploy/lite/db_post_process.cc +++ b/deploy/lite/db_post_process.cc @@ -214,6 +214,9 @@ BoxesFromBitmap(const cv::Mat pred, const cv::Mat bitmap, for (int i = 0; i < num_contours; i++) { float ssid; + if (contours[i].size() <= 2) + continue; + cv::RotatedRect box = cv::minAreaRect(contours[i]); auto array = GetMiniBoxes(box, ssid); @@ -232,6 +235,8 @@ BoxesFromBitmap(const cv::Mat pred, const cv::Mat bitmap, // start for unclip cv::RotatedRect points = Unclip(box_for_unclip, unclip_ratio); + if (points.size.height < 1.001 && points.size.width < 1.001) + continue; // end for unclip cv::RotatedRect clipbox = points; -- GitLab