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
77524834
Commit
77524834
authored
Sep 23, 2014
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3252 from GravityJack:point-division
parents
281ce441
c8ede7c9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
0 deletions
+101
-0
basic_structures.rst
modules/core/doc/basic_structures.rst
+2
-0
types.hpp
modules/core/include/opencv2/core/types.hpp
+99
-0
No files found.
modules/core/doc/basic_structures.rst
View file @
77524834
...
...
@@ -96,9 +96,11 @@ operation for each of the coordinates. Besides the class members listed in the d
pt1 = pt2 - pt3;
pt1 = pt2 * a;
pt1 = a * pt2;
pt1 = pt2 / a;
pt1 += pt2;
pt1 -= pt2;
pt1 *= a;
pt1 /= a;
double value = norm(pt); // L2 norm
pt1 == pt2;
pt1 != pt2;
...
...
modules/core/include/opencv2/core/types.hpp
View file @
77524834
...
...
@@ -994,6 +994,30 @@ Point_<_Tp>& operator *= (Point_<_Tp>& a, double b)
return
a
;
}
template
<
typename
_Tp
>
static
inline
Point_
<
_Tp
>&
operator
/=
(
Point_
<
_Tp
>&
a
,
int
b
)
{
a
.
x
=
saturate_cast
<
_Tp
>
(
a
.
x
/
b
);
a
.
y
=
saturate_cast
<
_Tp
>
(
a
.
y
/
b
);
return
a
;
}
template
<
typename
_Tp
>
static
inline
Point_
<
_Tp
>&
operator
/=
(
Point_
<
_Tp
>&
a
,
float
b
)
{
a
.
x
=
saturate_cast
<
_Tp
>
(
a
.
x
/
b
);
a
.
y
=
saturate_cast
<
_Tp
>
(
a
.
y
/
b
);
return
a
;
}
template
<
typename
_Tp
>
static
inline
Point_
<
_Tp
>&
operator
/=
(
Point_
<
_Tp
>&
a
,
double
b
)
{
a
.
x
=
saturate_cast
<
_Tp
>
(
a
.
x
/
b
);
a
.
y
=
saturate_cast
<
_Tp
>
(
a
.
y
/
b
);
return
a
;
}
template
<
typename
_Tp
>
static
inline
double
norm
(
const
Point_
<
_Tp
>&
pt
)
{
...
...
@@ -1080,6 +1104,30 @@ Point3_<_Tp> operator * (const Matx<_Tp, 3, 3>& a, const Point_<_Tp>& b)
return
Point3_
<
_Tp
>
(
tmp
.
val
[
0
],
tmp
.
val
[
1
],
tmp
.
val
[
2
]);
}
template
<
typename
_Tp
>
static
inline
Point_
<
_Tp
>
operator
/
(
const
Point_
<
_Tp
>&
a
,
int
b
)
{
Point_
<
_Tp
>
tmp
(
a
);
tmp
/=
b
;
return
tmp
;
}
template
<
typename
_Tp
>
static
inline
Point_
<
_Tp
>
operator
/
(
const
Point_
<
_Tp
>&
a
,
float
b
)
{
Point_
<
_Tp
>
tmp
(
a
);
tmp
/=
b
;
return
tmp
;
}
template
<
typename
_Tp
>
static
inline
Point_
<
_Tp
>
operator
/
(
const
Point_
<
_Tp
>&
a
,
double
b
)
{
Point_
<
_Tp
>
tmp
(
a
);
tmp
/=
b
;
return
tmp
;
}
//////////////////////////////// 3D Point ///////////////////////////////
...
...
@@ -1187,6 +1235,33 @@ Point3_<_Tp>& operator *= (Point3_<_Tp>& a, double b)
return
a
;
}
template
<
typename
_Tp
>
static
inline
Point3_
<
_Tp
>&
operator
/=
(
Point3_
<
_Tp
>&
a
,
int
b
)
{
a
.
x
=
saturate_cast
<
_Tp
>
(
a
.
x
/
b
);
a
.
y
=
saturate_cast
<
_Tp
>
(
a
.
y
/
b
);
a
.
z
=
saturate_cast
<
_Tp
>
(
a
.
z
/
b
);
return
a
;
}
template
<
typename
_Tp
>
static
inline
Point3_
<
_Tp
>&
operator
/=
(
Point3_
<
_Tp
>&
a
,
float
b
)
{
a
.
x
=
saturate_cast
<
_Tp
>
(
a
.
x
/
b
);
a
.
y
=
saturate_cast
<
_Tp
>
(
a
.
y
/
b
);
a
.
z
=
saturate_cast
<
_Tp
>
(
a
.
z
/
b
);
return
a
;
}
template
<
typename
_Tp
>
static
inline
Point3_
<
_Tp
>&
operator
/=
(
Point3_
<
_Tp
>&
a
,
double
b
)
{
a
.
x
=
saturate_cast
<
_Tp
>
(
a
.
x
/
b
);
a
.
y
=
saturate_cast
<
_Tp
>
(
a
.
y
/
b
);
a
.
z
=
saturate_cast
<
_Tp
>
(
a
.
z
/
b
);
return
a
;
}
template
<
typename
_Tp
>
static
inline
double
norm
(
const
Point3_
<
_Tp
>&
pt
)
{
...
...
@@ -1272,6 +1347,30 @@ Matx<_Tp, 4, 1> operator * (const Matx<_Tp, 4, 4>& a, const Point3_<_Tp>& b)
return
a
*
Matx
<
_Tp
,
4
,
1
>
(
b
.
x
,
b
.
y
,
b
.
z
,
1
);
}
template
<
typename
_Tp
>
static
inline
Point3_
<
_Tp
>
operator
/
(
const
Point3_
<
_Tp
>&
a
,
int
b
)
{
Point3_
<
_Tp
>
tmp
(
a
);
tmp
/=
b
;
return
tmp
;
}
template
<
typename
_Tp
>
static
inline
Point3_
<
_Tp
>
operator
/
(
const
Point3_
<
_Tp
>&
a
,
float
b
)
{
Point3_
<
_Tp
>
tmp
(
a
);
tmp
/=
b
;
return
tmp
;
}
template
<
typename
_Tp
>
static
inline
Point3_
<
_Tp
>
operator
/
(
const
Point3_
<
_Tp
>&
a
,
double
b
)
{
Point3_
<
_Tp
>
tmp
(
a
);
tmp
/=
b
;
return
tmp
;
}
////////////////////////////////// Size /////////////////////////////////
...
...
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