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
796553d0
Commit
796553d0
authored
Jul 07, 2010
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some quaternion operations on Scalar's.
parent
609ad4e4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
143 additions
and
1 deletion
+143
-1
core.hpp
modules/core/include/opencv2/core/core.hpp
+5
-0
operations.hpp
modules/core/include/opencv2/core/operations.hpp
+137
-0
detectors.cpp
modules/features2d/src/detectors.cpp
+1
-1
No files found.
modules/core/include/opencv2/core/core.hpp
View file @
796553d0
...
...
@@ -448,6 +448,9 @@ public:
_Tp
dot
(
const
Vec
&
v
)
const
;
//! dot product computed in double-precision arithmetics
double
ddot
(
const
Vec
&
v
)
const
;
//! per-element multiplication
Vec
mul
(
const
Vec
<
_Tp
,
cn
>&
v
)
const
;
/*!
cross product of the two 3D vectors.
...
...
@@ -924,6 +927,8 @@ public:
Scalar_
<
_Tp
>
mul
(
const
Scalar_
<
_Tp
>&
t
,
double
scale
=
1
)
const
;
//! another helper conversion method. \see cvScalarToRawData
template
<
typename
T2
>
void
convertTo
(
T2
*
buf
,
int
channels
,
int
unroll_to
=
0
)
const
;
Scalar_
<
_Tp
>
conj
()
const
;
};
typedef
Scalar_
<
double
>
Scalar
;
...
...
modules/core/include/opencv2/core/operations.hpp
View file @
796553d0
...
...
@@ -321,6 +321,14 @@ template<typename _Tp, int cn> inline double Vec<_Tp, cn>::ddot(const Vec<_Tp, c
}
template
<
typename
_Tp
,
int
cn
>
inline
Vec
<
_Tp
,
cn
>
Vec
<
_Tp
,
cn
>::
mul
(
const
Vec
<
_Tp
,
cn
>&
v
)
const
{
Vec
<
_Tp
,
cn
>
w
;
for
(
int
i
=
0
;
i
<
cn
;
i
++
)
w
.
val
[
i
]
=
saturate_cast
<
_Tp
>
(
val
[
i
]
*
v
.
val
[
i
]);
return
w
;
}
template
<
typename
_Tp
,
int
cn
>
inline
Vec
<
_Tp
,
cn
>
Vec
<
_Tp
,
cn
>::
cross
(
const
Vec
<
_Tp
,
cn
>&
v
)
const
{
CV_Error
(
CV_StsError
,
"for arbitrary-size vector there is no cross-product defined"
);
...
...
@@ -438,6 +446,25 @@ operator * (_Tp alpha, const Vec<_Tp, cn>& a)
{
return
a
*
alpha
;
}
template
<
typename
_Tp
>
static
inline
Vec
<
_Tp
,
4
>
operator
*
(
const
Vec
<
_Tp
,
4
>&
a
,
const
Vec
<
_Tp
,
4
>&
b
)
{
return
Vec
<
_Tp
,
4
>
(
saturate_cast
<
_Tp
>
(
a
[
0
]
*
b
[
0
]
-
a
[
1
]
*
b
[
1
]
-
a
[
2
]
*
b
[
2
]
-
a
[
3
]
*
b
[
3
]),
saturate_cast
<
_Tp
>
(
a
[
0
]
*
b
[
1
]
+
a
[
1
]
*
b
[
0
]
+
a
[
2
]
*
b
[
3
]
-
a
[
3
]
*
b
[
2
]),
saturate_cast
<
_Tp
>
(
a
[
0
]
*
b
[
2
]
-
a
[
1
]
*
b
[
3
]
+
a
[
2
]
*
b
[
0
]
-
a
[
3
]
*
b
[
1
]),
saturate_cast
<
_Tp
>
(
a
[
0
]
*
b
[
3
]
+
a
[
1
]
*
b
[
2
]
-
a
[
2
]
*
b
[
1
]
-
a
[
3
]
*
b
[
0
]));
}
template
<
typename
_Tp
>
static
inline
Vec
<
_Tp
,
4
>&
operator
*=
(
Vec
<
_Tp
,
4
>&
a
,
const
Vec
<
_Tp
,
4
>&
b
)
{
a
=
a
*
b
;
return
a
;
}
template
<
typename
_Tp
,
int
cn
>
static
inline
Vec
<
_Tp
,
cn
>
operator
-
(
const
Vec
<
_Tp
,
cn
>&
a
)
...
...
@@ -971,6 +998,41 @@ Vec<_Tp, m> operator * (const Matx<_Tp, m, n>& a, const Vec<_Tp, n>& b)
}
template
<
typename
_Tp
>
static
inline
Point_
<
_Tp
>
operator
*
(
const
Matx
<
_Tp
,
2
,
2
>&
a
,
const
Point_
<
_Tp
>&
b
)
{
return
Point_
<
_Tp
>
(
a
*
Vec
<
_Tp
,
2
>
(
b
));
}
template
<
typename
_Tp
>
static
inline
Point3_
<
_Tp
>
operator
*
(
const
Matx
<
_Tp
,
3
,
3
>&
a
,
const
Point3_
<
_Tp
>&
b
)
{
return
Point3_
<
_Tp
>
(
a
*
Vec
<
_Tp
,
3
>
(
b
));
}
template
<
typename
_Tp
>
static
inline
Point3_
<
_Tp
>
operator
*
(
const
Matx
<
_Tp
,
3
,
3
>&
a
,
const
Point_
<
_Tp
>&
b
)
{
return
Point3_
<
_Tp
>
(
a
*
Vec
<
_Tp
,
3
>
(
b
.
x
,
b
.
y
,
1
));
}
template
<
typename
_Tp
>
static
inline
Vec
<
_Tp
,
4
>
operator
*
(
const
Matx
<
_Tp
,
4
,
4
>&
a
,
const
Point3_
<
_Tp
>&
b
)
{
return
a
*
Vec
<
_Tp
,
4
>
(
b
.
x
,
b
.
y
,
b
.
z
,
1
);
}
template
<
typename
_Tp
>
static
inline
Scalar
operator
*
(
const
Matx
<
_Tp
,
4
,
4
>&
a
,
const
Scalar
&
b
)
{
return
Scalar
(
a
*
Vec
<
_Tp
,
4
>
(
b
));
}
template
<
typename
_Tp
,
int
m
,
int
n
>
inline
Matx
<
_Tp
,
m
,
n
>
Matx
<
_Tp
,
m
,
n
>::
mul
(
const
Matx
<
_Tp
,
m
,
n
>&
a
)
const
{
...
...
@@ -1909,6 +1971,81 @@ template<typename _Tp> static inline Scalar_<_Tp> operator - (const Scalar_<_Tp>
saturate_cast
<
_Tp
>
(
-
a
.
val
[
2
]),
saturate_cast
<
_Tp
>
(
-
a
.
val
[
3
]));
}
template
<
typename
_Tp
>
static
inline
Scalar_
<
_Tp
>
operator
*
(
const
Scalar_
<
_Tp
>&
a
,
const
Scalar_
<
_Tp
>&
b
)
{
return
Scalar_
<
_Tp
>
(
saturate_cast
<
_Tp
>
(
a
[
0
]
*
b
[
0
]
-
a
[
1
]
*
b
[
1
]
-
a
[
2
]
*
b
[
2
]
-
a
[
3
]
*
b
[
3
]),
saturate_cast
<
_Tp
>
(
a
[
0
]
*
b
[
1
]
+
a
[
1
]
*
b
[
0
]
+
a
[
2
]
*
b
[
3
]
-
a
[
3
]
*
b
[
2
]),
saturate_cast
<
_Tp
>
(
a
[
0
]
*
b
[
2
]
-
a
[
1
]
*
b
[
3
]
+
a
[
2
]
*
b
[
0
]
-
a
[
3
]
*
b
[
1
]),
saturate_cast
<
_Tp
>
(
a
[
0
]
*
b
[
3
]
+
a
[
1
]
*
b
[
2
]
-
a
[
2
]
*
b
[
1
]
-
a
[
3
]
*
b
[
0
]));
}
template
<
typename
_Tp
>
static
inline
Scalar_
<
_Tp
>&
operator
*=
(
Scalar_
<
_Tp
>&
a
,
const
Scalar_
<
_Tp
>&
b
)
{
a
=
a
*
b
;
return
a
;
}
template
<
typename
_Tp
>
inline
Scalar_
<
_Tp
>
Scalar_
<
_Tp
>::
conj
()
const
{
return
Scalar_
<
_Tp
>
(
saturate_cast
<
_Tp
>
(
this
->
val
[
0
]),
saturate_cast
<
_Tp
>
(
-
this
->
val
[
1
]),
saturate_cast
<
_Tp
>
(
-
this
->
val
[
2
]),
saturate_cast
<
_Tp
>
(
-
this
->
val
[
3
]));
}
template
<
typename
_Tp
>
static
inline
Scalar_
<
_Tp
>
operator
/
(
const
Scalar_
<
_Tp
>&
a
,
_Tp
alpha
)
{
return
Scalar_
<
_Tp
>
(
saturate_cast
<
_Tp
>
(
a
.
val
[
0
]
/
alpha
),
saturate_cast
<
_Tp
>
(
a
.
val
[
1
]
/
alpha
),
saturate_cast
<
_Tp
>
(
a
.
val
[
2
]
/
alpha
),
saturate_cast
<
_Tp
>
(
a
.
val
[
3
]
/
alpha
));
}
template
<>
static
inline
Scalar_
<
float
>
operator
/
(
const
Scalar_
<
float
>&
a
,
float
alpha
)
{
float
s
=
1
/
alpha
;
return
Scalar_
<
float
>
(
a
.
val
[
0
]
*
s
,
a
.
val
[
1
]
*
s
,
a
.
val
[
2
]
*
s
,
a
.
val
[
3
]
*
s
);
}
template
<>
static
inline
Scalar_
<
double
>
operator
/
(
const
Scalar_
<
double
>&
a
,
double
alpha
)
{
double
s
=
1
/
alpha
;
return
Scalar_
<
double
>
(
a
.
val
[
0
]
*
s
,
a
.
val
[
1
]
*
s
,
a
.
val
[
2
]
*
s
,
a
.
val
[
3
]
*
s
);
}
template
<
typename
_Tp
>
static
inline
Scalar_
<
_Tp
>&
operator
/=
(
Scalar_
<
_Tp
>&
a
,
_Tp
alpha
)
{
a
=
a
/
alpha
;
return
a
;
}
template
<
typename
_Tp
>
static
inline
Scalar_
<
_Tp
>
operator
/
(
_Tp
a
,
const
Scalar_
<
_Tp
>&
b
)
{
_Tp
s
=
a
/
(
b
[
0
]
*
b
[
0
]
+
b
[
1
]
*
b
[
1
]
+
b
[
2
]
*
b
[
2
]
+
b
[
3
]
*
b
[
3
]);
return
b
.
conj
()
*
s
;
}
template
<
typename
_Tp
>
static
inline
Scalar_
<
_Tp
>
operator
/
(
const
Scalar_
<
_Tp
>&
a
,
const
Scalar_
<
_Tp
>&
b
)
{
return
a
*
((
_Tp
)
1
/
b
);
}
template
<
typename
_Tp
>
static
inline
Scalar_
<
_Tp
>&
operator
/=
(
Scalar_
<
_Tp
>&
a
,
const
Scalar_
<
_Tp
>&
b
)
{
a
=
a
/
b
;
return
a
;
}
//////////////////////////////// Range /////////////////////////////////
inline
Range
::
Range
()
:
start
(
0
),
end
(
0
)
{}
...
...
modules/features2d/src/detectors.cpp
View file @
796553d0
...
...
@@ -52,7 +52,7 @@ struct MaskPredicate
{
MaskPredicate
(
const
Mat
&
_mask
)
:
mask
(
_mask
)
{}
MaskPredicate
&
operator
=
(
const
MaskPredicate
&
)
{}
MaskPredicate
&
operator
=
(
const
MaskPredicate
&
)
{
return
*
this
;
}
bool
operator
()
(
const
KeyPoint
&
key_pt
)
const
{
return
mask
.
at
<
uchar
>
(
(
int
)(
key_pt
.
pt
.
y
+
0.5
f
),
(
int
)(
key_pt
.
pt
.
x
+
0.5
f
)
)
==
0
;
...
...
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