Skip to content

Commit 473a536

Browse files
committed
Initial commit.
0 parents  commit 473a536

35 files changed

+3807
-0
lines changed

.github/workflows/ci.yaml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# SPDX-FileCopyrightText: Czech Technical University in Prague
3+
4+
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).
5+
# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)
6+
7+
name: CI
8+
9+
# This determines when this workflow is run
10+
on:
11+
push:
12+
branches: "master"
13+
pull_request:
14+
branches: "*"
15+
16+
jobs:
17+
license_lint:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: REUSE Compliance Check
22+
uses: fsfe/reuse-action@v5
23+
industrial_ci:
24+
strategy:
25+
matrix:
26+
env:
27+
- ROS_DISTRO: melodic
28+
DOCKER_IMAGE: "ros:melodic-perception-bionic"
29+
AFTER_SETUP_UPSTREAM_WORKSPACE: "echo 'yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml' > /etc/ros/rosdep/sources.list.d/21-master.list && rosdep update --include-eol-distros --rosdistro melodic"
30+
- ROS_DISTRO: noetic
31+
ROS_REPO: testing
32+
DOCKER_IMAGE: "ros:noetic-perception-focal"
33+
os: ["ubuntu-24.04", "ubuntu-24.04-arm"]
34+
name: "${{ matrix.env.ROS_DISTRO }}-${{ matrix.os }}"
35+
env:
36+
CCACHE_DIR: ${{ github.workspace }}/.ccache # Directory for ccache (and how we enable ccache in industrial_ci)
37+
runs-on: ${{ matrix.os }}
38+
steps:
39+
- uses: actions/checkout@v4
40+
# This step will fetch/store the directory used by ccache before/after the ci run
41+
- name: Cache ccache
42+
uses: rhaschke/cache@main
43+
with:
44+
path: ${{ env.CCACHE_DIR }}
45+
key: ccache-${{ matrix.os }}-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}-${{ github.sha }}-${{ github.run_id }}
46+
restore-keys: |
47+
ccache-${{ matrix.os }}-${{ matrix.env.ROS_DISTRO }}-${{ matrix.env.ROS_REPO }}-${{ github.sha }}
48+
ccache-${{ matrix.os }}-${{ matrix.env.ROS_DISTRO }}
49+
env:
50+
GHA_CACHE_SAVE: always
51+
# Run industrial_ci
52+
- uses: 'ros-industrial/industrial_ci@master'
53+
env: ${{ matrix.env }}

