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

Method process

src/cpu_depth_packet_processor.cpp:879–976  ·  view source on GitHub ↗

* Process a packet. * @param packet Packet to process. */

Source from the content-addressed store, hash-verified

877 * @param packet Packet to process.
878 */
879void CpuDepthPacketProcessor::process(const DepthPacket &packet)
880{
881 if(listener_ == 0) return;
882
883 impl_->startTiming();
884
885 impl_->ir_frame->timestamp = packet.timestamp;
886 impl_->depth_frame->timestamp = packet.timestamp;
887 impl_->ir_frame->sequence = packet.sequence;
888 impl_->depth_frame->sequence = packet.sequence;
889
890 Mat<Vec<float, 9> >
891 m(424, 512),
892 m_filtered(424, 512)
893 ;
894 Mat<unsigned char> m_max_edge_test(424, 512);
895
896 float *m_ptr = (m.ptr(0, 0)->val);
897
898 for(int y = 0; y < 424; ++y)
899 for(int x = 0; x < 512; ++x, m_ptr += 9)
900 {
901 impl_->processPixelStage1(x, y, packet.buffer, m_ptr + 0, m_ptr + 3, m_ptr + 6);
902 }
903
904 // bilateral filtering
905 if(impl_->enable_bilateral_filter)
906 {
907 float *m_filtered_ptr = (m_filtered.ptr(0, 0)->val);
908 unsigned char *m_max_edge_test_ptr = m_max_edge_test.ptr(0, 0);
909
910 for(int y = 0; y < 424; ++y)
911 for(int x = 0; x < 512; ++x, m_filtered_ptr += 9, ++m_max_edge_test_ptr)
912 {
913 bool max_edge_test_val = true;
914 impl_->filterPixelStage1(x, y, m, m_filtered_ptr, max_edge_test_val);
915 *m_max_edge_test_ptr = max_edge_test_val ? 1 : 0;
916 }
917
918 m_ptr = (m_filtered.ptr(0, 0)->val);
919 }
920 else
921 {
922 m_ptr = (m.ptr(0, 0)->val);
923 }
924
925 Mat<float> out_ir(424, 512, impl_->ir_frame->data), out_depth(424, 512, impl_->depth_frame->data);
926
927 if(impl_->enable_edge_filter)
928 {
929 Mat<Vec<float, 3> > depth_ir_sum(424, 512);
930 Vec<float, 3> *depth_ir_sum_ptr = depth_ir_sum.ptr(0, 0);
931 unsigned char *m_max_edge_test_ptr = m_max_edge_test.ptr(0, 0);
932
933 for(int y = 0; y < 424; ++y)
934 for(int x = 0; x < 512; ++x, m_ptr += 9, ++m_max_edge_test_ptr, ++depth_ir_sum_ptr)
935 {
936 float raw_depth, ir_sum;

Callers

nothing calls this directly

Calls 9

startTimingMethod · 0.80
processPixelStage1Method · 0.80
filterPixelStage1Method · 0.80
processPixelStage2Method · 0.80
filterPixelStage2Method · 0.80
onNewFrameMethod · 0.80
ptrMethod · 0.45
newIrFrameMethod · 0.45
newDepthFrameMethod · 0.45

Tested by

no test coverage detected