Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork56.4k
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
+118 −27
Merged
Changes fromall commits
Commits
Show all changes
10 commits Select commitHold shift + click to select a range
1b24e5d obsensor: add Orbbec Gemini330 camera support
sirudoi2ef9880 obsensor: pull OrbbecSDK v2 during build and update API calls
sirudoi49a1437 obsensor: fix compiler warnings
sirudoi9ce46bf obsensor: replace OrbbecSDK Git clone with archive download
sirudoic45874c obsensor: add firmware reminder to Note section
sirudoie9a444f obsensor: revert OrbbecSDK invocation code on macOS
sirudoie145f1f obsensor: fix API usage to v1 version
sirudoi2f1eccf obsensor: revert all API calls back to the v1 SDK.
sirudoi9edb7d6 obsensor: move ObExtensionUnit definitions from header to source file
sirudoibf3f4e3 obsensor: modify the stream-start resolution configuration to remove …
sirudoiFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
3 changes: 2 additions & 1 deletiondoc/tutorials/app/orbbec_uvc.markdown
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletionmodules/videoio/include/opencv2/videoio.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
15 changes: 15 additions & 0 deletionsmodules/videoio/src/cap_obsensor/obsensor_stream_channel_interface.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
18 changes: 12 additions & 6 deletionsmodules/videoio/src/cap_obsensor/obsensor_stream_channel_msmf.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletionsmodules/videoio/src/cap_obsensor/obsensor_stream_channel_v4l2.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
58 changes: 56 additions & 2 deletionsmodules/videoio/src/cap_obsensor/obsensor_uvc_stream_channel.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -35,19 +35,23 @@ | ||
| namespace cv { | ||
| namespace obsensor { | ||
| const ObExtensionUnit OBSENSOR_COMMON_XU_UNIT = { XU_UNIT_ID_COMMON, { 0xA55751A1, 0xF3C5, 0x4A5E, { 0x8D, 0x5A, 0x68, 0x54, 0xB8, 0xFA, 0x27, 0x16 } } }; | ||
| const ObExtensionUnit OBSENSOR_G330_XU_UNIT = { XU_UNIT_ID_G330, { 0xC9606CCB, 0x594C, 0x4D25, { 0xaf, 0x47, 0xcc, 0xc4, 0x96, 0x43, 0x59, 0x95 } } }; | ||
| const uint8_t OB_EXT_CMD0[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0x52, 0x00, 0x5B, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD1[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0x54, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD2[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0x56, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD3[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0x58, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD4[16] = { 0x47, 0x4d, 0x02, 0x00, 0x03, 0x00, 0x60, 0x00, 0xed, 0x03, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD5[16] = { 0x47, 0x4d, 0x02, 0x00, 0x03, 0x00, 0x62, 0x00, 0xe9, 0x03, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD6[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0x7c, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}; | ||
| const uint8_t OB_EXT_CMD7[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0xfe, 0x12, 0x55, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD8[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0xfe, 0x13, 0x3f, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD9[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0xfa, 0x13, 0x4b, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD11[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0xfe, 0x13, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD12[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0xfe, 0x13, 0x3f, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD13[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0xfa, 0x13, 0x4b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; | ||
| const uint8_t OB_EXT_CMD14[16] = { 0x47, 0x4d, 0x04, 0x00, 0x02, 0x00, 0xfa, 0x14, 0xd3, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 }; | ||
| #if defined(HAVE_OBSENSOR_V4L2) | ||
| #define fourCc2Int(a, b, c, d) \ | ||
| @@ -62,6 +66,7 @@ const std::map<uint32_t, FrameFormat> fourccToOBFormat = { | ||
| {fourCc2Int('M', 'J', 'P', 'G'), FRAME_FORMAT_MJPG}, | ||
| {fourCc2Int('Y', '1', '6', ' '), FRAME_FORMAT_Y16}, | ||
| {fourCc2Int('Y', '1', '4', ' '), FRAME_FORMAT_Y14}, | ||
| {fourCc2Int('Z', '1', '6', ' '), FRAME_FORMAT_Y16} | ||
asmorkalov marked this conversation as resolved. Show resolvedHide resolvedUh oh!There was an error while loading.Please reload this page. | ||
| }; | ||
| StreamType parseUvcDeviceNameToStreamType(const std::string& devName) | ||
| @@ -204,7 +209,6 @@ DepthFrameUnpacker::~DepthFrameUnpacker() { | ||
| delete[] outputDataBuf_; | ||
| } | ||
| #define ON_BITS(count) ((1 << count) - 1) | ||
| #define CREATE_MASK(count, offset) (ON_BITS(count) << offset) | ||
| #define TAKE_BITS(source, count, offset) ((source & CREATE_MASK(count, offset)) >> offset) | ||
| @@ -245,6 +249,7 @@ void DepthFrameUnpacker::process(Frame *frame){ | ||
| IUvcStreamChannel::IUvcStreamChannel(const UvcDeviceInfo& devInfo) : | ||
| devInfo_(devInfo), | ||
| xuUnit_(IS_OBSENSOR_GEMINI330_PID(devInfo.pid) ? OBSENSOR_G330_XU_UNIT : OBSENSOR_COMMON_XU_UNIT), | ||
| streamType_(parseUvcDeviceNameToStreamType(devInfo_.name)) | ||
| { | ||
| @@ -286,6 +291,11 @@ bool IUvcStreamChannel::setProperty(int propId, const uint8_t* /*data*/, uint32_ | ||
| rst &= getXu(2, &rcvData, &rcvLen); | ||
| rst &= setXu(2, OB_EXT_CMD6, sizeof(OB_EXT_CMD6)); | ||
| rst &= getXu(2, &rcvData, &rcvLen); | ||
| }else if(IS_OBSENSOR_GEMINI330_PID(devInfo_.pid)) { | ||
| rst &= setXu(2, OB_EXT_CMD6, sizeof(OB_EXT_CMD6)); | ||
| rst &= getXu(2, &rcvData, &rcvLen); | ||
| rst &= setXu(2, OB_EXT_CMD14, sizeof(OB_EXT_CMD14)); | ||
| rst &= getXu(2, &rcvData, &rcvLen); | ||
| }else{ | ||
| rst &= setXu(2, OB_EXT_CMD0, sizeof(OB_EXT_CMD0)); | ||
| rst &= getXu(2, &rcvData, &rcvLen); | ||
| @@ -400,6 +410,42 @@ bool IUvcStreamChannel::getProperty(int propId, uint8_t* recvData, uint32_t* rec | ||
| *recvDataSize = sizeof(CameraParam); | ||
| memcpy(recvData, ¶m, *recvDataSize); | ||
| } | ||
| else if(IS_OBSENSOR_GEMINI330_SHORT_PID(devInfo_.pid)){ | ||
| // return default param | ||
| CameraParam param; | ||
| param.p0[0] = 460.656f; | ||
| param.p0[1] = 460.782f; | ||
| param.p0[2] = 320.985f; | ||
| param.p0[3] = 233.921f; | ||
| param.p1[0] = 460.656f; | ||
| param.p1[1] = 460.782f; | ||
| param.p1[2] = 320.985f; | ||
| param.p1[3] = 233.921f; | ||
| param.p6[0] = 640; | ||
| param.p6[1] = 480; | ||
| param.p7[0] = 640; | ||
| param.p7[1] = 480; | ||
| *recvDataSize = sizeof(CameraParam); | ||
| memcpy(recvData, ¶m, *recvDataSize); | ||
| } | ||
| else if(IS_OBSENSOR_GEMINI330_LONG_PID(devInfo_.pid)){ | ||
| // return default param | ||
| CameraParam param; | ||
| param.p0[0] = 366.751f; | ||
| param.p0[1] = 365.782f; | ||
| param.p0[2] = 319.893f; | ||
| param.p0[3] = 243.415f; | ||
| param.p1[0] = 366.751f; | ||
| param.p1[1] = 365.782f; | ||
| param.p1[2] = 319.893f; | ||
| param.p1[3] = 243.415f; | ||
| param.p6[0] = 640; | ||
| param.p6[1] = 480; | ||
| param.p7[0] = 640; | ||
| param.p7[1] = 480; | ||
| *recvDataSize = sizeof(CameraParam); | ||
| memcpy(recvData, ¶m, *recvDataSize); | ||
| } | ||
| else{ | ||
| rst &= setXu(2, OB_EXT_CMD5, sizeof(OB_EXT_CMD5)); | ||
| rst &= getXu(2, &rcvData, &rcvLen); | ||
| @@ -453,7 +499,15 @@ bool IUvcStreamChannel::initDepthFrameProcessor() | ||
| setXu(2, OB_EXT_CMD13, sizeof(OB_EXT_CMD13)); | ||
| getXu(2, &rcvData, &rcvLen); | ||
| return true; | ||
| } | ||
| else if(IS_OBSENSOR_GEMINI330_PID(devInfo_.pid)) | ||
| { | ||
| uint8_t* rcvData; | ||
| uint32_t rcvLen; | ||
| setXu(2, OB_EXT_CMD7, sizeof(OB_EXT_CMD7)); | ||
| getXu(2, &rcvData, &rcvLen); | ||
| return true; | ||
| } | ||
| else if(streamType_ == OBSENSOR_STREAM_DEPTH && setXu(2, OB_EXT_CMD4, sizeof(OB_EXT_CMD4))) | ||
14 changes: 13 additions & 1 deletionmodules/videoio/src/cap_obsensor/obsensor_uvc_stream_channel.hpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
31 changes: 17 additions & 14 deletionsmodules/videoio/src/cap_obsensor_capture.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.