Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
eos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Richard Torenvliet
eos
Commits
46d52c70
Commit
46d52c70
authored
Feb 06, 2017
by
Richard Torenvliet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix paths, tests should be run from tests directory to find the right data paths
parent
b9c406a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
10 deletions
+22
-10
tests/fitting/fitting_test.hpp
tests/fitting/fitting_test.hpp
+18
-10
utils/CMakeLists.txt
utils/CMakeLists.txt
+4
-0
No files found.
tests/fitting/fitting_test.hpp
View file @
46d52c70
...
@@ -95,7 +95,7 @@ LandmarkCollection<cv::Vec2f> read_pts_landmarks(std::string filename)
...
@@ -95,7 +95,7 @@ LandmarkCollection<cv::Vec2f> read_pts_landmarks(std::string filename)
};
};
morphablemodel
::
MorphableModel
loadTestModel
()
{
morphablemodel
::
MorphableModel
loadTestModel
()
{
return
morphablemodel
::
load_model
(
"share/sfm_shape_3448.bin"
);
return
morphablemodel
::
load_model
(
"
../
share/sfm_shape_3448.bin"
);
}
}
/**
/**
...
@@ -154,11 +154,11 @@ inline float euclidean_distance(cv::Vec2f landmark, cv::Mat vertex_screen_coords
...
@@ -154,11 +154,11 @@ inline float euclidean_distance(cv::Vec2f landmark, cv::Mat vertex_screen_coords
TEST_CASE
(
"Test ortographic projection"
,
"[projection]"
){
TEST_CASE
(
"Test ortographic projection"
,
"[projection]"
){
// ======== begin setup ============
// ======== begin setup ============
Mat
image
=
cv
::
imread
(
"
tests/
data/image_0010.png"
);
Mat
image
=
cv
::
imread
(
"data/image_0010.png"
);
LandmarkCollection
<
cv
::
Vec2f
>
landmarks
;
LandmarkCollection
<
cv
::
Vec2f
>
landmarks
;
landmarks
=
read_pts_landmarks
(
"
tests/
data/image_0010.pts"
);
landmarks
=
read_pts_landmarks
(
"data/image_0010.pts"
);
core
::
LandmarkMapper
landmark_mapper
=
core
::
LandmarkMapper
(
"share/ibug2did.txt"
);
core
::
LandmarkMapper
landmark_mapper
=
core
::
LandmarkMapper
(
"
../
share/ibug2did.txt"
);
vector
<
Vec4f
>
model_points
;
// the points in the 3D shape model
vector
<
Vec4f
>
model_points
;
// the points in the 3D shape model
vector
<
int
>
vertex_indices
;
// their vertex indices
vector
<
int
>
vertex_indices
;
// their vertex indices
...
@@ -170,6 +170,12 @@ TEST_CASE("Test ortographic projection", "[projection]" ){
...
@@ -170,6 +170,12 @@ TEST_CASE("Test ortographic projection", "[projection]" ){
fitting
::
ScaledOrthoProjectionParameters
pose
=
fitting
::
estimate_orthographic_projection_linear
(
fitting
::
ScaledOrthoProjectionParameters
pose
=
fitting
::
estimate_orthographic_projection_linear
(
image_points
,
model_points
,
true
,
image
.
rows
image_points
,
model_points
,
true
,
image
.
rows
);
);
std
::
cout
<<
glm
::
to_string
(
pose
.
R
)
<<
endl
;
std
::
cout
<<
pose
.
s
<<
endl
;
std
::
cout
<<
pose
.
tx
<<
endl
;
std
::
cout
<<
pose
.
ty
<<
endl
;
fitting
::
RenderingParameters
rendering_params
(
pose
,
image
.
cols
,
image
.
rows
);
fitting
::
RenderingParameters
rendering_params
(
pose
,
image
.
cols
,
image
.
rows
);
// Estimate the shape coefficients by fitting the shape to the landmarks:
// Estimate the shape coefficients by fitting the shape to the landmarks:
...
@@ -201,22 +207,24 @@ TEST_CASE("Test ortographic projection", "[projection]" ){
...
@@ -201,22 +207,24 @@ TEST_CASE("Test ortographic projection", "[projection]" ){
// The vertex_idx should be around the value of the original coordinates after we have
// The vertex_idx should be around the value of the original coordinates after we have
// projected it with the affine_from_ortho that is obtained earlier.
// projected it with the affine_from_ortho that is obtained earlier.
Mat
vertex_screen_coords
=
affine_from_ortho
*
Mat
vertex_screen_coords
=
affine_from_ortho
*
Mat
(
cv
::
Vec4f
(
Mat
(
cv
::
Vec4f
(
mesh
.
vertices
[
vertex_idx
].
x
,
mesh
.
vertices
[
vertex_idx
].
x
,
mesh
.
vertices
[
vertex_idx
].
y
,
mesh
.
vertices
[
vertex_idx
].
y
,
mesh
.
vertices
[
vertex_idx
].
z
,
mesh
.
vertices
[
vertex_idx
].
z
,
mesh
.
vertices
[
vertex_idx
].
w
)
mesh
.
vertices
[
vertex_idx
].
w
);
)
);
// using euclidean distance here, but should look at other ways too.
// using euclidean distance here, but should look at other ways too.
total_error
.
push_back
(
euclidean_distance
(
landmarks
[
i
].
coordinates
,
vertex_screen_coords
));
float
dist
=
euclidean_distance
(
landmarks
[
i
].
coordinates
,
vertex_screen_coords
);
total_error
.
push_back
(
dist
);
}
}
// Caculate mean error and stddev.
// Ca
l
culate mean error and stddev.
float
accum
=
0.0
;
float
accum
=
0.0
;
float
mean_error
=
std
::
accumulate
(
total_error
.
begin
(),
total_error
.
end
(),
0
)
/
landmarks
.
size
();
float
mean_error
=
std
::
accumulate
(
total_error
.
begin
(),
total_error
.
end
(),
0
)
/
landmarks
.
size
();
// cacl. standardeviation
// cacl. standard
d
eviation
std
::
for_each
(
std
::
begin
(
total_error
),
std
::
end
(
total_error
),
[
&
](
const
float
d
)
{
std
::
for_each
(
std
::
begin
(
total_error
),
std
::
end
(
total_error
),
[
&
](
const
float
d
)
{
accum
+=
(
d
-
mean_error
)
*
(
d
-
mean_error
);
accum
+=
(
d
-
mean_error
)
*
(
d
-
mean_error
);
});
});
...
...
utils/CMakeLists.txt
View file @
46d52c70
...
@@ -49,8 +49,12 @@ target_link_libraries(edgestruct-csv-to-json ${Boost_LIBRARIES})
...
@@ -49,8 +49,12 @@ target_link_libraries(edgestruct-csv-to-json ${Boost_LIBRARIES})
add_executable
(
json-to-cereal-binary json-to-cereal-binary.cpp
)
add_executable
(
json-to-cereal-binary json-to-cereal-binary.cpp
)
target_link_libraries
(
json-to-cereal-binary
${
OpenCV_LIBS
}
${
Boost_LIBRARIES
}
)
target_link_libraries
(
json-to-cereal-binary
${
OpenCV_LIBS
}
${
Boost_LIBRARIES
}
)
add_executable
(
accuracy-evaluation accuracy-evaluation.cpp
)
target_link_libraries
(
accuracy-evaluation
${
OpenCV_LIBS
}
${
Boost_LIBRARIES
}
)
# install target:
# install target:
install
(
TARGETS scm-to-cereal DESTINATION bin
)
install
(
TARGETS scm-to-cereal DESTINATION bin
)
install
(
TARGETS bfm-binary-to-cereal DESTINATION bin
)
install
(
TARGETS bfm-binary-to-cereal DESTINATION bin
)
install
(
TARGETS json-to-cereal-binary DESTINATION bin
)
install
(
TARGETS json-to-cereal-binary DESTINATION bin
)
install
(
TARGETS edgestruct-csv-to-json DESTINATION bin
)
install
(
TARGETS edgestruct-csv-to-json DESTINATION bin
)
install
(
TARGETS accuracy-evaluation DESTINATION bin
)
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