Merge pull request #13422 from mshabunin:split-videoio-cmake

* Split videoio dependencies search into pieces, removed obsolete backends
pull/13534/head
Maksim Shabunin 6 years ago committed by Alexander Alekhin
parent e267342108
commit 73959fed45
  1. 73
      CMakeLists.txt
  2. 139
      cmake/FindGstreamerWindows.cmake
  3. 59
      cmake/OpenCVDetectMediaSDK.cmake
  4. 20
      cmake/OpenCVFindIntelPerCSDK.cmake
  5. 15
      cmake/OpenCVFindLibRealsense.cmake
  6. 289
      cmake/OpenCVFindLibsVideo.cmake
  7. 89
      cmake/OpenCVFindOpenNI.cmake
  8. 61
      cmake/OpenCVFindOpenNI2.cmake
  9. 52
      cmake/OpenCVFindXimea.cmake
  10. 2
      cmake/OpenCVGenConfig.cmake
  11. 8
      cmake/OpenCVUtils.cmake
  12. 68
      cmake/templates/cvconfig.h.in
  13. 2
      doc/tutorials/videoio/intelperc.markdown
  14. 8
      modules/video/perf/opencl/perf_bgfg_knn.cpp
  15. 8
      modules/video/perf/opencl/perf_bgfg_mog2.cpp
  16. 9
      modules/video/perf/perf_bgfg_knn.cpp
  17. 9
      modules/video/perf/perf_bgfg_mog2.cpp
  18. 8
      modules/video/test/ocl/test_bgfg_mog2.cpp
  19. 251
      modules/videoio/CMakeLists.txt
  20. 34
      modules/videoio/cmake/detect_aravis.cmake
  21. 18
      modules/videoio/cmake/detect_avfoundation.cmake
  22. 31
      modules/videoio/cmake/detect_dc1394.cmake
  23. 14
      modules/videoio/cmake/detect_dshow.cmake
  24. 66
      modules/videoio/cmake/detect_ffmpeg.cmake
  25. 13
      modules/videoio/cmake/detect_gphoto.cmake
  26. 101
      modules/videoio/cmake/detect_gstreamer.cmake
  27. 15
      modules/videoio/cmake/detect_ios.cmake
  28. 47
      modules/videoio/cmake/detect_msdk.cmake
  29. 25
      modules/videoio/cmake/detect_msmf.cmake
  30. 49
      modules/videoio/cmake/detect_openni2.cmake
  31. 23
      modules/videoio/cmake/detect_pvapi.cmake
  32. 28
      modules/videoio/cmake/detect_realsense.cmake
  33. 19
      modules/videoio/cmake/detect_v4l.cmake
  34. 29
      modules/videoio/cmake/detect_ximea.cmake
  35. 12
      modules/videoio/cmake/detect_xine.cmake
  36. 40
      modules/videoio/cmake/init.cmake
  37. 3
      modules/videoio/include/opencv2/videoio.hpp
  38. 4
      modules/videoio/perf/perf_input.cpp
  39. 7
      modules/videoio/perf/perf_output.cpp
  40. 6
      modules/videoio/src/cap_avfoundation.mm
  41. 4
      modules/videoio/src/cap_avfoundation_mac.mm
  42. 1113
      modules/videoio/src/cap_dc1394.cpp
  43. 5
      modules/videoio/src/cap_dshow.cpp
  44. 764
      modules/videoio/src/cap_giganetix.cpp
  45. 227
      modules/videoio/src/cap_gstreamer.cpp
  46. 634
      modules/videoio/src/cap_intelperc.cpp
  47. 115
      modules/videoio/src/cap_intelperc.hpp
  48. 3
      modules/videoio/src/cap_msmf.cpp
  49. 1236
      modules/videoio/src/cap_openni.cpp
  50. 41
      modules/videoio/src/videoio_registry.cpp
  51. 18
      modules/videoio/test/test_video_io.cpp
  52. 3
      modules/world/CMakeLists.txt

