Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Noetic] Use opencv3 on buster #330

Merged
merged 4 commits into from
May 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions cv_bridge/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,26 @@ find_package(catkin REQUIRED COMPONENTS rosconsole sensor_msgs)

if(NOT ANDROID)
find_package(PythonLibs)
find_package(Boost REQUIRED python)

if(PYTHONLIBS_VERSION_STRING VERSION_LESS "3.8")
# Debian Buster
find_package(Boost REQUIRED python37)
else()
# Ubuntu Focal
find_package(Boost REQUIRED python)
endif()
else()
find_package(Boost REQUIRED)
endif()
find_package(OpenCV 4 REQUIRED

set(_opencv_version 4)
find_package(OpenCV 4 QUIET)
if(NOT OpenCV_FOUND)
message(STATUS "Did not find OpenCV 4, trying OpenCV 3")
set(_opencv_version 3)
endif()

find_package(OpenCV ${_opencv_version4} REQUIRED

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this contains a typo and should be ${_opencv_version} not '${_opencv_version4}'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Definitely. Linking to your PR #333

COMPONENTS
opencv_core
opencv_imgproc
Expand Down
5 changes: 5 additions & 0 deletions cv_bridge/src/module_opencv4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ static PyObject* failmsgp(const char *fmt, ...)

class NumpyAllocator : public MatAllocator
{
#if CV_MAJOR_VERSION == 3
protected:
typedef int AccessFlag;
#endif

public:
NumpyAllocator() { stdAllocator = Mat::getStdAllocator(); }
~NumpyAllocator() {}
Expand Down
1 change: 0 additions & 1 deletion cv_bridge/test/conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def test_encode_decode_cv2_compressed(self):
original = np.uint8(np.random.randint(0, 255, size=(h, w)))
else:
original = np.uint8(np.random.randint(0, 255, size=(h, w, channels)))
print(f)
compress_rosmsg = cvb_en.cv2_to_compressed_imgmsg(original, f)
newimg = cvb_de.compressed_imgmsg_to_cv2(compress_rosmsg)
self.assert_(original.dtype == newimg.dtype)
Expand Down