realsense后处理

realsense的深度信息噪声特别大,直接拿来做物体定位不会太准,需要先后处理。
可参考:

  1. https://www.mouser.com/pdfdocs/Intel-RealSense-Depth-PostProcess.pdf
  2. https://github.com/IntelRealSense/librealsense/blob/master/doc/post-processing-filters.md#hole-filling-filter
 	// Streaming initialization
    rs2::pipeline pipe;
    ...
    // Declare filters
    rs2::decimation_filter dec_filter;
    rs2::spatial_filter spat_filter;

    // Configure filter parameters
    decimation_filter.set_option(RS2_OPTION_FILTER_MAGNITUDE, 3);
    ...
    spatial_filter.set_option(RS2_OPTION_FILTER_SMOOTH_ALPHA, 0.55f);
    ...


    // Main Loop
   while (true) {
       	rs2::frameset data = pipe.wait_for_frames();
   		rs2::frame depth_frame = data.get_depth_frame();
   		...
   		rs2::frame filtered = depth_frame;
   		// Note the concatenation of output/input frame to build up a chain
   		filtered = dec_filter.process(filtered);
   		filtered = spatial_filter.process(filtered);
	}

你可能感兴趣的:(机器人,机器视觉)