2011-03-30 05:48:36 +08:00
Camera Calibration and 3D Reconstruction
2011-02-23 04:43:26 +08:00
========================================
.. highlight :: cpp
2011-08-30 16:27:23 +08:00
2011-02-23 04:43:26 +08:00
gpu::StereoBM_GPU
-----------------
2011-06-16 20:48:23 +08:00
.. ocv:class :: gpu::StereoBM_GPU
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
Class computing stereo correspondence (disparity map) using the block matching algorithm. ::
2011-02-23 04:43:26 +08:00
class StereoBM_GPU
{
public:
enum { BASIC_PRESET = 0, PREFILTER_XSOBEL = 1 };
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
enum { DEFAULT_NDISP = 64, DEFAULT_WINSZ = 19 };
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
StereoBM_GPU();
2011-02-26 19:05:10 +08:00
StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP,
2011-02-23 04:43:26 +08:00
int winSize = DEFAULT_WINSZ);
2011-02-26 19:05:10 +08:00
void operator() (const GpuMat& left, const GpuMat& right,
2011-08-30 16:27:23 +08:00
GpuMat& disparity, Stream& stream = Stream::Null());
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
static bool checkIfGpuCallReasonable();
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
int preset;
int ndisp;
int winSize;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
float avergeTexThreshold;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
...
};
2011-03-01 05:26:43 +08:00
2011-03-29 07:16:20 +08:00
2011-08-30 16:27:23 +08:00
The class also performs pre- and post-filtering steps: Sobel pre-filtering (if `` PREFILTER_XSOBEL `` flag is set) and low textureness filtering (if `` averageTexThreshols > 0 `` ). If `` avergeTexThreshold = 0 `` , low textureness filtering is disabled. Otherwise, the disparity is set to 0 in each point `` (x, y) `` , where for the left image
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
.. math ::
2011-03-29 07:16:20 +08:00
\sum HorizontalGradiensInWindow(x, y, winSize) < (winSize \cdot winSize) \cdot avergeTexThreshold
2011-03-23 18:56:20 +08:00
2011-03-30 05:48:36 +08:00
This means that the input left image is low textured.
2011-02-23 04:43:26 +08:00
2013-08-06 22:24:09 +08:00
.. note ::
2011-08-30 16:27:23 +08:00
2013-08-06 22:24:09 +08:00
* A basic stereo matching example can be found at opencv_source_code/samples/gpu/stereo_match.cpp
* A stereo matching example using several GPU's can be found at opencv_source_code/samples/gpu/stereo_multi.cpp
* A stereo matching example using several GPU's and driver API can be found at opencv_source_code/samples/gpu/driver_api_stereo_multi.cpp
2013-08-21 20:44:09 +08:00
2011-03-03 15:29:55 +08:00
gpu::StereoBM_GPU::StereoBM_GPU
2011-03-30 05:48:36 +08:00
-----------------------------------
2011-08-30 16:27:23 +08:00
Enables :ocv:class: `gpu::StereoBM_GPU` constructors.
2011-06-16 20:48:23 +08:00
.. ocv:function :: gpu::StereoBM_GPU::StereoBM_GPU()
2011-02-23 04:43:26 +08:00
2011-06-16 20:48:23 +08:00
.. ocv:function :: gpu::StereoBM_GPU::StereoBM_GPU(int preset, int ndisparities = DEFAULT_NDISP, int winSize = DEFAULT_WINSZ)
2011-02-23 04:43:26 +08:00
2011-06-19 04:45:35 +08:00
:param preset: Parameter presetting:
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
* **BASIC_PRESET** Basic mode without pre-processing.
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
* **PREFILTER_XSOBEL** Sobel pre-filtering mode.
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param ndisparities: Number of disparities. It must be a multiple of 8 and less or equal to 256.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param winSize: Block size.
2011-02-23 04:43:26 +08:00
2011-03-29 07:16:20 +08:00
2011-03-03 15:29:55 +08:00
gpu::StereoBM_GPU::operator ()
2011-02-23 04:43:26 +08:00
----------------------------------
2011-08-30 16:27:23 +08:00
Enables the stereo correspondence operator that finds the disparity for the specified rectified stereo pair.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: void gpu::StereoBM_GPU::operator ()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream = Stream::Null())
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param left: Left image. Only ``CV_8UC1`` type is supported.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param right: Right image with the same size and the same type as the left one.
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param disparity: Output disparity map. It is a ``CV_8UC1`` image with the same size as the input images.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param stream: Stream for the asynchronous version.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
2011-03-03 15:29:55 +08:00
gpu::StereoBM_GPU::checkIfGpuCallReasonable
2011-02-23 04:43:26 +08:00
-----------------------------------------------
2011-08-30 16:27:23 +08:00
Uses a heuristic method to estimate whether the current GPU is faster than the CPU in this algorithm. It queries the currently active device.
2011-06-16 20:48:23 +08:00
.. ocv:function :: bool gpu::StereoBM_GPU::checkIfGpuCallReasonable()
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
2011-02-23 04:43:26 +08:00
gpu::StereoBeliefPropagation
----------------------------
2011-06-16 20:48:23 +08:00
.. ocv:class :: gpu::StereoBeliefPropagation
2011-02-23 04:43:26 +08:00
2011-06-19 04:45:35 +08:00
Class computing stereo correspondence using the belief propagation algorithm. ::
2011-02-23 04:43:26 +08:00
class StereoBeliefPropagation
{
public:
enum { DEFAULT_NDISP = 64 };
enum { DEFAULT_ITERS = 5 };
enum { DEFAULT_LEVELS = 5 };
2011-02-26 19:05:10 +08:00
static void estimateRecommendedParams(int width, int height,
2011-02-23 04:43:26 +08:00
int& ndisp, int& iters, int& levels);
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
explicit StereoBeliefPropagation(int ndisp = DEFAULT_NDISP,
int iters = DEFAULT_ITERS,
int levels = DEFAULT_LEVELS,
int msg_type = CV_32F);
StereoBeliefPropagation(int ndisp, int iters, int levels,
float max_data_term, float data_weight,
float max_disc_term, float disc_single_jump,
int msg_type = CV_32F);
2011-02-26 19:05:10 +08:00
void operator()(const GpuMat& left, const GpuMat& right,
2011-08-30 16:27:23 +08:00
GpuMat& disparity, Stream& stream = Stream::Null());
void operator()(const GpuMat& data, GpuMat& disparity, Stream& stream = Stream::Null());
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
int ndisp;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
int iters;
int levels;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
float max_data_term;
float data_weight;
float max_disc_term;
float disc_single_jump;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
int msg_type;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
...
};
2011-03-01 05:26:43 +08:00
2011-06-30 06:06:42 +08:00
The class implements algorithm described in [Felzenszwalb2006]_ . It can compute own data cost (using a truncated linear model) or use a user-provided data cost.
2011-02-23 04:43:26 +08:00
2011-06-19 04:45:35 +08:00
.. note ::
2011-04-04 06:10:32 +08:00
2011-06-30 06:06:42 +08:00
`` StereoBeliefPropagation `` requires a lot of memory for message storage:
2011-02-23 04:43:26 +08:00
2011-06-30 06:06:42 +08:00
.. math ::
2011-02-23 04:43:26 +08:00
2011-06-30 06:06:42 +08:00
width \_ step \cdot height \cdot ndisp \cdot 4 \cdot (1 + 0.25)
2011-02-23 04:43:26 +08:00
2011-06-30 06:06:42 +08:00
and for data cost storage:
2011-02-23 04:43:26 +08:00
2011-06-30 06:06:42 +08:00
.. math ::
2011-02-23 04:43:26 +08:00
2011-06-30 06:06:42 +08:00
width\_step \cdot height \cdot ndisp \cdot (1 + 0.25 + 0.0625 + \dotsm + \frac{1}{4^{levels}})
`` width_step `` is the number of bytes in a line including padding.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
2011-03-03 15:29:55 +08:00
gpu::StereoBeliefPropagation::StereoBeliefPropagation
2011-02-23 04:43:26 +08:00
---------------------------------------------------------
2011-08-30 16:27:23 +08:00
Enables the :ocv:class: `gpu::StereoBeliefPropagation` constructors.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: gpu::StereoBeliefPropagation::StereoBeliefPropagation(int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int msg_type = CV_32F)
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: gpu::StereoBeliefPropagation::StereoBeliefPropagation(int ndisp, int iters, int levels, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int msg_type = CV_32F)
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param ndisp: Number of disparities.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param iters: Number of BP iterations on each level.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param levels: Number of levels.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param max_data_term: Threshold for data cost truncation.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param data_weight: Data weight.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param max_disc_term: Threshold for discontinuity truncation.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param disc_single_jump: Discontinuity single jump.
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param msg_type: Type for messages. ``CV_16SC1`` and ``CV_32FC1`` types are supported.
2011-08-30 16:27:23 +08:00
2011-03-30 05:48:36 +08:00
`` StereoBeliefPropagation `` uses a truncated linear model for the data cost and discontinuity terms:
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
.. math ::
2011-02-23 04:43:26 +08:00
2013-02-08 02:25:15 +08:00
DataCost = data \_ weight \cdot \min ( \lvert Img_Left(x,y)-Img_Right(x-d,y) \rvert , max \_ data \_ term)
2011-02-23 04:43:26 +08:00
.. math ::
2011-03-29 07:16:20 +08:00
DiscTerm = \min (disc \_ single \_ jump \cdot \lvert f_1-f_2 \rvert , max \_ disc \_ term)
2011-02-23 04:43:26 +08:00
2011-06-30 06:06:42 +08:00
For more details, see [Felzenszwalb2006]_ .
2011-02-23 04:43:26 +08:00
2011-08-14 00:49:40 +08:00
By default, :ocv:class: `gpu::StereoBeliefPropagation` uses floating-point arithmetics and the `` CV_32FC1 `` type for messages. But it can also use fixed-point arithmetics and the `` CV_16SC1 `` message type for better performance. To avoid an overflow in this case, the parameters must satisfy the following requirement:
2011-02-23 04:43:26 +08:00
.. math ::
2011-03-29 07:16:20 +08:00
10 \cdot 2^{levels-1} \cdot max \_ data \_ term < SHRT \_ MAX
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
2011-03-03 15:29:55 +08:00
gpu::StereoBeliefPropagation::estimateRecommendedParams
-----------------------------------------------------------
2011-08-30 16:27:23 +08:00
Uses a heuristic method to compute the recommended parameters ( `` ndisp `` , `` iters `` and `` levels `` ) for the specified image size ( `` width `` and `` height `` ).
.. ocv:function :: void gpu::StereoBeliefPropagation::estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels)
2011-03-03 15:29:55 +08:00
2011-03-23 18:56:20 +08:00
2011-03-03 15:29:55 +08:00
gpu::StereoBeliefPropagation::operator ()
2011-02-23 04:43:26 +08:00
---------------------------------------------
2011-08-30 16:27:23 +08:00
Enables the stereo correspondence operator that finds the disparity for the specified rectified stereo pair or data cost.
2011-07-22 20:50:49 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: void gpu::StereoBeliefPropagation::operator ()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream = Stream::Null())
2011-07-22 20:50:49 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: void gpu::StereoBeliefPropagation::operator ()(const GpuMat& data, GpuMat& disparity, Stream& stream = Stream::Null())
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param left: Left image. ``CV_8UC1`` , ``CV_8UC3`` and ``CV_8UC4`` types are supported.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param right: Right image with the same size and the same type as the left one.
2011-02-23 04:43:26 +08:00
2011-06-19 04:45:35 +08:00
:param data: User-specified data cost, a matrix of ``msg_type`` type and ``Size(<image columns>*ndisp, <image rows>)`` size.
2011-02-23 04:43:26 +08:00
2011-07-22 20:50:49 +08:00
:param disparity: Output disparity map. If ``disparity`` is empty, the output type is ``CV_16SC1`` . Otherwise, the type is retained.
2011-02-23 04:43:26 +08:00
2011-03-23 18:56:20 +08:00
:param stream: Stream for the asynchronous version.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
2011-02-23 04:43:26 +08:00
gpu::StereoConstantSpaceBP
--------------------------
2011-06-16 20:48:23 +08:00
.. ocv:class :: gpu::StereoConstantSpaceBP
2011-02-23 04:43:26 +08:00
2011-06-19 04:45:35 +08:00
Class computing stereo correspondence using the constant space belief propagation algorithm. ::
2011-02-23 04:43:26 +08:00
class StereoConstantSpaceBP
{
public:
enum { DEFAULT_NDISP = 128 };
enum { DEFAULT_ITERS = 8 };
enum { DEFAULT_LEVELS = 4 };
enum { DEFAULT_NR_PLANE = 4 };
2011-02-26 19:05:10 +08:00
static void estimateRecommendedParams(int width, int height,
2011-02-23 04:43:26 +08:00
int& ndisp, int& iters, int& levels, int& nr_plane);
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
explicit StereoConstantSpaceBP(int ndisp = DEFAULT_NDISP,
int iters = DEFAULT_ITERS,
int levels = DEFAULT_LEVELS,
int nr_plane = DEFAULT_NR_PLANE,
int msg_type = CV_32F);
StereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane,
2011-02-26 19:05:10 +08:00
float max_data_term, float data_weight,
2011-02-23 04:43:26 +08:00
float max_disc_term, float disc_single_jump,
int min_disp_th = 0,
int msg_type = CV_32F);
2011-02-26 19:05:10 +08:00
void operator()(const GpuMat& left, const GpuMat& right,
2011-08-30 16:27:23 +08:00
GpuMat& disparity, Stream& stream = Stream::Null());
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
int ndisp;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
int iters;
int levels;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
int nr_plane;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
float max_data_term;
float data_weight;
float max_disc_term;
float disc_single_jump;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
int min_disp_th;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
int msg_type;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
bool use_local_init_data_cost;
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
...
};
2011-03-01 05:26:43 +08:00
2011-02-23 04:43:26 +08:00
2012-04-14 03:04:44 +08:00
The class implements algorithm described in [Yang2010]_ . `` StereoConstantSpaceBP `` supports both local minimum and global minimum data cost initialization algorithms. For more details, see the paper mentioned above. By default, a local algorithm is used. To enable a global algorithm, set `` use_local_init_data_cost `` to `` false `` .
2011-08-30 16:27:23 +08:00
2011-03-23 18:56:20 +08:00
2011-03-03 15:29:55 +08:00
gpu::StereoConstantSpaceBP::StereoConstantSpaceBP
2011-02-23 04:43:26 +08:00
-----------------------------------------------------
2011-08-30 16:27:23 +08:00
Enables the :ocv:class: `gpu::StereoConstantSpaceBP` constructors.
2011-06-16 20:48:23 +08:00
.. ocv:function :: gpu::StereoConstantSpaceBP::StereoConstantSpaceBP(int ndisp = DEFAULT_NDISP, int iters = DEFAULT_ITERS, int levels = DEFAULT_LEVELS, int nr_plane = DEFAULT_NR_PLANE, int msg_type = CV_32F)
2011-02-23 04:43:26 +08:00
2012-05-30 19:13:07 +08:00
.. ocv:function :: gpu::StereoConstantSpaceBP::StereoConstantSpaceBP(int ndisp, int iters, int levels, int nr_plane, float max_data_term, float data_weight, float max_disc_term, float disc_single_jump, int min_disp_th = 0, int msg_type = CV_32F)
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param ndisp: Number of disparities.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param iters: Number of BP iterations on each level.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param levels: Number of levels.
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param nr_plane: Number of disparity levels on the first level.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param max_data_term: Truncation of data cost.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param data_weight: Data weight.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param max_disc_term: Truncation of discontinuity.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param disc_single_jump: Discontinuity single jump.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param min_disp_th: Minimal disparity threshold.
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param msg_type: Type for messages. ``CV_16SC1`` and ``CV_32FC1`` types are supported.
2011-08-30 16:27:23 +08:00
2011-03-30 05:48:36 +08:00
`` StereoConstantSpaceBP `` uses a truncated linear model for the data cost and discontinuity terms:
2011-02-23 04:43:26 +08:00
.. math ::
2011-03-29 07:16:20 +08:00
DataCost = data \_ weight \cdot \min ( \lvert I_2-I_1 \rvert , max \_ data \_ term)
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
.. math ::
2011-02-23 04:43:26 +08:00
2011-03-29 07:16:20 +08:00
DiscTerm = \min (disc \_ single \_ jump \cdot \lvert f_1-f_2 \rvert , max \_ disc \_ term)
2011-02-26 19:05:10 +08:00
2011-06-30 06:06:42 +08:00
For more details, see [Yang2010]_ .
2011-02-23 04:43:26 +08:00
2012-04-14 03:04:44 +08:00
By default, `` StereoConstantSpaceBP `` uses floating-point arithmetics and the `` CV_32FC1 `` type for messages. But it can also use fixed-point arithmetics and the `` CV_16SC1 `` message type for better performance. To avoid an overflow in this case, the parameters must satisfy the following requirement:
2011-02-23 04:43:26 +08:00
.. math ::
2011-03-29 07:16:20 +08:00
10 \cdot 2^{levels-1} \cdot max \_ data \_ term < SHRT \_ MAX
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
2011-03-03 15:29:55 +08:00
gpu::StereoConstantSpaceBP::estimateRecommendedParams
---------------------------------------------------------
2011-08-30 16:27:23 +08:00
Uses a heuristic method to compute parameters (ndisp, iters, levelsand nrplane) for the specified image size (widthand height).
.. ocv:function :: void gpu::StereoConstantSpaceBP::estimateRecommendedParams(int width, int height, int& ndisp, int& iters, int& levels, int& nr_plane)
2011-03-03 15:29:55 +08:00
2011-03-23 18:56:20 +08:00
2011-02-23 04:43:26 +08:00
2011-03-03 15:29:55 +08:00
gpu::StereoConstantSpaceBP::operator ()
2011-02-23 04:43:26 +08:00
-------------------------------------------
2011-08-30 16:27:23 +08:00
Enables the stereo correspondence operator that finds the disparity for the specified rectified stereo pair.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: void gpu::StereoConstantSpaceBP::operator ()(const GpuMat& left, const GpuMat& right, GpuMat& disparity, Stream& stream = Stream::Null())
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param left: Left image. ``CV_8UC1`` , ``CV_8UC3`` and ``CV_8UC4`` types are supported.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param right: Right image with the same size and the same type as the left one.
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param disparity: Output disparity map. If ``disparity`` is empty, the output type is ``CV_16SC1`` . Otherwise, the output type is ``disparity.type()`` .
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param stream: Stream for the asynchronous version.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
2011-02-23 04:43:26 +08:00
gpu::DisparityBilateralFilter
-----------------------------
2011-06-16 20:48:23 +08:00
.. ocv:class :: gpu::DisparityBilateralFilter
2011-02-23 04:43:26 +08:00
2012-04-14 03:04:44 +08:00
Class refining a disparity map using joint bilateral filtering. ::
2011-02-23 04:43:26 +08:00
2011-03-29 07:16:20 +08:00
class CV_EXPORTS DisparityBilateralFilter
2011-02-23 04:43:26 +08:00
{
public:
enum { DEFAULT_NDISP = 64 };
enum { DEFAULT_RADIUS = 3 };
enum { DEFAULT_ITERS = 1 };
2011-02-26 19:05:10 +08:00
explicit DisparityBilateralFilter(int ndisp = DEFAULT_NDISP,
2011-02-23 04:43:26 +08:00
int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS);
2011-02-26 19:05:10 +08:00
DisparityBilateralFilter(int ndisp, int radius, int iters,
float edge_threshold, float max_disc_threshold,
2011-02-23 04:43:26 +08:00
float sigma_range);
2011-02-26 19:05:10 +08:00
void operator()(const GpuMat& disparity, const GpuMat& image,
2011-08-30 16:27:23 +08:00
GpuMat& dst, Stream& stream = Stream::Null());
2011-02-26 19:05:10 +08:00
2011-02-23 04:43:26 +08:00
...
};
2011-03-01 05:26:43 +08:00
2011-02-23 04:43:26 +08:00
2011-06-30 06:06:42 +08:00
The class implements [Yang2010]_ algorithm.
2011-03-23 18:56:20 +08:00
2011-08-30 16:27:23 +08:00
2011-03-03 15:29:55 +08:00
gpu::DisparityBilateralFilter::DisparityBilateralFilter
2011-02-23 04:43:26 +08:00
-----------------------------------------------------------
2011-08-30 16:27:23 +08:00
Enables the :ocv:class: `gpu::DisparityBilateralFilter` constructors.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: gpu::DisparityBilateralFilter::DisparityBilateralFilter(int ndisp = DEFAULT_NDISP, int radius = DEFAULT_RADIUS, int iters = DEFAULT_ITERS)
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: gpu::DisparityBilateralFilter::DisparityBilateralFilter(int ndisp, int radius, int iters, float edge_threshold, float max_disc_threshold, float sigma_range)
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param ndisp: Number of disparities.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param radius: Filter radius.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param iters: Number of iterations.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param edge_threshold: Threshold for edges.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param max_disc_threshold: Constant to reject outliers.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param sigma_range: Filter range.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
2011-03-03 15:29:55 +08:00
gpu::DisparityBilateralFilter::operator ()
2011-02-23 04:43:26 +08:00
----------------------------------------------
2011-08-30 16:27:23 +08:00
Refines a disparity map using joint bilateral filtering.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: void gpu::DisparityBilateralFilter::operator ()(const GpuMat& disparity, const GpuMat& image, GpuMat& dst, Stream& stream = Stream::Null())
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param disparity: Input disparity map. ``CV_8UC1`` and ``CV_16SC1`` types are supported.
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param image: Input image. ``CV_8UC1`` and ``CV_8UC3`` types are supported.
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param dst: Destination disparity map. It has the same size and type as ``disparity`` .
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param stream: Stream for the asynchronous version.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
2011-03-03 15:29:55 +08:00
gpu::drawColorDisp
2011-02-23 04:43:26 +08:00
----------------------
2011-08-30 16:27:23 +08:00
Colors a disparity image.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
.. ocv:function :: void gpu::drawColorDisp(const GpuMat& src_disp, GpuMat& dst_disp, int ndisp, Stream& stream = Stream::Null())
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param src_disp: Source disparity image. ``CV_8UC1`` and ``CV_16SC1`` types are supported.
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param dst_disp: Output disparity image. It has the same size as ``src_disp`` . The type is ``CV_8UC4`` in ``BGRA`` format (alpha = 255).
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param ndisp: Number of disparities.
2011-02-23 04:43:26 +08:00
2011-02-26 19:05:10 +08:00
:param stream: Stream for the asynchronous version.
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
This function draws a colored disparity map by converting disparity values from `` [0..ndisp) `` interval first to `` HSV `` color space (where different disparity values correspond to different hues) and then converting the pixels to `` RGB `` for visualization.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
2011-03-03 15:29:55 +08:00
gpu::reprojectImageTo3D
2011-02-23 04:43:26 +08:00
---------------------------
2011-08-30 16:27:23 +08:00
Reprojects a disparity image to 3D space.
2011-02-23 04:43:26 +08:00
2012-04-03 14:45:32 +08:00
.. ocv:function :: void gpu::reprojectImageTo3D(const GpuMat& disp, GpuMat& xyzw, const Mat& Q, int dst_cn = 4, Stream& stream = Stream::Null())
2011-02-23 04:43:26 +08:00
2011-03-30 05:48:36 +08:00
:param disp: Input disparity image. ``CV_8U`` and ``CV_16S`` types are supported.
2011-02-23 04:43:26 +08:00
2012-04-03 14:45:32 +08:00
:param xyzw: Output 3- or 4-channel floating-point image of the same size as ``disp`` . Each element of ``xyzw(x,y)`` contains 3D coordinates ``(x,y,z)`` or ``(x,y,z,1)`` of the point ``(x,y)`` , computed from the disparity map.
2011-02-23 04:43:26 +08:00
2011-06-30 20:06:26 +08:00
:param Q: :math:`4 \times 4` perspective transformation matrix that can be obtained via :ocv:func:`stereoRectify` .
2011-02-23 04:43:26 +08:00
2012-04-03 14:45:32 +08:00
:param dst_cn: The number of channels for output image. Can be 3 or 4.
2011-02-26 19:05:10 +08:00
:param stream: Stream for the asynchronous version.
2011-02-23 04:43:26 +08:00
2011-08-30 16:27:23 +08:00
.. seealso :: :ocv:func: `reprojectImageTo3D`
2011-03-09 16:48:39 +08:00
gpu::solvePnPRansac
-------------------
2011-08-30 16:27:23 +08:00
Finds the object pose from 3D-2D point correspondences.
2011-03-09 16:48:39 +08:00
2011-06-16 20:48:23 +08:00
.. ocv:function :: void gpu::solvePnPRansac(const Mat& object, const Mat& image, const Mat& camera_mat, const Mat& dist_coef, Mat& rvec, Mat& tvec, bool use_extrinsic_guess=false, int num_iters=100, float max_dist=8.0, int min_inlier_count=100, vector<int>* inliers=NULL)
2011-03-09 16:48:39 +08:00
:param object: Single-row matrix of object points.
2011-08-30 16:27:23 +08:00
2011-03-09 16:48:39 +08:00
:param image: Single-row matrix of image points.
2011-08-30 16:27:23 +08:00
2011-03-09 16:48:39 +08:00
:param camera_mat: 3x3 matrix of intrinsic camera parameters.
2011-08-30 16:27:23 +08:00
2011-06-16 20:48:23 +08:00
:param dist_coef: Distortion coefficients. See :ocv:func:`undistortPoints` for details.
2011-08-30 16:27:23 +08:00
2011-03-09 16:48:39 +08:00
:param rvec: Output 3D rotation vector.
2011-08-30 16:27:23 +08:00
2011-03-09 16:48:39 +08:00
:param tvec: Output 3D translation vector.
2011-08-30 16:27:23 +08:00
2011-03-30 05:48:36 +08:00
:param use_extrinsic_guess: Flag to indicate that the function must use ``rvec`` and ``tvec`` as an initial transformation guess. It is not supported for now.
2011-08-30 16:27:23 +08:00
2011-03-09 16:48:39 +08:00
:param num_iters: Maximum number of RANSAC iterations.
2011-08-30 16:27:23 +08:00
2011-03-09 16:48:39 +08:00
:param max_dist: Euclidean distance threshold to detect whether point is inlier or not.
2011-08-30 16:27:23 +08:00
2011-03-30 05:48:36 +08:00
:param min_inlier_count: Flag to indicate that the function must stop if greater or equal number of inliers is achieved. It is not supported for now.
2011-03-09 16:48:39 +08:00
2011-08-30 16:27:23 +08:00
:param inliers: Output vector of inlier indices.
.. seealso :: :ocv:func: `solvePnPRansac`
2011-06-30 06:06:42 +08:00
.. [Felzenszwalb2006] Pedro F. Felzenszwalb algorithm [Pedro F. Felzenszwalb and Daniel P. Huttenlocher. *Efficient belief propagation for early vision* . International Journal of Computer Vision, 70(1), October 2006
.. [Yang2010] Q. Yang, L. Wang, and N. Ahuja. *A constant-space belief propagation algorithm for stereo matching* . In CVPR, 2010.