[opencv] 25/251: Fix. Now cv::Rect() is the identity under cv::Rect::operator| operation
Nobuhiro Iwamatsu
iwamatsu at moszumanska.debian.org
Sun Aug 27 23:27:20 UTC 2017
This is an automated email from the git hooks/post-receive script.
iwamatsu pushed a commit to annotated tag 3.3.0
in repository opencv.
commit c5b5d5c8d3eb3ef35dff8676421c8726576f098a
Author: Piotr Semenov <semenov at searchie.org>
Date: Wed Jul 5 18:50:07 2017 +0300
Fix. Now cv::Rect() is the identity under cv::Rect::operator| operation
---
modules/core/include/opencv2/core/types.hpp | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/modules/core/include/opencv2/core/types.hpp b/modules/core/include/opencv2/core/types.hpp
index be8d0be..ffac2ee 100644
--- a/modules/core/include/opencv2/core/types.hpp
+++ b/modules/core/include/opencv2/core/types.hpp
@@ -1803,12 +1803,17 @@ Rect_<_Tp>& operator &= ( Rect_<_Tp>& a, const Rect_<_Tp>& b )
template<typename _Tp> static inline
Rect_<_Tp>& operator |= ( Rect_<_Tp>& a, const Rect_<_Tp>& b )
{
- _Tp x1 = std::min(a.x, b.x);
- _Tp y1 = std::min(a.y, b.y);
- a.width = std::max(a.x + a.width, b.x + b.width) - x1;
- a.height = std::max(a.y + a.height, b.y + b.height) - y1;
- a.x = x1;
- a.y = y1;
+ if (!a.area()) {
+ a = b;
+ }
+ else if (b.area()) {
+ _Tp x1 = std::min(a.x, b.x);
+ _Tp y1 = std::min(a.y, b.y);
+ a.width = std::max(a.x + a.width, b.x + b.width) - x1;
+ a.height = std::max(a.y + a.height, b.y + b.height) - y1;
+ a.x = x1;
+ a.y = y1;
+ }
return a;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/opencv.git
More information about the debian-science-commits
mailing list