Hi All,
I have integrated the camera sdk with an c++ websocket server so I can stream the depth coordinates to a HTML page.
This works perfectly.
However I am only interested in the camera information if i have a connected client.
So what I am trying to do is initialize the camera the moment a client connects.
astra::initialize();
Then terminate the stream if no camera is connected
astra::terminate();
And then re initialize the stream as soon as I have a connected client again.
astra::initialize();
The problem is that as soon as I have terminated the astra connection and try to re initialize it I get an exception within VS 2015.
Anyone know how to re initialize the camera stream?
I have the same problem. Is this a feature or a bug? What is the best way to turn the streams on and off?
Sample code below. astra::initialize() throws an exception after the first iteration.
int main()
{
while(true)
{
astra::initialize();
auto streamSet = astra::StreamSet();
auto streamReader = streamSet.create_reader();
auto pointStream = streamReader.stream<astra::PointStream>();
pointStream.start();
auto frame = streamReader.get_latest_frame(1000);
std::cout << "frame.is_valid(): " << frame.is_valid() << std::endl;
auto pointFrame = frame.get<astra::PointFrame>();
auto pointData = (float*)pointFrame.data();
std::cout << pointData[3 * 10000] << std::endl;
astra::terminate();
}
return 0;
}