@ -221,10 +221,13 @@ OCV_OPTION(BUILD_ITT "Build Intel ITT from source" (NOT MI
# ===================================================
OCV_OPTION(WITH_1394 "Include IEEE1394 support" ON
VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
VERIFY HAVE_DC1394)
VERIFY HAVE_DC1394_2)
OCV_OPTION(WITH_AVFOUNDATION "Use AVFoundation for Video I/O (iOS/Mac)" ON
VISIBLE_IF APPLE
VERIFY HAVE_AVFOUNDATION)
OCV_OPTION(WITH_CAP_IOS "Enable iOS video capture" ON
VISIBLE_IF IOS
VERIFY HAVE_CAP_IOS)
OCV_OPTION(WITH_CAROTENE "Use NVidia carotene acceleration library for ARM platform" ON
VISIBLE_IF (ARM OR AARCH64) AND NOT IOS AND NOT (CMAKE_VERSION VERSION_LESS "2.8.11"))
OCV_OPTION(WITH_CPUFEATURES "Use cpufeatures Android library" ON
@ -253,10 +256,7 @@ OCV_OPTION(WITH_FFMPEG "Include FFMPEG support" ON
VERIFY HAVE_FFMPEG)
OCV_OPTION(WITH_GSTREAMER "Include Gstreamer support" ON
VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
VERIFY HAVE_GSTREAMER AND GSTREAMER_BASE_VERSION VERSION_GREATER "0.99")
OCV_OPTION(WITH_GSTREAMER_0_10 "Enable Gstreamer 0.10 support (instead of 1.x)" OFF
VISIBLE_IF TRUE
VERIFY HAVE_GSTREAMER AND GSTREAMER_BASE_VERSION VERSION_LESS "1.0")
VERIFY HAVE_GSTREAMER AND GSTREAMER_VERSION VERSION_GREATER "0.99")
OCV_OPTION(WITH_GTK "Include GTK support" ON
VISIBLE_IF UNIX AND NOT APPLE AND NOT ANDROID
VERIFY HAVE_GTK)
@ -308,9 +308,6 @@ OCV_OPTION(WITH_GDCM "Include DICOM support" OFF
OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" OFF
VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
VERIFY HAVE_PVAPI)
OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" OFF
VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT
VERIFY HAVE_GIGE_API)
OCV_OPTION(WITH_ARAVIS "Include Aravis GigE support" OFF
VISIBLE_IF NOT ANDROID AND NOT IOS AND NOT WINRT AND NOT WIN32
VERIFY HAVE_ARAVIS_API)
@ -371,9 +368,6 @@ OCV_OPTION(WITH_OPENCLAMDBLAS "Include AMD OpenCL BLAS library support" ON
OCV_OPTION(WITH_DIRECTX "Include DirectX support" ON
VISIBLE_IF WIN32 AND NOT WINRT
VERIFY HAVE_DIRECTX)
OCV_OPTION(WITH_INTELPERC "Include Intel Perceptual Computing support" OFF
VISIBLE_IF WIN32 AND NOT WINRT
VERIFY HAVE_INTELPERC)
OCV_OPTION(WITH_LIBREALSENSE "Include Intel librealsense support" OFF
VISIBLE_IF NOT WITH_INTELPERC
VERIFY HAVE_LIBREALSENSE)
@ -1351,7 +1345,7 @@ if(WITH_GDAL OR HAVE_GDAL)
endif()
if(WITH_GDCM OR HAVE_GDCM)
status(" GDCM:" HAVE_GDCM THEN "YES (ver ${GDCM_VERSION})" ELSE "NO")
status(" GDCM:" HAVE_GDCM THEN "YES (${GDCM_VERSION})" ELSE "NO")
endif()
if(WITH_IMGCODEC_HDR OR DEFINED HAVE_IMGCODEC_HDR)
@ -1375,11 +1369,7 @@ status("")
status(" Video I/O:")
if(WITH_1394 OR HAVE_DC1394_2)
if (HAVE_DC1394_2)
status(" DC1394:" "YES (ver ${ALIASOF_libdc1394-2_VERSION})")
else()
status(" DC1394:" "NO")
endif()
status(" DC1394:" HAVE_DC1394_2 THEN "YES (${DC1394_2_VERSION})" ELSE NO)
endif()
if(WITH_FFMPEG OR HAVE_FFMPEG)
@ -1390,58 +1380,43 @@ if(WITH_FFMPEG OR HAVE_FFMPEG)
else()
status(" FFMPEG:" HAVE_FFMPEG THEN YES ELSE NO)
endif()
status(" avcodec:" FFMPEG_libavcodec_FOUND THEN "YES (ver ${FFMPEG_libavcodec_VERSION})" ELSE NO)
status(" avformat:" FFMPEG_libavformat_FOUND THEN "YES (ver ${FFMPEG_libavformat_VERSION})" ELSE NO)
status(" avutil:" FFMPEG_libavutil_FOUND THEN "YES (ver ${FFMPEG_libavutil_VERSION})" ELSE NO)
status(" swscale:" FFMPEG_libswscale_FOUND THEN "YES (ver ${FFMPEG_libswscale_VERSION})" ELSE NO)
status(" avresample:" FFMPEG_libavresample_FOUND THEN "YES (ver ${FFMPEG_libavresample_VERSION})" ELSE NO)
status(" avcodec:" FFMPEG_libavcodec_VERSION THEN "YES (${FFMPEG_libavcodec_VERSION})" ELSE NO)
status(" avformat:" FFMPEG_libavformat_VERSION THEN "YES (${FFMPEG_libavformat_VERSION})" ELSE NO)
status(" avutil:" FFMPEG_libavutil_VERSION THEN "YES (${FFMPEG_libavutil_VERSION})" ELSE NO)
status(" swscale:" FFMPEG_libswscale_VERSION THEN "YES (${FFMPEG_libswscale_VERSION})" ELSE NO)
status(" avresample:" FFMPEG_libavresample_VERSION THEN "YES (${FFMPEG_libavresample_VERSION})" ELSE NO)
endif()
if(WITH_GSTREAMER OR HAVE_GSTREAMER)
status(" GStreamer:" HAVE_GSTREAMER THEN "" ELSE NO)
if(HAVE_GSTREAMER)
status(" base:" "YES (ver ${GSTREAMER_BASE_VERSION})")
status(" video:" "YES (ver ${GSTREAMER_VIDEO_VERSION})")
status(" app:" "YES (ver ${GSTREAMER_APP_VERSION})")
status(" riff:" "YES (ver ${GSTREAMER_RIFF_VERSION})")
status(" pbutils:" "YES (ver ${GSTREAMER_PBUTILS_VERSION})")
endif(HAVE_GSTREAMER)
endif()
if(WITH_OPENNI OR HAVE_OPENNI)
status(" OpenNI:" HAVE_OPENNI THEN "YES (ver ${OPENNI_VERSION_STRING}, build ${OPENNI_VERSION_BUILD})" ELSE NO)
status(" OpenNI PrimeSensor Modules:" HAVE_OPENNI_PRIME_SENSOR_MODULE THEN "YES (${OPENNI_PRIME_SENSOR_MODULE})" ELSE NO)
status(" GStreamer:" HAVE_GSTREAMER THEN "YES (${GSTREAMER_VERSION})" ELSE NO)
endif()
if(WITH_OPENNI2 OR HAVE_OPENNI2)
status(" OpenNI2:" HAVE_OPENNI2 THEN "YES (ver ${OPENNI2_VERSION_STRING}, build ${OPENNI2_VERSION_BUILD})" ELSE NO)
status(" OpenNI2:" HAVE_OPENNI2 THEN "YES (${OPENNI2_VERSION})" ELSE NO)
endif()
if(WITH_PVAPI OR HAVE_PVAPI)
status(" PvAPI:" HAVE_PVAPI THEN YES ELSE NO)
endif()
if(WITH_GIGEAPI OR HAVE_GIGE_API)
status(" GigEVisionSDK:" HAVE_GIGE_API THEN YES ELSE NO)
endif()
if(WITH_ARAVIS OR HAVE_ARAVIS_API)
status(" Aravis SDK:" HAVE_ARAVIS_API THEN "YES (${ARAVIS_LIBRARIES})" ELSE NO)
status(" Aravis SDK:" HAVE_ARAVIS_API THEN "YES (${ARAVIS_VERSION})" ELSE NO)
endif()
if(APPLE)
if(WITH_AVFOUNDATION OR HAVE_AVFOUNDATION)
status(" AVFoundation:" HAVE_AVFOUNDATION THEN YES ELSE NO)
if(WITH_QUICKTIME OR HAVE_QUICKTIME)
status(" QuickTime:" HAVE_QUICKTIME THEN YES ELSE NO)
endif()
if(HAVE_CAP_IOS)
status(" iOS capture:" YES)
endif()
if(WITH_V4L OR HAVE_CAMV4L2 OR HAVE_VIDEOIO)
if(WITH_V4L OR HAVE_V4L)
ocv_build_features_string(v4l_status
IF HAVE_CAMV4L2 THEN "linux/videodev2.h"
IF HAVE_VIDEOIO THEN "sys/videoio.h"
ELSE "NO")
status(" v4l/v4l2:" "${v4l_status}")
status(" v4l/v4l2:" HAVE_V4L THEN "YES (${v4l_status})" ELSE NO)
endif()
if(WITH_DSHOW OR HAVE_DSHOW)
@ -1458,11 +1433,11 @@ if(WITH_XIMEA OR HAVE_XIMEA)
endif()
if(WITH_XINE OR HAVE_XINE)
status(" Xine:" HAVE_XINE THEN "YES (ver ${ALIASOF_libxine_VERSION})" ELSE NO)
status(" Xine:" HAVE_XINE THEN "YES (${XINE_VERSION})" ELSE NO)
endif()
if(WITH_INTELPERC OR HAVE_INTELPERC)
status(" Intel PerC:" HAVE_INTELPERC THEN "YES" ELSE NO)
if(WITH_LIBREALSENSE OR HAVE_LIBREALSENSE)
status(" Intel RealSense:" HAVE_LIBREALSENSE THEN "YES (${LIBREALSENSE_VERSION})" ELSE NO)
endif()
if(WITH_MFX OR HAVE_MFX)

@ -1,139 +0,0 @@
FILE(TO_CMAKE_PATH "$ENV{GSTREAMER_DIR}" TRY1_DIR)
FILE(TO_CMAKE_PATH "${GSTREAMER_DIR}" TRY2_DIR)
FILE(GLOB GSTREAMER_DIR ${TRY1_DIR} ${TRY2_DIR})
FIND_PATH(GSTREAMER_gst_INCLUDE_DIR gst/gst.h
PATHS ${GSTREAMER_DIR}/include/gstreamer-1.0 ${GSTREAMER_DIR}/include /usr/local/include/gstreamer-1.0 /usr/include/gstreamer-1.0
ENV INCLUDE DOC "Directory containing gst/gst.h include file")
FIND_PATH(GSTREAMER_glib_INCLUDE_DIR glib.h
PATHS ${GSTREAMER_DIR}/include/glib-2.0/
ENV INCLUDE DOC "Directory containing glib.h include file")
FIND_PATH(GSTREAMER_glibconfig_INCLUDE_DIR glibconfig.h
PATHS ${GSTREAMER_DIR}/lib/glib-2.0/include
ENV INCLUDE DOC "Directory containing glibconfig.h include file")
FIND_PATH(GSTREAMER_gstconfig_INCLUDE_DIR gst/gstconfig.h
PATHS ${GSTREAMER_DIR}/lib/gstreamer-1.0/include ${GSTREAMER_DIR}/include ${GSTREAMER_DIR}/include/gstreamer-1.0 ${GSTREAMER_DIR}/lib/include /usr/local/include/gstreamer-1.0 /usr/include/gstreamer-1.0 /usr/local/lib/include/gstreamer-1.0 /usr/lib/include/gstreamer-1.0
ENV INCLUDE DOC "Directory containing gst/gstconfig.h include file")
FIND_LIBRARY(GSTREAMER_gstaudio_LIBRARY NAMES gstaudio libgstaudio-1.0 gstaudio-1.0
PATHS ${GSTREMAER_DIR}/lib ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstaudio library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gstapp_LIBRARY NAMES gstapp libgstapp-1.0 gstapp-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstapp library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gstbase_LIBRARY NAMES gstbase libgstbase-1.0 gstbase-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstbase library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GLIB_gstcdda_LIBRARY NAMES gstcdda libgstcdda-1.0 gstcdda-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstcdda library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gstcontroller_LIBRARY NAMES gstcontroller libgstcontroller-1.0 gstcontroller-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstcontroller library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gstnet_LIBRARY NAMES gstnet libgstnet-1.0 gstnet-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstnet library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gstpbutils_LIBRARY NAMES gstpbutils libgstpbutils-1.0 gstpbutils-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstpbutils library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gstreamer_LIBRARY NAMES gstreamer libgstreamer-1.0 gstreamer-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstreamer library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gstriff_LIBRARY NAMES gstriff libgstriff-1.0 gstriff-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstriff library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gstrtp_LIBRARY NAMES gstrtp libgstrtp-1.0 gstrtp-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstrtp library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gstrtsp_LIBRARY NAMES gstrtsp libgstrtsp-1.0 gstrtsp-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstrtsp library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gstsdp_LIBRARY NAMES gstsdp libgstsdp-1.0 gstsdp-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstsdp library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gsttag_LIBRARY NAMES gsttag libgsttag-1.0 gsttag-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gsttag library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GSTREAMER_gstvideo_LIBRARY NAMES gstvideo libgstvideo-1.0 gstvideo-1.0
PATHS ${GSTREAMER_DIR}/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/bin ${GSTREAMER_DIR}/bin/bin C:/gstreamer/bin ${GSTREAMER_DIR}/lib ${GSTREAMER_DIR}/win32/lib /usr/local/lib /usr/lib
ENV LIB
DOC "gstvideo library to link with"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GLIB_LIBRARY NAMES libglib-2.0 glib-2.0
PATHS ${GSTREAMER_DIR}/lib
ENV LIB
DOC "Glib library"
NO_SYSTEM_ENVIRONMENT_PATH)
FIND_LIBRARY(GOBJECT_LIBRARY NAMES libobject-2.0 gobject-2.0
PATHS ${GSTREAMER_DIR}/lib
ENV LIB
DOC "Glib library"
NO_SYSTEM_ENVIRONMENT_PATH)
IF (GSTREAMER_gst_INCLUDE_DIR AND GSTREAMER_gstconfig_INCLUDE_DIR AND
GSTREAMER_gstaudio_LIBRARY AND GSTREAMER_gstbase_LIBRARY AND GSTREAMER_gstcontroller_LIBRARY AND GSTREAMER_gstnet_LIBRARY
AND GSTREAMER_gstpbutils_LIBRARY AND GSTREAMER_gstreamer_LIBRARY AND
GSTREAMER_gstriff_LIBRARY AND GSTREAMER_gstrtp_LIBRARY AND GSTREAMER_gstrtsp_LIBRARY AND GSTREAMER_gstsdp_LIBRARY AND
GSTREAMER_gsttag_LIBRARY AND GSTREAMER_gstvideo_LIBRARY AND GLIB_LIBRARY AND GSTREAMER_gstapp_LIBRARY AND GOBJECT_LIBRARY)
SET(GSTREAMER_INCLUDE_DIR ${GSTREAMER_gst_INCLUDE_DIR} ${GSTREAMER_gstconfig_INCLUDE_DIR} ${GSTREAMER_glib_INCLUDE_DIR} ${GSTREAMER_glibconfig_INCLUDE_DIR})
list(REMOVE_DUPLICATES GSTREAMER_INCLUDE_DIR)
SET(GSTREAMER_LIBRARIES ${GSTREAMER_gstaudio_LIBRARY} ${GSTREAMER_gstbase_LIBRARY}
${GSTREAMER_gstcontroller_LIBRARY} ${GSTREAMER_gstdataprotocol_LIBRARY} ${GSTREAMER_gstinterfaces_LIBRARY}
${GSTREAMER_gstnet_LIBRARY} ${GSTREAMER_gstpbutils_LIBRARY}
${GSTREAMER_gstreamer_LIBRARY} ${GSTREAMER_gstriff_LIBRARY} ${GSTREAMER_gstrtp_LIBRARY}
${GSTREAMER_gstrtsp_LIBRARY} ${GSTREAMER_gstsdp_LIBRARY} ${GSTREAMER_gsttag_LIBRARY} ${GSTREAMER_gstvideo_LIBRARY} ${GLIB_LIBRARY}
${GSTREAMER_gstapp_LIBRARY} ${GOBJECT_LIBRARY})
list(REMOVE_DUPLICATES GSTREAMER_LIBRARIES)
SET(GSTREAMER_FOUND TRUE)
ENDIF (GSTREAMER_gst_INCLUDE_DIR AND GSTREAMER_gstconfig_INCLUDE_DIR AND
GSTREAMER_gstaudio_LIBRARY AND GSTREAMER_gstbase_LIBRARY AND GSTREAMER_gstcontroller_LIBRARY
AND GSTREAMER_gstnet_LIBRARY AND GSTREAMER_gstpbutils_LIBRARY AND GSTREAMER_gstreamer_LIBRARY AND
GSTREAMER_gstriff_LIBRARY AND GSTREAMER_gstrtp_LIBRARY AND GSTREAMER_gstrtsp_LIBRARY AND GSTREAMER_gstsdp_LIBRARY AND
GSTREAMER_gsttag_LIBRARY AND GSTREAMER_gstvideo_LIBRARY AND GLIB_LIBRARY AND GSTREAMER_gstapp_LIBRARY AND GOBJECT_LIBRARY)

@ -1,59 +0,0 @@
set(HAVE_MFX 0)
if (UNIX)
set(root "$ENV{MFX_HOME}")
elseif(WIN32)
set(root "$ENV{INTELMEDIASDKROOT}")
endif()
# TODO: ICC? MINGW? ARM? IOS?
if(WIN32)
if(X86_64)
set(arch "x64")
else()
set(arch "win32")
endif()
elseif(UNIX)
set(arch "lin_x64")
else()
# ???
endif()
find_path(MFX_INCLUDE mfxdefs.h PATHS "${root}/include" NO_DEFAULT_PATH)
message(STATUS "MFX_INCLUDE: ${MFX_INCLUDE} (${root}/include)")
find_library(MFX_LIBRARY NAMES mfx PATHS "${root}/lib/${arch}" NO_DEFAULT_PATH)
if(MSVC)
if(MSVC14)
find_library(MFX_LIBRARY NAMES libmfx_vs2015.lib PATHS "${root}/lib/${arch}" NO_DEFAULT_PATH)
else()
find_library(MFX_LIBRARY NAMES libmfx.lib PATHS "${root}/lib/${arch}" NO_DEFAULT_PATH)
endif()
endif()
if(NOT MFX_INCLUDE OR NOT MFX_LIBRARY)
return()
endif()
set(deps)
if (UNIX)
find_library(MFX_VA_LIBRARY va)
find_library(MFX_VA_DRM_LIBRARY va-drm)
if (NOT MFX_VA_LIBRARY OR NOT MFX_VA_DRM_LIBRARY)
return()
endif()
add_library(mfx-va UNKNOWN IMPORTED)
set_target_properties(mfx-va PROPERTIES IMPORTED_LOCATION "${MFX_VA_LIBRARY}")
add_library(mfx-va-drm UNKNOWN IMPORTED)
set_target_properties(mfx-va-drm PROPERTIES IMPORTED_LOCATION "${MFX_VA_DRM_LIBRARY}")
list(APPEND deps mfx-va mfx-va-drm "-Wl,--exclude-libs=libmfx")
endif()
add_library(mfx UNKNOWN IMPORTED)
set_target_properties(mfx PROPERTIES
IMPORTED_LOCATION "${MFX_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${MFX_INCLUDE}"
INTERFACE_LINK_LIBRARIES "${deps}"
)
set(HAVE_MFX 1)

@ -1,20 +0,0 @@
# Main variables:
# INTELPERC_LIBRARIES and INTELPERC_INCLUDE to link Intel Perceptial Computing SDK modules
# HAVE_INTELPERC for conditional compilation OpenCV with/without Intel Perceptial Computing SDK
if(X86_64)
find_path(INTELPERC_INCLUDE_DIR "pxcsession.h" PATHS "$ENV{PCSDK_DIR}include" DOC "Path to Intel Perceptual Computing SDK interface headers")
find_file(INTELPERC_LIBRARIES "libpxc.lib" PATHS "$ENV{PCSDK_DIR}lib/x64" DOC "Path to Intel Perceptual Computing SDK interface libraries")
else()
find_path(INTELPERC_INCLUDE_DIR "pxcsession.h" PATHS "$ENV{PCSDK_DIR}include" DOC "Path to Intel Perceptual Computing SDK interface headers")
find_file(INTELPERC_LIBRARIES "libpxc.lib" PATHS "$ENV{PCSDK_DIR}lib/Win32" DOC "Path to Intel Perceptual Computing SDK interface libraries")
endif()
if(INTELPERC_INCLUDE_DIR AND INTELPERC_LIBRARIES)
set(HAVE_INTELPERC TRUE)
else()
set(HAVE_INTELPERC FALSE)
message(WARNING "Intel Perceptual Computing SDK library directory (set by INTELPERC_LIB_DIR variable) is not found or does not have Intel Perceptual Computing SDK libraries.")
endif() #if(INTELPERC_INCLUDE_DIR AND INTELPERC_LIBRARIES)
mark_as_advanced(FORCE INTELPERC_LIBRARIES INTELPERC_INCLUDE_DIR)

@ -1,15 +0,0 @@
# Main variables:
# LIBREALSENSE_LIBRARIES and LIBREALSENSE_INCLUDE to link Intel librealsense modules
# HAVE_LIBREALSENSE for conditional compilation OpenCV with/without librealsense
find_path(LIBREALSENSE_INCLUDE_DIR "librealsense2/rs.hpp" PATHS "$ENV{LIBREALSENSE_INCLUDE}" DOC "Path to librealsense interface headers")
find_library(LIBREALSENSE_LIBRARIES "realsense2" PATHS "$ENV{LIBREALSENSE_LIB}" DOC "Path to librealsense interface libraries")
if(LIBREALSENSE_INCLUDE_DIR AND LIBREALSENSE_LIBRARIES)
set(HAVE_LIBREALSENSE TRUE)
else()
set(HAVE_LIBREALSENSE FALSE)
message( WARNING, " librealsense include directory (set by LIBREALSENSE_INCLUDE_DIR variable) is not found or does not have librealsense include files." )
endif() #if(LIBREALSENSE_INCLUDE_DIR AND LIBREALSENSE_LIBRARIES)
mark_as_advanced(FORCE LIBREALSENSE_LIBRARIES LIBREALSENSE_INCLUDE_DIR)

@ -1,297 +1,8 @@
# ----------------------------------------------------------------------------
# Detect 3rd-party video IO libraries
# ----------------------------------------------------------------------------
# --- GStreamer ---
ocv_clear_vars(HAVE_GSTREAMER)
# try to find gstreamer 1.x first if 0.10 was not requested
if(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10)
if(WIN32)
SET(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_LIST_DIR}")
FIND_PACKAGE(GstreamerWindows)
IF(GSTREAMER_gstbase_LIBRARY AND GSTREAMER_gstvideo_LIBRARY AND GSTREAMER_gstapp_LIBRARY AND GSTREAMER_gstpbutils_LIBRARY AND GSTREAMER_gstriff_LIBRARY)
set(HAVE_GSTREAMER TRUE)
set(GSTREAMER_BASE_VERSION 1.0)
set(GSTREAMER_VIDEO_VERSION 1.0)
set(GSTREAMER_APP_VERSION 1.0)
set(GSTREAMER_RIFF_VERSION 1.0)
set(GSTREAMER_PBUTILS_VERSION 1.0)
ENDIF(GSTREAMER_gstbase_LIBRARY AND GSTREAMER_gstvideo_LIBRARY AND GSTREAMER_gstapp_LIBRARY AND GSTREAMER_gstpbutils_LIBRARY AND GSTREAMER_gstriff_LIBRARY)
else(WIN32)
CHECK_MODULE(gstreamer-base-1.0 HAVE_GSTREAMER_BASE VIDEOIO)
CHECK_MODULE(gstreamer-video-1.0 HAVE_GSTREAMER_VIDEO VIDEOIO)
CHECK_MODULE(gstreamer-app-1.0 HAVE_GSTREAMER_APP VIDEOIO)
CHECK_MODULE(gstreamer-riff-1.0 HAVE_GSTREAMER_RIFF VIDEOIO)
CHECK_MODULE(gstreamer-pbutils-1.0 HAVE_GSTREAMER_PBUTILS VIDEOIO)
if(HAVE_GSTREAMER_BASE AND HAVE_GSTREAMER_VIDEO AND HAVE_GSTREAMER_APP AND HAVE_GSTREAMER_RIFF AND HAVE_GSTREAMER_PBUTILS)
set(HAVE_GSTREAMER TRUE)
set(GSTREAMER_BASE_VERSION ${ALIASOF_gstreamer-base-1.0_VERSION})
set(GSTREAMER_VIDEO_VERSION ${ALIASOF_gstreamer-video-1.0_VERSION})
set(GSTREAMER_APP_VERSION ${ALIASOF_gstreamer-app-1.0_VERSION})
set(GSTREAMER_RIFF_VERSION ${ALIASOF_gstreamer-riff-1.0_VERSION})
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-1.0_VERSION})
endif()
endif(WIN32)
endif(WITH_GSTREAMER AND NOT WITH_GSTREAMER_0_10)
# if gstreamer 1.x was not found, or we specified we wanted 0.10, try to find it
if(WITH_GSTREAMER AND NOT HAVE_GSTREAMER OR WITH_GSTREAMER_0_10)
CHECK_MODULE(gstreamer-base-0.10 HAVE_GSTREAMER_BASE VIDEOIO)
CHECK_MODULE(gstreamer-video-0.10 HAVE_GSTREAMER_VIDEO VIDEOIO)
CHECK_MODULE(gstreamer-app-0.10 HAVE_GSTREAMER_APP VIDEOIO)
CHECK_MODULE(gstreamer-riff-0.10 HAVE_GSTREAMER_RIFF VIDEOIO)
CHECK_MODULE(gstreamer-pbutils-0.10 HAVE_GSTREAMER_PBUTILS VIDEOIO)
if(HAVE_GSTREAMER_BASE AND HAVE_GSTREAMER_VIDEO AND HAVE_GSTREAMER_APP AND HAVE_GSTREAMER_RIFF AND HAVE_GSTREAMER_PBUTILS)
set(HAVE_GSTREAMER TRUE)
set(GSTREAMER_BASE_VERSION ${ALIASOF_gstreamer-base-0.10_VERSION})
set(GSTREAMER_VIDEO_VERSION ${ALIASOF_gstreamer-video-0.10_VERSION})
set(GSTREAMER_APP_VERSION ${ALIASOF_gstreamer-app-0.10_VERSION})
set(GSTREAMER_RIFF_VERSION ${ALIASOF_gstreamer-riff-0.10_VERSION})
set(GSTREAMER_PBUTILS_VERSION ${ALIASOF_gstreamer-pbutils-0.10_VERSION})
endif()
endif(WITH_GSTREAMER AND NOT HAVE_GSTREAMER OR WITH_GSTREAMER_0_10)
# --- PvApi ---
ocv_clear_vars(HAVE_PVAPI)
if(WITH_PVAPI)
find_path(PVAPI_INCLUDE_PATH "PvApi.h"
PATHS /usr/local /opt /usr ENV ProgramFiles ENV ProgramW6432
PATH_SUFFIXES include "Allied Vision Technologies/GigESDK/inc-pc" "AVT GigE SDK/inc-pc" "GigESDK/inc-pc"
DOC "The path to PvAPI header")
if(PVAPI_INCLUDE_PATH)
if(X86 AND NOT WIN32)
set(PVAPI_SDK_SUBDIR x86)
elseif(X86_64)
set(PVAPI_SDK_SUBDIR x64)
elseif(ARM)
set(PVAPI_SDK_SUBDIR arm)
endif()
get_filename_component(_PVAPI_LIBRARY_HINT "${PVAPI_INCLUDE_PATH}/../lib-pc" ABSOLUTE)
find_library(PVAPI_LIBRARY NAMES "PvAPI" PATHS "${_PVAPI_LIBRARY_HINT}")
if(PVAPI_LIBRARY)
if(WIN32)
if(MINGW)
set(PVAPI_DEFINITIONS "-DPVDECL=__stdcall")
endif(MINGW)
endif()
set(HAVE_PVAPI TRUE)
endif()
endif(PVAPI_INCLUDE_PATH)
endif(WITH_PVAPI)
# --- GigEVisionSDK ---
ocv_clear_vars(HAVE_GIGE_API)
if(WITH_GIGEAPI)
find_path(GIGEAPI_INCLUDE_PATH "GigEVisionSDK.h"
PATHS /usr/local /var /opt /usr ENV ProgramFiles ENV ProgramW6432
PATH_SUFFIXES include "Smartek Vision Technologies/GigEVisionSDK/gige_cpp" "GigEVisionSDK/gige_cpp" "GigEVisionSDK/gige_c"
DOC "The path to Smartek GigEVisionSDK header")
FIND_LIBRARY(GIGEAPI_LIBRARIES NAMES GigEVisionSDK)
if(GIGEAPI_LIBRARIES AND GIGEAPI_INCLUDE_PATH)
set(HAVE_GIGE_API TRUE)
endif()
endif(WITH_GIGEAPI)
# --- Aravis SDK ---
ocv_clear_vars(HAVE_ARAVIS_API)
if(WITH_ARAVIS)
check_module(glib-2.0 HAVE_ARAVIS_GLIB VIDEOIO)
if(HAVE_ARAVIS_GLIB)
find_path(ARAVIS_INCLUDE_PATH "arv.h"
PATHS /usr/local /var /opt /usr ENV ProgramFiles ENV ProgramW6432
PATH_SUFFIXES include "aravis-0.6" "aravis-0.4"
DOC "The path to Aravis SDK headers")
find_library(ARAVIS_LIBRARIES NAMES "aravis-0.6" "aravis-0.4" )
if(ARAVIS_LIBRARIES AND ARAVIS_INCLUDE_PATH)
set(HAVE_ARAVIS_API TRUE)
endif()
else()
message("Can not build Aravis support without glib2")
endif()
endif(WITH_ARAVIS)
# --- Dc1394 ---
ocv_clear_vars(HAVE_DC1394 HAVE_DC1394_2)
if(WITH_1394)
if(WIN32 AND MINGW)
find_path(CMU1394_INCLUDE_PATH "/1394common.h"
PATH_SUFFIXES include
DOC "The path to cmu1394 headers")
find_path(DC1394_2_INCLUDE_PATH "/dc1394/dc1394.h"
PATH_SUFFIXES include
DOC "The path to DC1394 2.x headers")
if(CMU1394_INCLUDE_PATH AND DC1394_2_INCLUDE_PATH)
set(CMU1394_LIB_DIR "${CMU1394_INCLUDE_PATH}/../lib" CACHE PATH "Full path of CMU1394 library directory")
set(DC1394_2_LIB_DIR "${DC1394_2_INCLUDE_PATH}/../lib" CACHE PATH "Full path of DC1394 2.x library directory")
if(EXISTS "${CMU1394_LIB_DIR}/lib1394camera.a" AND EXISTS "${DC1394_2_LIB_DIR}/libdc1394.a")
set(HAVE_DC1394_2 TRUE)
endif()
endif()
if(HAVE_DC1394_2)
ocv_parse_pkg("libdc1394-2" "${DC1394_2_LIB_DIR}/pkgconfig" "")
ocv_include_directories(${DC1394_2_INCLUDE_PATH})
set(VIDEOIO_LIBRARIES ${VIDEOIO_LIBRARIES}
"${DC1394_2_LIB_DIR}/libdc1394.a"
"${CMU1394_LIB_DIR}/lib1394camera.a")
endif(HAVE_DC1394_2)
else(WIN32 AND MINGW)
CHECK_MODULE(libdc1394-2 HAVE_DC1394_2 VIDEOIO)
if(NOT HAVE_DC1394_2)
CHECK_MODULE(libdc1394 HAVE_DC1394 VIDEOIO)
endif()
endif(WIN32 AND MINGW)
endif(WITH_1394)
# --- xine ---
ocv_clear_vars(HAVE_XINE)
if(WITH_XINE)
CHECK_MODULE(libxine HAVE_XINE VIDEOIO)
endif(WITH_XINE)
# --- V4L ---
ocv_clear_vars(HAVE_CAMV4L2 HAVE_VIDEOIO)
if(WITH_V4L)
CHECK_INCLUDE_FILE(linux/videodev2.h HAVE_CAMV4L2)
CHECK_INCLUDE_FILE(sys/videoio.h HAVE_VIDEOIO)
endif(WITH_V4L)
# --- OpenNI ---
ocv_clear_vars(HAVE_OPENNI HAVE_OPENNI_PRIME_SENSOR_MODULE)
if(WITH_OPENNI)
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenNI.cmake")
endif(WITH_OPENNI)
ocv_clear_vars(HAVE_OPENNI2)
if(WITH_OPENNI2)
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindOpenNI2.cmake")
endif(WITH_OPENNI2)
# --- XIMEA ---
ocv_clear_vars(HAVE_XIMEA)
if(WITH_XIMEA)
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindXimea.cmake")
if(XIMEA_FOUND)
set(HAVE_XIMEA TRUE)
endif()
endif(WITH_XIMEA)
# --- FFMPEG ---
ocv_clear_vars(HAVE_FFMPEG)
if(WITH_FFMPEG) # try FFmpeg autodetection
if(OPENCV_FFMPEG_USE_FIND_PACKAGE)
if(OPENCV_FFMPEG_USE_FIND_PACKAGE STREQUAL "1" OR OPENCV_FFMPEG_USE_FIND_PACKAGE STREQUAL "ON")
set(OPENCV_FFMPEG_USE_FIND_PACKAGE "FFMPEG")
endif()
find_package(${OPENCV_FFMPEG_USE_FIND_PACKAGE}) # Required components: AVCODEC AVFORMAT AVUTIL SWSCALE
if(FFMPEG_FOUND OR FFmpeg_FOUND)
set(HAVE_FFMPEG TRUE)
else()
message(STATUS "Can't find FFmpeg via find_package(${OPENCV_FFMPEG_USE_FIND_PACKAGE})")
endif()
elseif(WIN32 AND NOT ARM AND NOT OPENCV_FFMPEG_SKIP_DOWNLOAD)
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg.cmake")
download_win_ffmpeg(FFMPEG_CMAKE_SCRIPT)
if(FFMPEG_CMAKE_SCRIPT)
set(HAVE_FFMPEG TRUE)
set(HAVE_FFMPEG_WRAPPER 1)
include("${FFMPEG_CMAKE_SCRIPT}")
endif()
elseif(PKG_CONFIG_FOUND)
ocv_check_modules(FFMPEG libavcodec libavformat libavutil libswscale)
ocv_check_modules(FFMPEG_libavresample libavresample)
if(FFMPEG_libavresample_FOUND)
ocv_append_build_options(FFMPEG FFMPEG_libavresample)
endif()
else()
message(STATUS "Can't find ffmpeg - 'pkg-config' utility is missing")
endif()
endif()
if(HAVE_FFMPEG
AND NOT HAVE_FFMPEG_WRAPPER
)
try_compile(__VALID_FFMPEG
"${OpenCV_BINARY_DIR}"
"${OpenCV_SOURCE_DIR}/cmake/checks/ffmpeg_test.cpp"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${FFMPEG_INCLUDE_DIRS}"
"-DLINK_DIRECTORIES:STRING=${FFMPEG_LIBRARY_DIRS}"
"-DLINK_LIBRARIES:STRING=${FFMPEG_LIBRARIES}"
OUTPUT_VARIABLE TRY_OUT
)
if(NOT __VALID_FFMPEG)
#message(FATAL_ERROR "FFMPEG: test check build log:\n${TRY_OUT}")
message(STATUS "WARNING: Can't build ffmpeg test code")
set(HAVE_FFMPEG FALSE)
else()
ocv_append_build_options(VIDEOIO FFMPEG)
endif()
endif()
# --- VideoInput/DirectShow ---
if(WITH_DSHOW)
if(MSVC_VERSION GREATER 1499)
set(HAVE_DSHOW 1)
elseif(NOT HAVE_DSHOW)
check_include_file(DShow.h HAVE_DSHOW)
endif()
endif(WITH_DSHOW)
# --- VideoInput/Microsoft Media Foundation ---
ocv_clear_vars(HAVE_MSMF)
if(WITH_MSMF)
check_include_file(Mfapi.h HAVE_MSMF)
set(HAVE_MSMF_DXVA "")
if(WITH_MSMF_DXVA)
check_include_file(D3D11.h D3D11_found)
check_include_file(D3d11_4.h D3D11_4_found)
if(D3D11_found AND D3D11_4_found)
set(HAVE_MSMF_DXVA YES)
endif()
endif()
endif()
# --- Extra HighGUI and VideoIO libs on Windows ---
if(WIN32)
list(APPEND HIGHGUI_LIBRARIES comctl32 gdi32 ole32 setupapi ws2_32)
if(MINGW64)
list(APPEND VIDEOIO_LIBRARIES avifil32 avicap32 winmm msvfw32)
elseif(MINGW)
list(APPEND VIDEOIO_LIBRARIES winmm)
endif()
endif(WIN32)
if(APPLE)
if(WITH_AVFOUNDATION)
set(HAVE_AVFOUNDATION YES)
endif()
endif(APPLE)
# --- Intel librealsense ---
if(WITH_LIBREALSENSE)
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindLibRealsense.cmake")
endif(WITH_LIBREALSENSE)
# --- Intel Perceptual Computing SDK ---
if(WITH_INTELPERC)
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIntelPerCSDK.cmake")
endif(WITH_INTELPERC)
if(WITH_MFX)
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectMediaSDK.cmake")
endif()
# --- gPhoto2 ---
ocv_clear_vars(HAVE_GPHOTO2)
if(WITH_GPHOTO2)
CHECK_MODULE(libgphoto2 HAVE_GPHOTO2 VIDEOIO)
endif(WITH_GPHOTO2)
# --- VA & VA_INTEL ---
if(WITH_VA_INTEL)
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindVA_INTEL.cmake")

@ -1,89 +0,0 @@
# Main variables:
# OPENNI_LIBRARY and OPENNI_INCLUDES to link OpenCV modules with OpenNI
# HAVE_OPENNI for conditional compilation OpenCV with/without OpenNI
if(NOT "${OPENNI_LIB_DIR}" STREQUAL "${OPENNI_LIB_DIR_INTERNAL}")
unset(OPENNI_LIBRARY CACHE)
unset(OPENNI_LIB_DIR CACHE)
endif()
if(NOT "${OPENNI_INCLUDE_DIR}" STREQUAL "${OPENNI_INCLUDE_DIR_INTERNAL}")
unset(OPENNI_INCLUDES CACHE)
unset(OPENNI_INCLUDE_DIR CACHE)
endif()
if(NOT "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR}" STREQUAL "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR_INTERNAL}")
unset(OPENNI_PRIME_SENSOR_MODULE CACHE)
unset(OPENNI_PRIME_SENSOR_MODULE_BIN_DIR CACHE)
endif()
if(WIN32)
if(NOT (MSVC64 OR MINGW64))
find_file(OPENNI_INCLUDES "XnCppWrapper.h" PATHS "$ENV{OPEN_NI_INSTALL_PATH}Include" DOC "OpenNI c++ interface header")
find_library(OPENNI_LIBRARY "OpenNI" PATHS $ENV{OPEN_NI_LIB} DOC "OpenNI library")
else()
find_file(OPENNI_INCLUDES "XnCppWrapper.h" PATHS "$ENV{OPEN_NI_INSTALL_PATH64}Include" DOC "OpenNI c++ interface header")
find_library(OPENNI_LIBRARY "OpenNI64" PATHS $ENV{OPEN_NI_LIB64} DOC "OpenNI library")
endif()
elseif(UNIX OR APPLE)
find_file(OPENNI_INCLUDES "XnCppWrapper.h" PATHS "/usr/include/ni" "/usr/include/openni" DOC "OpenNI c++ interface header")
find_library(OPENNI_LIBRARY "OpenNI" PATHS "/usr/lib" DOC "OpenNI library")
endif()
if(OPENNI_LIBRARY AND OPENNI_INCLUDES)
set(HAVE_OPENNI TRUE)
# the check: are PrimeSensor Modules for OpenNI installed
if(WIN32)
if(NOT (MSVC64 OR MINGW64))
find_file(OPENNI_PRIME_SENSOR_MODULE "XnCore.dll" PATHS "$ENV{OPEN_NI_INSTALL_PATH}../PrimeSense/Sensor/Bin" "$ENV{OPEN_NI_INSTALL_PATH}../PrimeSense/SensorKinect/Bin" DOC "Core library of PrimeSensor Modules for OpenNI")
else()
find_file(OPENNI_PRIME_SENSOR_MODULE "XnCore64.dll" PATHS "$ENV{OPEN_NI_INSTALL_PATH64}../PrimeSense/Sensor/Bin64" "$ENV{OPEN_NI_INSTALL_PATH64}../PrimeSense/SensorKinect/Bin64" DOC "Core library of PrimeSensor Modules for OpenNI")
endif()
elseif(UNIX OR APPLE)
find_library(OPENNI_PRIME_SENSOR_MODULE "XnCore" PATHS "/usr/lib" DOC "Core library of PrimeSensor Modules for OpenNI")
endif()
if(OPENNI_PRIME_SENSOR_MODULE)
set(HAVE_OPENNI_PRIME_SENSOR_MODULE TRUE)
endif()
endif() #if(OPENNI_LIBRARY AND OPENNI_INCLUDES)
get_filename_component(OPENNI_LIB_DIR "${OPENNI_LIBRARY}" PATH)
get_filename_component(OPENNI_INCLUDE_DIR ${OPENNI_INCLUDES} PATH)
get_filename_component(OPENNI_PRIME_SENSOR_MODULE_BIN_DIR "${OPENNI_PRIME_SENSOR_MODULE}" PATH)
if(HAVE_OPENNI)
set(OPENNI_LIB_DIR "${OPENNI_LIB_DIR}" CACHE PATH "Path to OpenNI libraries" FORCE)
set(OPENNI_INCLUDE_DIR "${OPENNI_INCLUDE_DIR}" CACHE PATH "Path to OpenNI headers" FORCE)
set(OPENNI_PRIME_SENSOR_MODULE_BIN_DIR "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR}" CACHE PATH "Path to OpenNI PrimeSensor Module binaries" FORCE)
endif()
if(OPENNI_LIBRARY)
set(OPENNI_LIB_DIR_INTERNAL "${OPENNI_LIB_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI_LIB_DIR was set successfully." FORCE)
else()
message( WARNING, " OpenNI library directory (set by OPENNI_LIB_DIR variable) is not found or does not have OpenNI libraries." )
endif()
if(OPENNI_INCLUDES)
set(OPENNI_INCLUDE_DIR_INTERNAL "${OPENNI_INCLUDE_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI_INCLUDE_DIR was set successfully." FORCE)
else()
message( WARNING, " OpenNI include directory (set by OPENNI_INCLUDE_DIR variable) is not found or does not have OpenNI include files." )
endif()
if(OPENNI_PRIME_SENSOR_MODULE)
set(OPENNI_PRIME_SENSOR_MODULE_BIN_DIR_INTERNAL "${OPENNI_PRIME_SENSOR_MODULE_BIN_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI_PRIME_SENSOR_MODULE_BIN_DIR was set successfully." FORCE)
else()
message( WARNING, " PrimeSensor Module binaries directory (set by OPENNI_PRIME_SENSOR_MODULE_BIN_DIR variable) is not found or does not have PrimeSensor Module binaries." )
endif()
mark_as_advanced(FORCE OPENNI_PRIME_SENSOR_MODULE)
mark_as_advanced(FORCE OPENNI_LIBRARY)
mark_as_advanced(FORCE OPENNI_INCLUDES)
if(HAVE_OPENNI)
ocv_parse_header("${OPENNI_INCLUDE_DIR}/XnVersion.h" OPENNI_VERSION_LINES XN_MAJOR_VERSION XN_MINOR_VERSION XN_MAINTENANCE_VERSION XN_BUILD_VERSION)
if(XN_MAJOR_VERSION)
set(OPENNI_VERSION_STRING ${XN_MAJOR_VERSION}.${XN_MINOR_VERSION}.${XN_MAINTENANCE_VERSION} CACHE INTERNAL "OpenNI version")
set(OPENNI_VERSION_BUILD ${XN_BUILD_VERSION} CACHE INTERNAL "OpenNI build version")
endif()
endif()

