-
-
Notifications
You must be signed in to change notification settings - Fork 56.2k
videoio: add support for obsensor (Orbbec RGB-D Camera ) #22196
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
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.
Thank you for your contribution!
modules/videoio/src/cap_obsensor/obsensor_stream_channel_interface.hpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_stream_channel_msmf.cpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_stream_channel_v4l2.cpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_stream_channel_v4l2.cpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_uvc_stream_channel.cpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_uvc_stream_channel.cpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_stream_channel_interface.hpp
Outdated
Show resolved
Hide resolved
Functional test reportTesting Code: Functional Test summary
Multi-Camera Test
some results display |
modules/videoio/src/cap_obsensor/obsensor_stream_channel_interface.hpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_stream_channel_interface.hpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_stream_channel_interface.hpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_stream_channel_interface.hpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_stream_channel_msmf.cpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_stream_channel_msmf.hpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_stream_channel_v4l2.cpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_stream_channel_v4l2.cpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_uvc_stream_channel.hpp
Outdated
Show resolved
Hide resolved
modules/videoio/src/cap_obsensor/obsensor_uvc_stream_channel.cpp
Outdated
Show resolved
Hide resolved
virtual void stop() override; | ||
|
||
private: | ||
virtual bool setXu(uint8_t ctrl, const uint8_t* data, uint32_t len) override; |
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.
can we use int ctrl
instead of uint8_t ctrl
?
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.
According to the UVC protocol , the range of ctrl
is limited on: 0~255
|
||
FrameCallback frameCallback_; | ||
StreamProfile currentProfile_; | ||
int8_t currentStreamIndex_; |
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.
int currentStreamIndex_;
?
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.
currentStreamIndex_
is less than 5, and currentStreamIndex_ < 0
mean error!
modules/videoio/src/cap_obsensor/obsensor_stream_channel_msmf.hpp
Outdated
Show resolved
Hide resolved
Mat adjDepthMap; | ||
while (true) | ||
{ | ||
// obsensorCapture >> depthMap; |
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.
Can we remove this piece of code? I see a very similar chunk of code below
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.
I will remove this and add some comments
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.
LGTM! 👍
Looks good to me! @alalek, I think, it can be merged |
//! OBSENSOR data given from iamge generator | ||
enum { | ||
CAP_OBSENSOR_DEPTH_MAP = 0, //!< Depth values in mm (CV_16UC1) | ||
CAP_OBSENSOR_BGR_IMAGE = 1, //!< Data given from BGR stream generator |
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.
BGR image is preserved to default stream 0 (of any VideoCapture backend)
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.
According to the existing code, both OpenNI and Intel Realsense use depth as the default stream。For RGB-D cameras, depth as the default stream is more in line with user needs as they may only need the depth data stream.
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.
@vpisarev Vadim, could you take a look on this and put a comment?
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.
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.
Problem is that this support is enabled by default (for many build configurations).
Existed user code may not expect non 8UC3 data and crash (16SC1/16UC1 or 32FC1 are used for depth).
Exception is preferable (and reliable for this case) than silent replacing of 8UC3 result.
If we go in this way, then we must update many sample code / documentation snippets / etc. But this would not resolve problem with existed users code.
BTW, another approach may go through another API, like VideoDepthCapture
. Including OpenNI/Realsense "buggy" cases.
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.
@alalek, there is already such situation with OpenNI and PerC and so far it did not cause any major problems. Let me merge this PR
while (true) | ||
{ | ||
// Grab depth map like this: | ||
// obsensorCapture >> depthMap; |
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.
"default" grab should be preserved for BGR frames (not depth or whatever)
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.
for depth cameras making the "depth" default is fine, I think.
After merging this PR there is a linking issue when building WinPack:
Steps to reproduce:
|
Currently, you could avoid this problem by disable cmake option |
Rage merge should not happen at all.
|
* videoio: add support for obsensor (Orbbec RGB-D Camera ) * obsensor: code format issues fixed and some code optimized * obsensor: fix typo and format issues * obsensor: fix crosses initialization error
VideoCapture for OBSensor
OBSensor is Orbbec's new generation RGB-D camera brand, based on UVC protocol. The purpose is to let OpenCV read RGB and depth data from Orbbec RGB-D Camera via UVC protocol, rather than relying on the 3rdparty library (like OpenNI). This will greatly facilitate users to directly read, use and process the depth camera in OpenCV.
Supported Orbbec Device
Supported OS: Windows and Linux. (MacOX will be supported in near future.)
Supported HW: x86, x64, ARM.
Since the new Orbbec devices rely on UVC, while old devices still rely on OpenNI. This will cause OBSensor doesn't support some old Orbbec cameras, and the following is a list of specific unsupported devices:
For these unspported devices, we still need the support of
OpenNI
, please refer to the detailed tutorial of Using Orbbec Astra 3D cameras in OpenCV.Pull Request Readiness Checklist
See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request