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
1d0f65c5
Commit
1d0f65c5
authored
7 years ago
by
Sebastian Gomez-Gonzalez
Browse files
Options
Downloads
Patches
Plain Diff
Adding a ZMQ driver for ball likelihood operator (Not tested or used yet)
parent
a9cd7e8a
Branches
dev
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+4
-0
4 additions, 0 deletions
CMakeLists.txt
src/server.cpp
+2
-0
2 additions, 0 deletions
src/server.cpp
src/tracker.cpp
+44
-0
44 additions, 0 deletions
src/tracker.cpp
with
50 additions
and
0 deletions
CMakeLists.txt
+
4
−
0
View file @
1d0f65c5
...
...
@@ -14,6 +14,8 @@ find_library(CAMLIB NAMES camera)
find_path
(
CAMLIB_INC NAMES camera.hpp
)
find_library
(
ROBOTICS NAMES robotics
)
find_path
(
ROBOTICS_INC NAMES robotics.hpp
)
find_library
(
ROB_PROTO NAMES rob_proto
)
find_path
(
ROB_PROTO_INC NAMES rob_proto/frame.pb.h
)
if
(
CUDA_FOUND
)
option
(
WITH_CUDA
"Compile the library with GPU implementations"
ON
)
...
...
@@ -42,6 +44,7 @@ include_directories(include
${
ZMQPP_INCLUDES
}
${
CAMLIB_INC
}
${
ROBOTICS_INC
}
${
ROB_PROTO_INC
}
)
add_library
(
ball_tracking SHARED
...
...
@@ -60,6 +63,7 @@ target_link_libraries(ball_tracking
${
Boost_LIBRARIES
}
${
ARMADILLO_LIBRARIES
}
${
ROBOTICS
}
${
ROB_PROTO
}
)
...
...
This diff is collapsed.
Click to expand it.
src/server.cpp
+
2
−
0
View file @
1d0f65c5
...
...
@@ -79,7 +79,9 @@ namespace ball_tracking {
//3) Start the cameras and call backs
BOOST_LOG_TRIVIAL
(
info
)
<<
"Starting the cameras..."
;
BOOST_LOG_TRIVIAL
(
info
)
<<
"Driver: "
<<
conf
.
at
(
"cameras"
).
at
(
"type"
);
cams
=
CameraSet
(
conf
.
at
(
"cameras"
));
BOOST_LOG_TRIVIAL
(
info
)
<<
"Cameras successfully started"
;
for
(
auto
&
p
:
trackers
)
{
unsigned
int
ID
=
p
.
first
;
...
...
This diff is collapsed.
Click to expand it.
src/tracker.cpp
+
44
−
0
View file @
1d0f65c5
...
...
@@ -6,6 +6,8 @@
#include
<json.hpp>
#include
<queue>
#include
<unordered_set>
#include
<zmqpp/zmqpp.hpp>
#include
<rob_proto/frame.pb.h>
#ifdef WITH_CUDA
#include
<ball_tracking/cuda/tracker.hpp>
...
...
@@ -88,6 +90,46 @@ namespace ball_tracking {
}
};
/**
* Network based image log likelihood
*/
class
ZMQ_log_lh
{
private:
shared_ptr
<
zmqpp
::
context
>
ctx
;
shared_ptr
<
zmqpp
::
socket
>
sk
;
public:
ZMQ_log_lh
(
const
json
&
conf
)
{
ctx
=
shared_ptr
<
zmqpp
::
context
>
(
new
zmqpp
::
context
);
sk
=
shared_ptr
<
zmqpp
::
socket
>
(
new
zmqpp
::
socket
(
*
ctx
,
zmqpp
::
socket_type
::
req
));
sk
->
connect
(
conf
.
at
(
"server"
));
}
cv
::
Mat
operator
()(
cv
::
InputArray
_src
)
{
cv
::
Mat
m
=
_src
.
getMat
();
rob_proto
::
Image
img
;
img
.
set_height
(
m
.
rows
);
img
.
set_width
(
m
.
cols
);
img
.
set_channels
(
m
.
channels
());
img
.
set_data
((
const
char
*
)
m
.
data
,
m
.
rows
*
m
.
cols
*
m
.
channels
());
string
s_img
=
img
.
SerializeAsString
();
zmqpp
::
message
req
,
res
;
req
<<
s_img
;
sk
->
send
(
req
);
cv
::
Mat
ans
(
m
.
rows
,
m
.
cols
,
CV_64FC1
);
sk
->
receive
(
res
);
res
>>
s_img
;
if
(
s_img
.
size
()
!=
ans
.
total
()
*
sizeof
(
double
))
{
BOOST_LOG_TRIVIAL
(
error
)
<<
"Error in ZMQ_log_lh. Obtained response size different than expected"
;
}
else
{
std
::
copy
(
s_img
.
begin
(),
s_img
.
end
(),
ans
.
data
);
}
return
ans
;
}
};
/**
* OpenCV Blob detection algorithm
*/
...
...
@@ -244,6 +286,8 @@ namespace ball_tracking {
const
json
&
conf
=
config
.
at
(
"conf"
);
if
(
type
==
"cb_log_reg"
)
{
bll
=
CB_log_reg
(
conf
);
}
else
if
(
type
==
"zmq_log_lh"
)
{
bll
=
ZMQ_log_lh
(
conf
);
}
else
{
throw
std
::
logic_error
(
"Type of ball log likelihood algorithm not recognized"
);
}
...
...
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