@@ -34,8 +34,10 @@ VideoCapture_obsensor::VideoCapture_obsensor(int index) : isOpened_(false)
34
34
{
35
35
static const obsensor::StreamProfile colorProfile = { 640 , 480 , 30 , obsensor::FRAME_FORMAT_MJPG };
36
36
static const obsensor::StreamProfile depthProfile = {640 , 480 , 30 , obsensor::FRAME_FORMAT_Y16};
37
- static const obsensor::StreamProfile gemini2depthProfile = {1280 , 800 , 30 , obsensor::FRAME_FORMAT_Y14};
38
- static const obsensor::StreamProfile astra2depthProfile = {640 , 480 , 30 , obsensor::FRAME_FORMAT_Y14};
37
+ static const obsensor::StreamProfile gemini2DepthProfile = {1280 , 800 , 30 , obsensor::FRAME_FORMAT_Y14};
38
+ static const obsensor::StreamProfile astra2DepthProfile = {640 , 480 , 30 , obsensor::FRAME_FORMAT_Y14};
39
+ static const obsensor::StreamProfile megaColorProfile = {1280 , 720 , 30 , obsensor::FRAME_FORMAT_MJPG};
40
+ static const obsensor::StreamProfile megaDepthProfile = {640 , 576 , 30 , obsensor::FRAME_FORMAT_Y16};
39
41
40
42
streamChannelGroup_ = obsensor::getStreamChannelGroup (index );
41
43
if (!streamChannelGroup_.empty ())
@@ -46,11 +48,17 @@ VideoCapture_obsensor::VideoCapture_obsensor(int index) : isOpened_(false)
46
48
switch (streamType)
47
49
{
48
50
case obsensor::OBSENSOR_STREAM_COLOR:
49
- channel->start (colorProfile, [&](obsensor::Frame* frame) {
51
+ {
52
+ auto profile = colorProfile;
53
+ if (OBSENSOR_FEMTO_MEGA_PID == channel->getPid ()){
54
+ profile = megaColorProfile;
55
+ }
56
+ channel->start (profile, [&](obsensor::Frame* frame) {
50
57
std::unique_lock<std::mutex> lk (frameMutex_);
51
58
colorFrame_ = Mat (1 , frame->dataSize , CV_8UC1, frame->data ).clone ();
52
59
frameCv_.notify_all ();
53
60
});
61
+ }
54
62
break ;
55
63
case obsensor::OBSENSOR_STREAM_DEPTH:
56
64
{
@@ -59,11 +67,13 @@ VideoCapture_obsensor::VideoCapture_obsensor(int index) : isOpened_(false)
59
67
60
68
obsensor::StreamProfile profile = depthProfile;
61
69
if (OBSENSOR_GEMINI2_PID == channel->getPid ()){
62
- profile = gemini2depthProfile ;
70
+ profile = gemini2DepthProfile ;
63
71
}
64
72
else if (OBSENSOR_ASTRA2_PID == channel->getPid ()){
65
-
66
- profile = astra2depthProfile;
73
+ profile = astra2DepthProfile;
74
+ }
75
+ else if (OBSENSOR_FEMTO_MEGA_PID == channel->getPid ()){
76
+ profile = megaDepthProfile;
67
77
}
68
78
69
79
channel->start (profile, [&](obsensor::Frame* frame) {
@@ -127,6 +137,10 @@ bool VideoCapture_obsensor::retrieveFrame(int outputType, OutputArray frame)
127
137
grabbedDepthFrame_ = grabbedDepthFrame_*0.8 ;
128
138
grabbedDepthFrame_.copyTo (frame);
129
139
}
140
+ else if (OBSENSOR_FEMTO_MEGA_PID == streamChannelGroup_.front ()->getPid ()){
141
+ Rect rect (0 , 0 , 640 , 360 );
142
+ grabbedDepthFrame_ (rect).copyTo (frame);
143
+ }
130
144
else {
131
145
grabbedDepthFrame_.copyTo (frame);
132
146
}
0 commit comments