RSLightFields
Disparity map estimator from 3D light fields
Classes | Macros | Functions
rslf_depth_computation_core.hpp File Reference

Implement low-level depth computation functions. More...

#include <chrono>
#include <omp.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <rslf_interpolation.hpp>
#include <rslf_kernels.hpp>
Include dependency graph for rslf_depth_computation_core.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  rslf::Depth1DParameters< DataType >
 Impelment a structure containing all the algorithm parameters. More...
 
struct  rslf::BufferDepth1D< DataType >
 Implement a buffer containing re-usable temporary variables in order to avoid multiple unnecessary allocations. More...
 

Macros

#define _MEAN_SHIFT_MAX_ITER   10
 
#define _EDGE_CONFIDENCE_FILTER_SIZE   9
 
#define _MEDIAN_FILTER_SIZE   5
 
#define _MEDIAN_FILTER_EPSILON   0.1
 
#define _EDGE_SCORE_THRESHOLD   0.02
 
#define _DISP_SCORE_THRESHOLD   0.01
 
#define _PROPAGATION_EPSILON   0.1
 
#define _BANDWIDTH_KERNEL_PARAMETER   0.2
 
#define _EDGE_CONFIDENCE_OPENING_TYPE   cv::MORPH_ELLIPSE
 
#define _EDGE_CONFIDENCE_OPENING_SIZE   1
 
#define _SHADOW_NORMALIZED_LEVEL   0.05 * 1.73205080757
 

Functions

template<typename DataType >
void rslf::compute_1D_edge_confidence (const Mat &a_epi, int a_s, Mat &a_edge_confidence_u, Mat &a_edge_confidence_mask_u, const Depth1DParameters< DataType > &a_parameters, BufferDepth1D< DataType > &a_buffer)
 Compute the edge confidence score for a single line along the dimension u.
 
template<typename DataType >
void rslf::compute_1D_depth_epi (const Mat &a_epi, const Mat &a_dmin_u, const Mat &a_dmax_u, int a_dim_d, int a_s_hat, const Mat &a_edge_confidence_u, const Mat &a_edge_confidence_mask_u, Mat &a_disp_confidence_u, Mat &a_best_depth_u, Mat &a_rbar_u, const Depth1DParameters< DataType > &a_parameters, BufferDepth1D< DataType > &a_buffer, Mat &a_mask_u)
 Given a single EPI along dimensions (s, u) (v is fixed), compute the slopes only looking at a single line (given by s_hat).
 
template<typename DataType >
void rslf::compute_1D_edge_confidence_pile (const Vec< Mat > &a_epis, int a_s, Mat &a_edge_confidence_v_u, Mat &a_edge_confidence_mask_v_u, const Depth1DParameters< DataType > &a_parameters, Vec< BufferDepth1D< DataType > * > &a_buffers)
 Given a vector of EPIs, compute the edge confidence along the line of given index s along the dimension u.
 
template<typename DataType >
void rslf::compute_1D_depth_epi_pile (const Vec< Mat > &a_epis, const Mat &a_dmin_v_u, const Mat &a_dmax_v_u, int a_dim_d, int a_s_hat, const Mat &a_edge_confidence_v_u, const Mat &a_edge_confidence_mask_v_u, Mat &a_disp_confidence_v_u, Mat &a_best_depth_v_u, Mat &a_rbar_v_u, const Depth1DParameters< DataType > &a_parameters, Vec< BufferDepth1D< DataType > * > &a_buffers, Mat &a_mask_v_u, bool a_verbose=true)
 For every EPI in the given vector (i.e. for all v), compute the slopes only looking at a single line (given by s_hat).
 
template<typename DataType >
void rslf::compute_2D_edge_confidence (const Vec< Mat > &a_epis, Vec< Mat > &a_edge_confidence_s_v_u, Vec< Mat > &a_edge_confidence_mask_s_v_u, const Depth1DParameters< DataType > &a_parameters, Vec< BufferDepth1D< DataType > * > &a_buffers)
 Given a vector of EPIs, compute the edge confidence on all lines for all EPIs (so that an edge confidence value is given for all (s, v, u)).
 
template<typename DataType >
void rslf::compute_2D_depth_epi (const Vec< Mat > &a_epis, const Vec< Mat > &a_dmin_s_v_u, const Vec< Mat > &a_dmax_s_v_u, int a_dim_d, const Vec< Mat > &a_edge_confidence_s_v_u, const Vec< Mat > &a_edge_confidence_mask_s_v_u, Vec< Mat > &a_disp_confidence_s_v_u, Vec< Mat > &a_best_depth_s_v_u, Vec< Mat > &a_rbar_s_v_u, const Depth1DParameters< DataType > &a_parameters, Vec< BufferDepth1D< DataType > * > &a_buffers, bool a_verbose=true)
 Given a vector of EPIs, compute the disparities for all points (s, v, u) using the propagation process along the temporal axis s.
 
template<typename DataType >
void rslf::selective_median_filter (const Mat &a_src, Mat &a_dst, const Vec< Mat > &a_epis, int a_s_hat, int a_size, const Mat &a_mask_v_u, float a_epsilon)
 Filter the given spatial image of dimensions (v, u) using a selective median filter (only points with high edge confidence and similar color are taken into account).
 
template<typename DataType >
void rslf::_square_sum_channels_into (const Mat &src, Mat &dst, Mat &buffer)
 Sum the squares of the values across channels of the input matrix. More...
 
template<typename DataType >
void rslf::_multiply_multi_channel (const Mat &line_mat, const Mat &vec_mat, Mat &res_mat, Mat &buffer)
 Multiply a vec matrix by a line matrix elementwise broadcasting the line matrix over channels of the vec matrix. More...
 
template<typename DataType >
void rslf::_divide_multi_channel (const Mat &line_mat, const Mat &vec_mat, Mat &res_mat, Mat &buffer)
 Divide a vec matrix by a line matrix elementwise broadcasting the line matrix over channels of the vec matrix. More...
 

Detailed Description

Implement low-level depth computation functions.

Function Documentation

◆ _divide_multi_channel()

template<typename DataType >
void rslf::_divide_multi_channel ( const Mat line_mat,
const Mat vec_mat,
Mat res_mat,
Mat buffer 
)

Divide a vec matrix by a line matrix elementwise broadcasting the line matrix over channels of the vec matrix.

Parameters
line_matInput
vec_matInput
res_matOutput
bufferBuffer matrix (CV_32FC3)

◆ _multiply_multi_channel()

template<typename DataType >
void rslf::_multiply_multi_channel ( const Mat line_mat,
const Mat vec_mat,
Mat res_mat,
Mat buffer 
)

Multiply a vec matrix by a line matrix elementwise broadcasting the line matrix over channels of the vec matrix.

Parameters
line_matInput
vec_matInput
res_matOutput
bufferBuffer matrix (CV_32FC3)

◆ _square_sum_channels_into()

template<typename DataType >
void rslf::_square_sum_channels_into ( const Mat src,
Mat dst,
Mat buffer 
)

Sum the squares of the values across channels of the input matrix.

Parameters
srcInput
dstOutput
bufferBuffer matrix (CV_32FC1)