Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AAU NAV
development
camera_streaming
Commits
82ab4e22
Commit
82ab4e22
authored
Aug 07, 2018
by
Barcis, Michal
Browse files
proper frame numbers
parent
3a09dbb4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/cam2image.cpp
View file @
82ab4e22
...
@@ -77,7 +77,7 @@ void adapt(
...
@@ -77,7 +77,7 @@ void adapt(
size_t
*
adapted_width
,
size_t
*
adapted_width
,
size_t
*
adapted_height
)
size_t
*
adapted_height
)
{
{
*
rate_adaptation
=
0.
2
;
*
rate_adaptation
=
0.
1
;
if
(
factor
>=
1
)
{
if
(
factor
>=
1
)
{
*
adapted_width
=
640
;
*
adapted_width
=
640
;
*
adapted_height
=
480
;
*
adapted_height
=
480
;
...
@@ -205,6 +205,7 @@ int main(int argc, char * argv[])
...
@@ -205,6 +205,7 @@ int main(int argc, char * argv[])
msg
->
is_bigendian
=
false
;
msg
->
is_bigendian
=
false
;
size_t
i
=
1
;
size_t
i
=
1
;
size_t
frame_id
=
1
;
double
rate_adaptation
;
double
rate_adaptation
;
size_t
adapted_width
;
size_t
adapted_width
;
size_t
adapted_height
;
size_t
adapted_height
;
...
@@ -236,7 +237,7 @@ int main(int argc, char * argv[])
...
@@ -236,7 +237,7 @@ int main(int argc, char * argv[])
if
(
!
frame
.
empty
())
{
if
(
!
frame
.
empty
())
{
// Convert to a ROS image
// Convert to a ROS image
if
(
!
is_flipped
)
{
if
(
!
is_flipped
)
{
convert_frame_to_message
(
frame
,
i
,
msg
);
convert_frame_to_message
(
frame
,
frame_id
,
msg
);
}
else
{
}
else
{
// Flip the frame if needed
// Flip the frame if needed
cv
::
flip
(
frame
,
flipped_frame
,
1
);
cv
::
flip
(
frame
,
flipped_frame
,
1
);
...
@@ -253,8 +254,9 @@ int main(int argc, char * argv[])
...
@@ -253,8 +254,9 @@ int main(int argc, char * argv[])
}
}
// Publish the image message and increment the frame_id.
// Publish the image message and increment the frame_id.
if
(
i
%
(
int
)(
1
/
rate_adaptation
)
==
0
)
{
if
(
i
%
(
int
)(
1
/
rate_adaptation
)
==
0
)
{
RCLCPP_
DEBUG
(
node_logger
,
"Publishing image #%zd"
,
i
)
RCLCPP_
INFO
(
node_logger
,
"Publishing image #%zd"
,
frame_id
)
pub
->
publish
(
msg
);
pub
->
publish
(
msg
);
++
frame_id
;
}
else
{
}
else
{
RCLCPP_DEBUG
(
node_logger
,
"Skipping image #%zd"
,
i
)
RCLCPP_DEBUG
(
node_logger
,
"Skipping image #%zd"
,
i
)
}
}
...
...
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