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
64533009
Commit
64533009
authored
Aug 03, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
akaze: optimize allocations
parent
8aca8d90
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
18 deletions
+20
-18
AKAZEFeatures.cpp
modules/features2d/src/kaze/AKAZEFeatures.cpp
+20
-18
No files found.
modules/features2d/src/kaze/AKAZEFeatures.cpp
View file @
64533009
...
...
@@ -1679,12 +1679,10 @@ void Upright_MLDB_Full_Descriptor_Invoker::Get_Upright_MLDB_Full_Descriptor(cons
const
AKAZEOptions
&
options
=
*
options_
;
const
std
::
vector
<
Evolution
>&
evolution
=
*
evolution_
;
// Matrices for the M-LDB descriptor
Mat
values
[
3
]
=
{
Mat
(
4
,
options
.
descriptor_channels
,
CV_32FC1
),
Mat
(
9
,
options
.
descriptor_channels
,
CV_32FC1
),
Mat
(
16
,
options
.
descriptor_channels
,
CV_32FC1
)
};
// Buffer for the M-LDB descriptor
const
int
max_channels
=
3
;
CV_Assert
(
options
.
descriptor_channels
<=
max_channels
);
float
values
[
16
*
max_channels
];
// Get the information from the keypoint
ratio
=
(
float
)(
1
<<
kpt
.
octave
);
...
...
@@ -1739,7 +1737,7 @@ void Upright_MLDB_Full_Descriptor_Invoker::Get_Upright_MLDB_Full_Descriptor(cons
dx
/=
nsamples
;
dy
/=
nsamples
;
float
*
val
=
values
[
z
].
ptr
<
float
>
(
dcount2
)
;
float
*
val
=
&
values
[
dcount2
*
max_channels
]
;
*
(
val
)
=
di
;
*
(
val
+
1
)
=
dx
;
*
(
val
+
2
)
=
dy
;
...
...
@@ -1751,8 +1749,8 @@ void Upright_MLDB_Full_Descriptor_Invoker::Get_Upright_MLDB_Full_Descriptor(cons
const
int
num
=
(
z
+
2
)
*
(
z
+
2
);
for
(
int
i
=
0
;
i
<
num
;
i
++
)
{
for
(
int
j
=
i
+
1
;
j
<
num
;
j
++
)
{
const
float
*
valI
=
values
[
z
].
ptr
<
float
>
(
i
)
;
const
float
*
valJ
=
values
[
z
].
ptr
<
float
>
(
j
)
;
const
float
*
valI
=
&
values
[
i
*
max_channels
]
;
const
float
*
valJ
=
&
values
[
j
*
max_channels
]
;
for
(
int
k
=
0
;
k
<
3
;
++
k
)
{
if
(
*
(
valI
+
k
)
>
*
(
valJ
+
k
))
{
desc
[
dcount1
/
8
]
|=
(
1
<<
(
dcount1
%
8
));
...
...
@@ -1931,7 +1929,11 @@ void MLDB_Descriptor_Subset_Invoker::Get_MLDB_Descriptor_Subset(const KeyPoint&
float
si
=
sin
(
angle
);
// Allocate memory for the matrix of values
Mat
values
((
4
+
9
+
16
)
*
options
.
descriptor_channels
,
1
,
CV_32FC1
);
// Buffer for the M-LDB descriptor
const
int
max_channels
=
3
;
const
int
channels
=
options
.
descriptor_channels
;
CV_Assert
(
channels
<=
max_channels
);
float
values
[(
4
+
9
+
16
)
*
max_channels
];
// Sample everything, but only do the comparisons
const
int
pattern_size
=
options
.
descriptor_pattern_size
;
...
...
@@ -1978,23 +1980,23 @@ void MLDB_Descriptor_Subset_Invoker::Get_MLDB_Descriptor_Subset(const KeyPoint&
}
}
*
(
values
.
ptr
<
float
>
(
options
.
descriptor_channels
*
i
))
=
di
;
float
*
pValues
=
&
values
[
channels
*
i
];
pValues
[
0
]
=
di
;
if
(
options
.
descriptor_
channels
==
2
)
{
*
(
values
.
ptr
<
float
>
(
options
.
descriptor_channels
*
i
+
1
))
=
dx
;
if
(
channels
==
2
)
{
pValues
[
1
]
=
dx
;
}
else
if
(
options
.
descriptor_
channels
==
3
)
{
*
(
values
.
ptr
<
float
>
(
options
.
descriptor_channels
*
i
+
1
))
=
dx
;
*
(
values
.
ptr
<
float
>
(
options
.
descriptor_channels
*
i
+
2
))
=
dy
;
else
if
(
channels
==
3
)
{
pValues
[
1
]
=
dx
;
pValues
[
2
]
=
dy
;
}
}
// Do the comparisons
const
float
*
vals
=
values
.
ptr
<
float
>
(
0
);
const
int
*
comps
=
descriptorBits_
.
ptr
<
int
>
(
0
);
for
(
int
i
=
0
;
i
<
descriptorBits_
.
rows
;
i
++
)
{
if
(
val
s
[
comps
[
2
*
i
]]
>
val
s
[
comps
[
2
*
i
+
1
]])
{
if
(
val
ues
[
comps
[
2
*
i
]]
>
value
s
[
comps
[
2
*
i
+
1
]])
{
desc
[
i
/
8
]
|=
(
1
<<
(
i
%
8
));
}
else
{
desc
[
i
/
8
]
&=
~
(
1
<<
(
i
%
8
));
...
...
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