MCPcopy Create free account
hub / github.com/OpenKinect/libfreenect2 / stream

Method stream

tools/streamer_recorder/streamer.cpp:43–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43void Streamer::stream(libfreenect2::Frame* frame)
44{
45 try
46 {
47 // int total_pack = 1 + (encoded.size() - 1) / PACK_SIZE;
48 cv::Mat frame_depth = cv::Mat(frame->height, frame->width, CV_32FC1, frame->data) / 10;
49 cv::imencode(".jpg", frame_depth, encoded, compression_params);
50
51 // resize image
52 // resize(frame, encoded, Size(FRAME_WIDTH, FRAME_HEIGHT), 0, 0, INTER_LINEAR);
53
54 // show encoded frame
55 // cv::namedWindow( "streamed frame", CV_WINDOW_AUTOSIZE);
56 // cv::imshow("streamed frame", encoded);
57 // cv::waitKey(0);
58
59 total_pack = 1 + (encoded.size() - 1) / PACK_SIZE;
60
61 // send pre-info
62 ibuf[0] = total_pack;
63 sock.sendTo(ibuf, sizeof(int), servAddress, servPort);
64
65 // send image data packet
66 for(int i = 0; i < total_pack; i++)
67 sock.sendTo( & encoded[i * PACK_SIZE], PACK_SIZE, servAddress, servPort);
68 }
69 catch (SocketException & e)
70 {
71 std::cerr << e.what() << std::endl;
72 // exit(1);
73 }
74}

Callers 1

mainFunction · 0.80

Calls 4

MatClass · 0.85
sendToMethod · 0.80
sizeMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected