@@ -12,7 +12,6 @@ int main() {
1212 // Define a source - color camera
1313 auto camRgb = pipeline.create <dai::node::ColorCamera>();
1414 camRgb->setInterleaved (true );
15- camRgb->setIspScale (1 , 3 ); // 1920x1080 / 3 = 640x360
1615 camRgb->setPreviewSize (640 , 360 );
1716 camRgb->setFps (FPS);
1817
@@ -35,21 +34,12 @@ int main() {
3534 left->out .link (stereo->left );
3635 right->out .link (stereo->right );
3736
38- auto encLeft = pipeline.create <dai::node::VideoEncoder>();
39- encLeft->setDefaultProfilePreset (left->getFps (), dai::VideoEncoderProperties::Profile::H264_MAIN);
40- stereo->syncedLeft .link (encLeft->input );
41-
42- auto encRight = pipeline.create <dai::node::VideoEncoder>();
43- encRight->setDefaultProfilePreset (left->getFps (), dai::VideoEncoderProperties::Profile::H264_MAIN);
44- stereo->syncedRight .link (encRight->input );
4537
4638 // Script node will sync high-res frames
4739 auto script = pipeline.create <dai::node::Script>();
4840
4941 // Send all streams to the Script node so we can sync them
5042 stereo->disparity .link (script->inputs [" disp_in" ]);
51- encLeft->bitstream .link (script->inputs [" left_in" ]);
52- encRight->bitstream .link (script->inputs [" right_in" ]);
5343 camRgb->preview .link (script->inputs [" rgb_in" ]);
5444
5545 script->setScript (R"(
@@ -80,7 +70,7 @@ int main() {
8070 else:
8171 return False # We don't have synced frames yet
8272
83- names = ['disp', 'left', 'right', ' rgb']
73+ names = ['disp', 'rgb']
8474 frames = dict() # Dict where we store all received frames
8575 for name in names:
8676 frames[name] = []
@@ -103,30 +93,17 @@ int main() {
10393 time.sleep(0.001) # Avoid lazy looping
10494 )" );
10595
106- std::vector<std::string> scriptOut{" disp" , " left " , " right " };
96+ std::vector<std::string> scriptOut{" disp" , " rgb " };
10797 for (auto & name : scriptOut) {
10898 auto xout = pipeline.create <dai::node::XLinkOut>();
10999 xout->setStreamName (name);
110100 script->outputs [name + " _out" ].link (xout->input );
111101 }
112102
113- // Convert color stream RGB->NV12 so we can later encode the stream
114- auto typeManip = pipeline.create <dai::node::ImageManip>();
115- typeManip->initialConfig .setFrameType (dai::RawImgFrame::Type::NV12);
116- script->outputs [" rgb_out" ].link (typeManip->inputImage );
117-
118- auto encRgb = pipeline.create <dai::node::VideoEncoder>();
119- encRgb->setDefaultProfilePreset (camRgb->getFps (), dai::VideoEncoderProperties::Profile::H264_MAIN);
120- typeManip->out .link (encRgb->input );
121- // Send encoded color stream to the host computer
122- auto xoutRgb = pipeline.create <dai::node::XLinkOut>();
123- xoutRgb->setStreamName (" rgb" );
124- encRgb->bitstream .link (xoutRgb->input );
125-
126103 dai::Device device (pipeline);
127104 // Rgb should be the first - as we will first.get() that frame, as it will arrive the latest to the host
128105 // because it first needs to be converted to NV12 and then encoded to H264.
129- std::vector<std::string> names{" rgb" , " disp" , " left " , " right " };
106+ std::vector<std::string> names{" rgb" , " disp" };
130107 std::map<std::string, std::shared_ptr<dai::DataOutputQueue>> streams;
131108 for (auto & name : names) {
132109 streams[name] = device.getOutputQueue (name);
0 commit comments