Commit c5b5d5c8 authored by Piotr Semenov's avatar Piotr Semenov

Fix. Now cv::Rect() is the identity under cv::Rect::operator| operation

parent f670a992
...@@ -1803,12 +1803,17 @@ Rect_<_Tp>& operator &= ( Rect_<_Tp>& a, const Rect_<_Tp>& b ) ...@@ -1803,12 +1803,17 @@ Rect_<_Tp>& operator &= ( Rect_<_Tp>& a, const Rect_<_Tp>& b )
template<typename _Tp> static inline template<typename _Tp> static inline
Rect_<_Tp>& operator |= ( Rect_<_Tp>& a, const Rect_<_Tp>& b ) Rect_<_Tp>& operator |= ( Rect_<_Tp>& a, const Rect_<_Tp>& b )
{ {
if (!a.area()) {
a = b;
}
else if (b.area()) {
_Tp x1 = std::min(a.x, b.x); _Tp x1 = std::min(a.x, b.x);
_Tp y1 = std::min(a.y, b.y); _Tp y1 = std::min(a.y, b.y);
a.width = std::max(a.x + a.width, b.x + b.width) - x1; 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.height = std::max(a.y + a.height, b.y + b.height) - y1;
a.x = x1; a.x = x1;
a.y = y1; a.y = y1;
}
return a; return a;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment