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

fix compatibility with OpenCV 4.x #13

Merged
merged 3 commits into from
Aug 25, 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
10 changes: 7 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
# CMakeLists.txt has to be located in the project folder and cmake has to be
# executed from 'project/build' with 'cmake ../'.

cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 3.9)
project(frame_helper
VERSION 1.0
DESCRIPTION "Library for manipulating Rock Core image type")
find_package(Rock)
rock_init(frame_helper 1.0)
rock_init()

rock_opencv_autodetect(OPENCV_PACKAGE)
rock_standard_layout()
set(PROJECT_DESCRIPTION "Library for manipulating frames")
2 changes: 1 addition & 1 deletion bindings/ruby/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pkg_check_modules(TYPELIBRUBY "typelib_ruby")
if (TYPELIB_FOUND AND TYPELIBRUBY_FOUND AND GEM_FOUND)
rock_ruby_rice_extension(frame_helper_ruby SHARED
SOURCES FrameHelperRice.cpp
DEPS_PKGCONFIG rtt_typelib-$ENV{OROCOS_TARGET} typelib_ruby base-types)
DEPS_PKGCONFIG ${OPENCV_PACKAGE} rtt_typelib-$ENV{OROCOS_TARGET} typelib_ruby base-types)
target_link_libraries(frame_helper_ruby frame_helper ${GEM_LIBRARIES})
else()
if (NOT TYPELIB_FOUND)
Expand Down
5 changes: 2 additions & 3 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ rock_library(${PROJECT_NAME}
FrameHelper.h
FrameHelperTypes.h
FrameQImageConverter.h
DEPS_PKGCONFIG base-types opencv jpeg_conversion
DEPS_PLAIN
Boost_REGEX
DEPS_PKGCONFIG base-types ${OPENCV_PACKAGE} jpeg_conversion
DEPS_PLAIN Boost_REGEX
LIBS ${LIBV4l2_LIBRARIES} ${LIBV4l2C_LIBRARIES}
)
4 changes: 2 additions & 2 deletions src/FrameHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ namespace frame_helper
{
case MODE_RGB:
{
cv::Mat out = cv::imdecode(src.image,CV_LOAD_IMAGE_COLOR);
cv::Mat out = cv::imdecode(src.image,cv::IMREAD_COLOR);
dst.init(out.cols,out.rows,8,MODE_RGB);
cv::cvtColor(out,FrameHelper::convertToCvMat(dst),cv::COLOR_BGR2RGB);
break;
Expand All @@ -726,7 +726,7 @@ namespace frame_helper
//PNG --> BGR
case MODE_BGR:
{
cv::Mat out = cv::imdecode(src.image,CV_LOAD_IMAGE_COLOR);
cv::Mat out = cv::imdecode(src.image,cv::IMREAD_COLOR);
copyMatToFrame(out,dst);
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/FrameQImageConverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ namespace frame_helper
{
char *buffer = const_cast<char*>(pbuffer); // workaround for Mat non const constructor
const cv::Mat input(1,buffer_size,CV_8UC1,buffer); // ensure buffer will not be modified !!!
cv::Mat img = cv::imdecode(input,CV_LOAD_IMAGE_COLOR);
cv::Mat img = cv::imdecode(input, cv::IMREAD_COLOR);
dst = QImage((const uchar*)img.data,img.cols,img.rows,QImage::Format_RGB888);
dst = dst.rgbSwapped();
break;
Expand Down
2 changes: 1 addition & 1 deletion src/frame_helper.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ includedir=${prefix}/include
Name: @PROJECT_NAME@
Description: @PROJECT_DESCRIPTION@
Version: @PROJECT_VERSION@
Requires: opencv
Requires: @PKGCONFIG_REQUIRES@
Libs: -L${libdir} -l@PROJECT_NAME@
Cflags: -I${includedir}