From: Dmitry Budnikov Date: Wed, 9 Jun 2021 10:28:32 +0000 (+0300) Subject: Merge pull request #20245 from dbudniko:dbudniko/mtcnn_roi_size_hotfix X-Git-Tag: accepted/tizen/unified/20220125.121719~1^2~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4c2dff88de606f2c2337bc7816fbe463a4b9013f;p=platform%2Fupstream%2Fopencv.git Merge pull request #20245 from dbudniko:dbudniko/mtcnn_roi_size_hotfix Hot fix negative MTCNN PNet ROI coordinates * fix negative roi start * some more experiments * clean up --- diff --git a/modules/gapi/samples/face_detection_mtcnn.cpp b/modules/gapi/samples/face_detection_mtcnn.cpp index 6e88a9e..c437bdb 100644 --- a/modules/gapi/samples/face_detection_mtcnn.cpp +++ b/modules/gapi/samples/face_detection_mtcnn.cpp @@ -364,7 +364,8 @@ GAPI_OCV_KERNEL(OCVR_O_NetPreProcGetROIs, R_O_NetPreProcGetROIs) { for (const auto& face : in_faces) { cv::Rect tmp_rect = face.bbox.getRect(); //Compare to transposed sizes width<->height - tmp_rect &= cv::Rect(tmp_rect.x, tmp_rect.y, in_image_size.height - tmp_rect.x - 4, in_image_size.width - tmp_rect.y - 4); + tmp_rect &= cv::Rect(tmp_rect.x, tmp_rect.y, in_image_size.height - tmp_rect.x, in_image_size.width - tmp_rect.y) & + cv::Rect(0, 0, in_image_size.height, in_image_size.width); outs.push_back(tmp_rect); } }