CMakeLists.txt

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# SPDX-License-Identifier: BSD-3-Clause
2+
# SPDX-FileCopyrightText: Czech Technical University in Prague
3+
4+
cmake_minimum_required(VERSION 3.10.2)
5+
project(cv_image_transport)
6+
7+
find_package(catkin REQUIRED COMPONENTS
8+
cras_cpp_common
9+
cras_topic_tools
10+
cv_bridge
11+
dynamic_reconfigure
12+
image_transport
13+
image_transport_codecs
14+
pluginlib
15+
sensor_msgs
16+
)
17+
18+
catkin_python_setup()
19+
20+
generate_dynamic_reconfigure_options(cfg/CVPublisher.cfg)
21+
22+
catkin_package(
23+
INCLUDE_DIRS include
24+
LIBRARIES cv_codec
25+
CATKIN_DEPENDS cras_cpp_common cras_topic_tools image_transport_codecs sensor_msgs
26+
)
27+
28+
include_directories(include ${catkin_INCLUDE_DIRS})
29+
30+
add_library(cv_codec src/cv_codec.cpp src/parse_compressed_format.cpp)
31+
target_link_libraries(cv_codec PUBLIC ${catkin_LIBRARIES})
32+
add_dependencies(cv_codec ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
33+
34+
add_library(cv_codec_plugin src/cv_codec_plugin.cpp)
35+
target_link_libraries(cv_codec_plugin ${catkin_LIBRARIES} cv_codec)
36+
add_dependencies(cv_codec_plugin ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
37+
38+
add_library(${PROJECT_NAME} src/cv_publisher.cpp src/cv_subscriber.cpp)
39+
target_link_libraries(${PROJECT_NAME} ${catkin_LIBRARIES} cv_codec)
40+
add_dependencies(${PROJECT_NAME} ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
41+
42+
install(TARGETS cv_codec cv_codec_plugin ${PROJECT_NAME}
43+
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
44+
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
45+
RUNTIME DESTINATION ${CATKIN_GLOBAL_BIN_DESTINATION}
46+
)
47+
48+
install(DIRECTORY include/${PROJECT_NAME}/
49+
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
50+
FILES_MATCHING PATTERN "*.h"
51+
)
52+
53+
install(FILES
54+
codec.xml
55+
transport.xml
56+
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
57+
)
58+
59+
if (CATKIN_ENABLE_TESTING)
60+
find_package(rosbag REQUIRED)
61+
find_package(roslaunch REQUIRED)
62+
find_package(roslint REQUIRED)
63+
find_package(rostest REQUIRED)
64+
65+
roslint_custom(catkin_lint "-W2" .)
66+
67+
# Roslint C++ - checks formatting and some other rules for C++ files
68+
file(GLOB_RECURSE ROSLINT_FILES include/*.h src/*.c src/*.cpp test/*.cpp)
69+
set(ROSLINT_CPP_OPTS "--extensions=h,hpp,hh,c,cpp,cc;--linelength=120;--filter=\
70+
-build/header_guard,-build/include,-readability/namespace,-whitespace/braces,-runtime/references,\
71+
-build/c++11,-readability/nolint,-readability/todo,-legal/copyright")
72+
roslint_cpp(${ROSLINT_FILES})
73+
74+
# Roslint C++ - checks formatting and some other rules for C++ files
75+
file(GLOB_RECURSE ROSLINT_PY_FILES src/*.py test/*.py)
76+
roslint_python(${ROSLINT_PY_FILES})
77+
78+
roslint_add_test()
79+
80+
include_directories(${rosbag_INCLUDE_DIRS})
81+
82+
catkin_add_gtest(test_codec test/test_codec.cpp)
83+
target_link_libraries(test_codec ${catkin_LIBRARIES} ${rosbag_LIBRARIES})
84+
add_dependencies(test_codec cv_codec_plugin)
85+
target_compile_definitions(test_codec PRIVATE TEST_DATA_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/test/data\")
86+
87+
catkin_add_nosetests(test/test_codec.py DEPENDENCIES cv_codec_plugin cv_codec ${catkin_EXPORTED_TARGETS})
88+
89+
add_rostest_gmock(test_${PROJECT_NAME} test/test_${PROJECT_NAME}.test test/test_${PROJECT_NAME}.cpp)
90+
target_link_libraries(test_${PROJECT_NAME} ${catkin_LIBRARIES} ${rosbag_LIBRARIES})
91+
add_dependencies(test_${PROJECT_NAME} ${PROJECT_NAME})
92+
target_compile_definitions(test_${PROJECT_NAME} PRIVATE TEST_DATA_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/test/data\")
93+
roslaunch_add_file_check(test/test_${PROJECT_NAME}.test USE_TEST_DEPENDENCIES)
94+
endif()

LICENSE

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
LICENSES/BSD-3-Clause.txt

LICENSES/BSD-3-Clause.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright (c) 2025 Czech Technical University in Prague.
2+
3+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4+
5+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6+
7+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8+
9+
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10+
11+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

LICENSES/CC0-1.0.txt

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
Creative Commons Legal Code
2+
3+
CC0 1.0 Universal
4+
5+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
6+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
7+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
8+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
9+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
10+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
11+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
12+
HEREUNDER.
13+
14+
Statement of Purpose
15+
16+
The laws of most jurisdictions throughout the world automatically confer
17+
exclusive Copyright and Related Rights (defined below) upon the creator
18+
and subsequent owner(s) (each and all, an "owner") of an original work of
19+
authorship and/or a database (each, a "Work").
20+
21+
Certain owners wish to permanently relinquish those rights to a Work for
22+
the purpose of contributing to a commons of creative, cultural and
23+
scientific works ("Commons") that the public can reliably and without fear
24+
of later claims of infringement build upon, modify, incorporate in other
25+
works, reuse and redistribute as freely as possible in any form whatsoever
26+
and for any purposes, including without limitation commercial purposes.
27+
These owners may contribute to the Commons to promote the ideal of a free
28+
culture and the further production of creative, cultural and scientific
29+
works, or to gain reputation or greater distribution for their Work in
30+
part through the use and efforts of others.
31+
32+
For these and/or other purposes and motivations, and without any
33+
expectation of additional consideration or compensation, the person
34+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
35+
is an owner of Copyright and Related Rights in the Work, voluntarily
36+
elects to apply CC0 to the Work and publicly distribute the Work under its
37+
terms, with knowledge of his or her Copyright and Related Rights in the
38+
Work and the meaning and intended legal effect of CC0 on those rights.
39+
40+
1. Copyright and Related Rights. A Work made available under CC0 may be
41+
protected by copyright and related or neighboring rights ("Copyright and
42+
Related Rights"). Copyright and Related Rights include, but are not
43+
limited to, the following:
44+
45+
i. the right to reproduce, adapt, distribute, perform, display,
46+
communicate, and translate a Work;
47+
ii. moral rights retained by the original author(s) and/or performer(s);
48+
iii. publicity and privacy rights pertaining to a person's image or
49+
likeness depicted in a Work;
50+
iv. rights protecting against unfair competition in regards to a Work,
51+
subject to the limitations in paragraph 4(a), below;
52+
v. rights protecting the extraction, dissemination, use and reuse of data
53+
in a Work;
54+
vi. database rights (such as those arising under Directive 96/9/EC of the
55+
European Parliament and of the Council of 11 March 1996 on the legal
56+
protection of databases, and under any national implementation
57+
thereof, including any amended or successor version of such
58+
directive); and
59+
vii. other similar, equivalent or corresponding rights throughout the
60+
world based on applicable law or treaty, and any national
61+
implementations thereof.
62+
63+
2. Waiver. To the greatest extent permitted by, but not in contravention
64+
of, applicable law, Affirmer hereby overtly, fully, permanently,
65+
irrevocably and unconditionally waives, abandons, and surrenders all of
66+
Affirmer's Copyright and Related Rights and associated claims and causes
67+
of action, whether now known or unknown (including existing as well as
68+
future claims and causes of action), in the Work (i) in all territories
69+
worldwide, (ii) for the maximum duration provided by applicable law or
70+
treaty (including future time extensions), (iii) in any current or future
71+
medium and for any number of copies, and (iv) for any purpose whatsoever,
72+
including without limitation commercial, advertising or promotional
73+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
74+
member of the public at large and to the detriment of Affirmer's heirs and
75+
successors, fully intending that such Waiver shall not be subject to
76+
revocation, rescission, cancellation, termination, or any other legal or
77+
equitable action to disrupt the quiet enjoyment of the Work by the public
78+
as contemplated by Affirmer's express Statement of Purpose.
79+
80+
3. Public License Fallback. Should any part of the Waiver for any reason
81+
be judged legally invalid or ineffective under applicable law, then the
82+
Waiver shall be preserved to the maximum extent permitted taking into
83+
account Affirmer's express Statement of Purpose. In addition, to the
84+
extent the Waiver is so judged Affirmer hereby grants to each affected
85+
person a royalty-free, non transferable, non sublicensable, non exclusive,
86+
irrevocable and unconditional license to exercise Affirmer's Copyright and
87+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
88+
maximum duration provided by applicable law or treaty (including future
89+
time extensions), (iii) in any current or future medium and for any number
90+
of copies, and (iv) for any purpose whatsoever, including without
91+
limitation commercial, advertising or promotional purposes (the
92+
"License"). The License shall be deemed effective as of the date CC0 was
93+
applied by Affirmer to the Work. Should any part of the License for any
94+
reason be judged legally invalid or ineffective under applicable law, such
95+
partial invalidity or ineffectiveness shall not invalidate the remainder
96+
of the License, and in such case Affirmer hereby affirms that he or she
97+
will not (i) exercise any of his or her remaining Copyright and Related
98+
Rights in the Work or (ii) assert any associated claims and causes of
99+
action with respect to the Work, in either case contrary to Affirmer's
100+
express Statement of Purpose.
101+
102+
4. Limitations and Disclaimers.
103+
104+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
105+
surrendered, licensed or otherwise affected by this document.
106+
b. Affirmer offers the Work as-is and makes no representations or
107+
warranties of any kind concerning the Work, express, implied,
108+
statutory or otherwise, including without limitation warranties of
109+
title, merchantability, fitness for a particular purpose, non
110+
infringement, or the absence of latent or other defects, accuracy, or
111+
the present or absence of errors, whether or not discoverable, all to
112+
the greatest extent permissible under applicable law.
113+
c. Affirmer disclaims responsibility for clearing rights of other persons
114+
that may apply to the Work or any use thereof, including without
115+
limitation any person's Copyright and Related Rights in the Work.
116+
Further, Affirmer disclaims responsibility for obtaining any necessary
117+
consents, permissions or other rights required for any use of the
118+
Work.
119+
d. Affirmer understands and acknowledges that Creative Commons is not a
120+
party to this document and has no duty or obligation with respect to
121+
this CC0 or use of the Work.

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<!--
2+
SPDX-License-Identifier: BSD-3-Clause
3+
SPDX-FileCopyrightText: Czech Technical University in Prague
4+
-->
5+
6+
# OpenCV Image Transport
7+
8+
This package provides ROS image transport "cv" which compresses images using OpenCV `imencode/imdecode` functions.
9+
10+
The `data` field of the `CompressedImage` messages can be directly stored as image files of the corresponding type and interpreted by other programs.
11+
12+
The JPEG and PNG encoding done by this package is the same as `compressed_image_transport`. For better compatibility, use that package if possible.
13+
14+
This image transport also provides the [image_transport_codecs](https://wiki.ros.org/image_transport_codecs) interface.
15+
This means it is possible to directly encode/decode images from C++/Python code without the need for going through
16+
a pub/sub cycle. You don't even need a ROS master for the conversion.
17+
18+
## C/C++ ABI stability
19+
20+
Currently, the package offers encoder options corresponding to `cv::imencode()` in version 4.12 and 5.0.0-alpha.
21+
The related C and C++ structs can change in the future as new `imencode` options will be added.
22+
23+
Make sure when using the C or C++ API directly to always update and rebuild both this and the dependent package at the
24+
same time. Otherwise, memory corruption and segfault errors can happen.
25+
26+
## Build Status
27+
28+
[![CI](https://github.com/ctu-vras/cv_image_transport/actions/workflows/ci.yaml/badge.svg)](https://github.com/ctu-vras/cv_image_transport/actions/workflows/ci.yaml)

0 commit comments

Comments
 (0)