mirror of
https://github.com/opencv/opencv.git
synced 2025-06-06 00:43:52 +08:00
videoio: remove cap_libv4l in favour of cap_v4l
cap_libv4l depends on an external library (libv4l) yet is still larger (1966 loc vs 1822 loc). It was initially introduced copy pasting cap_v4l in order to offload various color conversions to libv4l. However nowadays we handle most of the needed color conversions inside OpenCV. Our own implementation is better tested and (probably) also better performing. (as it can optionally leverage IPP/ OpenCL) Currently cap_v4l is better maintained and generally the code is in better shape. There is however an API difference in getting unconverted frames: * on cap_libv4l one need to set `CV_CAP_MODE_GRAY=1` or `CV_CAP_MODE_YUYV=1` * on cap_v4l one needs to set `CV_CAP_PROP_CONVERT_RGB=0` the latter is more flexible though as it also allows accessing undecoded JPEG images. fixes #4563
This commit is contained in:
parent
5459c11e99
commit
0d65397ae7
@ -259,7 +259,6 @@ OCV_OPTION(WITH_OPENMP "Include OpenMP support" OFF
|
||||
OCV_OPTION(WITH_PTHREADS_PF "Use pthreads-based parallel_for" ON IF (NOT WIN32 OR MINGW) )
|
||||
OCV_OPTION(WITH_TIFF "Include TIFF support" ON IF (NOT IOS) )
|
||||
OCV_OPTION(WITH_V4L "Include Video 4 Linux support" ON IF (UNIX AND NOT ANDROID AND NOT APPLE) )
|
||||
OCV_OPTION(WITH_LIBV4L "Use libv4l for Video 4 Linux support" OFF IF (UNIX AND NOT ANDROID AND NOT APPLE) )
|
||||
OCV_OPTION(WITH_DSHOW "Build VideoIO with DirectShow support" ON IF (WIN32 AND NOT ARM AND NOT WINRT) )
|
||||
OCV_OPTION(WITH_MSMF "Build VideoIO with Media Foundation support" ON IF WIN32 )
|
||||
OCV_OPTION(WITH_XIMEA "Include XIMEA cameras support" OFF IF (NOT ANDROID AND NOT WINRT) )
|
||||
@ -1304,10 +1303,8 @@ if(APPLE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WITH_V4L OR WITH_LIBV4L OR HAVE_LIBV4L OR HAVE_CAMV4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO)
|
||||
status(" libv4l/libv4l2:" HAVE_LIBV4L THEN "${ALIASOF_libv4l1_VERSION} / ${ALIASOF_libv4l2_VERSION}" ELSE "NO")
|
||||
if(WITH_V4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO)
|
||||
ocv_build_features_string(v4l_status
|
||||
IF HAVE_CAMV4L THEN "linux/videodev.h"
|
||||
IF HAVE_CAMV4L2 THEN "linux/videodev2.h"
|
||||
IF HAVE_VIDEOIO THEN "sys/videoio.h"
|
||||
ELSE "NO")
|
||||
|
@ -156,18 +156,8 @@ if(WITH_XINE)
|
||||
endif(WITH_XINE)
|
||||
|
||||
# --- V4L ---
|
||||
ocv_clear_vars(HAVE_LIBV4L HAVE_CAMV4L HAVE_CAMV4L2 HAVE_VIDEOIO)
|
||||
ocv_clear_vars(HAVE_CAMV4L2 HAVE_VIDEOIO)
|
||||
if(WITH_V4L)
|
||||
if(WITH_LIBV4L)
|
||||
CHECK_MODULE(libv4l1 HAVE_LIBV4L1 VIDEOIO)
|
||||
CHECK_MODULE(libv4l2 HAVE_LIBV4L2 VIDEOIO)
|
||||
if(HAVE_LIBV4L1 AND HAVE_LIBV4L2)
|
||||
set(HAVE_LIBV4L YES)
|
||||
else()
|
||||
set(HAVE_LIBV4L NO)
|
||||
endif()
|
||||
endif()
|
||||
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)
|
||||
|
@ -116,9 +116,6 @@
|
||||
/* GDCM DICOM codec */
|
||||
#cmakedefine HAVE_GDCM
|
||||
|
||||
/* V4L/V4L2 capturing support via libv4l */
|
||||
#cmakedefine HAVE_LIBV4L
|
||||
|
||||
/* Microsoft Media Foundation Capture library */
|
||||
#cmakedefine HAVE_MSMF
|
||||
|
||||
|
@ -62,12 +62,11 @@ yum install cmake
|
||||
yum install python-devel numpy
|
||||
yum install gcc gcc-c++
|
||||
@endcode
|
||||
Next we need **GTK** support for GUI features, Camera support (libdc1394, libv4l), Media Support
|
||||
Next we need **GTK** support for GUI features, Camera support (libdc1394, v4l), Media Support
|
||||
(ffmpeg, gstreamer) etc.
|
||||
@code{.sh}
|
||||
yum install gtk2-devel
|
||||
yum install libdc1394-devel
|
||||
yum install libv4l-devel
|
||||
yum install ffmpeg-devel
|
||||
yum install gstreamer-plugins-base-devel
|
||||
@endcode
|
||||
|
@ -66,12 +66,11 @@ sudo apt-get install python-devel numpy
|
||||
sudo apt-get install gcc gcc-c++
|
||||
```
|
||||
|
||||
Next we need **GTK** support for GUI features, Camera support (libv4l), Media Support
|
||||
Next we need **GTK** support for GUI features, Camera support (v4l), Media Support
|
||||
(ffmpeg, gstreamer) etc.
|
||||
|
||||
```
|
||||
sudo apt-get install gtk2-devel
|
||||
sudo apt-get install libv4l-devel
|
||||
sudo apt-get install ffmpeg-devel
|
||||
sudo apt-get install gstreamer-plugins-base-devel
|
||||
```
|
||||
|
@ -105,9 +105,7 @@ if(HAVE_GSTREAMER)
|
||||
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_gstreamer.cpp)
|
||||
endif(HAVE_GSTREAMER)
|
||||
|
||||
if(HAVE_LIBV4L)
|
||||
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_libv4l.cpp)
|
||||
elseif(HAVE_CAMV4L2 OR HAVE_VIDEOIO)
|
||||
if(HAVE_CAMV4L2 OR HAVE_VIDEOIO)
|
||||
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_v4l.cpp)
|
||||
endif()
|
||||
|
||||
|
@ -89,7 +89,7 @@ See @ref videoio_overview for more information.
|
||||
enum VideoCaptureAPIs {
|
||||
CAP_ANY = 0, //!< Auto detect == 0
|
||||
CAP_VFW = 200, //!< Video For Windows (obsolete, removed)
|
||||
CAP_V4L = 200, //!< V4L/V4L2 capturing support via libv4l
|
||||
CAP_V4L = 200, //!< V4L/V4L2 capturing support
|
||||
CAP_V4L2 = CAP_V4L, //!< Same as CAP_V4L
|
||||
CAP_FIREWIRE = 300, //!< IEEE 1394 drivers
|
||||
CAP_FIREWARE = CAP_FIREWIRE, //!< Same value as CAP_FIREWIRE
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -82,7 +82,7 @@ static const struct VideoBackendInfo builtin_backends[] =
|
||||
// Linux, some Unix
|
||||
#if defined HAVE_CAMV4L2
|
||||
DECLARE_BACKEND(CAP_V4L2, "V4L2", MODE_CAPTURE_ALL),
|
||||
#elif defined HAVE_LIBV4L || defined HAVE_CAMV4L
|
||||
#elif defined HAVE_CAMV4L
|
||||
DECLARE_BACKEND(CAP_V4L, "V4L", MODE_CAPTURE_ALL),
|
||||
#endif
|
||||
|
||||
@ -493,7 +493,7 @@ void VideoCapture_create(CvCapture*& capture, Ptr<IVideoCapture>& icap, VideoCap
|
||||
default:
|
||||
CV_LOG_WARNING(NULL, "VideoCapture(filename=" << filename << ") was built without support of requested backendID=" << (int)api);
|
||||
break;
|
||||
#if defined HAVE_LIBV4L || defined HAVE_CAMV4L || defined HAVE_CAMV4L2 || defined HAVE_VIDEOIO
|
||||
#if defined HAVE_CAMV4L || defined HAVE_CAMV4L2 || defined HAVE_VIDEOIO
|
||||
case CAP_V4L:
|
||||
TRY_OPEN_LEGACY(cvCreateCameraCapture_V4L(filename.c_str()))
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user