This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

OPT8241-CDK-EVM: Multiple Camera Problem when using voxel SDK

Part Number: OPT8241-CDK-EVM

Hello.

I am working with multiple camera using voxel SDK. My application uses MFC to show amplitude or depth data. It uses multi-threading in depth frame callback method. The application seems no problem when I use only one camera to operate. But using 2 or 3 cameras, some problem happens occasionally. Some problem means corrupted frame data(line by line), and dropping frame data.

I tried cameras connected to USB 3.0 Hub, my laptop directly, or mixed. But The problems occurred too.

How can I fix these problems?

Thank you.

  • Hi Choi, 

    Frame drops happen when the USB transfer is slower than the rate at which the frames are coming. If two handles are trying to interact with the same camera, this could occur. 

    Are you sure multiple cameras are getting connected correctly to the SDK? Which version of Voxel SDK are you using? In versions earlier than 0.6.10, multi-camera handling is not supported.

    Suramya

  • Hi Suramya Gupta, Thank you for replying.

    How many bytes are required to transfer 1 frame? I connected to camera using 10m USB extend cable with repeater. Is that environment affected to frame dropping problem?

    I built "4ebb1fae0496972163d7c31749ec10b055fffefb" with VS2017 for x86(win32), that you committed at Mar 6, 2018. I think this is 0.6.11 version of VoxelSDK.

    I attached some code of my callback routine that used in camera handling object. The handling object have CameraSystem instance separately. I create the objects to 2 or 3 to handle multiple camera.

    ///////////////////////


        DepthCameraPtr m_ptrCam;
        CameraSystem m_camSys;

    //////////////

    virtual void OnGetDepthFrame(const std::string& serialNumber, int id, uint64_t timestamp, uint32_t width, uint32_t height, const std::vector<float>& frameDataAmplitude, const std::vector<float>& frameDataDepth) = 0;

    ////////////
        m_ptrCam->registerCallback(DepthCamera::FRAME_DEPTH_FRAME, [&](DepthCamera &dc, const Frame &frame, DepthCamera::FrameType c) {
            const DepthFrame *d = dynamic_cast<const DepthFrame *>(&frame);

            if (!d)
            {
                logger(LOG_ERROR) << "Null frame captured? or not of type DepthFrame" << std::endl;
                return;
            }

            auto frameCallback = GetTofFrameCallback().lock();
            if (frameCallback)
            {
                std::thread workerDepth([](std::shared_ptr<ITofFrameCallback> frameCallback, const String& serialNumber, const DepthFrame& frame) {
                    if (frameCallback)
                    {
                        frameCallback->OnGetDepthFrame(serialNumber, frame.id, frame.timestamp, frame.size.width, frame.size.height, frame.amplitude, frame.depth);
                    }
                }
                , frameCallback, std::ref(dc.getDevice()->serialNumber()), std::ref(*d));

                workerDepth.detach(); // high frame rate but corrupted data occurred.
                //workerDepth.join(); //  corrupted data and freezing when camera stop in multi-camera.
            }
        });

        return m_ptrCam->start();

  • One frame consists of 320*240*4 = 307200 bytes per frame. It is possible to use a 10 m USB cable, this doesn't generally cause a problem. The OPT8241-CDK-EVM uses FX2, so you should be mindful of very high frame rates. What frame rate are you using? 

    As far as the code is concerned, you should have only one global CameraSystem instance. Use two (or more) cameras by connecting them using the connect function.