Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

sirudoi
Copy link
Contributor

@sirudoi sirudoi commented Apr 14, 2025

Pull Request Readiness Checklist

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

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • The PR is proposed to the proper branch
  • 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.
  • 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!

@asmorkalov asmorkalov requested a review from fengyuentau April 16, 2025 07:46
@asmorkalov
Copy link
Contributor

@fengyuentau Could you handle the pr?

@fengyuentau
Copy link
Member

@fengyuentau Could you handle the pr?

@kaingwade will help to test this PR once we get the camera.

@fengyuentau fengyuentau requested a review from kaingwade April 16, 2025 08:02
Copy link
Contributor

@kaingwade kaingwade left a 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.

Comment on lines 16 to 37
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})
Copy link
Contributor

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.

@kaingwade
Copy link
Contributor

LGTM.

Comment on lines 221 to 243
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));
Copy link
Contributor

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.

Copy link
Contributor Author

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!

@asmorkalov asmorkalov added this to the 4.12.0 milestone Apr 23, 2025
@asmorkalov asmorkalov merged commit 485c7d5 into opencv:4.x Apr 25, 2025
51 of 55 checks passed
fengyuentau pushed a commit to fengyuentau/opencv that referenced this pull request Apr 25, 2025
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!
@asmorkalov asmorkalov mentioned this pull request Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants