@@ -34,8 +34,10 @@ VideoCapture_obsensor::VideoCapture_obsensor(int index) : isOpened_(false)
3434{
3535 static const obsensor::StreamProfile colorProfile = { 640 , 480 , 30 , obsensor::FRAME_FORMAT_MJPG };
3636 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};
3941
4042 streamChannelGroup_ = obsensor::getStreamChannelGroup (index);
4143 if (!streamChannelGroup_.empty ())
@@ -46,11 +48,17 @@ VideoCapture_obsensor::VideoCapture_obsensor(int index) : isOpened_(false)
4648 switch (streamType)
4749 {
4850 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) {
5057 std::unique_lock<std::mutex> lk (frameMutex_);
5158 colorFrame_ = Mat (1 , frame->dataSize , CV_8UC1, frame->data ).clone ();
5259 frameCv_.notify_all ();
5360 });
61+ }
5462 break ;
5563 case obsensor::OBSENSOR_STREAM_DEPTH:
5664 {
@@ -59,11 +67,13 @@ VideoCapture_obsensor::VideoCapture_obsensor(int index) : isOpened_(false)
5967
6068 obsensor::StreamProfile profile = depthProfile;
6169 if (OBSENSOR_GEMINI2_PID == channel->getPid ()){
62- profile = gemini2depthProfile ;
70+ profile = gemini2DepthProfile ;
6371 }
6472 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;
6777 }
6878
6979 channel->start (profile, [&](obsensor::Frame* frame) {
@@ -127,6 +137,10 @@ bool VideoCapture_obsensor::retrieveFrame(int outputType, OutputArray frame)
127137 grabbedDepthFrame_ = grabbedDepthFrame_*0.8 ;
128138 grabbedDepthFrame_.copyTo (frame);
129139 }
140+ else if (OBSENSOR_FEMTO_MEGA_PID == streamChannelGroup_.front ()->getPid ()){
141+ Rect rect (0 , 0 , 640 , 360 );
142+ grabbedDepthFrame_ (rect).copyTo (frame);
143+ }
130144 else {
131145 grabbedDepthFrame_.copyTo (frame);
132146 }
0 commit comments