OpenCV 2 compat

OpenCV 2 (at least in CentOS 7) has the imgproc.hpp header in
(opencv2/)imgproc/ subdirectory. Instead of tweaking the location,
include opencv.hpp directly if available (as it was before 2db2a73803).
This commit is contained in:
Martin Pulec
2023-06-08 14:52:36 +02:00
parent d207d6fa5b
commit 3d9bc677c8
3 changed files with 13 additions and 2 deletions

View File

@@ -1319,6 +1319,9 @@ if test "$opencv_req" != no; then
fi
if test "$opencv" = yes; then
AC_LANG_PUSH(C++)
AC_CHECK_HEADERS([opencv2/opencv.hpp])
AC_LANG_POP(C++)
# opencv_imgproc is commonly needed so make the check here
SAVED_LIBS=$LIBS
LIBS="$LIBS $OPENCV_LIBS"

View File

@@ -6,7 +6,7 @@
*/
/*
* Copyright (c) 2014 Fundació i2CAT, Internet I Innovació Digital a Catalunya
* Copyright (c) 2015-2021 CESNET, z. s. p. o.
* Copyright (c) 2015-2023 CESNET, z. s. p. o.
*
* Redistribution and use in source and binary forms, with or without
* modification, is permitted provided that the following conditions
@@ -54,8 +54,12 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
#pragma GCC diagnostic ignored "-Wcast-qual"
#ifdef HAVE_OPENCV2_OPENCV_HPP
#include <opencv2/opencv.hpp>
#else
#include <opencv2/imgproc.hpp>
#include <opencv2/imgproc/types_c.h>
#endif
#pragma GCC diagnostic pop
#include "capture_filter/resize_utils.h"

View File

@@ -4,7 +4,7 @@
* @author Martin Piatka <piatka@cesnet.cz>
*/
/*
* Copyright (c) 2014-2022 CESNET, z. s. p. o.
* Copyright (c) 2014-2023 CESNET, z. s. p. o.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -64,8 +64,12 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wcast-align"
#pragma GCC diagnostic ignored "-Wcast-qual"
#ifdef HAVE_OPENCV2_OPENCV_HPP
#include <opencv2/opencv.hpp>
#else
#include <opencv2/core/mat.hpp>
#include <opencv2/imgproc.hpp>
#endif
#pragma GCC diagnostic pop
#ifdef __SSSE3__