diff --git a/CMakeLists.txt b/CMakeLists.txt index 0e5cd9ec03..c977f97662 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -722,7 +722,7 @@ if(DEFINED WITH_V4L) else() set(HAVE_CAMV4L_STR "NO") endif() - if(HAVE_CAMV4L2) + if(HAVE_CAMV4L2 OR HAVE_VIDEOIO) set(HAVE_CAMV4L2_STR "YES") else() set(HAVE_CAMV4L2_STR "NO") diff --git a/cmake/OpenCVFindLibsVideo.cmake b/cmake/OpenCVFindLibsVideo.cmake index fdc9ea27f7..cfa4dcab97 100644 --- a/cmake/OpenCVFindLibsVideo.cmake +++ b/cmake/OpenCVFindLibsVideo.cmake @@ -90,6 +90,7 @@ if(WITH_V4L) CHECK_MODULE(libv4l1 HAVE_LIBV4L) CHECK_INCLUDE_FILE(linux/videodev.h HAVE_CAMV4L) CHECK_INCLUDE_FILE(linux/videodev2.h HAVE_CAMV4L2) + CHECK_INCLUDE_FILE(sys/videoio.h HAVE_VIDEOIO) endif(WITH_V4L) # --- OpenNI --- diff --git a/cmake/templates/cvconfig.h.cmake b/cmake/templates/cvconfig.h.cmake index 368905fd9c..e44e1359a2 100644 --- a/cmake/templates/cvconfig.h.cmake +++ b/cmake/templates/cvconfig.h.cmake @@ -19,6 +19,9 @@ /* V4L2 capturing support */ #cmakedefine HAVE_CAMV4L2 +/* V4L2 capturing support in videoio.h */ +#cmakedefine HAVE_VIDEOIO + /* V4L/V4L2 capturing support via libv4l */ #cmakedefine HAVE_LIBV4L diff --git a/modules/highgui/CMakeLists.txt b/modules/highgui/CMakeLists.txt index b4b2896d7a..3c8f9ba9ab 100644 --- a/modules/highgui/CMakeLists.txt +++ b/modules/highgui/CMakeLists.txt @@ -131,7 +131,7 @@ endif(HAVE_UNICAP) if(HAVE_LIBV4L) list(APPEND highgui_srcs src/cap_libv4l.cpp) -elseif(HAVE_CAMV4L OR HAVE_CAMV4L2) +elseif(HAVE_CAMV4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO) list(APPEND highgui_srcs src/cap_v4l.cpp) endif() diff --git a/modules/highgui/src/cap.cpp b/modules/highgui/src/cap.cpp index f8d32e7eee..821478f1b3 100644 --- a/modules/highgui/src/cap.cpp +++ b/modules/highgui/src/cap.cpp @@ -173,6 +173,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) defined(HAVE_VFW) || \ defined(HAVE_LIBV4L) || \ (defined(HAVE_CAMV4L) && defined(HAVE_CAMV4L2)) || \ + defined(HAVE_VIDEOIO) || \ defined(HAVE_GSTREAMER) || \ defined(HAVE_DC1394_2) || \ defined(HAVE_DC1394) || \ @@ -216,7 +217,7 @@ CV_IMPL CvCapture * cvCreateCameraCapture (int index) return capture; #endif -#if defined HAVE_LIBV4L || (defined (HAVE_CAMV4L) && defined (HAVE_CAMV4L2)) +#if defined HAVE_LIBV4L || (defined (HAVE_CAMV4L) && defined (HAVE_CAMV4L2)) || defined HAVE_VIDEOIO capture = cvCreateCameraCapture_V4L (index); if (capture) return capture; diff --git a/modules/highgui/src/cap_v4l.cpp b/modules/highgui/src/cap_v4l.cpp index 2ab4567d15..33e0f386aa 100644 --- a/modules/highgui/src/cap_v4l.cpp +++ b/modules/highgui/src/cap_v4l.cpp @@ -202,7 +202,7 @@ make & enjoy! #include "precomp.hpp" -#if !defined WIN32 && defined HAVE_CAMV4L && defined HAVE_CAMV4L2 +#if !defined WIN32 && ((defined HAVE_CAMV4L && defined HAVE_CAMV4L2) || defined HAVE_VIDEOIO) #define CLEAR(x) memset (&(x), 0, sizeof (x)) @@ -227,6 +227,11 @@ make & enjoy! #include #endif +#ifdef HAVE_VIDEOIO +#include +#define HAVE_CAMV4L2 +#endif + /* Defaults - If your board can do better, set it here. Set for the most common type inputs. */ #define DEFAULT_V4L_WIDTH 640 #define DEFAULT_V4L_HEIGHT 480