@ -1,61 +0,0 @@
# Main variables:
# OPENNI2_LIBRARY and OPENNI2_INCLUDES to link OpenCV modules with OpenNI2
# HAVE_OPENNI2 for conditional compilation OpenCV with/without OpenNI2
if(NOT "${OPENNI2_LIB_DIR}" STREQUAL "${OPENNI2_LIB_DIR_INTERNAL}")
unset(OPENNI2_LIBRARY CACHE)
unset(OPENNI2_LIB_DIR CACHE)
endif()
if(NOT "${OPENNI2_INCLUDE_DIR}" STREQUAL "${OPENNI2_INCLUDE_DIR_INTERNAL}")
unset(OPENNI2_INCLUDES CACHE)
unset(OPENNI2_INCLUDE_DIR CACHE)
endif()
if(WIN32)
if(NOT (MSVC64 OR MINGW64))
find_file(OPENNI2_INCLUDES "OpenNI.h" PATHS $ENV{OPENNI2_INCLUDE} "$ENV{OPEN_NI_INSTALL_PATH}Include" DOC "OpenNI2 c++ interface header")
find_library(OPENNI2_LIBRARY "OpenNI2" PATHS $ENV{OPENNI2_LIB} DOC "OpenNI2 library")
else()
find_file(OPENNI2_INCLUDES "OpenNI.h" PATHS $ENV{OPENNI2_INCLUDE64} "$ENV{OPEN_NI_INSTALL_PATH64}Include" DOC "OpenNI2 c++ interface header")
find_library(OPENNI2_LIBRARY "OpenNI2" PATHS $ENV{OPENNI2_LIB64} DOC "OpenNI2 library")
endif()
elseif(UNIX OR APPLE)
find_file(OPENNI2_INCLUDES "OpenNI.h" PATHS "/usr/include/ni2" "/usr/include/openni2" $ENV{OPENNI2_INCLUDE} DOC "OpenNI2 c++ interface header")
find_library(OPENNI2_LIBRARY "OpenNI2" PATHS "/usr/lib" $ENV{OPENNI2_REDIST} DOC "OpenNI2 library")
endif()
if(OPENNI2_LIBRARY AND OPENNI2_INCLUDES)
set(HAVE_OPENNI2 TRUE)
endif() #if(OPENNI2_LIBRARY AND OPENNI2_INCLUDES)
get_filename_component(OPENNI2_LIB_DIR "${OPENNI2_LIBRARY}" PATH)
get_filename_component(OPENNI2_INCLUDE_DIR ${OPENNI2_INCLUDES} PATH)
if(HAVE_OPENNI2)
set(OPENNI2_LIB_DIR "${OPENNI2_LIB_DIR}" CACHE PATH "Path to OpenNI2 libraries" FORCE)
set(OPENNI2_INCLUDE_DIR "${OPENNI2_INCLUDE_DIR}" CACHE PATH "Path to OpenNI2 headers" FORCE)
endif()
if(OPENNI2_LIBRARY)
set(OPENNI2_LIB_DIR_INTERNAL "${OPENNI2_LIB_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI_LIB_DIR was set successfully." FORCE)
else()
message( WARNING, " OpenNI2 library directory (set by OPENNI2_LIB_DIR variable) is not found or does not have OpenNI2 libraries." )
endif()
if(OPENNI2_INCLUDES)
set(OPENNI2_INCLUDE_DIR_INTERNAL "${OPENNI2_INCLUDE_DIR}" CACHE INTERNAL "This is the value of the last time OPENNI2_INCLUDE_DIR was set successfully." FORCE)
else()
message( WARNING, " OpenNI2 include directory (set by OPENNI2_INCLUDE_DIR variable) is not found or does not have OpenNI2 include files." )
endif()
mark_as_advanced(FORCE OPENNI2_LIBRARY)
mark_as_advanced(FORCE OPENNI2_INCLUDES)
if(HAVE_OPENNI2)
ocv_parse_header("${OPENNI2_INCLUDE_DIR}/OniVersion.h" ONI_VERSION_LINE ONI_VERSION_MAJOR ONI_VERSION_MINOR ONI_VERSION_MAINTENANCE ONI_VERSION_BUILD)
if(ONI_VERSION_MAJOR)
set(OPENNI2_VERSION_STRING ${ONI_VERSION_MAJOR}.${ONI_VERSION_MINOR}.${ONI_VERSION_MAINTENANCE} CACHE INTERNAL "OpenNI2 version")
set(OPENNI2_VERSION_BUILD ${ONI_VERSION_BUILD} CACHE INTERNAL "OpenNI2 build version")
endif()
endif()

@ -1,52 +0,0 @@
# - Find XIMEA
# This module finds if XIMEA Software package is installed
# and determines where the binaries and header files are.
# This code sets the following variables:
#
# XIMEA_FOUND - True if XIMEA API found
# XIMEA_PATH: - Path to the XIMEA API folder
# XIMEA_LIBRARY_DIR - XIMEA libraries folder
#
# Created: 5 Aug 2011 by Marian Zajko (marian.zajko@ximea.com)
# Updated: 25 June 2012 by Igor Kuzmin (parafin@ximea.com)
# Updated: 22 October 2012 by Marian Zajko (marian.zajko@ximea.com)
#
set(XIMEA_FOUND)
set(XIMEA_PATH)
set(XIMEA_LIBRARY_DIR)
if(WIN32)
# Try to find the XIMEA API path in registry.
GET_FILENAME_COMPONENT(XIMEA_PATH "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE)
if(EXISTS ${XIMEA_PATH})
set(XIMEA_FOUND 1)
# set LIB folders
if(X86_64)
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x64")
else()
set(XIMEA_LIBRARY_DIR "${XIMEA_PATH}/x86")
endif()
else()
set(XIMEA_FOUND 0)
endif()
elseif(APPLE)
if(EXISTS /Library/Frameworks/m3api.framework)
set(XIMEA_FOUND 1)
else()
set(XIMEA_FOUND 0)
endif()
else()
if(EXISTS /opt/XIMEA)
set(XIMEA_FOUND 1)
# set folders
set(XIMEA_PATH /opt/XIMEA/include)
else()
set(XIMEA_FOUND 0)
endif()
endif()
mark_as_advanced(FORCE XIMEA_FOUND)
mark_as_advanced(FORCE XIMEA_PATH)
mark_as_advanced(FORCE XIMEA_LIBRARY_DIR)

@ -41,7 +41,7 @@ foreach(m ${OPENCV_MODULES_BUILD})
endif()
endforeach()
export(TARGETS ${OpenCVModules_TARGETS} FILE "${CMAKE_BINARY_DIR}/OpenCVModules.cmake")
export(EXPORT OpenCVModules FILE "${CMAKE_BINARY_DIR}/OpenCVModules.cmake")
if(TARGET ippicv AND NOT BUILD_SHARED_LIBS)
set(USE_IPPICV TRUE)

@ -1243,14 +1243,6 @@ macro(ocv_parse_header2 LIBNAME HDR_PATH VARNAME)
endif()
endmacro()
# read single version info from the pkg file
macro(ocv_parse_pkg LIBNAME PKG_PATH SCOPE)
if(EXISTS "${PKG_PATH}/${LIBNAME}.pc")
file(STRINGS "${PKG_PATH}/${LIBNAME}.pc" line_to_parse REGEX "^Version:[ \t]+[0-9.]*.*$" LIMIT_COUNT 1)
STRING(REGEX REPLACE ".*Version: ([^ ]+).*" "\\1" ALIASOF_${LIBNAME}_VERSION "${line_to_parse}" )
endif()
endmacro()
################################################################################################
# short command to setup source group
function(ocv_source_group group)

@ -22,12 +22,6 @@
/* Compile for 'virtual' NVIDIA PTX architectures */
#define CUDA_ARCH_PTX "${OPENCV_CUDA_ARCH_PTX}"
/* AVFoundation video libraries */
#cmakedefine HAVE_AVFOUNDATION
/* V4L2 capturing support */
#cmakedefine HAVE_CAMV4L2
/* AMD's Basic Linear Algebra Subprograms Library*/
#cmakedefine HAVE_CLAMDBLAS
@ -49,12 +43,6 @@
/* NVIDIA CUDA Fast Fourier Transform (FFT) API*/
#cmakedefine HAVE_CUFFT
/* IEEE1394 capturing support */
#cmakedefine HAVE_DC1394
/* IEEE1394 capturing support - libdc1394 v2.x */
#cmakedefine HAVE_DC1394_2
/* DirectX */
#cmakedefine HAVE_DIRECTX
#cmakedefine HAVE_DIRECTX_NV12
@ -62,21 +50,12 @@
#cmakedefine HAVE_D3D10
#cmakedefine HAVE_D3D9
/* DirectShow Video Capture library */
#cmakedefine HAVE_DSHOW
/* Eigen Matrix & Linear Algebra Library */
#cmakedefine HAVE_EIGEN
/* FFMpeg video library */
#cmakedefine HAVE_FFMPEG
/* Geospatial Data Abstraction Library */
#cmakedefine HAVE_GDAL
/* GStreamer multimedia framework */
#cmakedefine HAVE_GSTREAMER
/* GTK+ 2.0 Thread support */
#cmakedefine HAVE_GTHREAD
@ -92,9 +71,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
/* Intel Perceptual Computing SDK library */
#cmakedefine HAVE_INTELPERC
/* Intel Integrated Performance Primitives */
#cmakedefine HAVE_IPP
#cmakedefine HAVE_IPP_ICV
@ -113,9 +89,6 @@
/* GDCM DICOM codec */
#cmakedefine HAVE_GDCM
/* Microsoft Media Foundation Capture library */
#cmakedefine HAVE_MSMF
/* NVIDIA Video Decoding API*/
#cmakedefine HAVE_NVCUVID
@ -133,15 +106,6 @@
/* OpenGL support*/
#cmakedefine HAVE_OPENGL
/* OpenNI library */
#cmakedefine HAVE_OPENNI
/* OpenNI library */
#cmakedefine HAVE_OPENNI2
/* librealsense library */
#cmakedefine HAVE_LIBREALSENSE
/* PNG codec */
#cmakedefine HAVE_PNG
@ -166,34 +130,19 @@
/* TIFF codec */
#cmakedefine HAVE_TIFF
/* V4L2 capturing support in videoio.h */
#cmakedefine HAVE_VIDEOIO
/* Win32 UI */
#cmakedefine HAVE_WIN32UI
/* XIMEA camera support */
#cmakedefine HAVE_XIMEA
/* Xine video library */
#cmakedefine HAVE_XINE
/* Define if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#cmakedefine WORDS_BIGENDIAN
/* gPhoto2 library */
#cmakedefine HAVE_GPHOTO2
/* VA library (libva) */
#cmakedefine HAVE_VA
/* Intel VA-API/OpenCL */
#cmakedefine HAVE_VA_INTEL
/* Intel Media SDK */
#cmakedefine HAVE_MFX
/* Lapack */
#cmakedefine HAVE_LAPACK
@ -203,23 +152,6 @@
/* OpenVX */
#cmakedefine HAVE_OPENVX
#if defined(HAVE_XINE) || \
defined(HAVE_GSTREAMER) || \
defined(HAVE_AVFOUNDATION) || \
/*defined(HAVE_OPENNI) || too specialized */ \
defined(HAVE_FFMPEG) || \
defined(HAVE_MSMF)
#define HAVE_VIDEO_INPUT
#endif
#if /*defined(HAVE_XINE) || */\
defined(HAVE_GSTREAMER) || \
defined(HAVE_AVFOUNDATION) || \
defined(HAVE_FFMPEG) || \
defined(HAVE_MSMF)
#define HAVE_VIDEO_OUTPUT
#endif
/* OpenCV trace utilities */
#cmakedefine OPENCV_TRACE

@ -1,6 +1,8 @@
Using Creative Senz3D and other Intel Perceptual Computing SDK compatible depth sensors {#tutorial_intelperc}
=======================================================================================
**Note**: this tutorial is partially obsolete since PerC SDK has been replaced with RealSense SDK
Depth sensors compatible with Intel Perceptual Computing SDK are supported through VideoCapture
class. Depth map, RGB image and some other formats of output can be retrieved by using familiar
interface of VideoCapture.

@ -6,7 +6,6 @@
#include "opencv2/ts/ocl_perf.hpp"
#ifdef HAVE_OPENCL
#ifdef HAVE_VIDEO_INPUT
#include "../perf_bgfg_utils.hpp"
namespace cvtest {
@ -32,7 +31,8 @@ OCL_PERF_TEST_P(KNN_Apply, KNN, Combine(Values("gpu/video/768x576.avi", "gpu/vid
vector<Mat> frame_buffer(nFrame);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
if (!cap.isOpened())
throw SkipTestException("Video file can not be opened");
prepareData(cap, cn, frame_buffer);
UMat u_foreground;
@ -65,7 +65,8 @@ OCL_PERF_TEST_P(KNN_GetBackgroundImage, KNN, Values(
vector<Mat> frame_buffer(nFrame);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
if (!cap.isOpened())
throw SkipTestException("Video file can not be opened");
prepareData(cap, cn, frame_buffer, skipFrames);
UMat u_foreground, u_background;
@ -92,4 +93,3 @@ OCL_PERF_TEST_P(KNN_GetBackgroundImage, KNN, Values(
}}// namespace cvtest::ocl
#endif
#endif

@ -6,7 +6,6 @@
#include "opencv2/ts/ocl_perf.hpp"
#ifdef HAVE_OPENCL
#ifdef HAVE_VIDEO_INPUT
#include "../perf_bgfg_utils.hpp"
namespace opencv_test {
@ -32,7 +31,8 @@ OCL_PERF_TEST_P(MOG2_Apply, Mog2, Combine(Values("gpu/video/768x576.avi", "gpu/v
vector<Mat> frame_buffer(nFrame);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
if (!cap.isOpened())
throw SkipTestException("Video file can not be opened");
prepareData(cap, cn, frame_buffer);
UMat u_foreground;
@ -65,7 +65,8 @@ OCL_PERF_TEST_P(MOG2_GetBackgroundImage, Mog2, Values(
vector<Mat> frame_buffer(nFrame);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
if (!cap.isOpened())
throw SkipTestException("Video file can not be opened");
prepareData(cap, cn, frame_buffer, skipFrames);
UMat u_foreground, u_background;
@ -92,4 +93,3 @@ OCL_PERF_TEST_P(MOG2_GetBackgroundImage, Mog2, Values(
}}// namespace opencv_test::ocl
#endif
#endif

@ -4,7 +4,6 @@
#include "perf_precomp.hpp"
#ifdef HAVE_VIDEO_INPUT
#include "perf_bgfg_utils.hpp"
namespace opencv_test { namespace {
@ -27,7 +26,8 @@ PERF_TEST_P(KNN_Apply, KNN, Combine(Values("gpu/video/768x576.avi", "gpu/video/1
vector<Mat> frame_buffer(nFrame);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
if (!cap.isOpened())
throw SkipTestException("Video file can not be opened");
prepareData(cap, cn, frame_buffer);
Mat foreground;
@ -60,7 +60,8 @@ PERF_TEST_P(KNN_GetBackgroundImage, KNN, Values(
vector<Mat> frame_buffer(nFrame);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
if (!cap.isOpened())
throw SkipTestException("Video file can not be opened");
prepareData(cap, cn, frame_buffer, skipFrames);
Mat foreground, background;
@ -85,5 +86,3 @@ PERF_TEST_P(KNN_GetBackgroundImage, KNN, Values(
}
}}// namespace
#endif

@ -4,7 +4,6 @@
#include "perf_precomp.hpp"
#ifdef HAVE_VIDEO_INPUT
#include "perf_bgfg_utils.hpp"
namespace opencv_test { namespace {
@ -27,7 +26,8 @@ PERF_TEST_P(MOG2_Apply, Mog2, Combine(Values("gpu/video/768x576.avi", "gpu/video
vector<Mat> frame_buffer(nFrame);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
if (!cap.isOpened())
throw SkipTestException("Video file can not be opened");
prepareData(cap, cn, frame_buffer);
Mat foreground;
@ -60,7 +60,8 @@ PERF_TEST_P(MOG2_GetBackgroundImage, Mog2, Values(
vector<Mat> frame_buffer(nFrame);
cv::VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
if (!cap.isOpened())
throw SkipTestException("Video file can not be opened");
prepareData(cap, cn, frame_buffer, skipFrames);
Mat foreground, background;
@ -85,5 +86,3 @@ PERF_TEST_P(MOG2_GetBackgroundImage, Mog2, Values(
}
}}// namespace
#endif

@ -2,7 +2,6 @@
#include "opencv2/ts/ocl_test.hpp"
#ifdef HAVE_OPENCL
#ifdef HAVE_VIDEO_INPUT
namespace opencv_test {
namespace ocl {
@ -33,7 +32,8 @@ OCL_TEST_P(Mog2_Update, Accuracy)
{
string inputFile = string(TS::ptr()->get_data_path()) + "video/768x576.avi";
VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
if (!cap.isOpened())
throw SkipTestException("Video file can not be opened");
Ptr<BackgroundSubtractorMOG2> mog2_cpu = createBackgroundSubtractorMOG2();
Ptr<BackgroundSubtractorMOG2> mog2_ocl = createBackgroundSubtractorMOG2();
@ -90,7 +90,8 @@ OCL_TEST_P(Mog2_getBackgroundImage, Accuracy)
{
string inputFile = string(TS::ptr()->get_data_path()) + "video/768x576.avi";
VideoCapture cap(inputFile);
ASSERT_TRUE(cap.isOpened());
if (!cap.isOpened())
throw SkipTestException("Video file can not be opened");
Ptr<BackgroundSubtractorMOG2> mog2_cpu = createBackgroundSubtractorMOG2();
Ptr<BackgroundSubtractorMOG2> mog2_ocl = createBackgroundSubtractorMOG2();
@ -142,4 +143,3 @@ OCL_INSTANTIATE_TEST_CASE_P(OCL_Video, Mog2_getBackgroundImage, Combine(
}}// namespace opencv_test::ocl
#endif
#endif

@ -1,44 +1,29 @@
set(the_description "Media I/O")
ocv_add_module(videoio opencv_imgproc opencv_imgcodecs WRAP java python)
# ----------------------------------------------------------------------------
# CMake file for videoio. See root CMakeLists.txt
# Some parts taken from version of Hartmut Seichter, HIT Lab NZ.
# Jose Luis Blanco, 2008
# ----------------------------------------------------------------------------
set(videoio_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/precomp.hpp)
if(DEFINED WINRT AND NOT DEFINED ENABLE_WINRT_MODE_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif()
if(APPLE)
ocv_include_directories(${ZLIB_INCLUDE_DIRS})
list(APPEND VIDEOIO_LIBRARIES ${ZLIB_LIBRARIES})
endif()
set(videoio_hdrs
${CMAKE_CURRENT_LIST_DIR}/src/precomp.hpp
)
set(videoio_srcs
${CMAKE_CURRENT_LIST_DIR}/src/videoio_registry.cpp
${CMAKE_CURRENT_LIST_DIR}/src/videoio_c.cpp
${CMAKE_CURRENT_LIST_DIR}/src/cap.cpp
${CMAKE_CURRENT_LIST_DIR}/src/cap_images.cpp
${CMAKE_CURRENT_LIST_DIR}/src/cap_mjpeg_encoder.cpp
${CMAKE_CURRENT_LIST_DIR}/src/cap_mjpeg_decoder.cpp
${CMAKE_CURRENT_LIST_DIR}/src/container_avi.cpp
)
"${CMAKE_CURRENT_LIST_DIR}/src/videoio_registry.cpp"
"${CMAKE_CURRENT_LIST_DIR}/src/videoio_c.cpp"
"${CMAKE_CURRENT_LIST_DIR}/src/cap.cpp"
"${CMAKE_CURRENT_LIST_DIR}/src/cap_images.cpp"
"${CMAKE_CURRENT_LIST_DIR}/src/cap_mjpeg_encoder.cpp"
"${CMAKE_CURRENT_LIST_DIR}/src/cap_mjpeg_decoder.cpp"
"${CMAKE_CURRENT_LIST_DIR}/src/container_avi.cpp")
file(GLOB videoio_ext_hdrs
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.hpp"
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/*.h"
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/legacy/*.h"
)
"${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/legacy/*.h")
# Removing WinRT API headers by default
list(REMOVE_ITEM videoio_ext_hdrs "${CMAKE_CURRENT_LIST_DIR}/include/opencv2/${name}/cap_winrt.hpp")
if(DEFINED WINRT AND NOT DEFINED ENABLE_WINRT_MODE_NATIVE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /ZW")
endif()
# Dependencies used by the implementation referenced
# below are not available on WinRT 8.0.
# Enabling it for WiRT 8.1+ only.
@ -65,226 +50,134 @@ if(DEFINED WINRT AND NOT DEFINED WINRT_8_0 AND NOT DEFINED ENABLE_WINRT_MODE_NAT
${CMAKE_CURRENT_LIST_DIR}/src/cap_winrt/MediaStreamSink.hpp)
endif()
if(HAVE_MFX)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_common.cpp)
list(APPEND videoio_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_common.hpp)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_reader.cpp)
list(APPEND videoio_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_reader.hpp)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_writer.cpp)
list(APPEND videoio_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_writer.hpp)
list(APPEND VIDEOIO_LIBRARIES mfx)
set(tgts)
if(TARGET ocv.3rdparty.mediasdk)
list(APPEND videoio_srcs
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_common.cpp
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_reader.cpp
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_writer.cpp)
list(APPEND videoio_hdrs
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_common.hpp
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_reader.hpp
${CMAKE_CURRENT_LIST_DIR}/src/cap_mfx_writer.hpp)
list(APPEND tgts ocv.3rdparty.mediasdk)
endif()
if (WIN32 AND HAVE_DSHOW)
if(TARGET ocv.3rdparty.dshow)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_dshow.cpp)
list(APPEND videoio_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/cap_dshow.hpp)
if (MINGW64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTRSAFE_NO_DEPRECATE")
endif()
list(APPEND tgts ocv.3rdparty.dshow)
endif()
if(WIN32 AND HAVE_MSMF)
if(TARGET ocv.3rdparty.msmf)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_msmf.hpp)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_msmf.cpp)
if(HAVE_MSMF_DXVA)
add_definitions(-DHAVE_MSMF_DXVA)
endif()
list(APPEND tgts ocv.3rdparty.msmf)
endif()
if(HAVE_XINE)
if(TARGET ocv.3rdparty.xine)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_xine.cpp)
endif(HAVE_XINE)
list(APPEND tgts ocv.3rdparty.xine)
endif()
if(HAVE_DC1394_2)
if(TARGET ocv.3rdparty.dc1394_2)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_dc1394_v2.cpp)
endif(HAVE_DC1394_2)
list(APPEND tgts ocv.3rdparty.dc1394_2)
endif()
if(HAVE_GSTREAMER)
IF(WIN32)
INCLUDE_DIRECTORIES(${GSTREAMER_INCLUDE_DIR})
list(APPEND VIDEOIO_LIBRARIES ${GSTREAMER_LIBRARIES})
ENDIF(WIN32)
if(TARGET ocv.3rdparty.gstreamer)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_gstreamer.cpp)
endif(HAVE_GSTREAMER)
list(APPEND tgts ocv.3rdparty.gstreamer)
endif()
if(HAVE_CAMV4L2 OR HAVE_VIDEOIO)
if(TARGET ocv.3rdparty.v4l)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_v4l.cpp)
list(APPEND tgts ocv.3rdparty.v4l)
endif()
if(HAVE_OPENNI)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_openni.cpp)
ocv_include_directories(${OPENNI_INCLUDE_DIR})
list(APPEND VIDEOIO_LIBRARIES ${OPENNI_LIBRARY})
endif(HAVE_OPENNI)
if(HAVE_OPENNI2)
if(TARGET ocv.3rdparty.openni2)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_openni2.cpp)
ocv_include_directories(${OPENNI2_INCLUDE_DIR})
list(APPEND VIDEOIO_LIBRARIES ${OPENNI2_LIBRARY})
endif(HAVE_OPENNI2)
list(APPEND tgts ocv.3rdparty.openni2)
endif()
if(HAVE_XIMEA)
if(TARGET ocv.3rdparty.ximea)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_ximea.cpp)
if(XIMEA_PATH)
ocv_include_directories(${XIMEA_PATH})
endif()
if(XIMEA_LIBRARY_DIR)
link_directories("${XIMEA_LIBRARY_DIR}")
endif()
if(WIN32 AND X86_64)
list(APPEND VIDEOIO_LIBRARIES xiapi64)
elseif(WIN32)
list(APPEND VIDEOIO_LIBRARIES xiapi32)
elseif(APPLE)
list(APPEND VIDEOIO_LIBRARIES "-framework m3api")
else()
list(APPEND VIDEOIO_LIBRARIES m3api)
list(APPEND tgts ocv.3rdparty.ximea)
endif()
endif(HAVE_XIMEA)
if(HAVE_FFMPEG)
if(TARGET ocv.3rdparty.ffmpeg)
list(APPEND videoio_hdrs ${CMAKE_CURRENT_LIST_DIR}/src/cap_ffmpeg_impl.hpp)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_ffmpeg.cpp)
if(UNIX AND BZIP2_LIBRARIES)
list(APPEND VIDEOIO_LIBRARIES ${BZIP2_LIBRARIES})
endif()
if(APPLE)
list(APPEND VIDEOIO_LIBRARIES "-framework VideoDecodeAcceleration" bz2)
endif()
if(HAVE_FFMPEG_WRAPPER)
add_definitions(-DHAVE_FFMPEG_WRAPPER=1)
list(APPEND tgts ocv.3rdparty.ffmpeg)
endif()
endif(HAVE_FFMPEG)
if(HAVE_PVAPI)
add_definitions(-DHAVE_PVAPI)
add_definitions(${PVAPI_DEFINITIONS})
ocv_include_directories(${PVAPI_INCLUDE_PATH})
if(TARGET ocv.3rdparty.pvapi)
set(videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_pvapi.cpp ${videoio_srcs})
list(APPEND VIDEOIO_LIBRARIES ${PVAPI_LIBRARY})
list(APPEND tgts ocv.3rdparty.pvapi)
endif()
if(HAVE_GIGE_API)
add_definitions(-DHAVE_GIGE_API)
ocv_include_directories(${GIGEAPI_INCLUDE_PATH})
set(videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_giganetix.cpp ${videoio_srcs})
list(APPEND VIDEOIO_LIBRARIES ${GIGEAPI_LIBRARIES})
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_giganetix.cpp)
endif(HAVE_GIGE_API)
if(HAVE_ARAVIS_API)
add_definitions(-DHAVE_ARAVIS_API)
ocv_include_directories(${ARAVIS_INCLUDE_PATH})
set(videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_aravis.cpp ${videoio_srcs})
list(APPEND VIDEOIO_LIBRARIES ${ARAVIS_LIBRARIES})
if(TARGET ocv.3rdparty.aravis)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_aravis.cpp)
endif(HAVE_ARAVIS_API)
list(APPEND tgts ocv.3rdparty.aravis)
endif()
if(HAVE_AVFOUNDATION)
if(TARGET ocv.3rdparty.avfoundation)
if(IOS)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_avfoundation.mm)
list(APPEND VIDEOIO_LIBRARIES "-framework AVFoundation" "-framework QuartzCore")
else()
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_avfoundation_mac.mm)
list(APPEND VIDEOIO_LIBRARIES "-framework Cocoa" "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore")
endif()
list(APPEND tgts ocv.3rdparty.avfoundation)
endif()
if(HAVE_INTELPERC)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_intelperc.cpp)
ocv_include_directories(${INTELPERC_INCLUDE_DIR})
list(APPEND VIDEOIO_LIBRARIES ${INTELPERC_LIBRARIES})
endif(HAVE_INTELPERC)
if(HAVE_LIBREALSENSE)
if(TARGET ocv.3rdparty.librealsense)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_librealsense.cpp)
ocv_include_directories(${LIBREALSENSE_INCLUDE_DIR})
list(APPEND VIDEOIO_LIBRARIES ${LIBREALSENSE_LIBRARIES})
endif(HAVE_LIBREALSENSE)
list(APPEND tgts ocv.3rdparty.librealsense)
endif()
if(HAVE_GPHOTO2)
if(TARGET ocv.3rdparty.gphoto2)
list(APPEND videoio_srcs ${CMAKE_CURRENT_LIST_DIR}/src/cap_gphoto2.cpp)
endif(HAVE_GPHOTO2)
list(APPEND tgts ocv.3rdparty.gphoto2)
endif()
if(IOS)
if(TARGET ocv.3rdparty.cap_ios)
list(APPEND videoio_srcs
${CMAKE_CURRENT_LIST_DIR}/src/cap_ios_abstract_camera.mm
${CMAKE_CURRENT_LIST_DIR}/src/cap_ios_photo_camera.mm
${CMAKE_CURRENT_LIST_DIR}/src/cap_ios_video_camera.mm)
list(APPEND VIDEOIO_LIBRARIES "-framework Accelerate" "-framework AVFoundation" "-framework CoreGraphics" "-framework CoreImage" "-framework CoreMedia" "-framework CoreVideo" "-framework QuartzCore" "-framework UIKit")
endif()
if(UNIX)
#these variables are set by CHECK_MODULE macro
foreach(P ${VIDEOIO_INCLUDE_DIRS})
ocv_include_directories(${P})
endforeach()
foreach(P ${VIDEOIO_LIBRARY_DIRS})
link_directories(${P})
endforeach()
list(APPEND tgts ocv.3rdparty.cap_ios)
endif()
source_group("Src" FILES ${videoio_srcs} ${videoio_hdrs})
source_group("Include" FILES ${videoio_ext_hdrs})
ocv_set_module_sources(HEADERS ${videoio_ext_hdrs} SOURCES ${videoio_srcs} ${videoio_hdrs})
ocv_set_module_sources(HEADERS ${videoio_ext_hdrs} ${videoio_hdrs} SOURCES ${videoio_srcs})
ocv_module_include_directories()
ocv_create_module()
ocv_add_accuracy_tests(${tgts})
ocv_add_perf_tests(${tgts})
ocv_create_module(${VIDEOIO_LIBRARIES})
macro(ocv_videoio_configure_target)
if(APPLE)
add_apple_compiler_options(the_module)
endif()
if(MSVC)
set_target_properties(${the_module} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:atlthunk.lib /NODEFAULTLIB:atlsd.lib /NODEFAULTLIB:libcmt.lib /DEBUG")
if(DEFINED WINRT AND NOT DEFINED ENABLE_WINRT_MODE_NATIVE)
set_target_properties(${the_module} PROPERTIES VS_DESKTOP_EXTENSIONS_VERSION "${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}")
endif()
endif()
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wno-deprecated-declarations)
ocv_target_link_libraries(${the_module} LINK_PRIVATE ${tgts})
# copy FFmpeg dll to the output folder
if(WIN32 AND HAVE_FFMPEG_WRAPPER)
#copy ffmpeg dll to the output folder
if(MSVC64 OR MINGW64)
set(FFMPEG_SUFFIX _64)
endif()
set(ffmpeg_dir "${OpenCV_BINARY_DIR}/3rdparty/ffmpeg")
set(ffmpeg_bare_name "opencv_ffmpeg${FFMPEG_SUFFIX}.dll")
set(ffmpeg_bare_name_ver "opencv_ffmpeg${OPENCV_DLLVERSION}${FFMPEG_SUFFIX}.dll")
set(ffmpeg_path "${ffmpeg_dir}/${ffmpeg_bare_name}")
if(MSVC_IDE)
add_custom_command(TARGET ${the_module} POST_BUILD
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Release/${ffmpeg_bare_name_ver}"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Debug/${ffmpeg_bare_name_ver}"
COMMENT "Copying ${ffmpeg_path} to the output directory")
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/Debug/${ffmpeg_bare_name_ver}")
elseif(MSVC AND (CMAKE_GENERATOR MATCHES "Visual"))
add_custom_command(TARGET ${the_module} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/${ffmpeg_bare_name_ver}"
COMMENT "Copying ${ffmpeg_path} to the output directory")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}/${ffmpeg_bare_name_ver}")
else()
add_custom_command(TARGET ${the_module} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${ffmpeg_bare_name_ver}"
COMMENT "Copying ${ffmpeg_path} to the output directory")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${ffmpeg_path}" "${EXECUTABLE_OUTPUT_PATH}/${ffmpeg_bare_name_ver}")
endif()
install(FILES "${ffmpeg_path}" DESTINATION ${OPENCV_BIN_INSTALL_PATH} COMPONENT libs RENAME "${ffmpeg_bare_name_ver}")
if(INSTALL_CREATE_DISTRIB)
install(FILES "${ffmpeg_dir}/opencv_ffmpeg.dll" DESTINATION "bin/" COMPONENT libs RENAME "opencv_ffmpeg${OPENCV_DLLVERSION}.dll")
install(FILES "${ffmpeg_dir}/opencv_ffmpeg_64.dll" DESTINATION "bin/" COMPONENT libs RENAME "opencv_ffmpeg${OPENCV_DLLVERSION}_64.dll")
endif()
endif()
endmacro()
if(NOT BUILD_opencv_world)
ocv_videoio_configure_target()
endif()
ocv_add_accuracy_tests()
ocv_add_perf_tests()

@ -0,0 +1,34 @@
# --- Aravis SDK ---
if(NOT HAVE_ARAVIS_API AND PKG_CONFIG_FOUND)
pkg_check_modules(ARAVIS aravis-0.6 QUIET)
if(ARAVIS_FOUND)
set(HAVE_ARAVIS_API TRUE)
endif()
endif()
if(NOT HAVE_ARAVIS_API)
find_path(ARAVIS_INCLUDE "arv.h"
PATHS "${ARAVIS_ROOT}" ENV ARAVIS_ROOT
PATH_SUFFIXES "include/aravis-0.6"
NO_DEFAULT_PATH)
find_library(ARAVIS_LIBRARY "aravis-0.6"
PATHS "${ARAVIS_ROOT}" ENV ARAVIS_ROOT
PATH_SUFFIXES "lib"
NO_DEFAULT_PATH)
if(ARAVIS_INCLUDE AND ARAVIS_LIBRARY)
set(HAVE_ARAVIS_API TRUE)
file(STRINGS "${ARAVIS_INCLUDE}/arvversion.h" ver_strings REGEX "#define +ARAVIS_(MAJOR|MINOR|MICRO)_VERSION.*")
string(REGEX REPLACE ".*ARAVIS_MAJOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*ARAVIS_MINOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*ARAVIS_MICRO_VERSION[^0-9]+([0-9]+).*" "\\1" ver_micro "${ver_strings}")
set(ARAVIS_VERSION "${ver_major}.${ver_minor}.${ver_micro}" PARENT_SCOPE) # informational
set(ARAVIS_INCLUDE_DIRS "${ARAVIS_INCLUDE}")
set(ARAVIS_LIBRARIES "${ARAVIS_LIBRARY}")
endif()
endif()
if(HAVE_ARAVIS_API)
ocv_add_external_target(aravis "${ARAVIS_INCLUDE_DIRS}" "${ARAVIS_LIBRARIES}" "HAVE_ARAVIS_API")
endif()
set(HAVE_ARAVIS_API ${HAVE_ARAVIS_API} PARENT_SCOPE)

@ -0,0 +1,18 @@
if(APPLE)
set(HAVE_AVFOUNDATION TRUE)
if(IOS)
set(libs "-framework AVFoundation" "-framework QuartzCore")
else()
set(libs
"-framework Cocoa"
"-framework Accelerate"
"-framework AVFoundation"
"-framework CoreGraphics"
"-framework CoreMedia"
"-framework CoreVideo"
"-framework QuartzCore")
endif()
ocv_add_external_target(avfoundation "" "${libs}" "HAVE_AVFOUNDATION")
endif()
set(HAVE_AVFOUNDATION ${HAVE_AVFOUNDATION} PARENT_SCOPE)

@ -0,0 +1,31 @@
# --- Dc1394 ---
if(NOT HAVE_DC1394_2 AND PKG_CONFIG_FOUND)
pkg_check_modules(DC1394_2 libdc1394-2 QUIET)
if(DC1394_2_FOUND)
set(DC1394_2_VERSION "${DC1394_2_VERSION}" PARENT_SCOPE) # informational
set(HAVE_DC1394_2 TRUE)
endif()
endif()
if(NOT HAVE_DC1394_2)
find_path(DC1394_INCLUDE "dc1394/dc1394.h"
PATHS "${DC1394_ROOT}" ENV DC1394_ROOT
PATH_SUFFIXES "include"
NO_DEFAULT_PATH)
find_library(DC1394_LIBRARY "dc1394"
PATHS "${DC1394_ROOT}" ENV DC1394_ROOT
PATH_SUFFIXES "lib"
NO_DEFAULT_PATH)
if(DC1394_INCLUDE AND DC1394_LIBRARY)
set(HAVE_DC1394_2 TRUE)
set(DC1394_2_INCLUDE_DIRS "${DC1394_INCLUDE}")
set(DC1394_2_LIBRARIES "${DC1394_LIBRARY}")
set(DC1394_2_VERSION "unknown" PARENT_SCOPE) # informational
endif()
endif()
if(HAVE_DC1394_2)
ocv_add_external_target(dc1394_2 "${DC1394_2_INCLUDE_DIRS}" "${DC1394_2_LIBRARIES}" "HAVE_DC1394_2")
endif()
set(HAVE_DC1394_2 ${HAVE_DC1394_2} PARENT_SCOPE)

@ -0,0 +1,14 @@
# --- VideoInput/DirectShow ---
if(NOT HAVE_DSHOW AND MSVC AND NOT MSVC_VERSION LESS 1500)
set(HAVE_DSHOW TRUE)
endif()
if(NOT HAVE_DSHOW)
check_include_file(dshow.h HAVE_DSHOW)
endif()
if(HAVE_DSHOW)
ocv_add_external_target(dshow "" "" "HAVE_DSHOW")
endif()
set(HAVE_DSHOW ${HAVE_DSHOW} PARENT_SCOPE)

@ -0,0 +1,66 @@
# --- FFMPEG ---
if(NOT HAVE_FFMPEG AND OPENCV_FFMPEG_USE_FIND_PACKAGE)
if(OPENCV_FFMPEG_USE_FIND_PACKAGE STREQUAL "1" OR OPENCV_FFMPEG_USE_FIND_PACKAGE STREQUAL "ON")
set(OPENCV_FFMPEG_USE_FIND_PACKAGE "FFMPEG")
endif()
find_package(${OPENCV_FFMPEG_USE_FIND_PACKAGE}) # Required components: AVCODEC AVFORMAT AVUTIL SWSCALE
if(FFMPEG_FOUND OR FFmpeg_FOUND)
set(HAVE_FFMPEG TRUE)
endif()
endif()
if(NOT HAVE_FFMPEG AND WIN32 AND NOT ARM AND NOT OPENCV_FFMPEG_SKIP_DOWNLOAD)
include("${OpenCV_SOURCE_DIR}/3rdparty/ffmpeg/ffmpeg.cmake")
download_win_ffmpeg(FFMPEG_CMAKE_SCRIPT)
if(FFMPEG_CMAKE_SCRIPT)
include("${FFMPEG_CMAKE_SCRIPT}")
set(FFMPEG_libavcodec_VERSION ${FFMPEG_libavcodec_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libavformat_VERSION ${FFMPEG_libavformat_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libavutil_VERSION ${FFMPEG_libavutil_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libswscale_VERSION ${FFMPEG_libswscale_VERSION} PARENT_SCOPE) # info
set(FFMPEG_libavresample_VERSION ${FFMPEG_libavresample_VERSION} PARENT_SCOPE) # info
set(HAVE_FFMPEG TRUE)
set(HAVE_FFMPEG_WRAPPER TRUE)
endif()
endif()
if(NOT HAVE_FFMPEG AND PKG_CONFIG_FOUND)
pkg_check_modules(FFMPEG libavcodec libavformat libavutil libswscale QUIET)
pkg_check_modules(FFMPEG_libavresample libavresample QUIET) # optional
if(FFMPEG_FOUND)
if(FFMPEG_libavresample_FOUND)
list(APPEND FFMPEG_LIBRARIES ${FFMPEG_libavresample_LIBRARIES})
endif()
set(HAVE_FFMPEG TRUE)
endif()
endif()
#==================================
if(HAVE_FFMPEG AND NOT HAVE_FFMPEG_WRAPPER)
try_compile(__VALID_FFMPEG
"${OpenCV_BINARY_DIR}"
"${OpenCV_SOURCE_DIR}/cmake/checks/ffmpeg_test.cpp"
CMAKE_FLAGS "-DINCLUDE_DIRECTORIES:STRING=${FFMPEG_INCLUDE_DIRS}"
"-DLINK_DIRECTORIES:STRING=${FFMPEG_LIBRARY_DIRS}"
"-DLINK_LIBRARIES:STRING=${FFMPEG_LIBRARIES}"
OUTPUT_VARIABLE TRY_OUT
)
if(NOT __VALID_FFMPEG)
# message(FATAL_ERROR "FFMPEG: test check build log:\n${TRY_OUT}")
message(STATUS "WARNING: Can't build ffmpeg test code")
set(HAVE_FFMPEG FALSE)
endif()
endif()
#==================================
if(HAVE_FFMPEG)
set(defs "HAVE_FFMPEG")
if(HAVE_FFMPEG_WRAPPER)
list(APPEND defs "HAVE_FFMPEG_WRAPPER")
endif()
ocv_add_external_target(ffmpeg "${FFMPEG_INCLUDE_DIRS}" "${FFMPEG_LIBRARIES}" "${defs}")
endif()
set(HAVE_FFMPEG ${HAVE_FFMPEG} PARENT_SCOPE)

@ -0,0 +1,13 @@
# --- gPhoto2 ---
if(NOT HAVE_GPHOTO2 AND PKG_CONFIG_FOUND)
pkg_check_modules(GPHOTO2 libgphoto2 QUIET)
if(GPHOTO2_FOUND)
set(HAVE_GPHOTO2 TRUE)
endif()
endif()
if(HAVE_GPHOTO2)
ocv_add_external_target(gphoto2 "${GPHOTO2_INCLUDE_DIRS}" "${GPHOTO2_LIBRARIES}" "HAVE_GPHOTO2")
endif()
set(HAVE_GPHOTO2 ${HAVE_GPHOTO2} PARENT_SCOPE)

@ -0,0 +1,101 @@
# --- GStreamer ---
if(NOT HAVE_GSTREAMER AND WIN32)
set(env_paths "${GSTREAMER_DIR}" ENV GSTREAMER_ROOT)
if(X86_64)
list(APPEND env_paths ENV GSTREAMER_1_0_ROOT_X86_64 ENV GSTREAMER_ROOT_X86_64)
else()
list(APPEND env_paths ENV GSTREAMER_1_0_ROOT_X86 ENV GSTREAMER_ROOT_X86)
endif()
find_path(GSTREAMER_gst_INCLUDE_DIR
gst/gst.h
PATHS ${env_paths}
PATH_SUFFIXES "include/gstreamer-1.0")
find_path(GSTREAMER_glib_INCLUDE_DIR
glib.h
PATHS ${env_paths}
PATH_SUFFIXES "include/glib-2.0")
find_path(GSTREAMER_glibconfig_INCLUDE_DIR
glibconfig.h
PATHS ${env_paths}
PATH_SUFFIXES "lib/glib-2.0/include")
find_library(GSTREAMER_gstreamer_LIBRARY
NAMES gstreamer gstreamer-1.0
PATHS ${env_paths}
PATH_SUFFIXES "lib")
find_library(GSTREAMER_app_LIBRARY
NAMES gstapp gstapp-1.0
PATHS ${env_paths}
PATH_SUFFIXES "lib")
find_library(GSTREAMER_base_LIBRARY
NAMES gstbase gstbase-1.0
PATHS ${env_paths}
PATH_SUFFIXES "lib")
find_library(GSTREAMER_pbutils_LIBRARY
NAMES gstpbutils gstpbutils-1.0
PATHS ${env_paths}
PATH_SUFFIXES "lib")
find_library(GSTREAMER_riff_LIBRARY
NAMES gstriff gstriff-1.0
PATHS ${env_paths}
PATH_SUFFIXES "lib")
find_library(GSTREAMER_glib_LIBRARY
NAMES glib-2.0
PATHS ${env_paths}
PATH_SUFFIXES "lib")
find_library(GSTREAMER_gobject_LIBRARY
NAMES gobject-2.0
PATHS ${env_paths}
PATH_SUFFIXES "lib")
if(GSTREAMER_gst_INCLUDE_DIR
AND GSTREAMER_glib_INCLUDE_DIR
AND GSTREAMER_glibconfig_INCLUDE_DIR
AND GSTREAMER_gstreamer_LIBRARY
AND GSTREAMER_app_LIBRARY
AND GSTREAMER_base_LIBRARY
AND GSTREAMER_pbutils_LIBRARY
AND GSTREAMER_riff_LIBRARY
AND GSTREAMER_glib_LIBRARY
AND GSTREAMER_gobject_LIBRARY)
file(STRINGS "${GSTREAMER_gst_INCLUDE_DIR}/gst/gstversion.h" ver_strings REGEX "#define +GST_VERSION_(MAJOR|MINOR|MICRO|NANO).*")
string(REGEX REPLACE ".*GST_VERSION_MAJOR[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*GST_VERSION_MINOR[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*GST_VERSION_MICRO[^0-9]+([0-9]+).*" "\\1" ver_micro "${ver_strings}")
set(GSTREAMER_VERSION "${ver_major}.${ver_minor}.${ver_micro}" PARENT_SCOPE) # informational
set(HAVE_GSTREAMER TRUE)
set(GSTREAMER_LIBRARIES
${GSTREAMER_gstreamer_LIBRARY}
${GSTREAMER_base_LIBRARY}
${GSTREAMER_app_LIBRARY}
${GSTREAMER_riff_LIBRARY}
${GSTREAMER_pbutils_LIBRARY}
${GSTREAMER_glib_LIBRARY}
${GSTREAMER_gobject_LIBRARY})
set(GSTREAMER_INCLUDE_DIRS
${GSTREAMER_gst_INCLUDE_DIR}
${GSTREAMER_glib_INCLUDE_DIR}
${GSTREAMER_glibconfig_INCLUDE_DIR})
endif()
endif()
if(NOT HAVE_GSTREAMER AND PKG_CONFIG_FOUND)
pkg_check_modules(GSTREAMER_base gstreamer-base-1.0 QUIET)
pkg_check_modules(GSTREAMER_app gstreamer-app-1.0 QUIET)
pkg_check_modules(GSTREAMER_riff gstreamer-riff-1.0 QUIET)
pkg_check_modules(GSTREAMER_pbutils gstreamer-pbutils-1.0 QUIET)
if(GSTREAMER_base_FOUND AND GSTREAMER_app_FOUND AND GSTREAMER_riff_FOUND AND GSTREAMER_pbutils_FOUND)
set(HAVE_GSTREAMER TRUE)
set(GSTREAMER_VERSION ${GSTREAMER_base_VERSION} PARENT_SCOPE) # informational
set(GSTREAMER_LIBRARIES ${GSTREAMER_base_LIBRARIES} ${GSTREAMER_app_LIBRARIES} ${GSTREAMER_riff_LIBRARIES} ${GSTREAMER_pbutils_LIBRARIES})
set(GSTREAMER_INCLUDE_DIRS ${GSTREAMER_base_INCLUDE_DIRS} ${GSTREAMER_app_INCLUDE_DIRS} ${GSTREAMER_riff_INCLUDE_DIRS} ${GSTREAMER_pbutils_INCLUDE_DIRS})
endif()
endif()
if(HAVE_GSTREAMER)
ocv_add_external_target(gstreamer "${GSTREAMER_INCLUDE_DIRS}" "${GSTREAMER_LIBRARIES}" "HAVE_GSTREAMER")
endif()
set(HAVE_GSTREAMER ${HAVE_GSTREAMER} PARENT_SCOPE)

@ -0,0 +1,15 @@
if(APPLE AND IOS)
set(HAVE_CAP_IOS TRUE)
set(libs
"-framework Accelerate"
"-framework AVFoundation"
"-framework CoreGraphics"
"-framework CoreImage"
"-framework CoreMedia"
"-framework CoreVideo"
"-framework QuartzCore"
"-framework UIKit")
ocv_add_external_target(cap_ios "" "${libs}" "HAVE_CAP_IOS")
endif()
set(HAVE_CAP_IOS ${HAVE_CAP_IOS} PARENT_SCOPE)

@ -0,0 +1,47 @@
if(NOT HAVE_MFX)
set(paths "${MFX_HOME}" ENV "MFX_HOME" ENV "INTELMEDIASDKROOT")
if(MSVC)
if(MSVC_VERSION LESS 1900)
set(vs_suffix)
else()
set(vs_suffix "_vs2015")
endif()
if(X86_64)
set(vs_arch "x64")
else()
set(vs_arch "win32")
endif()
endif()
find_path(MFX_INCLUDE mfxdefs.h
PATHS ${paths}
PATH_SUFFIXES "include"
NO_DEFAULT_PATH)
find_library(MFX_LIBRARY mfx libmfx${vs_suffix}
PATHS ${paths}
PATH_SUFFIXES "lib64" "lib/lin_x64" "lib/${vs_arch}"
NO_DEFAULT_PATH)
if(MFX_INCLUDE AND MFX_LIBRARY)
set(HAVE_MFX TRUE)
set(MFX_INCLUDE_DIRS "${MFX_INCLUDE}")
set(MFX_LIBRARIES "${MFX_LIBRARY}")
endif()
endif()
if(HAVE_MFX AND UNIX)
find_path(MFX_va_INCLUDE va/va.h PATHS ${paths} PATH_SUFFIXES "include")
find_library(MFX_va_LIBRARY va PATHS ${paths} PATH_SUFFIXES "lib64" "lib/lin_x64")
find_library(MFX_va_drm_LIBRARY va-drm PATHS ${paths} PATH_SUFFIXES "lib64" "lib/lin_x64")
if(MFX_va_INCLUDE AND MFX_va_LIBRARY AND MFX_va_drm_LIBRARY)
list(APPEND MFX_INCLUDE_DIRS "${MFX_va_INCLUDE}")
list(APPEND MFX_LIBRARIES "${MFX_va_LIBRARY}" "${MFX_va_drm_LIBRARY}")
# list(APPEND MFX_LIBRARIES "-Wl,--exclude-libs=libmfx")
else()
set(HAVE_MFX FALSE)
endif()
endif()
if(HAVE_MFX)
ocv_add_external_target(mediasdk "${MFX_INCLUDE_DIRS}" "${MFX_LIBRARIES}" "HAVE_MFX")
endif()
set(HAVE_MFX ${HAVE_MFX} PARENT_SCOPE)

@ -0,0 +1,25 @@
# --- VideoInput/Microsoft Media Foundation ---
if(NOT HAVE_MSMF)
check_include_file(mfapi.h HAVE_MFAPI)
if(HAVE_MFAPI)
set(HAVE_MSMF TRUE)
endif()
endif()
if(HAVE_MSMF)
if(WITH_MSMF_DXVA)
check_include_file(d3d11.h HAVE_D3D11)
check_include_file(d3d11_4.h HAVE_D3D11_4)
if(HAVE_D3D11 AND HAVE_D3D11_4)
set(HAVE_MSMF_DXVA TRUE)
endif()
endif()
set(defs "HAVE_MSMF")
if(HAVE_MSMF_DXVA)
list(APPEND defs "HAVE_MSMF_DXVA")
endif()
ocv_add_external_target(msmf "" "" "${defs}")
endif()
set(HAVE_MSMF ${HAVE_MSMF} PARENT_SCOPE)
set(HAVE_MSMF_DXVA ${HAVE_MSMF_DXVA} PARENT_SCOPE)

@ -0,0 +1,49 @@
# --- OpenNI2 ---
if(NOT HAVE_OPENNI2)
set(paths "${OPENNI2_DIR}")
if(MSVC AND X86_64)
list(APPEND paths ENV OPENNI2_INCLUDE64 ENV OPENNI2_LIB64 ENV OPENNI2_REDIST64)
else()
list(APPEND paths ENV OPENNI2_INCLUDE ENV OPENNI2_LIB ENV OPENNI2_REDIST)
endif()
# From SDK
find_path(OPENNI2_INCLUDE "OpenNI.h"
PATHS ${paths}
PATH_SUFFIXES "Include"
NO_DEFAULT_PATH)
find_library(OPENNI2_LIBRARY "OpenNI2"
PATHS ${paths}
PATH_SUFFIXES "Redist" "Lib"
NO_DEFAULT_PATH)
if(OPENNI2_LIBRARY AND OPENNI2_INCLUDE)
set(HAVE_OPENNI2 TRUE)
set(OPENNI2_INCLUDE_DIRS "${OPENNI2_INCLUDE}")
set(OPENNI2_LIBRARIES "${OPENNI2_LIBRARY}")
endif()
endif()
if(NOT HAVE_OPENNI2)
# From system
find_path(OPENNI2_SYS_INCLUDE "OpenNI.h" PATH_SUFFIXES "openni2" "ni2")
find_library(OPENNI2_SYS_LIBRARY "OpenNI2")
if(OPENNI2_SYS_LIBRARY AND OPENNI2_SYS_INCLUDE)
set(HAVE_OPENNI2 TRUE)
set(OPENNI2_INCLUDE_DIRS "${OPENNI2_SYS_INCLUDE}")
set(OPENNI2_LIBRARIES "${OPENNI2_SYS_LIBRARY}")
endif()
endif()
if(HAVE_OPENNI2)
file(STRINGS "${OPENNI2_INCLUDE_DIRS}/OniVersion.h" ver_strings REGEX "#define +ONI_VERSION_(MAJOR|MINOR|MAINTENANCE|BUILD).*")
string(REGEX REPLACE ".*ONI_VERSION_MAJOR[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*ONI_VERSION_MINOR[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*ONI_VERSION_MAINTENANCE[^0-9]+([0-9]+).*" "\\1" ver_maint "${ver_strings}")
set(OPENNI2_VERSION "${ver_major}.${ver_minor}.${ver_maint}" PARENT_SCOPE) # informational
ocv_add_external_target(openni2 "${OPENNI2_INCLUDE_DIRS}" "${OPENNI2_LIBRARIES}" "HAVE_OPENNI2")
endif()
set(HAVE_OPENNI2 ${HAVE_OPENNI2} PARENT_SCOPE)

@ -0,0 +1,23 @@
# --- PvApi ---
if(NOT HAVE_PVAPI)
if(X86_64)
set(arch x64)
else()
set(arch x86)
endif()
find_path(PVAPI_INCLUDE "PvApi.h"
PATHS "${PVAPI_ROOT}" ENV PVAPI_ROOT
PATH_SUFFIXES "inc-pc")
find_library(PVAPI_LIBRARY "PvAPI"
PATHS "${PVAPI_ROOT}" ENV PVAPI_ROOT
PATH_SUFFIXES "bin-pc/${arch}/${gcc}")
if(PVAPI_INCLUDE AND PVAPI_LIBRARY)
set(HAVE_PVAPI TRUE)
endif()
endif()
if(HAVE_PVAPI)
ocv_add_external_target(pvapi "${PVAPI_INCLUDE}" "${PVAPI_LIBRARY}" "HAVE_PVAPI")
endif()
set(HAVE_PVAPI ${HAVE_PVAPI} PARENT_SCOPE)

@ -0,0 +1,28 @@
# --- Intel librealsense ---
if(NOT HAVE_LIBREALSENSE)
find_package(realsense2 QUIET)
if(realsense2_FOUND)
set(HAVE_LIBREALSENSE TRUE)
set(LIBREALSENSE_VERSION "${realsense2_VERSION}" PARENT_SCOPE) # informational
ocv_add_external_target(librealsense "" "${realsense2_LIBRARY}" "HAVE_LIBREALSENSE")
endif()
endif()
if(NOT HAVE_LIBREALSENSE)
find_path(LIBREALSENSE_INCLUDE_DIR "librealsense2/rs.hpp"
PATHS "${LIBREALSENSE_INCLUDE}" ENV LIBREALSENSE_INCLUDE)
find_library(LIBREALSENSE_LIBRARIES "realsense2"
PATHS "${LIBREALSENSE_LIB}" ENV LIBREALSENSE_LIB)
if(LIBREALSENSE_INCLUDE_DIR AND LIBREALSENSE_LIBRARIES)
set(HAVE_LIBREALSENSE TRUE)
file(STRINGS "${LIBREALSENSE_INCLUDE_DIR}/librealsense2/rs.h" ver_strings REGEX "#define +RS2_API_(MAJOR|MINOR|PATCH|BUILD)_VERSION.*")
string(REGEX REPLACE ".*RS2_API_MAJOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_major "${ver_strings}")
string(REGEX REPLACE ".*RS2_API_MINOR_VERSION[^0-9]+([0-9]+).*" "\\1" ver_minor "${ver_strings}")
string(REGEX REPLACE ".*RS2_API_PATCH_VERSION[^0-9]+([0-9]+).*" "\\1" ver_patch "${ver_strings}")
set(LIBREALSENSE_VERSION "${ver_major}.${ver_minor}.${ver_patch}" PARENT_SCOPE) # informational
ocv_add_external_target(librealsense "${LIBREALSENSE_INCLUDE_DIR}" "${LIBREALSENSE_LIBRARIES}" "HAVE_LIBREALSENSE")
endif()
endif()
set(HAVE_LIBREALSENSE ${HAVE_LIBREALSENSE} PARENT_SCOPE)

@ -0,0 +1,19 @@
# --- V4L ---
if(NOT HAVE_V4L)
set(CMAKE_REQUIRED_QUIET TRUE) # for check_include_file
check_include_file(linux/videodev2.h HAVE_CAMV4L2)
check_include_file(sys/videoio.h HAVE_VIDEOIO)
if(HAVE_CAMV4L2 OR HAVE_VIDEOIO)
set(HAVE_V4L TRUE)
set(defs)
if(HAVE_CAMV4L2)
list(APPEND defs "HAVE_CAMV4L2")
endif()
if(HAVE_VIDEOIO)
list(APPEND defs "HAVE_VIDEOIO")
endif()
ocv_add_external_target(v4l "" "" "${defs}")
endif()
endif()
set(HAVE_V4L ${HAVE_V4L} PARENT_SCOPE)

@ -0,0 +1,29 @@
if(NOT HAVE_XIMEA)
if(WIN32)
get_filename_component(regpath "[HKEY_CURRENT_USER\\Software\\XIMEA\\CamSupport\\API;Path]" ABSOLUTE)
endif()
if(X86_64)
set(lib_dir "x64")
set(lib_suffix "64")
else()
set(lib_dir "x86")
set(lib_suffix "32")
endif()
find_path(XIMEA_INCLUDE "xiApi.h"
PATHS "${XIMEA_ROOT}" ENV XIMEA_ROOT "/opt/XIMEA"
HINTS "${regpath}"
PATH_SUFFIXES "include" "API")
find_library(XIMEA_LIBRARY m3api xiapi${lib_suffix}
PATHS "${XIMEA_ROOT}" ENV XIMEA_ROOT "/opt/XIMEA"
HINTS "${regpath}"
PATH_SUFFIXES "API/${lib_dir}")
if(XIMEA_INCLUDE AND XIMEA_LIBRARY)
set(HAVE_XIMEA TRUE)
endif()
endif()
if(HAVE_XIMEA)
ocv_add_external_target(ximea "${XIMEA_INCLUDE}" "${XIMEA_LIBRARY}" "HAVE_XIMEA")
endif()
set(HAVE_XIMEA ${HAVE_XIMEA} PARENT_SCOPE)

@ -0,0 +1,12 @@
if(NOT HAVE_XINE AND PKG_CONFIG_FOUND)
pkg_check_modules(XINE libxine QUIET)
if(XINE_FOUND)
set(HAVE_XINE TRUE)
endif()
endif()
if(HAVE_XINE)
ocv_add_external_target(xine "${XINE_INCLUDE_DIRS}" "${XINE_LIBRARIES}" "HAVE_XINE")
endif()
set(HAVE_XINE ${HAVE_XINE} PARENT_SCOPE)

@ -0,0 +1,40 @@
macro(add_backend backend_id cond_var)
if(${cond_var})
include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
endif()
endmacro()
function(ocv_add_external_target name inc link def)
if(BUILD_SHARED_LIBS)
set(imp IMPORTED)
endif()
add_library(ocv.3rdparty.${name} INTERFACE ${imp})
set_target_properties(ocv.3rdparty.${name} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${inc}"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES "${inc}"
INTERFACE_LINK_LIBRARIES "${link}"
INTERFACE_COMPILE_DEFINITIONS "${def}")
if(NOT BUILD_SHARED_LIBS)
install(TARGETS ocv.3rdparty.${name} EXPORT OpenCVModules)
endif()
endfunction()
add_backend("ffmpeg" WITH_FFMPEG)
add_backend("gstreamer" WITH_GSTREAMER)
add_backend("v4l" WITH_V4L)
add_backend("aravis" WITH_ARAVIS)
add_backend("dc1394" WITH_1394)
add_backend("gphoto" WITH_GPHOTO2)
add_backend("msdk" WITH_MFX)
add_backend("openni2" WITH_OPENNI2)
add_backend("pvapi" WITH_PVAPI)
add_backend("realsense" WITH_LIBREALSENSE)
add_backend("ximea" WITH_XIMEA)
add_backend("xine" WITH_XINE)
add_backend("avfoundation" WITH_AVFOUNDATION)
add_backend("ios" WITH_CAP_IOS)
add_backend("dshow" WITH_DSHOW)
add_backend("msmf" WITH_MSMF)

@ -108,7 +108,8 @@ enum VideoCaptureAPIs {
CAP_GIGANETIX = 1300, //!< Smartek Giganetix GigEVisionSDK
CAP_MSMF = 1400, //!< Microsoft Media Foundation (via videoInput)
CAP_WINRT = 1410, //!< Microsoft Windows Runtime using Media Foundation
CAP_INTELPERC = 1500, //!< Intel Perceptual Computing SDK
CAP_INTELPERC = 1500, //!< RealSense (former Intel Perceptual Computing SDK)
CAP_REALSENSE = 1500, //!< Synonym for CAP_INTELPERC
CAP_OPENNI2 = 1600, //!< OpenNI2 (for Kinect)
CAP_OPENNI2_ASUS = 1610, //!< OpenNI2 (for Asus Xtion and Occipital Structure sensors)
CAP_GPHOTO2 = 1700, //!< gPhoto2 connection

@ -3,8 +3,6 @@
// of this distribution and at http://opencv.org/license.html
#include "perf_precomp.hpp"
#ifdef HAVE_VIDEO_INPUT
namespace opencv_test
{
using namespace perf;
@ -35,5 +33,3 @@ PERF_TEST_P(VideoCapture_Reading, ReadFile, testing::ValuesIn(bunny_files) )
}
} // namespace
#endif // HAVE_VIDEO_INPUT

@ -3,8 +3,6 @@
// of this distribution and at http://opencv.org/license.html
#include "perf_precomp.hpp"
#ifdef HAVE_VIDEO_OUTPUT
namespace opencv_test
{
using namespace perf;
@ -38,11 +36,12 @@ PERF_TEST_P(VideoWriter_Writing, WriteFrame,
#endif
VideoWriter writer(outfile, fourcc, 25, cv::Size(image.cols, image.rows), isColor);
if (!writer.isOpened())
throw SkipTestException("Video file can not be opened");
TEST_CYCLE_N(100) { writer << image; }
SANITY_CHECK_NOTHING();
remove(outfile.c_str());
}
} // namespace
#endif // HAVE_VIDEO_OUTPUT

@ -29,13 +29,15 @@
*
*/
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include "precomp.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
#import <AVFoundation/AVFoundation.h>
#import <Foundation/NSException.h>
/********************** Declaration of class headers ************************/
/*****************************************************************************
@ -1330,3 +1332,5 @@ bool CvVideoWriter_AVFoundation::writeFrame(const IplImage* iplimage) {
}
}
#pragma clang diagnostic pop

@ -39,6 +39,8 @@
//
//M*////////////////////////////////////////////////////////////////////////////////////////
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include "precomp.hpp"
#include "opencv2/imgproc.hpp"
@ -1333,3 +1335,5 @@ bool CvVideoWriter_AVFoundation::writeFrame(const IplImage* iplimage) {
}
}
#pragma clang diagnostic pop

File diff suppressed because it is too large Load Diff

@ -96,6 +96,7 @@ Thanks to:
#ifdef __MINGW32__
// MinGW does not understand COM interfaces
#pragma GCC diagnostic ignored "-Wnon-virtual-dtor"
#define STRSAFE_NO_DEPRECATE
#endif
#include <tchar.h>
@ -108,9 +109,9 @@ Thanks to:
#include <vector>
//Include Directshow stuff here so we don't worry about needing all the h files.
#include "DShow.h"
#include "dshow.h"
#include "strmif.h"
#include "Aviriff.h"
#include "aviriff.h"
#include "dvdmedia.h"
#include "bdaiface.h"

@ -1,764 +0,0 @@
////////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// Intel License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000, Intel Corporation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of Intel Corporation may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//
//
// The code has been contributed by Vladimir N. Litvinenko on 2012 Jul
// mailto:vladimir.litvinenko@codepaint.ru
//
#include "precomp.hpp"
#include <GigEVisionSDK.h>
#include <GigEVisionSDK.cpp>
#ifdef _WIN32
#include <io.h>
#else
#include <stdio.h>
#endif
#ifdef NDEBUG
#define CV_WARN(message)
#else
#define CV_WARN(message) fprintf(stderr, "warning: %s (%s:%d)\n", message, __FILE__, __LINE__)
#endif
#define QTGIG_HEARTBEAT_TIME (12000.0)
#define QTGIG_MAX_WAIT_TIME (2.0)
#define QTGIG_IMG_WAIT_TIME (3.0)
/*----------------------------------------------------------------------------*/
/**
\internal
\fn bool wrprInitGigEVisionAPI();
\brief Wrapper to GigEVisionAPI function gige::InitGigEVisionAPI ()
\return true -- success
See \a wrprExitGigEVisionAPI
*/
bool
wrprInitGigEVisionAPI()
{
CV_FUNCNAME("wrprInitGigEVisionAPI");
__BEGIN__;
try {
gige::InitGigEVisionAPI ();
} catch(...) {
CV_ERROR(CV_StsError, "GigEVisionAPI: initialization (InitGigEVisionAPI()) failed.\n");
}
__END__;
return true;
}
/*----------------------------------------------------------------------------*/
/**
\internal
\fn void wrprExitGigEVisionAPI()
\brief Wrapper to GigEVisionAPI function gige::ExitGigEVisionAPI ()
\return true -- success
See \a wrprInitGigEVisionAPI
*/
bool
wrprExitGigEVisionAPI()
{
CV_FUNCNAME("wrprExitGigEVisionAPI");
__BEGIN__;
try {
gige::ExitGigEVisionAPI ();
} catch(...) {
CV_ERROR(CV_StsError, "GigEVisionAPI: finalization (ExitGigEVisionAPI()) failed.\n");
return false;
}
__END__;
return true;
}
/*----------------------------------------------------------------------------*/
/**
\internal
\fn gige::IGigEVisionAPI wrprGetGigEVisionAPI()
\brief Wrapper to GigEVisionAPI function gige::GetGigEVisionAPI ()
\return item of gige::IGigEVisionAPI type
See \a wrprInitGigEVisionAPI, \a gige::IGigEVisionAPI
*/
gige::IGigEVisionAPI
wrprGetGigEVisionAPI()
{
gige::IGigEVisionAPI b_ret = 0;
CV_FUNCNAME("wrprGetGigEVisionAPI");
__BEGIN__;
try {
b_ret = gige::GetGigEVisionAPI ();
} catch(...) {
CV_ERROR(CV_StsError, "GigEVisionAPI: API instance (from GetGigEVisionAPI()) failed.\n");
}
__END__;
return b_ret;
}
/*----------------------------------------------------------------------------*/
/**
\internal
\fn bool wrprUnregisterCallback( const gige::IGigEVisionAPI* api, gige::ICallbackEvent* eventHandler)
\brief Wrapper to GigEVisionAPI function
\param api
\param eventHandler
\return true - success, else - false
See \a wrprInitGigEVisionAPI, \a gige::IGigEVisionAPI
*/
bool
wrprUnregisterCallback( const gige::IGigEVisionAPI* api, gige::ICallbackEvent* eventHandler)
{
bool b_ret = api != NULL;
if(b_ret) b_ret = api->IsValid ();
CV_FUNCNAME("wrprUnregisterCallback");
__BEGIN__;
if(b_ret)
{
if(eventHandler != NULL)
{
try {
b_ret = ((gige::IGigEVisionAPIInterface*)api)->UnregisterCallback (eventHandler);
} catch(...) {
CV_ERROR(CV_StsError, "GigEVisionAPI: API unregister callback function (from UnregisterCallback()) failed.\n");
b_ret = false;
}
}
}
__END__;
return (b_ret);
}
/*----------------------------------------------------------------------------*/
/**
\internal
\fn bool wrprDeviceIsConnect( gige::IDevice& device )
\brief Wrapper to GigEVisionAPI function IDevice::IsConnected()
\param device - selected device
\return true - device connected
*/
bool
wrprDeviceIsConnect( gige::IDevice& device )
{
bool b_ret = device != NULL;
CV_FUNCNAME("wrprDeviceIsConnect");
__BEGIN__;
if(b_ret)
{
try {
b_ret = device->IsConnected ();
} catch (...) {
CV_ERROR(CV_StsError, "GigEVisionAPI: API device connection state (from IsConnected()) failed.\n");
b_ret = false;
}
}
__END__;
return (b_ret);
}
/*----------------------------------------------------------------------------*/
/**
\internal
\fn bool wrprDeviceIsValid( gige::IDevice& device )
\brief Wrapper to GigEVisionAPI function IDevice::Connect()
\param device - selected device
\return true - device valid
*/
bool
wrprDeviceIsValid( gige::IDevice& device )
{
bool b_ret = device != NULL;
CV_FUNCNAME("wrprDeviceIsConnect");
__BEGIN__;
if(b_ret)
{
try {
b_ret = device.IsValid ();
} catch (...) {
CV_ERROR(CV_StsError, "GigEVisionAPI: API device validation state (from IsValid()) failed.\n");
b_ret = false;
}
}
__END__;
return (b_ret);
}
/*----------------------------------------------------------------------------*/
/**
\internal
\fn bool wrprDeviceDisconnect ( gige::IDevice& device )
\brief Wrapper to GigEVisionAPI function IDevice::Disconnect()
\param device - selected device
\return true - device valid
*/
bool
wrprDeviceDisconnect ( gige::IDevice& device )
{
bool b_ret = device != NULL;
CV_FUNCNAME("wrprDeviceDisconnect");
__BEGIN__;
if(b_ret)
{
try {
device->Disconnect ();
} catch (...) {
CV_ERROR(CV_StsError, "GigEVisionAPI: API device disconnect (from Disconnect()) failed.\n");
b_ret = false;
}
}
__END__;
return (b_ret);
}
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
/**
\internal
\class CvCaptureCAM_Giganetix
\brief Capturing video from camera via Smartec Giganetix (use GigEVisualSDK library).
*/
class CvCaptureCAM_Giganetix : public CvCapture
{
public:
CvCaptureCAM_Giganetix();
virtual ~CvCaptureCAM_Giganetix();
virtual bool open( int index );
virtual void close();
virtual double getProperty(int) const CV_OVERRIDE;
virtual bool setProperty(int, double) CV_OVERRIDE;
virtual bool grabFrame() CV_OVERRIDE;
virtual IplImage* retrieveFrame(int) CV_OVERRIDE;
virtual int getCaptureDomain() CV_OVERRIDE
{
return CV_CAP_GIGANETIX;
}
bool start ();
bool stop ();
protected:
void init ();
void grabImage ();
gige::IGigEVisionAPI m_api;
bool m_api_on;
gige::IDevice m_device;
bool m_active;
IplImage* m_raw_image;
UINT32 m_rawImagePixelType;
bool m_monocrome;
};
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
void
CvCaptureCAM_Giganetix::init ()
{
m_monocrome = m_active = m_api_on = false;
m_api = 0;
m_device = 0;
m_raw_image = 0;
m_rawImagePixelType = 0;
}
/*----------------------------------------------------------------------------*/
CvCaptureCAM_Giganetix::CvCaptureCAM_Giganetix()
{
init ();
m_api_on = wrprInitGigEVisionAPI ();
if(m_api_on)
{
if((m_api = wrprGetGigEVisionAPI ()) != NULL)
{
m_api->SetHeartbeatTime (QTGIG_HEARTBEAT_TIME);
}
}
}
/*----------------------------------------------------------------------------*/
CvCaptureCAM_Giganetix::~CvCaptureCAM_Giganetix()
{
close();
}
/*----------------------------------------------------------------------------*/
void
CvCaptureCAM_Giganetix::close()
{
stop ();
(void)wrprDeviceDisconnect(m_device);
(void)wrprExitGigEVisionAPI ();
if(m_raw_image) cvReleaseImageHeader(&m_raw_image);
init ();
}
/*----------------------------------------------------------------------------*/
bool
CvCaptureCAM_Giganetix::open( int index )
{
bool b_ret = m_api_on;
CV_FUNCNAME("CvCaptureCAM_Giganetix::open");
__BEGIN__;
if(b_ret)
b_ret = m_api.IsValid ();
if(b_ret )
{
m_api->FindAllDevices (QTGIG_MAX_WAIT_TIME);
//TODO - serch device as DevicesList member
gige::DevicesList DevicesList = m_api->GetAllDevices ();
m_device = 0;
b_ret = false;
for (int i = 0; i < (int) DevicesList.size() && !b_ret; i++)
{
b_ret = (i == index);
if(b_ret)
{
m_device = DevicesList[i];
b_ret = m_device->Connect ();
if(b_ret)
{
b_ret =
m_device->SetStringNodeValue("AcquisitionStatusSelector", "AcquisitionActive")
&&
m_device->SetStringNodeValue ("TriggerMode", "Off")
&&
m_device->SetStringNodeValue ("AcquisitionMode", "Continuous")
&&
m_device->SetIntegerNodeValue ("AcquisitionFrameCount", 20)
;
}
}
} // for
}
if(!b_ret)
{
CV_ERROR(CV_StsError, "Giganetix: Error cannot find camera\n");
close ();
} else {
start ();
}
__END__;
return b_ret;
}
/*----------------------------------------------------------------------------*/
void
CvCaptureCAM_Giganetix::grabImage ()
{
CV_FUNCNAME("CvCaptureCAM_Giganetix::grabImage");
__BEGIN__;
if(wrprDeviceIsValid(m_device) && wrprDeviceIsConnect(m_device))
{
if(!m_device->IsBufferEmpty ())
{
gige::IImageInfo imageInfo;
m_device->GetImageInfo (&imageInfo);
assert(imageInfo.IsValid());
if (m_device->GetPendingImagesCount() == 1)
{
UINT32 newPixelType;
UINT32 newWidth, newHeight;
imageInfo->GetPixelType(newPixelType);
imageInfo->GetSize(newWidth, newHeight);
//TODO - validation of image exists
bool b_validation = m_raw_image != NULL;
if(b_validation)
{
b_validation =
m_raw_image->imageSize == (int)(imageInfo->GetRawDataSize ())
&&
m_rawImagePixelType == newPixelType;
} else {
if(m_raw_image) cvReleaseImageHeader(&m_raw_image);
}
m_rawImagePixelType = newPixelType;
m_monocrome = GvspGetBitsPerPixel((GVSP_PIXEL_TYPES)newPixelType) == IPL_DEPTH_8U;
try {
if (m_monocrome)
{
//TODO - For Mono & Color BayerRGB raw pixel types
if (!b_validation)
{
m_raw_image = cvCreateImageHeader (cvSize((int)newWidth, (int)newHeight),IPL_DEPTH_8U,1);
m_raw_image->origin = IPL_ORIGIN_TL;
m_raw_image->dataOrder = IPL_DATA_ORDER_PIXEL;
m_raw_image->widthStep = newWidth;
}
// Copy image.
// ::memcpy(m_raw_image->imageData, imageInfo->GetRawData (), imageInfo->GetRawDataSize ());
//TODO - Set pointer to image !
m_raw_image->imageData = (char*)(imageInfo->GetRawData ());
}
if (!m_monocrome && newPixelType == GVSP_PIX_RGB8_PACKED)
{
//TODO - 24 bit RGB color image.
if (!b_validation)
{
m_raw_image = cvCreateImageHeader (cvSize((int)newWidth, (int)newHeight), IPL_DEPTH_32F, 3);
m_raw_image->origin = IPL_ORIGIN_TL;
m_raw_image->dataOrder = IPL_DATA_ORDER_PIXEL;
m_raw_image->widthStep = newWidth * 3;
}
m_raw_image->imageData = (char*)(imageInfo->GetRawData ());
}
} catch (...) {
CV_ERROR(CV_StsError, "Giganetix: failed to queue a buffer on device\n");
close ();
}
} else {
//TODO - all other pixel types
m_raw_image = 0;
CV_WARN("Giganetix: Undefined image pixel type\n");
}
m_device->PopImage (imageInfo);
m_device->ClearImageBuffer ();
}
}
__END__;
}
/*----------------------------------------------------------------------------*/
bool
CvCaptureCAM_Giganetix::start ()
{
CV_FUNCNAME("CvCaptureCAM_Giganetix::start");
__BEGIN__;
m_active = wrprDeviceIsValid(m_device) && wrprDeviceIsConnect(m_device);
if(m_active)
{
(void)m_device->SetIntegerNodeValue("TLParamsLocked", 1);
(void)m_device->CommandNodeExecute("AcquisitionStart");
m_active = m_device->GetBooleanNodeValue("AcquisitionStatus", m_active);
}
if(!m_active)
{
CV_ERROR(CV_StsError, "Giganetix: Cannot open camera\n");
close ();
}
__END__;
return m_active;
}
/*----------------------------------------------------------------------------*/
bool
CvCaptureCAM_Giganetix::stop ()
{
if (!m_active) return true;
CV_FUNCNAME("CvCaptureCAM_Giganetix::stop");
__BEGIN__;
if(wrprDeviceIsValid(m_device) && wrprDeviceIsConnect(m_device))
{
(void)m_device->GetBooleanNodeValue("AcquisitionStatus", m_active);
if(m_active)
{
(void)m_device->CommandNodeExecute("AcquisitionStop");
(void)m_device->SetIntegerNodeValue("TLParamsLocked", 0);
m_device->ClearImageBuffer ();
(void)m_device->GetBooleanNodeValue("AcquisitionStatus", m_active);
}
}
if(m_active)
{
CV_ERROR(CV_StsError, "Giganetix: Improper closure of the camera\n");
close ();
}
__END__;
return !m_active;
}
/*----------------------------------------------------------------------------*/
bool
CvCaptureCAM_Giganetix::grabFrame()
{
bool b_ret =
wrprDeviceIsValid(m_device)
&&
wrprDeviceIsConnect(m_device);
if(b_ret) grabImage ();
return b_ret;
}
/*----------------------------------------------------------------------------*/
IplImage*
CvCaptureCAM_Giganetix::retrieveFrame(int)
{
return (
wrprDeviceIsValid(m_device) && wrprDeviceIsConnect(m_device) ?
m_raw_image :
NULL
);
}
/*----------------------------------------------------------------------------*/
double
CvCaptureCAM_Giganetix::getProperty( int property_id ) const
{
double d_ret = -1.0;
INT64 i;
if(wrprDeviceIsConnect(m_device))
{
switch ( property_id )
{
case CV_CAP_PROP_FRAME_WIDTH:
m_device->GetIntegerNodeValue ("Width", i);
d_ret = i;
break;
case CV_CAP_PROP_FRAME_HEIGHT:
m_device->GetIntegerNodeValue ("Height", i);
d_ret = i;
break;
case CV_CAP_PROP_GIGA_FRAME_OFFSET_X:
m_device->GetIntegerNodeValue ("OffsetX", i);
d_ret = i;
break;
case CV_CAP_PROP_GIGA_FRAME_OFFSET_Y:
m_device->GetIntegerNodeValue ("OffsetY", i);
d_ret = i;
break;
case CV_CAP_PROP_GIGA_FRAME_WIDTH_MAX:
m_device->GetIntegerNodeValue ("WidthMax", i);
d_ret = i;
break;
case CV_CAP_PROP_GIGA_FRAME_HEIGH_MAX:
m_device->GetIntegerNodeValue ("HeightMax", i);
d_ret = i;
break;
case CV_CAP_PROP_GIGA_FRAME_SENS_WIDTH:
m_device->GetIntegerNodeValue ("SensorWidth", i);
d_ret = i;
break;
case CV_CAP_PROP_GIGA_FRAME_SENS_HEIGH:
m_device->GetIntegerNodeValue ("SensorHeight", i);
d_ret = i;
break;
case CV_CAP_PROP_FRAME_COUNT:
m_device->GetIntegerNodeValue ("AcquisitionFrameCount", i);
d_ret = i;
break;
case CV_CAP_PROP_EXPOSURE:
m_device->GetFloatNodeValue ("ExposureTime",d_ret);
break;
case CV_CAP_PROP_GAIN :
m_device->GetFloatNodeValue ("Gain",d_ret);
break;
case CV_CAP_PROP_TRIGGER :
bool b;
m_device->GetBooleanNodeValue ("TriggerMode",b);
d_ret = (double)b;
break;
case CV_CAP_PROP_TRIGGER_DELAY :
m_device->GetFloatNodeValue ("TriggerDelay",d_ret);
break;
default : ;
}
}
return d_ret;
}
/*----------------------------------------------------------------------------*/
bool
CvCaptureCAM_Giganetix::setProperty( int property_id, double value )
{
bool b_ret = wrprDeviceIsConnect(m_device);
if(b_ret)
{
bool b_val = m_active;
switch ( property_id )
{
case CV_CAP_PROP_FRAME_WIDTH:
stop ();
b_ret = m_device->SetIntegerNodeValue ("Width", (INT64)value);
if(b_val) start ();
break;
case CV_CAP_PROP_GIGA_FRAME_WIDTH_MAX:
stop ();
b_ret = m_device->SetIntegerNodeValue ("WidthMax", (INT64)value);
if(b_val) start ();
break;
case CV_CAP_PROP_GIGA_FRAME_SENS_WIDTH:
stop ();
b_ret = m_device->SetIntegerNodeValue ("SensorWidth", (INT64)value);
if(b_val) start ();
break;
case CV_CAP_PROP_FRAME_HEIGHT:
stop ();
b_ret = m_device->SetIntegerNodeValue ("Height", (INT64)value);
if(b_val) start ();
break;
case CV_CAP_PROP_GIGA_FRAME_HEIGH_MAX:
stop ();
b_ret = m_device->SetIntegerNodeValue ("HeightMax", (INT64)value);
if(b_val) start ();
break;
case CV_CAP_PROP_GIGA_FRAME_SENS_HEIGH:
stop ();
b_ret = m_device->SetIntegerNodeValue ("SensorHeight", (INT64)value);
if(b_val) start ();
break;
case CV_CAP_PROP_GIGA_FRAME_OFFSET_X: {
INT64 w, wmax, val = (INT64)value;
if((b_ret = m_device->GetIntegerNodeValue ("Width", w)))
if((b_ret = m_device->GetIntegerNodeValue ("WidthMax", wmax)))
b_ret = m_device->SetIntegerNodeValue ("OffsetX", (val + w) > wmax ? (wmax - w) : val);
} break;
case CV_CAP_PROP_GIGA_FRAME_OFFSET_Y: {
INT64 h, hmax, val = (INT64)value;
if((b_ret = m_device->GetIntegerNodeValue ("Height", h)))
if((b_ret = m_device->GetIntegerNodeValue ("HeightMax", hmax)))
b_ret = m_device->SetIntegerNodeValue ("OffsetY", (val + h) > hmax ? (hmax - h) : val);
b_ret = m_device->SetIntegerNodeValue ("OffsetY", (INT64)value);
}
break;
case CV_CAP_PROP_EXPOSURE:
b_ret = m_device->SetFloatNodeValue ("ExposureTime",value);
break;
case CV_CAP_PROP_GAIN :
b_ret = m_device->SetFloatNodeValue ("Gain",value);
break;
case CV_CAP_PROP_TRIGGER :
b_ret = m_device->SetBooleanNodeValue ("TriggerMode",(bool)value);
break;
case CV_CAP_PROP_TRIGGER_DELAY :
stop ();
b_ret = m_device->SetFloatNodeValue ("TriggerDelay",value);
if(b_val) start ();
break;
default:
b_ret = false;
}
}
return b_ret;
}
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
CvCapture*
cvCreateCameraCapture_Giganetix( int index )
{
CvCaptureCAM_Giganetix* capture = new CvCaptureCAM_Giganetix;
if (!(capture->open( index )))
{
delete capture;
capture = NULL;
}
return ((CvCapture*)capture);
}
/*----------------------------------------------------------------------------*/

@ -65,11 +65,8 @@ using namespace std;
#define VERSION_NUM(major, minor, micro) (major * 1000000 + minor * 1000 + micro)
#define FULL_GST_VERSION VERSION_NUM(GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO)
#if FULL_GST_VERSION >= VERSION_NUM(0,10,32)
#include <gst/pbutils/encoding-profile.h>
//#include <gst/base/gsttypefindhelper.h>
#endif
#ifdef NDEBUG
#define CV_WARN(message)
@ -77,13 +74,8 @@ using namespace std;
#define CV_WARN(message) fprintf(stderr, "OpenCV | GStreamer warning: %s (%s:%d)\n", message, __FILE__, __LINE__)
#endif
#if GST_VERSION_MAJOR == 0
#define COLOR_ELEM "ffmpegcolorspace"
#define COLOR_ELEM_NAME "ffmpegcsp"
#else
#define COLOR_ELEM "videoconvert"
#define COLOR_ELEM_NAME COLOR_ELEM
#endif
#if defined(_WIN32) || defined(_WIN64)
#if defined(__MINGW32__)
@ -164,12 +156,7 @@ private:
GstElement* pipeline;
GstElement* v4l2src;
GstElement* sink;
#if GST_VERSION_MAJOR > 0
GstSample* sample;
#else
void * sample; // unused
GstBuffer* buffer;
#endif
GstCaps* caps;
gint64 duration;
gint width;
@ -256,19 +243,11 @@ bool GStreamerCapture::grabFrame()
if(gst_app_sink_is_eos(GST_APP_SINK(sink)))
return false;
#if GST_VERSION_MAJOR == 0
if(buffer)
gst_buffer_unref(buffer);
buffer = gst_app_sink_pull_buffer(GST_APP_SINK(sink));
if(!buffer)
return false;
#else
if(sample)
gst_sample_unref(sample);
sample = gst_app_sink_pull_sample(GST_APP_SINK(sink));
if(!sample)
return false;
#endif
if (isPosFramesEmulated)
emulatedFrameNumber++;
@ -283,23 +262,14 @@ bool GStreamerCapture::grabFrame()
*/
bool GStreamerCapture::retrieveFrame(int, OutputArray dst)
{
#if GST_VERSION_MAJOR == 0
if (!buffer)
return false;
#else
if(!sample)
return false;
#endif
Size sz;
if (!determineFrameDims(sz))
return false;
// gstreamer expects us to handle the memory at this point
// so we can just wrap the raw buffer and be done with it
#if GST_VERSION_MAJOR == 0
Mat src(sz, CV_8UC1, (uchar*)GST_BUFFER_DATA(buffer));
src.copyTo(dst);
#else
GstBuffer * buf = gst_sample_get_buffer(sample);
if (!buf)
return false;
@ -321,18 +291,13 @@ bool GStreamerCapture::retrieveFrame(int, OutputArray dst)
src.copyTo(dst);
}
gst_buffer_unmap(buf, &info);
#endif
return true;
}
bool GStreamerCapture::determineFrameDims(Size &sz)
{
#if GST_VERSION_MAJOR == 0
GstCaps * frame_caps = gst_buffer_get_caps(buffer);
#else
GstCaps * frame_caps = gst_sample_get_caps(sample);
#endif
// bail out in no caps
if (!GST_CAPS_IS_SIMPLE(frame_caps))
return false;
@ -346,7 +311,6 @@ bool GStreamerCapture::determineFrameDims(Size &sz)
sz = Size(width, height);
#if GST_VERSION_MAJOR > 0
const gchar* name = gst_structure_get_name(structure);
if (!name)
@ -399,10 +363,6 @@ bool GStreamerCapture::determineFrameDims(Size &sz)
channels = 1;
isOutputByteBuffer = true;
}
#else
// we support only video/x-raw, format=BGR -> 8bit, 3 channels
channels = 3;
#endif
return true;
}
@ -494,27 +454,17 @@ void GStreamerCapture::setFilter(const char *prop, int type, int v1, int v2)
{
if(type == G_TYPE_INT)
{
#if GST_VERSION_MAJOR == 0
caps = gst_caps_new_simple("video/x-raw-rgb", prop, type, v1, NULL);
#else
caps = gst_caps_new_simple("video/x-raw","format",G_TYPE_STRING,"BGR", prop, type, v1, NULL);
#endif
}
else
{
#if GST_VERSION_MAJOR == 0
caps = gst_caps_new_simple("video/x-raw-rgb", prop, type, v1, v2, NULL);
#else
caps = gst_caps_new_simple("video/x-raw","format",G_TYPE_STRING,"BGR", prop, type, v1, v2, NULL);
#endif
}
}
else
{
#if GST_VERSION_MAJOR > 0
if (! gst_caps_is_writable(caps))
caps = gst_caps_make_writable (caps);
#endif
if(type == G_TYPE_INT){
gst_caps_set_simple(caps, prop, type, v1, NULL);
}else{
@ -522,9 +472,7 @@ void GStreamerCapture::setFilter(const char *prop, int type, int v1, int v2)
}
}
#if GST_VERSION_MAJOR > 0
caps = gst_caps_fixate(caps);
#endif
gst_app_sink_set_caps(GST_APP_SINK(sink), caps);
//printf("filtering with %s\n", gst_caps_to_string(caps));
@ -540,10 +488,8 @@ void GStreamerCapture::removeFilter(const char *filter)
if(!caps)
return;
#if GST_VERSION_MAJOR > 0
if (! gst_caps_is_writable(caps))
caps = gst_caps_make_writable (caps);
#endif
GstStructure *s = gst_caps_get_structure(caps, 0);
gst_structure_remove_field(s, filter);
@ -699,11 +645,7 @@ bool GStreamerCapture::open(const String &filename_)
gchar * protocol = gst_uri_get_protocol(uri);
if (!strcasecmp(protocol , "v4l2"))
{
#if GST_VERSION_MAJOR == 0
uridecodebin = gst_element_make_from_uri(GST_URI_SRC, uri, "src");
#else
uridecodebin = gst_element_make_from_uri(GST_URI_SRC, uri, "src", NULL);
#endif
element_from_uri = true;
}
else
@ -727,22 +669,14 @@ bool GStreamerCapture::open(const String &filename_)
GstElement *element = NULL;
gboolean done = false;
gchar* name = NULL;
#if GST_VERSION_MAJOR > 0
GValue value = G_VALUE_INIT;
#endif
while (!done)
{
#if GST_VERSION_MAJOR > 0
switch (gst_iterator_next (it, &value))
{
case GST_ITERATOR_OK:
element = GST_ELEMENT (g_value_get_object (&value));
#else
switch (gst_iterator_next (it, (gpointer *)&element))
{
case GST_ITERATOR_OK:
#endif
name = gst_element_get_name(element);
if (name)
{
@ -762,9 +696,7 @@ bool GStreamerCapture::open(const String &filename_)
done = sink && color && v4l2src;
}
#if GST_VERSION_MAJOR > 0
g_value_unset (&value);
#endif
break;
case GST_ITERATOR_RESYNC:
@ -827,15 +759,6 @@ bool GStreamerCapture::open(const String &filename_)
gst_app_sink_set_emit_signals (GST_APP_SINK(sink), FALSE);
// gst_base_sink_set_sync(GST_BASE_SINK(sink), FALSE);
#if GST_VERSION_MAJOR == 0
caps = gst_caps_new_simple("video/x-raw-rgb",
"bpp", G_TYPE_INT, 24,
"red_mask", G_TYPE_INT, 0x0000FF,
"green_mask", G_TYPE_INT, 0x00FF00,
"blue_mask", G_TYPE_INT, 0xFF0000,
NULL);
#else
caps = gst_caps_from_string("video/x-raw, format=(string){BGR, GRAY8}; video/x-bayer,format=(string){rggb,bggr,grbg,gbrg}; image/jpeg");
if(manualpipeline){
@ -849,7 +772,6 @@ bool GStreamerCapture::open(const String &filename_)
gst_caps_unref(peer_caps);
}
#endif
gst_app_sink_set_caps(GST_APP_SINK(sink), caps);
gst_caps_unref(caps);
@ -876,11 +798,7 @@ bool GStreamerCapture::open(const String &filename_)
GstFormat format;
format = GST_FORMAT_DEFAULT;
#if GST_VERSION_MAJOR == 0
if(!gst_element_query_duration(sink, &format, &duration))
#else
if(!gst_element_query_duration(sink, format, &duration))
#endif
{
handleMessage(pipeline);
CV_WARN("GStreamer: unable to query duration of stream");
@ -890,11 +808,7 @@ bool GStreamerCapture::open(const String &filename_)
handleMessage(pipeline);
GstPad* pad = gst_element_get_static_pad(sink, "sink");
#if GST_VERSION_MAJOR == 0
GstCaps* buffer_caps = gst_pad_get_caps(pad);
#else
GstCaps* buffer_caps = gst_pad_get_current_caps(pad);
#endif
const GstStructure *structure = gst_caps_get_structure (buffer_caps, 0);
if (!gst_structure_get_int (structure, "width", &width))
@ -921,13 +835,7 @@ bool GStreamerCapture::open(const String &filename_)
gboolean status_;
format_ = GST_FORMAT_DEFAULT;
#if GST_VERSION_MAJOR == 0
#define FORMAT &format_
#else
#define FORMAT format_
#endif
status_ = gst_element_query_position(sink, FORMAT, &value_);
#undef FORMAT
status_ = gst_element_query_position(sink, format_, &value_);
if (!status_ || value_ != 0 || duration < 0)
{
CV_WARN(cv::format("Cannot query video position: status=%d value=%lld duration=%lld\n",
@ -961,12 +869,6 @@ double GStreamerCapture::getProperty(int propId) const
gint64 value;
gboolean status;
#if GST_VERSION_MAJOR == 0
#define FORMAT &format
#else
#define FORMAT format
#endif
if(!pipeline) {
CV_WARN("GStreamer: no pipeline");
return 0;
@ -975,7 +877,7 @@ double GStreamerCapture::getProperty(int propId) const
switch(propId) {
case CV_CAP_PROP_POS_MSEC:
format = GST_FORMAT_TIME;
status = gst_element_query_position(sink, FORMAT, &value);
status = gst_element_query_position(sink, format, &value);
if(!status) {
handleMessage(pipeline);
CV_WARN("GStreamer: unable to query position of stream");
@ -990,7 +892,7 @@ double GStreamerCapture::getProperty(int propId) const
return 0; // TODO getProperty() "unsupported" value should be changed
}
format = GST_FORMAT_DEFAULT;
status = gst_element_query_position(sink, FORMAT, &value);
status = gst_element_query_position(sink, format, &value);
if(!status) {
handleMessage(pipeline);
CV_WARN("GStreamer: unable to query position of stream");
@ -999,7 +901,7 @@ double GStreamerCapture::getProperty(int propId) const
return value;
case CV_CAP_PROP_POS_AVI_RATIO:
format = GST_FORMAT_PERCENT;
status = gst_element_query_position(sink, FORMAT, &value);
status = gst_element_query_position(sink, format, &value);
if(!status) {
handleMessage(pipeline);
CV_WARN("GStreamer: unable to query position of stream");
@ -1041,8 +943,6 @@ double GStreamerCapture::getProperty(int propId) const
break;
}
#undef FORMAT
return 0;
}
@ -1392,22 +1292,15 @@ bool CvVideoWriter_GStreamer::open( const char * filename, int fourcc,
GstCaps* caps = NULL;
GstCaps* videocaps = NULL;
#if FULL_GST_VERSION >= VERSION_NUM(0,10,32)
GstCaps* containercaps = NULL;
GstEncodingContainerProfile* containerprofile = NULL;
GstEncodingVideoProfile* videoprofile = NULL;
#endif
GstIterator* it = NULL;
gboolean done = FALSE;
GstElement *element = NULL;
gchar* name = NULL;
#if GST_VERSION_MAJOR == 0
GstElement* splitter = NULL;
GstElement* combiner = NULL;
#endif
// we first try to construct a pipeline from the given string.
// if that fails, we assume it is an ordinary filename
@ -1416,13 +1309,6 @@ bool CvVideoWriter_GStreamer::open( const char * filename, int fourcc,
if(manualpipeline)
{
#if GST_VERSION_MAJOR == 0
it = gst_bin_iterate_sources(GST_BIN(encodebin));
if(gst_iterator_next(it, (gpointer *)&source) != GST_ITERATOR_OK) {
CV_WARN("GStreamer: cannot find appsink in manual pipeline\n");
return false;
}
#else
it = gst_bin_iterate_sources (GST_BIN(encodebin));
GValue value = G_VALUE_INIT;
@ -1456,7 +1342,6 @@ bool CvVideoWriter_GStreamer::open( const char * filename, int fourcc,
CV_WARN("GStreamer: cannot find appsrc in manual pipeline\n");
return false;
}
#endif
pipeline = encodebin;
}
else
@ -1489,21 +1374,17 @@ bool CvVideoWriter_GStreamer::open( const char * filename, int fourcc,
return false;
}
#if FULL_GST_VERSION >= VERSION_NUM(0,10,32)
containercaps = gst_caps_from_string(mime);
//create encodebin profile
containerprofile = gst_encoding_container_profile_new("container", "container", containercaps, NULL);
videoprofile = gst_encoding_video_profile_new(videocaps, NULL, NULL, 1);
gst_encoding_container_profile_add_profile(containerprofile, (GstEncodingProfile *) videoprofile);
#endif
//create pipeline elements
encodebin = gst_element_factory_make("encodebin", NULL);
#if FULL_GST_VERSION >= VERSION_NUM(0,10,32)
g_object_set(G_OBJECT(encodebin), "profile", containerprofile, NULL);
#endif
source = gst_element_factory_make("appsrc", NULL);
file = gst_element_factory_make("filesink", NULL);
g_object_set(G_OBJECT(file), "location", filename, NULL);
@ -1511,29 +1392,17 @@ bool CvVideoWriter_GStreamer::open( const char * filename, int fourcc,
if (fourcc == CV_FOURCC('M','J','P','G') && frameSize.height == 1)
{
#if GST_VERSION_MAJOR > 0
input_pix_fmt = GST_VIDEO_FORMAT_ENCODED;
caps = gst_caps_new_simple("image/jpeg",
"framerate", GST_TYPE_FRACTION, int(fps), 1,
NULL);
caps = gst_caps_fixate(caps);
#else
CV_WARN("Gstreamer 0.10 Opencv backend does not support writing encoded MJPEG data.");
return false;
#endif
}
else if(is_color)
{
input_pix_fmt = GST_VIDEO_FORMAT_BGR;
bufsize = frameSize.width * frameSize.height * 3;
#if GST_VERSION_MAJOR == 0
caps = gst_video_format_new_caps(GST_VIDEO_FORMAT_BGR,
frameSize.width,
frameSize.height,
int(fps), 1,
1, 1);
#else
caps = gst_caps_new_simple("video/x-raw",
"format", G_TYPE_STRING, "BGR",
"width", G_TYPE_INT, frameSize.width,
@ -1542,22 +1411,12 @@ bool CvVideoWriter_GStreamer::open( const char * filename, int fourcc,
NULL);
caps = gst_caps_fixate(caps);
#endif
}
else
{
#if FULL_GST_VERSION >= VERSION_NUM(0,10,29)
input_pix_fmt = GST_VIDEO_FORMAT_GRAY8;
bufsize = frameSize.width * frameSize.height;
#if GST_VERSION_MAJOR == 0
caps = gst_video_format_new_caps(GST_VIDEO_FORMAT_GRAY8,
frameSize.width,
frameSize.height,
int(fps), 1,
1, 1);
#else
caps = gst_caps_new_simple("video/x-raw",
"format", G_TYPE_STRING, "GRAY8",
"width", G_TYPE_INT, frameSize.width,
@ -1565,11 +1424,6 @@ bool CvVideoWriter_GStreamer::open( const char * filename, int fourcc,
"framerate", GST_TYPE_FRACTION, int(fps), 1,
NULL);
caps = gst_caps_fixate(caps);
#endif
#else
CV_Error(Error::StsError,
"Gstreamer 0.10.29 or newer is required for grayscale input");
#endif
}
gst_app_src_set_caps(GST_APP_SRC(source), caps);
@ -1591,63 +1445,6 @@ bool CvVideoWriter_GStreamer::open( const char * filename, int fourcc,
}
}
#if GST_VERSION_MAJOR == 0
// HACK: remove streamsplitter and streamcombiner from
// encodebin pipeline to prevent early EOF event handling
// We always fetch BGR or gray-scale frames, so combiner->spliter
// endge in graph is useless.
it = gst_bin_iterate_recurse (GST_BIN(encodebin));
while (!done) {
switch (gst_iterator_next (it, (void**)&element)) {
case GST_ITERATOR_OK:
name = gst_element_get_name(element);
if (strstr(name, "streamsplitter"))
splitter = element;
else if (strstr(name, "streamcombiner"))
combiner = element;
break;
case GST_ITERATOR_RESYNC:
gst_iterator_resync (it);
break;
case GST_ITERATOR_ERROR:
done = true;
break;
case GST_ITERATOR_DONE:
done = true;
break;
}
}
gst_iterator_free (it);
if (splitter && combiner)
{
gst_element_unlink(splitter, combiner);
GstPad* src = gst_element_get_pad(combiner, "src");
GstPad* sink = gst_element_get_pad(combiner, "encodingsink");
GstPad* srcPeer = gst_pad_get_peer(src);
GstPad* sinkPeer = gst_pad_get_peer(sink);
gst_pad_unlink(sinkPeer, sink);
gst_pad_unlink(src, srcPeer);
gst_pad_link(sinkPeer, srcPeer);
src = gst_element_get_pad(splitter, "encodingsrc");
sink = gst_element_get_pad(splitter, "sink");
srcPeer = gst_pad_get_peer(src);
sinkPeer = gst_pad_get_peer(sink);
gst_pad_unlink(sinkPeer, sink);
gst_pad_unlink(src, srcPeer);
gst_pad_link(sinkPeer, srcPeer);
}
#endif
GST_DEBUG_BIN_TO_DOT_FILE(GST_BIN(pipeline), GST_DEBUG_GRAPH_SHOW_ALL, "write-pipeline");
stateret = gst_element_set_state(GST_ELEMENT(pipeline), GST_STATE_PLAYING);
@ -1682,7 +1479,6 @@ bool CvVideoWriter_GStreamer::writeFrame( const IplImage * image )
handleMessage(pipeline);
#if GST_VERSION_MAJOR > 0
if (input_pix_fmt == GST_VIDEO_FORMAT_ENCODED) {
if (image->nChannels != 1 || image->depth != IPL_DEPTH_8U || image->height != 1) {
CV_WARN("cvWriteFrame() needs images with depth = IPL_DEPTH_8U, nChannels = 1 and height = 1.");
@ -1690,21 +1486,18 @@ bool CvVideoWriter_GStreamer::writeFrame( const IplImage * image )
}
}
else
#endif
if(input_pix_fmt == GST_VIDEO_FORMAT_BGR) {
if (image->nChannels != 3 || image->depth != IPL_DEPTH_8U) {
CV_WARN("cvWriteFrame() needs images with depth = IPL_DEPTH_8U and nChannels = 3.");
return false;
}
}
#if FULL_GST_VERSION >= VERSION_NUM(0,10,29)
else if (input_pix_fmt == GST_VIDEO_FORMAT_GRAY8) {
if (image->nChannels != 1 || image->depth != IPL_DEPTH_8U) {
CV_WARN("cvWriteFrame() needs images with depth = IPL_DEPTH_8U and nChannels = 1.");
return false;
}
}
#endif
else {
CV_WARN("cvWriteFrame() needs BGR or grayscale images\n");
return false;
@ -1715,17 +1508,6 @@ bool CvVideoWriter_GStreamer::writeFrame( const IplImage * image )
timestamp = num_frames * duration;
//gst_app_src_push_buffer takes ownership of the buffer, so we need to supply it a copy
#if GST_VERSION_MAJOR == 0
buffer = gst_buffer_try_new_and_alloc (size);
if (!buffer)
{
CV_WARN("Cannot create GStreamer buffer");
}
memcpy(GST_BUFFER_DATA (buffer), (guint8*)image->imageData, size);
GST_BUFFER_DURATION(buffer) = duration;
GST_BUFFER_TIMESTAMP(buffer) = timestamp;
#else
buffer = gst_buffer_new_allocate (NULL, size, NULL);
GstMapInfo info;
gst_buffer_map(buffer, &info, (GstMapFlags)GST_MAP_READ);
@ -1734,7 +1516,6 @@ bool CvVideoWriter_GStreamer::writeFrame( const IplImage * image )
GST_BUFFER_DURATION(buffer) = duration;
GST_BUFFER_PTS(buffer) = timestamp;
GST_BUFFER_DTS(buffer) = timestamp;
#endif
//set the current number in the frame
GST_BUFFER_OFFSET(buffer) = num_frames;

@ -1,634 +0,0 @@
#ifdef HAVE_INTELPERC
#include "cap_intelperc.hpp"
namespace cv
{
///////////////// IntelPerCStreamBase //////////////////
IntelPerCStreamBase::IntelPerCStreamBase()
: m_profileIdx(-1)
, m_frameIdx(0)
, m_timeStampStartNS(0)
{
}
IntelPerCStreamBase::~IntelPerCStreamBase()
{
}
bool IntelPerCStreamBase::isValid()
{
return (m_device.IsValid() && m_stream.IsValid());
}
bool IntelPerCStreamBase::grabFrame()
{
if (!m_stream.IsValid())
return false;
if (-1 == m_profileIdx)
{
if (!setProperty(CV_CAP_PROP_INTELPERC_PROFILE_IDX, 0))
return false;
}
PXCSmartSP sp;
m_pxcImage.ReleaseRef();
if (PXC_STATUS_NO_ERROR > m_stream->ReadStreamAsync(&m_pxcImage, &sp))
return false;
if (PXC_STATUS_NO_ERROR > sp->Synchronize())
return false;
if (0 == m_timeStampStartNS)
m_timeStampStartNS = m_pxcImage->QueryTimeStamp();
m_timeStamp = (double)((m_pxcImage->QueryTimeStamp() - m_timeStampStartNS) / 10000);
m_frameIdx++;
return true;
}
int IntelPerCStreamBase::getProfileIDX() const
{
return m_profileIdx;
}
double IntelPerCStreamBase::getProperty(int propIdx) const
{
double ret = 0.0;
switch (propIdx)
{
case CV_CAP_PROP_INTELPERC_PROFILE_COUNT:
ret = (double)m_profiles.size();
break;
case CV_CAP_PROP_FRAME_WIDTH :
if ((0 <= m_profileIdx) && (m_profileIdx < m_profiles.size()))
ret = (double)m_profiles[m_profileIdx].imageInfo.width;
break;
case CV_CAP_PROP_FRAME_HEIGHT :
if ((0 <= m_profileIdx) && (m_profileIdx < m_profiles.size()))
ret = (double)m_profiles[m_profileIdx].imageInfo.height;
break;
case CV_CAP_PROP_FPS :
if ((0 <= m_profileIdx) && (m_profileIdx < m_profiles.size()))
{
ret = ((double)m_profiles[m_profileIdx].frameRateMin.numerator / (double)m_profiles[m_profileIdx].frameRateMin.denominator
+ (double)m_profiles[m_profileIdx].frameRateMax.numerator / (double)m_profiles[m_profileIdx].frameRateMax.denominator) / 2.0;
}
break;
case CV_CAP_PROP_POS_FRAMES:
ret = (double)m_frameIdx;
break;
case CV_CAP_PROP_POS_MSEC:
ret = m_timeStamp;
break;
};
return ret;
}
bool IntelPerCStreamBase::setProperty(int propIdx, double propVal)
{
bool isSet = false;
switch (propIdx)
{
case CV_CAP_PROP_INTELPERC_PROFILE_IDX:
{
int propValInt = (int)propVal;
if (0 > propValInt)
{
m_profileIdx = propValInt;
isSet = true;
}
else if (propValInt < m_profiles.size())
{
if (m_profileIdx != propValInt)
{
m_profileIdx = propValInt;
if (m_stream.IsValid())
m_stream->SetProfile(&m_profiles[m_profileIdx]);
m_frameIdx = 0;
m_timeStampStartNS = 0;
}
isSet = true;
}
}
break;
};
return isSet;
}
bool IntelPerCStreamBase::initDevice(PXCSession *session)
{
if (NULL == session)
return false;
pxcStatus sts = PXC_STATUS_NO_ERROR;
PXCSession::ImplDesc templat;
memset(&templat,0,sizeof(templat));
templat.group = PXCSession::IMPL_GROUP_SENSOR;
templat.subgroup= PXCSession::IMPL_SUBGROUP_VIDEO_CAPTURE;
for (int modidx = 0; PXC_STATUS_NO_ERROR <= sts; modidx++)
{
PXCSession::ImplDesc desc;
sts = session->QueryImpl(&templat, modidx, &desc);
if (PXC_STATUS_NO_ERROR > sts)
break;
PXCSmartPtr<PXCCapture> capture;
sts = session->CreateImpl<PXCCapture>(&desc, &capture);
if (!capture.IsValid())
continue;
/* enumerate devices */
for (int devidx = 0; PXC_STATUS_NO_ERROR <= sts; devidx++)
{
PXCSmartPtr<PXCCapture::Device> device;
sts = capture->CreateDevice(devidx, &device);
if (PXC_STATUS_NO_ERROR <= sts)
{
m_device = device.ReleasePtr();
return true;
}
}
}
return false;
}
void IntelPerCStreamBase::initStreamImpl(PXCImage::ImageType type)
{
if (!m_device.IsValid())
return;
pxcStatus sts = PXC_STATUS_NO_ERROR;
/* enumerate streams */
for (int streamidx = 0; PXC_STATUS_NO_ERROR <= sts; streamidx++)
{
PXCCapture::Device::StreamInfo sinfo;
sts = m_device->QueryStream(streamidx, &sinfo);
if (PXC_STATUS_NO_ERROR > sts)
break;
if (PXCCapture::VideoStream::CUID != sinfo.cuid)
continue;
if (type != sinfo.imageType)
continue;
sts = m_device->CreateStream<PXCCapture::VideoStream>(streamidx, &m_stream);
if (PXC_STATUS_NO_ERROR == sts)
break;
m_stream.ReleaseRef();
}
}
bool IntelPerCStreamBase::validProfile(const PXCCapture::VideoStream::ProfileInfo& /*pinfo*/)
{
return true;
}
void IntelPerCStreamBase::enumProfiles()
{
m_profiles.clear();
if (!m_stream.IsValid())
return;
pxcStatus sts = PXC_STATUS_NO_ERROR;
for (int profidx = 0; PXC_STATUS_NO_ERROR <= sts; profidx++)
{
PXCCapture::VideoStream::ProfileInfo pinfo;
sts = m_stream->QueryProfile(profidx, &pinfo);
if (PXC_STATUS_NO_ERROR > sts)
break;
if (validProfile(pinfo))
m_profiles.push_back(pinfo);
}
}
///////////////// IntelPerCStreamImage //////////////////
IntelPerCStreamImage::IntelPerCStreamImage()
{
}
IntelPerCStreamImage::~IntelPerCStreamImage()
{
}
bool IntelPerCStreamImage::initStream(PXCSession *session)
{
if (!initDevice(session))
return false;
initStreamImpl(PXCImage::IMAGE_TYPE_COLOR);
if (!m_stream.IsValid())
return false;
enumProfiles();
return true;
}
double IntelPerCStreamImage::getProperty(int propIdx) const
{
switch (propIdx)
{
case CV_CAP_PROP_BRIGHTNESS:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_COLOR_BRIGHTNESS, &fret))
return (double)fret;
return 0.0;
}
break;
case CV_CAP_PROP_CONTRAST:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_COLOR_CONTRAST, &fret))
return (double)fret;
return 0.0;
}
break;
case CV_CAP_PROP_SATURATION:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_COLOR_SATURATION, &fret))
return (double)fret;
return 0.0;
}
break;
case CV_CAP_PROP_HUE:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_COLOR_HUE, &fret))
return (double)fret;
return 0.0;
}
break;
case CV_CAP_PROP_GAMMA:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_COLOR_GAMMA, &fret))
return (double)fret;
return 0.0;
}
break;
case CV_CAP_PROP_SHARPNESS:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_COLOR_SHARPNESS, &fret))
return (double)fret;
return 0.0;
}
break;
case CV_CAP_PROP_GAIN:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_COLOR_GAIN, &fret))
return (double)fret;
return 0.0;
}
break;
case CV_CAP_PROP_BACKLIGHT:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_COLOR_BACK_LIGHT_COMPENSATION, &fret))
return (double)fret;
return 0.0;
}
break;
case CV_CAP_PROP_EXPOSURE:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_COLOR_EXPOSURE, &fret))
return (double)fret;
return 0.0;
}
break;
//Add image stream specific properties
}
return IntelPerCStreamBase::getProperty(propIdx);
}
bool IntelPerCStreamImage::setProperty(int propIdx, double propVal)
{
switch (propIdx)
{
case CV_CAP_PROP_BRIGHTNESS:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_COLOR_BRIGHTNESS, (float)propVal));
}
break;
case CV_CAP_PROP_CONTRAST:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_COLOR_CONTRAST, (float)propVal));
}
break;
case CV_CAP_PROP_SATURATION:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_COLOR_SATURATION, (float)propVal));
}
break;
case CV_CAP_PROP_HUE:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_COLOR_HUE, (float)propVal));
}
break;
case CV_CAP_PROP_GAMMA:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_COLOR_GAMMA, (float)propVal));
}
break;
case CV_CAP_PROP_SHARPNESS:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_COLOR_SHARPNESS, (float)propVal));
}
break;
case CV_CAP_PROP_GAIN:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_COLOR_GAIN, (float)propVal));
}
break;
case CV_CAP_PROP_BACKLIGHT:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_COLOR_BACK_LIGHT_COMPENSATION, (float)propVal));
}
break;
case CV_CAP_PROP_EXPOSURE:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_COLOR_EXPOSURE, (float)propVal));
}
break;
//Add image stream specific properties
}
return IntelPerCStreamBase::setProperty(propIdx, propVal);
}
bool IntelPerCStreamImage::retrieveAsOutputArray(cv::OutputArray image)
{
if (!m_pxcImage.IsValid())
return false;
PXCImage::ImageInfo info;
m_pxcImage->QueryInfo(&info);
PXCImage::ImageData data;
m_pxcImage->AcquireAccess(PXCImage::ACCESS_READ, PXCImage::COLOR_FORMAT_RGB24, &data);
if (PXCImage::SURFACE_TYPE_SYSTEM_MEMORY != data.type)
return false;
cv::Mat temp(info.height, info.width, CV_8UC3, data.planes[0], data.pitches[0]);
temp.copyTo(image);
m_pxcImage->ReleaseAccess(&data);
return true;
}
///////////////// IntelPerCStreamDepth //////////////////
IntelPerCStreamDepth::IntelPerCStreamDepth()
{
}
IntelPerCStreamDepth::~IntelPerCStreamDepth()
{
}
bool IntelPerCStreamDepth::initStream(PXCSession *session)
{
if (!initDevice(session))
return false;
initStreamImpl(PXCImage::IMAGE_TYPE_DEPTH);
if (!m_stream.IsValid())
return false;
enumProfiles();
return true;
}
double IntelPerCStreamDepth::getProperty(int propIdx) const
{
switch (propIdx)
{
case CV_CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_DEPTH_LOW_CONFIDENCE_VALUE, &fret))
return (double)fret;
return 0.0;
}
break;
case CV_CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_DEPTH_SATURATION_VALUE, &fret))
return (double)fret;
return 0.0;
}
break;
case CV_CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD:
{
if (!m_device.IsValid())
return 0.0;
float fret = 0.0f;
if (PXC_STATUS_NO_ERROR == m_device->QueryProperty(PXCCapture::Device::PROPERTY_DEPTH_CONFIDENCE_THRESHOLD, &fret))
return (double)fret;
return 0.0;
}
break;
case CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_HORZ:
{
if (!m_device.IsValid())
return 0.0f;
PXCPointF32 ptf;
if (PXC_STATUS_NO_ERROR == m_device->QueryPropertyAsPoint(PXCCapture::Device::PROPERTY_DEPTH_FOCAL_LENGTH, &ptf))
return (double)ptf.x;
return 0.0;
}
break;
case CV_CAP_PROP_INTELPERC_DEPTH_FOCAL_LENGTH_VERT:
{
if (!m_device.IsValid())
return 0.0f;
PXCPointF32 ptf;
if (PXC_STATUS_NO_ERROR == m_device->QueryPropertyAsPoint(PXCCapture::Device::PROPERTY_DEPTH_FOCAL_LENGTH, &ptf))
return (double)ptf.y;
return 0.0;
}
break;
//Add depth stream sepcific properties
}
return IntelPerCStreamBase::getProperty(propIdx);
}
bool IntelPerCStreamDepth::setProperty(int propIdx, double propVal)
{
switch (propIdx)
{
case CV_CAP_PROP_INTELPERC_DEPTH_LOW_CONFIDENCE_VALUE:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_DEPTH_LOW_CONFIDENCE_VALUE, (float)propVal));
}
break;
case CV_CAP_PROP_INTELPERC_DEPTH_SATURATION_VALUE:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_DEPTH_SATURATION_VALUE, (float)propVal));
}
break;
case CV_CAP_PROP_INTELPERC_DEPTH_CONFIDENCE_THRESHOLD:
{
if (!m_device.IsValid())
return false;
return (PXC_STATUS_NO_ERROR == m_device->SetProperty(PXCCapture::Device::PROPERTY_DEPTH_CONFIDENCE_THRESHOLD, (float)propVal));
}
break;
//Add depth stream sepcific properties
}
return IntelPerCStreamBase::setProperty(propIdx, propVal);
}
bool IntelPerCStreamDepth::retrieveDepthAsOutputArray(cv::OutputArray image)
{
return retriveFrame(CV_16SC1, 0, image);
}
bool IntelPerCStreamDepth::retrieveIRAsOutputArray(cv::OutputArray image)
{
return retriveFrame(CV_16SC1, 1, image);
}
bool IntelPerCStreamDepth::retrieveUVAsOutputArray(cv::OutputArray image)
{
return retriveFrame(CV_32FC2, 2, image);
}
bool IntelPerCStreamDepth::validProfile(const PXCCapture::VideoStream::ProfileInfo& pinfo)
{
return (PXCImage::COLOR_FORMAT_DEPTH == pinfo.imageInfo.format);
}
bool IntelPerCStreamDepth::retriveFrame(int type, int planeIdx, cv::OutputArray frame)
{
if (!m_pxcImage.IsValid())
return false;
PXCImage::ImageInfo info;
m_pxcImage->QueryInfo(&info);
PXCImage::ImageData data;
m_pxcImage->AcquireAccess(PXCImage::ACCESS_READ, &data);
if (PXCImage::SURFACE_TYPE_SYSTEM_MEMORY != data.type)
return false;
cv::Mat temp(info.height, info.width, type, data.planes[planeIdx], data.pitches[planeIdx]);
temp.copyTo(frame);
m_pxcImage->ReleaseAccess(&data);
return true;
}
///////////////// VideoCapture_IntelPerC //////////////////
VideoCapture_IntelPerC::VideoCapture_IntelPerC()
: m_contextOpened(false)
{
pxcStatus sts = PXCSession_Create(&m_session);
if (PXC_STATUS_NO_ERROR > sts)
return;
m_contextOpened = m_imageStream.initStream(m_session);
m_contextOpened &= m_depthStream.initStream(m_session);
}
VideoCapture_IntelPerC::~VideoCapture_IntelPerC(){}
double VideoCapture_IntelPerC::getProperty(int propIdx) const
{
double propValue = 0;
int purePropIdx = propIdx & ~CV_CAP_INTELPERC_GENERATORS_MASK;
if (CV_CAP_INTELPERC_IMAGE_GENERATOR == (propIdx & CV_CAP_INTELPERC_GENERATORS_MASK))
{
propValue = m_imageStream.getProperty(purePropIdx);
}
else if (CV_CAP_INTELPERC_DEPTH_GENERATOR == (propIdx & CV_CAP_INTELPERC_GENERATORS_MASK))
{
propValue = m_depthStream.getProperty(purePropIdx);
}
else
{
propValue = m_depthStream.getProperty(purePropIdx);
}
return propValue;
}
bool VideoCapture_IntelPerC::setProperty(int propIdx, double propVal)
{
bool isSet = false;
int purePropIdx = propIdx & ~CV_CAP_INTELPERC_GENERATORS_MASK;
if (CV_CAP_INTELPERC_IMAGE_GENERATOR == (propIdx & CV_CAP_INTELPERC_GENERATORS_MASK))
{
isSet = m_imageStream.setProperty(purePropIdx, propVal);
}
else if (CV_CAP_INTELPERC_DEPTH_GENERATOR == (propIdx & CV_CAP_INTELPERC_GENERATORS_MASK))
{
isSet = m_depthStream.setProperty(purePropIdx, propVal);
}
else
{
isSet = m_depthStream.setProperty(purePropIdx, propVal);
}
return isSet;
}
bool VideoCapture_IntelPerC::grabFrame()
{
if (!isOpened())
return false;
bool isGrabbed = false;
if (m_depthStream.isValid())
isGrabbed = m_depthStream.grabFrame();
if ((m_imageStream.isValid()) && (-1 != m_imageStream.getProfileIDX()))
isGrabbed &= m_imageStream.grabFrame();
return isGrabbed;
}
bool VideoCapture_IntelPerC::retrieveFrame(int outputType, cv::OutputArray frame)
{
switch (outputType)
{
case CV_CAP_INTELPERC_DEPTH_MAP:
return m_depthStream.retrieveDepthAsOutputArray(frame);
case CV_CAP_INTELPERC_UVDEPTH_MAP:
return m_depthStream.retrieveUVAsOutputArray(frame);
case CV_CAP_INTELPERC_IR_MAP:
return m_depthStream.retrieveIRAsOutputArray(frame);
case CV_CAP_INTELPERC_IMAGE:
return m_imageStream.retrieveAsOutputArray(frame);
}
return false;
}
int VideoCapture_IntelPerC::getCaptureDomain()
{
return CV_CAP_INTELPERC;
}
bool VideoCapture_IntelPerC::isOpened() const
{
return m_contextOpened;
}
}
#endif //HAVE_INTELPERC

