Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
d8c70e2e
Commit
d8c70e2e
authored
Aug 02, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #9286 from alalek:rect_size_empty
parents
03bf0a89
321c0ec5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
2 deletions
+31
-2
types.hpp
modules/core/include/opencv2/core/types.hpp
+19
-2
core+Rect.java
modules/core/misc/java/src/java/core+Rect.java
+4
-0
core+Rect2d.java
modules/core/misc/java/src/java/core+Rect2d.java
+4
-0
core+Size.java
modules/core/misc/java/src/java/core+Size.java
+4
-0
No files found.
modules/core/include/opencv2/core/types.hpp
View file @
d8c70e2e
...
...
@@ -301,6 +301,8 @@ public:
Size_
&
operator
=
(
const
Size_
&
sz
);
//! the area (width*height)
_Tp
area
()
const
;
//! true if empty
bool
empty
()
const
;
//! conversion of another data type.
template
<
typename
_Tp2
>
operator
Size_
<
_Tp2
>
()
const
;
...
...
@@ -400,6 +402,8 @@ public:
Size_
<
_Tp
>
size
()
const
;
//! area (width*height) of the rectangle
_Tp
area
()
const
;
//! true if empty
bool
empty
()
const
;
//! conversion to another data type
template
<
typename
_Tp2
>
operator
Rect_
<
_Tp2
>
()
const
;
...
...
@@ -1599,6 +1603,13 @@ _Tp Size_<_Tp>::area() const
return
result
;
}
template
<
typename
_Tp
>
inline
bool
Size_
<
_Tp
>::
empty
()
const
{
return
width
<=
0
||
height
<=
0
;
}
template
<
typename
_Tp
>
static
inline
Size_
<
_Tp
>&
operator
*=
(
Size_
<
_Tp
>&
a
,
_Tp
b
)
{
...
...
@@ -1741,6 +1752,12 @@ _Tp Rect_<_Tp>::area() const
return
result
;
}
template
<
typename
_Tp
>
inline
bool
Rect_
<
_Tp
>::
empty
()
const
{
return
width
<=
0
||
height
<=
0
;
}
template
<
typename
_Tp
>
template
<
typename
_Tp2
>
inline
Rect_
<
_Tp
>::
operator
Rect_
<
_Tp2
>
()
const
{
...
...
@@ -1803,10 +1820,10 @@ 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
)
{
if
(
!
a
.
area
())
{
if
(
a
.
empty
())
{
a
=
b
;
}
else
if
(
b
.
area
())
{
else
if
(
!
b
.
empty
())
{
_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
;
...
...
modules/core/misc/java/src/java/core+Rect.java
View file @
d8c70e2e
...
...
@@ -65,6 +65,10 @@ public class Rect {
return
width
*
height
;
}
public
boolean
empty
()
{
return
width
<=
0
||
height
<=
0
;
}
public
boolean
contains
(
Point
p
)
{
return
x
<=
p
.
x
&&
p
.
x
<
x
+
width
&&
y
<=
p
.
y
&&
p
.
y
<
y
+
height
;
}
...
...
modules/core/misc/java/src/java/core+Rect2d.java
View file @
d8c70e2e
...
...
@@ -65,6 +65,10 @@ public class Rect2d {
return
width
*
height
;
}
public
boolean
empty
()
{
return
width
<=
0
||
height
<=
0
;
}
public
boolean
contains
(
Point
p
)
{
return
x
<=
p
.
x
&&
p
.
x
<
x
+
width
&&
y
<=
p
.
y
&&
p
.
y
<
y
+
height
;
}
...
...
modules/core/misc/java/src/java/core+Size.java
View file @
d8c70e2e
...
...
@@ -37,6 +37,10 @@ public class Size {
return
width
*
height
;
}
public
boolean
empty
()
{
return
width
<=
0
||
height
<=
0
;
}
public
Size
clone
()
{
return
new
Size
(
width
,
height
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment