1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-26 05:43:05 +04:00
Files
opencv/modules/videoio/cmake/detect_obsensor.cmake
sirudoi 881774d872 Merge pull request #27930 from sirudoi:4.x
Add macOS support for Orbbec Gemini330 camera #27930

### Description of Changes
Adds macOS support for Orbbec Gemini330 in videoio by integrating OrbbecSDK v2. Completes the non-macOS work in [#27230](https://github.com/opencv/opencv/pull/27230).

#### Motivation

[#27230](https://github.com/opencv/opencv/pull/27230) skipped macOS. On macOS, UVC alone lacks required device controls; OrbbecSDK v2 provides them.

#### Key Change
 - macOS: fetch/link OrbbecSDK v2.5.5 (replaces v1.9.4).
 - videoio (macOS): switch OrbbecSDK API usage from v1 to v2.

### Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

- [x] I agree to contribute to the project under Apache 2 License.
- [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV
- [x] The PR is proposed to the proper branch
- [x] The feature is well documented and sample code can be built with the project CMake
2025-11-07 10:36:11 +03:00

54 lines
2.2 KiB
CMake

# --- obsensor ---
if(NOT HAVE_OBSENSOR)
if(OBSENSOR_USE_ORBBEC_SDK)
include("${OpenCV_SOURCE_DIR}/3rdparty/orbbecsdk/orbbecsdk.cmake")
download_orbbec_sdk(ORBBEC_SDK_ROOT_DIR)
message(STATUS "ORBBEC_SDK_ROOT_DIR: ${ORBBEC_SDK_ROOT_DIR}")
if(ORBBEC_SDK_ROOT_DIR)
set(OrbbecSDK_DIR "${ORBBEC_SDK_ROOT_DIR}")
find_package(OrbbecSDK REQUIRED)
message(STATUS "OrbbecSDK_FOUND: ${OrbbecSDK_FOUND}")
message(STATUS "OrbbecSDK_INCLUDE_DIRS: ${OrbbecSDK_INCLUDE_DIRS}")
if(OrbbecSDK_FOUND)
set(HAVE_OBSENSOR TRUE)
set(HAVE_OBSENSOR_ORBBEC_SDK TRUE)
ocv_add_external_target(obsensor "${OrbbecSDK_INCLUDE_DIRS}" "${OrbbecSDK_LIBRARY}" "HAVE_OBSENSOR;HAVE_OBSENSOR_ORBBEC_SDK")
file(COPY ${OrbbecSDK_DLL_FILES} DESTINATION ${CMAKE_BINARY_DIR}/lib)
if(NOT ORBBEC_SDK_VERSION STREQUAL "1")
# OrbbecSDK v2 loads some libraries at runtime.
file(COPY ${OrbbecSDK_RUNTIME_RESOURCE_FILES} DESTINATION ${CMAKE_BINARY_DIR}/lib)
install(DIRECTORY ${OrbbecSDK_RUNTIME_RESOURCE_FILES} DESTINATION ${OPENCV_LIB_INSTALL_PATH})
endif()
install(FILES ${OrbbecSDK_DLL_FILES} DESTINATION ${OPENCV_LIB_INSTALL_PATH})
ocv_install_3rdparty_licenses(OrbbecSDK ${OrbbecSDK_DIR}/LICENSE.txt)
endif()
endif()
else()
if(WIN32)
check_include_file(mfapi.h HAVE_MFAPI)
check_include_file(vidcap.h HAVE_VIDCAP)
if(HAVE_MFAPI AND HAVE_VIDCAP)
set(HAVE_OBSENSOR TRUE)
set(HAVE_OBSENSOR_MSMF TRUE)
ocv_add_external_target(obsensor "" "" "HAVE_OBSENSOR;HAVE_OBSENSOR_MSMF")
else()
set(HAVE_OBSENSOR OFF)
set(HAVE_OBSENSOR_MSMF OFF)
if(NOT HAVE_MFAPI)
MESSAGE(STATUS "Could not find mfapi.h. Turning HAVE_OBSENSOR OFF")
endif()
if(NOT HAVE_VIDCAP)
MESSAGE(STATUS "Could not find vidcap.h. Turning HAVE_OBSENSOR OFF")
endif()
endif()
elseif(UNIX)
check_include_file(linux/videodev2.h HAVE_CAMV4L2_OBSENSOR)
if(HAVE_CAMV4L2_OBSENSOR)
set(HAVE_OBSENSOR TRUE)
set(HAVE_OBSENSOR_V4L2 TRUE)
ocv_add_external_target(obsensor "" "" "HAVE_OBSENSOR;HAVE_OBSENSOR_V4L2")
endif()
endif()
endif()
endif()