mirror of https://github.com/opencv/opencv.git
Merge pull request #13422 from mshabunin:split-videoio-cmake
* Split videoio dependencies search into pieces, removed obsolete backendspull/13534/head
parent
e267342108
commit
73959fed45
52 changed files with 727 additions and 5220 deletions
@ -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,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) |
|
@ -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) |
File diff suppressed because it is too large
Load Diff
@ -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); |
|
||||||
} |
|
||||||
|
|
||||||
/*----------------------------------------------------------------------------*/ |
|
@ -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_
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue