Part Number: OPT8241-CDK-EVM
Tool/software: TI C/C++ Compiler
Dear All:
We would like to steram multiple OPT8241 cameras synchrously.
The flow is designed as follows.
1. Connect Camera 1 to the computer with USB cable.
2. Start Voxel Viewer and start streaming.
3. Connect Camera 2 to the computer with USB cable.
4. Start another instance of Voxel Viewer and start streaming.
We will need to register call back twice, one for each camera. Each camera should have a different buffer. (refer: github.com/.../Qt)
First we try to integrate grabber.cpp and grabber.h(in github.com/.../Qt) to my main code.We found that callback function execute only once and can't continue to run again.Why?
Which setting is ignored in main code? What can we do next step?
Best Regards,
ShengHua
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The partial code is as follows.
main code:
CameraSystem sys;
// Get all valid detected devices
- const Vector<DevicePtr> &devices = sys.scan();
- DevicePtr toConnect;
- DepthCameraPtr depthCamera = sys.connect(toConnect);
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Grabber Grabber1(depthCamera, Grabber::FRAMEFLAG_DEPTH_FRAME, sys);
- Grabber1.start();
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In grabber.cpp
void Grabber::_callback(DepthCamera &depthCamera, const Frame &frame,DepthCamera::FrameType type)
{
Lock<Mutex> _(_mtx); // run only once
~~~~
else if (type == DepthCamera::FRAME_XYZI_POINT_CLOUD_FRAME)
{
if (_qXYZIFrame.size() >= FIFO_SIZE)
{
XYZIPointCloudFrame *f = _qXYZIFrame.front();
_qXYZIFrame.pop_front();
if (f != NULL)
delete f;
}
XYZIPointCloudFrame *nf = new XYZIPointCloudFrame;
*nf = *dynamic_cast<const XYZIPointCloudFrame *>(&frame);
_qXYZIFrame.push_back(nf);
_frameCount++;
}
}
////////////////////////////////////////////////////////////////////////////////////////////