Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
ball_tracking
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Sebastian Gomez-Gonzalez
ball_tracking
Commits
7fd5b486
Commit
7fd5b486
authored
7 years ago
by
Sebastian Gomez-Gonzalez
Browse files
Options
Downloads
Patches
Plain Diff
Adding optional smoothing capabilities to the tracker
parent
39699bed
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
examples/tracking/track_conf.json
+6
-2
6 additions, 2 deletions
examples/tracking/track_conf.json
src/tracker.cpp
+34
-3
34 additions, 3 deletions
src/tracker.cpp
with
40 additions
and
5 deletions
examples/tracking/track_conf.json
+
6
−
2
View file @
7fd5b486
{
"ball_log_lh"
:
{
"type"
:
"cb_log_reg"
,
"conf"
:
{
"conf"
:
{
"weights"
:
[
-4.3645153397769523
,
-1.7528550846385467
,
...
...
@@ -31,7 +31,11 @@
-5.4301792573145677
,
-4.7388290757015756
,
-5.739125161010926
]
],
"gauss_smooth"
:
{
"size"
:
5
,
"sigma"
:
0
}
}
},
"binarizer"
:
{
...
...
This diff is collapsed.
Click to expand it.
src/tracker.cpp
+
34
−
3
View file @
7fd5b486
...
...
@@ -16,6 +16,23 @@ namespace ball_tracking {
*/
namespace
{
class
GaussSmooth
{
private:
int
size
;
double
sigma
;
public:
GaussSmooth
(
const
json
&
conf
)
{
size
=
conf
.
at
(
"size"
);
sigma
=
conf
.
at
(
"sigma"
);
}
cv
::
Mat
operator
()(
cv
::
InputArray
_src
)
{
Mat
dst
;
GaussianBlur
(
_src
,
dst
,
Size
(
size
,
size
),
sigma
,
sigma
);
return
dst
;
}
};
/**
* Color and background based logistic regression
*/
...
...
@@ -23,18 +40,32 @@ namespace ball_tracking {
private:
Mat
bkg
;
//!< Background image
Mat
weights
;
//!< Model weights
vector
<
preproc
>
pre
;
//!< Preprocessing functions for the images
public:
cv
::
Mat
operator
()(
cv
::
InputArray
src
)
{
Mat
pre_chain
(
cv
::
InputArray
src
)
{
Mat
tmp
=
src
.
getMat
();
for
(
auto
p
:
pre
)
{
tmp
=
p
(
tmp
);
}
return
tmp
;
}
cv
::
Mat
operator
()(
cv
::
InputArray
_src
)
{
Mat
src
=
pre_chain
(
_src
);
if
(
bkg
.
empty
())
{
bkg
=
src
.
getMat
()
;
bkg
=
src
;
}
return
quadf_log_reg
(
src
,
bkg
,
weights
);
}
CB_log_reg
(
const
json
&
conf
)
{
weights
=
json2cvmat
(
conf
.
at
(
"weights"
));
if
(
conf
.
count
(
"gauss_smooth"
))
{
pre
.
push_back
(
GaussSmooth
(
conf
.
at
(
"gauss_smooth"
)));
}
if
(
conf
.
count
(
"background"
))
{
bkg
=
imread
(
conf
.
at
(
"background"
),
CV_LOAD_IMAGE_COLOR
);
bkg
=
pre_chain
(
imread
(
conf
.
at
(
"background"
),
CV_LOAD_IMAGE_COLOR
)
)
;
if
(
!
bkg
.
data
)
{
throw
std
::
logic_error
(
"File not found for background image"
);
}
...
...
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