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
01175882
Commit
01175882
authored
Oct 20, 2013
by
Davis King
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed fhog coordinate transforms so that they are properly invertible.
parent
a67c7c73
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
fhog.h
dlib/image_transforms/fhog.h
+7
-1
fhog_abstract.h
dlib/image_transforms/fhog_abstract.h
+4
-0
fhog.cpp
dlib/test/fhog.cpp
+24
-0
No files found.
dlib/image_transforms/fhog.h
View file @
01175882
...
...
@@ -434,7 +434,13 @@ namespace dlib
)
{
// Convert to image space and then set to the center of the cell.
return
(
p
+
point
(
1
,
1
))
*
cell_size
+
point
(
1
,
1
)
+
point
(
cell_size
/
2
,
cell_size
/
2
);
point
offset
;
if
(
p
.
x
()
>=
0
&&
p
.
y
()
>=
0
)
offset
=
point
(
cell_size
/
2
,
cell_size
/
2
);
if
(
p
.
x
()
<
0
&&
p
.
y
()
>=
0
)
offset
=
point
(
-
cell_size
/
2
,
cell_size
/
2
);
if
(
p
.
x
()
>=
0
&&
p
.
y
()
<
0
)
offset
=
point
(
cell_size
/
2
,
-
cell_size
/
2
);
if
(
p
.
x
()
<
0
&&
p
.
y
()
<
0
)
offset
=
point
(
-
cell_size
/
2
,
-
cell_size
/
2
);
return
(
p
+
point
(
1
,
1
))
*
cell_size
+
point
(
1
,
1
)
+
offset
;
}
// ----------------------------------------------------------------------------------------
...
...
dlib/image_transforms/fhog_abstract.h
View file @
01175882
...
...
@@ -130,6 +130,8 @@ namespace dlib
invertible. Therefore, the returned location will be the center of the cell
in the original image that contained the FHOG vector at position p. Moreover,
cell_size should be set to the value used by the call to extract_fhog_features().
- Mapping from fhog space to image space is an invertible transformation. That
is, for any point P we have P == image_to_fhog(fhog_to_image(P,cell_size),cell_size).
!*/
// ----------------------------------------------------------------------------------------
...
...
@@ -144,6 +146,8 @@ namespace dlib
ensures
- maps a rectangle from fhog space to image space. In particular this function returns:
rectangle(fhog_to_image(rect.tl_corner(),cell_size), fhog_to_image(rect.br_corner(),cell_size))
- Mapping from fhog space to image space is an invertible transformation. That
is, for any rectangle R we have R == image_to_fhog(fhog_to_image(R,cell_size),cell_size).
!*/
// ----------------------------------------------------------------------------------------
...
...
dlib/test/fhog.cpp
View file @
01175882
...
...
@@ -103,9 +103,33 @@ namespace
}
}
void
test_point_transforms
()
{
for
(
int
cell_size
=
1
;
cell_size
<
10
;
++
cell_size
)
{
print_spinner
();
for
(
long
i
=
-
10
;
i
<=
10
;
++
i
)
{
for
(
long
j
=
-
10
;
j
<=
10
;
++
j
)
{
for
(
long
k
=
-
10
;
k
<=
10
;
++
k
)
{
for
(
long
l
=
-
10
;
l
<=
10
;
++
l
)
{
rectangle
rect
(
point
(
i
,
j
),
point
(
k
,
l
));
DLIB_TEST
(
rect
==
image_to_fhog
(
fhog_to_image
(
rect
,
cell_size
),
cell_size
));
}
}
}
}
}
}
void
perform_test
(
)
{
test_point_transforms
();
test_on_small
();
print_spinner
();
...
...
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