Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Commits
dddda0e6
Commit
dddda0e6
authored
5 years ago
by
Sebastian Hahta
Browse files
Options
Downloads
Patches
Plain Diff
statistics: percent of samples with valid values
parent
2a569513
No related branches found
No related tags found
No related merge requests found
Pipeline
#12195
passed
5 years ago
Stage: all
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
applications/gui/src/camera.cpp
+34
-7
34 additions, 7 deletions
applications/gui/src/camera.cpp
with
34 additions
and
7 deletions
applications/gui/src/camera.cpp
+
34
−
7
View file @
dddda0e6
...
...
@@ -11,19 +11,37 @@ using ftl::gui::PoseWindow;
// TODO(Nick) MOVE
class
StatisticsImage
{
private:
cv
::
Mat
data_
;
cv
::
Size
size_
;
float
max_f_
;
cv
::
Mat
data_
;
// CV_32FC3, channels: m, s, f
cv
::
Size
size_
;
// image size
float
n_
;
// total number of samples
public:
StatisticsImage
(
cv
::
Size
size
);
StatisticsImage
(
cv
::
Size
size
,
float
max_f
);
/* @brief reset all statistics to 0
*/
void
reset
();
/* @brief update statistics with new values
*/
void
update
(
const
cv
::
Mat
&
in
);
/* @brief variance (depth)
*/
void
getVariance
(
cv
::
Mat
&
out
);
/* @brief standard deviation (depth)
*/
void
getStdDev
(
cv
::
Mat
&
out
);
/* @brief mean value (depth)
*/
void
getMean
(
cv
::
Mat
&
out
);
/* @brief percent of samples having valid depth value
*/
void
getValidRatio
(
cv
::
Mat
&
out
);
};
StatisticsImage
::
StatisticsImage
(
cv
::
Size
size
)
:
...
...
@@ -31,24 +49,27 @@ StatisticsImage::StatisticsImage(cv::Size size) :
StatisticsImage
::
StatisticsImage
(
cv
::
Size
size
,
float
max_f
)
{
size_
=
size
;
// channels: m, s, f
n_
=
0.0
f
;
data_
=
cv
::
Mat
(
size
,
CV_32FC3
,
cv
::
Scalar
(
0.0
,
0.0
,
0.0
));
max_f_
=
max_f
;
// TODO
if
(
!
std
::
isinf
(
max_f
_
))
{
if
(
!
std
::
isinf
(
max_f
))
{
LOG
(
WARNING
)
<<
"TODO: max_f_ not used. Values calculated for all samples"
;
}
}
void
StatisticsImage
::
reset
()
{
n_
=
0.0
f
;
data_
=
cv
::
Scalar
(
0.0
,
0.0
,
0.0
);
}
void
StatisticsImage
::
update
(
const
cv
::
Mat
&
in
)
{
DCHECK
(
in
.
type
()
==
CV_32F
);
DCHECK
(
in
.
size
()
==
size_
);
// Welford's Method
n_
=
n_
+
1.0
f
;
// Welford's Method
for
(
int
row
=
0
;
row
<
in
.
rows
;
row
++
)
{
float
*
ptr_data
=
data_
.
ptr
<
float
>
(
row
);
const
float
*
ptr_in
=
in
.
ptr
<
float
>
(
row
);
...
...
@@ -86,6 +107,12 @@ void StatisticsImage::getMean(cv::Mat &out) {
out
=
channels
[
0
];
}
void
StatisticsImage
::
getValidRatio
(
cv
::
Mat
&
out
)
{
std
::
vector
<
cv
::
Mat
>
channels
(
3
);
cv
::
split
(
data_
,
channels
);
cv
::
divide
(
channels
[
2
],
n_
,
out
);
}
static
Eigen
::
Affine3d
create_rotation_matrix
(
float
ax
,
float
ay
,
float
az
)
{
Eigen
::
Affine3d
rx
=
Eigen
::
Affine3d
(
Eigen
::
AngleAxisd
(
ax
,
Eigen
::
Vector3d
(
1
,
0
,
0
)));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment