Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dlib
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
dlib
Commits
46681570
Commit
46681570
authored
Dec 29, 2011
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made this code a little more efficient.
parent
70aaa13a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
20 deletions
+20
-20
hashed_feature_image.h
dlib/image_keypoint/hashed_feature_image.h
+20
-17
hashed_feature_image_abstract.h
dlib/image_keypoint/hashed_feature_image_abstract.h
+0
-3
No files found.
dlib/image_keypoint/hashed_feature_image.h
View file @
46681570
...
...
@@ -108,6 +108,7 @@ namespace dlib
private
:
array2d
<
unsigned
long
>
feats
;
feature_extractor
fe
;
hash_function_type
phash
;
...
...
@@ -126,6 +127,7 @@ namespace dlib
std
::
ostream
&
out
)
{
serialize
(
item
.
feats
,
out
);
serialize
(
item
.
fe
,
out
);
serialize
(
item
.
phash
,
out
);
}
...
...
@@ -136,6 +138,7 @@ namespace dlib
std
::
istream
&
in
)
{
deserialize
(
item
.
feats
,
in
);
deserialize
(
item
.
fe
,
in
);
deserialize
(
item
.
phash
,
in
);
}
...
...
@@ -169,6 +172,7 @@ namespace dlib
{
fe
.
clear
();
phash
=
hash_function_type
();
feats
.
clear
();
}
// ----------------------------------------------------------------------------------------
...
...
@@ -241,7 +245,18 @@ namespace dlib
const
image_type
&
img
)
{
fe
.
load
(
img
);
feature_extractor
fe_temp
;
fe_temp
.
copy_configuration
(
fe
);
fe_temp
.
load
(
img
);
feats
.
set_size
(
fe_temp
.
nr
(),
fe_temp
.
nc
());
for
(
long
r
=
0
;
r
<
feats
.
nr
();
++
r
)
{
for
(
long
c
=
0
;
c
<
feats
.
nc
();
++
c
)
{
feats
[
r
][
c
]
=
phash
(
fe_temp
(
r
,
c
));
}
}
}
// ----------------------------------------------------------------------------------------
...
...
@@ -254,7 +269,7 @@ namespace dlib
size
(
)
const
{
return
fe
.
size
();
return
fe
ats
.
size
();
}
// ----------------------------------------------------------------------------------------
...
...
@@ -267,7 +282,7 @@ namespace dlib
nr
(
)
const
{
return
fe
.
nr
();
return
fe
ats
.
nr
();
}
// ----------------------------------------------------------------------------------------
...
...
@@ -280,7 +295,7 @@ namespace dlib
nc
(
)
const
{
return
fe
.
nc
();
return
fe
ats
.
nc
();
}
// ----------------------------------------------------------------------------------------
...
...
@@ -320,7 +335,7 @@ namespace dlib
<<
"
\n\t
this: "
<<
this
);
hash_feats
[
0
]
=
std
::
make_pair
(
phash
(
fe
(
row
,
col
))
,
1
);
hash_feats
[
0
]
=
std
::
make_pair
(
feats
[
row
][
col
]
,
1
);
return
hash_feats
;
}
...
...
@@ -336,18 +351,6 @@ namespace dlib
long
col
)
const
{
// make sure requires clause is not broken
DLIB_ASSERT
(
0
<=
row
&&
row
<
nr
()
&&
0
<=
col
&&
col
<
nc
(),
"
\t
rectangle hashed_feature_image::get_block_rect(row,col)"
<<
"
\n\t
Invalid inputs were given to this function"
<<
"
\n\t
row: "
<<
row
<<
"
\n\t
col: "
<<
col
<<
"
\n\t
nr(): "
<<
nr
()
<<
"
\n\t
nc(): "
<<
nc
()
<<
"
\n\t
this: "
<<
this
);
return
fe
.
get_block_rect
(
row
,
col
);
}
...
...
dlib/image_keypoint/hashed_feature_image_abstract.h
View file @
46681570
...
...
@@ -176,9 +176,6 @@ namespace dlib
long
col
)
const
;
/*!
requires
- 0 <= row < nr()
- 0 <= col < nc()
ensures
- returns BASE_FE.get_block_rect(row,col)
I.e. returns a rectangle that tells you what part of the original image is associated
...
...
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