• DepthAI
  • How to modify queue_add_callback.cpp to use mono cameras only?

Hi, I am trying to catch mono images using callbacks, I modified the queue_add_callback.cpp by comment out all lines contain 'camRgb'. But it seems not working? If I use StreroDepth node, does it mean I must also use rgb camera?
Is it possible to hook only mono cameras? What more should I take care not to hook rgb camera? Thanks for replay!

  • erik replied to this.

    Hello frankshieh, how about selecting only mono streams when starting the deptha_demo?
    python3 depthai_demo.py -s left right
    Thanks, Erik

      erik But I am using in VS C++ and I hope to get rectified images.Using python then we must have two programs running, one using python to get vedio streams and one is our golf program that is by c++.Seems a little complicated! Do you realy suuggest us getting video steam using python?

      • erik replied to this.

        frankshieh I'm terribly sorry, I thought you were talking about python depthai_demo.py custom handlers. I re-read it and it now makes sense. So to remove mono cameras you can just use the example you are using and remove all lines that contain them (17/18 when creating the nodes, 27-30 and 34/35 when linking them).
        Thanks, Erik

          erik No, I would like to remove RGB camera! But it seems the program is unstable after I remove RGB cam lines!

          • erik replied to this.

            erik Hi, I have compared my codes with your callback_no_color.cpp . I have commented out L6870 :
            if(!data.frame.empty()) {
            cv::imshow(data.name.c_str(), data.frame);
            }
            But it seems program won't work without call opencv to show these images. After I add them back, I can get mono images at 110fps. But I found there are still some frames lost when I dump the time stamps of stored queues.
            device.setXLinkChunkSize(0);
            Has been added, the lost frames will be decreased. But still about less then 10 frames in one second will be lost. And we might try to interpolate them back. Or if there is some ways to get all frames unlost, please advice! Lost frames will cause us some troubles.
            Thanks!

              frankshieh Hi, here is my updates: There's NO lost frames in release mode of my codes.
              It seems debug mode will slow down callback hook sometimes and cause some frames lost. And release mode is OK as my preliminary tests.

              • erik replied to this.

                Hello frankshieh ,
                that's interesting, thanks for the feedback. In theory, if you are using device.getOutputQueue("frames", 4, **true**) it will block the pipeline to ensure no frames/messages are lost. Another thing is that the throughput of USB might not be able to handle 120FPS mono frames.
                Thanks, Erik

                  erik I have tried both true and false, flase will be more stable and is currely used. Though it will lost some frames but aceptable in my application. And currently I am using 110 fps about 9ms per frame. I am going on with this setting!