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
56f5fcd2
Commit
56f5fcd2
authored
Mar 28, 2012
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added Vec Matx::solve(Vec) (ticket #1376)
parent
c9efcf8d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
17 deletions
+23
-17
core.hpp
modules/core/include/opencv2/core/core.hpp
+1
-1
operations.hpp
modules/core/include/opencv2/core/operations.hpp
+6
-0
sift.cpp
modules/nonfree/src/sift.cpp
+7
-7
surf.cpp
modules/nonfree/src/surf.cpp
+9
-9
No files found.
modules/core/include/opencv2/core/core.hpp
View file @
56f5fcd2
...
...
@@ -502,7 +502,7 @@ public:
//! solve linear system
template
<
int
l
>
Matx
<
_Tp
,
n
,
l
>
solve
(
const
Matx
<
_Tp
,
m
,
l
>&
rhs
,
int
flags
=
DECOMP_LU
)
const
;
Matx
<
_Tp
,
n
,
1
>
solve
(
const
Matx
<
_Tp
,
m
,
1
>&
rhs
,
int
method
)
const
;
Vec
<
_Tp
,
n
>
solve
(
const
Vec
<
_Tp
,
m
>&
rhs
,
int
method
)
const
;
//! multiply two matrices element-wise
Matx
<
_Tp
,
m
,
n
>
mul
(
const
Matx
<
_Tp
,
m
,
n
>&
a
)
const
;
...
...
modules/core/include/opencv2/core/operations.hpp
View file @
56f5fcd2
...
...
@@ -903,6 +903,12 @@ Matx<_Tp, n, l> Matx<_Tp, m, n>::solve(const Matx<_Tp, m, l>& rhs, int method) c
return
ok
?
x
:
Matx
<
_Tp
,
n
,
l
>::
zeros
();
}
template
<
typename
_Tp
,
int
m
,
int
n
>
inline
Vec
<
_Tp
,
n
>
Matx
<
_Tp
,
m
,
n
>::
solve
(
const
Vec
<
_Tp
,
m
>&
rhs
,
int
method
)
const
{
Matx
<
_Tp
,
n
,
1
>
x
=
solve
(
reinterpret_cast
<
const
Matx
<
_Tp
,
m
,
1
>&>
(
rhs
),
method
);
return
reinterpret_cast
<
Vec
<
_Tp
,
n
>&>
(
x
);
}
template
<
typename
_Tp
,
typename
_AccTp
>
static
inline
_AccTp
normL2Sqr
(
const
_Tp
*
a
,
int
n
)
...
...
modules/nonfree/src/sift.cpp
View file @
56f5fcd2
...
...
@@ -343,9 +343,9 @@ static bool adjustLocalExtrema( const vector<Mat>& dog_pyr, KeyPoint& kpt, int o
const
Mat
&
prev
=
dog_pyr
[
idx
-
1
];
const
Mat
&
next
=
dog_pyr
[
idx
+
1
];
Matx31
f
dD
((
img
.
at
<
short
>
(
r
,
c
+
1
)
-
img
.
at
<
short
>
(
r
,
c
-
1
))
*
deriv_scale
,
(
img
.
at
<
short
>
(
r
+
1
,
c
)
-
img
.
at
<
short
>
(
r
-
1
,
c
))
*
deriv_scale
,
(
next
.
at
<
short
>
(
r
,
c
)
-
prev
.
at
<
short
>
(
r
,
c
))
*
deriv_scale
);
Vec3
f
dD
((
img
.
at
<
short
>
(
r
,
c
+
1
)
-
img
.
at
<
short
>
(
r
,
c
-
1
))
*
deriv_scale
,
(
img
.
at
<
short
>
(
r
+
1
,
c
)
-
img
.
at
<
short
>
(
r
-
1
,
c
))
*
deriv_scale
,
(
next
.
at
<
short
>
(
r
,
c
)
-
prev
.
at
<
short
>
(
r
,
c
))
*
deriv_scale
);
float
v2
=
(
float
)
img
.
at
<
short
>
(
r
,
c
)
*
2
;
float
dxx
=
(
img
.
at
<
short
>
(
r
,
c
+
1
)
+
img
.
at
<
short
>
(
r
,
c
-
1
)
-
v2
)
*
second_deriv_scale
;
...
...
@@ -362,11 +362,11 @@ static bool adjustLocalExtrema( const vector<Mat>& dog_pyr, KeyPoint& kpt, int o
dxy
,
dyy
,
dys
,
dxs
,
dys
,
dss
);
Matx31f
X
=
H
.
solve
<
1
>
(
dD
,
DECOMP_LU
);
Vec3f
X
=
H
.
solve
(
dD
,
DECOMP_LU
);
xi
=
-
X
(
2
,
0
)
;
xr
=
-
X
(
1
,
0
)
;
xc
=
-
X
(
0
,
0
)
;
xi
=
-
X
[
2
]
;
xr
=
-
X
[
1
]
;
xc
=
-
X
[
0
]
;
if
(
std
::
abs
(
xi
)
<
0.5
f
&&
std
::
abs
(
xr
)
<
0.5
f
&&
std
::
abs
(
xc
)
<
0.5
f
)
break
;
...
...
modules/nonfree/src/surf.cpp
View file @
56f5fcd2
...
...
@@ -228,9 +228,9 @@ static void calcLayerDetAndTrace( const Mat& sum, int size, int sampleStep,
static
int
interpolateKeypoint
(
float
N9
[
3
][
9
],
int
dx
,
int
dy
,
int
ds
,
KeyPoint
&
kpt
)
{
Matx31
f
b
(
-
(
N9
[
1
][
5
]
-
N9
[
1
][
3
])
/
2
,
// Negative 1st deriv with respect to x
-
(
N9
[
1
][
7
]
-
N9
[
1
][
1
])
/
2
,
// Negative 1st deriv with respect to y
-
(
N9
[
2
][
4
]
-
N9
[
0
][
4
])
/
2
);
// Negative 1st deriv with respect to s
Vec3
f
b
(
-
(
N9
[
1
][
5
]
-
N9
[
1
][
3
])
/
2
,
// Negative 1st deriv with respect to x
-
(
N9
[
1
][
7
]
-
N9
[
1
][
1
])
/
2
,
// Negative 1st deriv with respect to y
-
(
N9
[
2
][
4
]
-
N9
[
0
][
4
])
/
2
);
// Negative 1st deriv with respect to s
Matx33f
A
(
N9
[
1
][
3
]
-
2
*
N9
[
1
][
4
]
+
N9
[
1
][
5
],
// 2nd deriv x, x
...
...
@@ -243,16 +243,16 @@ interpolateKeypoint( float N9[3][9], int dx, int dy, int ds, KeyPoint& kpt )
(
N9
[
2
][
7
]
-
N9
[
2
][
1
]
-
N9
[
0
][
7
]
+
N9
[
0
][
1
])
/
4
,
// 2nd deriv y, s
N9
[
0
][
4
]
-
2
*
N9
[
1
][
4
]
+
N9
[
2
][
4
]);
// 2nd deriv s, s
Matx31f
x
=
A
.
solve
<
1
>
(
b
,
DECOMP_LU
);
Vec3f
x
=
A
.
solve
(
b
,
DECOMP_LU
);
bool
ok
=
(
x
(
0
,
0
)
!=
0
||
x
(
1
,
0
)
!=
0
||
x
(
2
,
0
)
!=
0
)
&&
std
::
abs
(
x
(
0
,
0
))
<=
1
&&
std
::
abs
(
x
(
1
,
0
))
<=
1
&&
std
::
abs
(
x
(
2
,
0
)
)
<=
1
;
bool
ok
=
(
x
[
0
]
!=
0
||
x
[
1
]
!=
0
||
x
[
2
]
!=
0
)
&&
std
::
abs
(
x
[
0
])
<=
1
&&
std
::
abs
(
x
[
1
])
<=
1
&&
std
::
abs
(
x
[
2
]
)
<=
1
;
if
(
ok
)
{
kpt
.
pt
.
x
+=
x
(
0
,
0
)
*
dx
;
kpt
.
pt
.
y
+=
x
(
1
,
0
)
*
dy
;
kpt
.
size
=
(
float
)
cvRound
(
kpt
.
size
+
x
(
2
,
0
)
*
ds
);
kpt
.
pt
.
x
+=
x
[
0
]
*
dx
;
kpt
.
pt
.
y
+=
x
[
1
]
*
dy
;
kpt
.
size
=
(
float
)
cvRound
(
kpt
.
size
+
x
[
2
]
*
ds
);
}
return
ok
;
}
...
...
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