CARVIEW |
Navigation Menu
-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
videoio: add Orbbec Gemini 330 camera support #27230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@fengyuentau Could you handle the pr? |
@kaingwade will help to test this PR once we get the camera. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested the latest Gemini 330 series on Windows 10 and Ubuntu 22.04 (6.8.0-57),335/335L/336 work well, but 336L only outputs the RGB stream.
if(WIN32) | ||
# copy orbbecsdk dll to output floader | ||
if(MSVC_IDE) | ||
file(COPY ${OrbbecSDK_DLL_FILES} DESTINATION ${EXECUTABLE_OUTPUT_PATH}/Release) | ||
file(COPY ${OrbbecSDK_DLL_FILES} DESTINATION ${EXECUTABLE_OUTPUT_PATH}/Debug) | ||
file(COPY ${OrbbecSDK_RUNTIME_RESOURCE_FILES} DESTINATION ${EXECUTABLE_OUTPUT_PATH}/Release) | ||
file(COPY ${OrbbecSDK_RUNTIME_RESOURCE_FILES} DESTINATION ${EXECUTABLE_OUTPUT_PATH}/Debug) | ||
|
||
file(COPY ${OrbbecSDK_LIBRARY} DESTINATION ${LIBRARY_OUTPUT_PATH}/Release) | ||
file(COPY ${OrbbecSDK_LIBRARY} DESTINATION ${LIBRARY_OUTPUT_PATH}/Debug) | ||
elseif(MSVC AND (CMAKE_GENERATOR MATCHES "Visual")) | ||
file(COPY ${OrbbecSDK_DLL_FILES} DESTINATION ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}) | ||
file(COPY ${OrbbecSDK_RUNTIME_RESOURCE_FILES} DESTINATION ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}) | ||
file(COPY ${OrbbecSDK_LIBRARY} DESTINATION ${LIBRARY_OUTPUT_PATH}/${CMAKE_BUILD_TYPE}) | ||
else() | ||
file(COPY ${OrbbecSDK_DLL_FILES} DESTINATION ${EXECUTABLE_OUTPUT_PATH}) | ||
file(COPY ${OrbbecSDK_RUNTIME_RESOURCE_FILES} DESTINATION ${EXECUTABLE_OUTPUT_PATH}) | ||
file(COPY ${OrbbecSDK_LIBRARY} DESTINATION ${LIBRARY_OUTPUT_PATH}) | ||
endif() | ||
else() | ||
file(COPY ${OrbbecSDK_RUNTIME_RESOURCE_FILES} DESTINATION ${EXECUTABLE_OUTPUT_PATH}) | ||
file(COPY ${OrbbecSDK_DLL_FILES} DESTINATION ${LIBRARY_OUTPUT_PATH}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unlike on MacOS, on Windows and Linux functionality of Orbbec SDK is integrated into OpenCV other than calling the SDK directly. These lines are not involved.
LGTM. |
cv::Mat srcMat(frame->height, frame->width, CV_16UC1, frame->data); | ||
cv::resize(srcMat, srcMat, cv::Size(), scale, scale, cv::INTER_LINEAR); | ||
|
||
// left/right crop | ||
const int valid_width = srcMat.cols - crop_left - crop_right; | ||
if (valid_width <= 0 || srcMat.rows <= 0) { | ||
CV_LOG_ERROR(NULL, "Invalid horizontal crop parameters"); | ||
return; | ||
} | ||
srcMat = srcMat(cv::Rect(crop_left, 0, valid_width, srcMat.rows)); | ||
|
||
// top padding | ||
if (pad_top > 0) { | ||
cv::copyMakeBorder(srcMat, srcMat, pad_top, 0, 0, 0, cv::BORDER_CONSTANT, 0); | ||
} | ||
|
||
// bottom crop | ||
const int valid_height = srcMat.rows - crop_bottom; | ||
if (valid_height <= 0) { | ||
CV_LOG_ERROR(NULL, "Invalid vertical crop parameters"); | ||
return; | ||
} | ||
srcMat = srcMat(cv::Rect(0, 0, srcMat.cols, valid_height)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need resize and crop for the camera frames? I propose to return them in original size.
Also resized does not support in-place processing. The code always triggers srcMat realloc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need resize and crop for the camera frames? I propose to return them in original size. Also resized does not support in-place processing. The code always triggers srcMat realloc.
Hi, the resize/crop operations ensured pixel alignment between depth and color streams with mismatched resolutions. Without them, users would receive misaligned data. I now enforce matching resolutions to eliminate these steps. Thank you for your insight!
…the cropping operation.
videoio: add Orbbec Gemini 330 camera support opencv#27230 ### 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 ### Description of Changes #### motivated: - Orbbec has launched a new RGB-D camera — the Gemini 330. To fully leverage the capabilities of the Gemini 330, Orbbec simultaneously released version 2 of the open-source OrbbecSDK. This PR adapts the support for the Gemini 330 series cameras to better meet and respond to users’ application requirements. #### change: - Add support for the Orbbec Gemini330 camera. - Fixed an issue with Femto Mega on Windows 10/11; for details, see [issue](opencv#23237 (comment)). - When enabling `HAVE_OBSENSOR_ORBBEC_SDK`, the build now fetches version 2 of the OrbbecSDK, and the sample API calls have been updated to the v2 format. ### Testing | OS | Compiler | Camera | Result | |:----------:|:---------------------------------------:|:-----------------:|:------:| | Windows 11 | (VS2022) MSVC runtime library version 14.40 | Gemini 335/336L | Pass | | Windows 11 | (VS2022) MSVC runtime library version 14.19 | Gemini 335/336L | Pass | | Ubuntu22.04| GCC 11.4 | Gemini 335/336L | Pass | | Ubuntu18.04| GCC 7.5 | Gemini 335/336L | Pass | ### Acknowledgements Thank you to the OpenCV team for the continuous support and for creating such a robust open source project. I appreciate the valuable feedback from the community and reviewers, which has helped improve the quality of this contribution!
Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request
Description of Changes
motivated:
change:
HAVE_OBSENSOR_ORBBEC_SDK
, the build now fetches version 2 of the OrbbecSDK, and the sample API calls have been updated to the v2 format.Testing
Acknowledgements
Thank you to the OpenCV team for the continuous support and for creating such a robust open source project. I appreciate the valuable feedback from the community and reviewers, which has helped improve the quality of this contribution!