@ -1,115 +0,0 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
//
// Copyright (C) 2014, Itseez, Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
//M*/
#ifndef _CAP_INTELPERC_HPP_
#define _CAP_INTELPERC_HPP_
#include "precomp.hpp"
#ifdef HAVE_INTELPERC
#include "pxcsession.h"
#include "pxcsmartptr.h"
#include "pxccapture.h"
namespace cv
{
class IntelPerCStreamBase
{
public:
IntelPerCStreamBase();
virtual ~IntelPerCStreamBase();
bool isValid();
bool grabFrame();
int getProfileIDX() const;
public:
virtual bool initStream(PXCSession *session) = 0;
virtual double getProperty(int propIdx) const;
virtual bool setProperty(int propIdx, double propVal);
protected:
mutable PXCSmartPtr<PXCCapture::Device> m_device;
bool initDevice(PXCSession *session);
PXCSmartPtr<PXCCapture::VideoStream> m_stream;
void initStreamImpl(PXCImage::ImageType type);
protected:
std::vector<PXCCapture::VideoStream::ProfileInfo> m_profiles;
int m_profileIdx;
int m_frameIdx;
pxcU64 m_timeStampStartNS;
double m_timeStamp;
PXCSmartPtr<PXCImage> m_pxcImage;
virtual bool validProfile(const PXCCapture::VideoStream::ProfileInfo& /*pinfo*/);
void enumProfiles();
};
class IntelPerCStreamImage
: public IntelPerCStreamBase
{
public:
IntelPerCStreamImage();
virtual ~IntelPerCStreamImage();
virtual bool initStream(PXCSession *session);
virtual double getProperty(int propIdx) const;
virtual bool setProperty(int propIdx, double propVal);
public:
bool retrieveAsOutputArray(OutputArray image);
};
class IntelPerCStreamDepth
: public IntelPerCStreamBase
{
public:
IntelPerCStreamDepth();
virtual ~IntelPerCStreamDepth();
virtual bool initStream(PXCSession *session);
virtual double getProperty(int propIdx) const;
virtual bool setProperty(int propIdx, double propVal);
public:
bool retrieveDepthAsOutputArray(OutputArray image);
bool retrieveIRAsOutputArray(OutputArray image);
bool retrieveUVAsOutputArray(OutputArray image);
protected:
virtual bool validProfile(const PXCCapture::VideoStream::ProfileInfo& pinfo);
protected:
bool retriveFrame(int type, int planeIdx, OutputArray frame);
};
class VideoCapture_IntelPerC : public IVideoCapture
{
public:
VideoCapture_IntelPerC();
virtual ~VideoCapture_IntelPerC();
virtual double getProperty(int propIdx) const CV_OVERRIDE;
virtual bool setProperty(int propIdx, double propVal) CV_OVERRIDE;
virtual bool grabFrame() CV_OVERRIDE;
virtual bool retrieveFrame(int outputType, OutputArray frame) CV_OVERRIDE;
virtual int getCaptureDomain() CV_OVERRIDE;
virtual bool isOpened() const CV_OVERRIDE;
protected:
bool m_contextOpened;
PXCSmartPtr<PXCSession> m_session;
IntelPerCStreamImage m_imageStream;
IntelPerCStreamDepth m_depthStream;
};
}
#endif //HAVE_INTELPERC
#endif //_CAP_INTELPERC_HPP_

@ -52,6 +52,7 @@
#undef WINVER
#define WINVER _WIN32_WINNT_WIN8
#endif
#include <windows.h>
#include <guiddef.h>
#include <mfidl.h>
@ -60,7 +61,7 @@
#include <mfobjects.h>
#include <tchar.h>
#include <strsafe.h>
#include <Mfreadwrite.h>
#include <mfreadwrite.h>
#ifdef HAVE_MSMF_DXVA
#include <d3d11.h>
#include <d3d11_4.h>

File diff suppressed because it is too large Load Diff

@ -8,7 +8,6 @@
#include "opencv2/videoio/registry.hpp"
#include "cap_intelperc.hpp"
#include "cap_librealsense.hpp"
#include "cap_dshow.hpp"
@ -45,7 +44,7 @@ namespace {
/** Ordering guidelines:
- modern optimized, multi-platform libraries: ffmpeg, gstreamer, Media SDK
- platform specific universal SDK: WINRT, AVFOUNDATION, MSMF/DSHOW, V4L/V4L2
- RGB-D: OpenNI/OpenNI2, INTELPERC/REALSENSE
- RGB-D: OpenNI/OpenNI2, REALSENSE
- special OpenCV (file-based): "images", "mjpeg"
- special camera SDKs, including stereo: other special SDKs: FIREWIRE/1394, XIMEA/ARAVIS/GIGANETIX/PVAPI(GigE)
- other: XINE, gphoto2, etc
@ -88,16 +87,12 @@ static const struct VideoBackendInfo builtin_backends[] =
// RGB-D universal
#ifdef HAVE_OPENNI
DECLARE_BACKEND(CAP_OPENNI, "OPENNI", MODE_CAPTURE_ALL),
#endif
#ifdef HAVE_OPENNI2
DECLARE_BACKEND(CAP_OPENNI2, "OPENNI2", MODE_CAPTURE_ALL),
#endif
#ifdef HAVE_INTELPERC
DECLARE_BACKEND(CAP_INTELPERC, "INTEL_PERC", MODE_CAPTURE_BY_INDEX),
#elif defined(HAVE_LIBREALSENSE)
DECLARE_BACKEND(CAP_INTELPERC, "INTEL_REALSENSE", MODE_CAPTURE_BY_INDEX),
#ifdef HAVE_LIBREALSENSE
DECLARE_BACKEND(CAP_REALSENSE, "INTEL_REALSENSE", MODE_CAPTURE_BY_INDEX),
#endif
// OpenCV file-based only
@ -115,9 +110,6 @@ static const struct VideoBackendInfo builtin_backends[] =
#ifdef HAVE_XIMEA
DECLARE_BACKEND(CAP_XIAPI, "XIMEA", MODE_CAPTURE_ALL),
#endif
#ifdef HAVE_GIGE_API
DECLARE_BACKEND(CAP_GIGANETIX, "GIGANETIX", MODE_CAPTURE_BY_INDEX),
#endif
#ifdef HAVE_ARAVIS_API
DECLARE_BACKEND(CAP_ARAVIS, "ARAVIS", MODE_CAPTURE_BY_INDEX),
#endif
@ -415,12 +407,8 @@ void VideoCapture_create(CvCapture*& capture, Ptr<IVideoCapture>& icap, VideoCap
TRY_OPEN(makePtr<VideoCapture_DShow>(index));
break;
#endif
#ifdef HAVE_INTELPERC
case CAP_INTELPERC:
TRY_OPEN(makePtr<VideoCapture_IntelPerC>());
break;
#elif defined(HAVE_LIBREALSENSE)
case CAP_INTELPERC:
#ifdef HAVE_LIBREALSENSE
case CAP_REALSENSE:
TRY_OPEN(makePtr<VideoCapture_LibRealsense>(index));
break;
#endif
@ -454,11 +442,6 @@ void VideoCapture_create(CvCapture*& capture, Ptr<IVideoCapture>& icap, VideoCap
TRY_OPEN_LEGACY(cvCreateCameraCapture_PvAPI(index))
break;
#endif
#ifdef HAVE_OPENNI
case CAP_OPENNI:
TRY_OPEN_LEGACY(cvCreateCameraCapture_OpenNI(index))
break;
#endif
#ifdef HAVE_OPENNI2
case CAP_OPENNI2:
TRY_OPEN_LEGACY(cvCreateCameraCapture_OpenNI2(index))
@ -476,12 +459,6 @@ void VideoCapture_create(CvCapture*& capture, Ptr<IVideoCapture>& icap, VideoCap
break;
#endif
#ifdef HAVE_GIGE_API
case CAP_GIGANETIX:
TRY_OPEN_LEGACY(cvCreateCameraCapture_Giganetix(index))
break;
#endif
#ifdef HAVE_ARAVIS_API
case CAP_ARAVIS:
TRY_OPEN_LEGACY(cvCreateCameraCapture_Aravis(index))
@ -510,12 +487,6 @@ void VideoCapture_create(CvCapture*& capture, Ptr<IVideoCapture>& icap, VideoCap
break;
#endif
#ifdef HAVE_OPENNI
case CAP_OPENNI:
TRY_OPEN_LEGACY(cvCreateFileCapture_OpenNI(filename.c_str()))
break;
#endif
#ifdef HAVE_OPENNI2
case CAP_OPENNI2:
TRY_OPEN_LEGACY(cvCreateFileCapture_OpenNI2(filename.c_str()))

@ -303,10 +303,6 @@ public:
//==================================================================================================
static const VideoCaptureAPIs backend_params[] = {
#ifdef HAVE_QUICKTIME
CAP_QT,
#endif
// TODO: Broken?
//#ifdef HAVE_AVFOUNDATION
// CAP_AVFOUNDATION,
@ -333,7 +329,6 @@ static const VideoCaptureAPIs backend_params[] = {
};
static const string bunny_params[] = {
#ifdef HAVE_VIDEO_INPUT
string("wmv"),
string("mov"),
string("mp4"),
@ -341,7 +336,6 @@ static const string bunny_params[] = {
string("avi"),
string("h264"),
string("h265"),
#endif
string("mjpg.avi")
};
@ -384,18 +378,6 @@ static Ext_Fourcc_PSNR synthetic_params[] = {
makeParam("mov", "H264", 30.f, CAP_MSMF),
#endif
#ifdef HAVE_QUICKTIME
makeParam("mov", "mp4v", 30.f, CAP_QT),
makeParam("avi", "XVID", 30.f, CAP_QT),
makeParam("avi", "MPEG", 30.f, CAP_QT),
makeParam("avi", "IYUV", 30.f, CAP_QT),
makeParam("avi", "MJPG", 30.f, CAP_QT),
makeParam("mkv", "XVID", 30.f, CAP_QT),
makeParam("mkv", "MPEG", 30.f, CAP_QT),
makeParam("mkv", "MJPG", 30.f, CAP_QT),
#endif
// TODO: Broken?
//#ifdef HAVE_AVFOUNDATION
// makeParam("mov", "mp4v", 30.f, CAP_AVFOUNDATION),

@ -64,9 +64,6 @@ ocv_target_compile_definitions(${the_module} PRIVATE OPENCV_MODULE_IS_PART_OF_WO
if(BUILD_opencv_imgcodecs AND OPENCV_MODULE_opencv_imgcodecs_IS_PART_OF_WORLD)
ocv_imgcodecs_configure_target()
endif()
if(BUILD_opencv_videoio AND OPENCV_MODULE_opencv_videoio_IS_PART_OF_WORLD)
ocv_videoio_configure_target()
endif()
if(BUILD_opencv_highgui AND OPENCV_MODULE_opencv_highgui_IS_PART_OF_WORLD)
ocv_highgui_configure_target()
endif()

Loading…
Cancel
Save