mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 08:13:04 +04:00
Merge branch 4.x
This commit is contained in:
@@ -118,7 +118,7 @@ This module offers a comprehensive suite of image processing functions, enabling
|
||||
coordinates needs to be retrieved. In the simplest case, the coordinates can be just rounded to the
|
||||
nearest integer coordinates and the corresponding pixel can be used. This is called a
|
||||
nearest-neighbor interpolation. However, a better result can be achieved by using more
|
||||
sophisticated [interpolation methods](http://en.wikipedia.org/wiki/Multivariate_interpolation) ,
|
||||
sophisticated [interpolation methods](https://en.wikipedia.org/wiki/Multivariate_interpolation) ,
|
||||
where a polynomial function is fit into some neighborhood of the computed pixel \f$(f_x(x,y),
|
||||
f_y(x,y))\f$, and then the value of the polynomial at \f$(f_x(x,y), f_y(x,y))\f$ is taken as the
|
||||
interpolated pixel value. In OpenCV, you can choose between several interpolation methods. See
|
||||
@@ -1467,7 +1467,7 @@ CV_EXPORTS_W void getDerivKernels( OutputArray kx, OutputArray ky,
|
||||
/** @brief Returns Gabor filter coefficients.
|
||||
|
||||
For more details about gabor filter equations and parameters, see: [Gabor
|
||||
Filter](http://en.wikipedia.org/wiki/Gabor_filter).
|
||||
Filter](https://en.wikipedia.org/wiki/Gabor_filter).
|
||||
|
||||
@param ksize Size of the filter returned.
|
||||
@param sigma Standard deviation of the gaussian envelope.
|
||||
@@ -1549,7 +1549,7 @@ CV_EXPORTS_W void GaussianBlur( InputArray src, OutputArray dst, Size ksize,
|
||||
/** @brief Applies the bilateral filter to an image.
|
||||
|
||||
The function applies bilateral filtering to the input image, as described in
|
||||
http://www.dai.ed.ac.uk/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html
|
||||
https://homepages.inf.ed.ac.uk/rbf/CVonline/LOCAL_COPIES/MANDUCHI1/Bilateral_Filtering.html
|
||||
bilateralFilter can reduce unwanted noise very well while keeping edges fairly sharp. However, it is
|
||||
very slow compared to most filters.
|
||||
|
||||
@@ -1659,7 +1659,7 @@ stackBlur can generate similar results as Gaussian blur, and the time consumptio
|
||||
It creates a kind of moving stack of colors whilst scanning through the image. Thereby it just has to add one new block of color to the right side
|
||||
of the stack and remove the leftmost color. The remaining colors on the topmost layer of the stack are either added on or reduced by one,
|
||||
depending on if they are on the right or on the left side of the stack. The only supported borderType is BORDER_REPLICATE.
|
||||
Original paper was proposed by Mario Klingemann, which can be found http://underdestruction.com/2004/02/25/stackblur-2004.
|
||||
Original paper was proposed by Mario Klingemann, which can be found https://underdestruction.com/2004/02/25/stackblur-2004.
|
||||
|
||||
@param src input image. The number of channels can be arbitrary, but the depth should be one of
|
||||
CV_8U, CV_16U, CV_16S or CV_32F.
|
||||
@@ -1892,7 +1892,7 @@ Check @ref tutorial_canny_detector "the corresponding tutorial" for more details
|
||||
The function finds edges in the input image and marks them in the output map edges using the
|
||||
Canny algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The
|
||||
largest value is used to find initial segments of strong edges. See
|
||||
<http://en.wikipedia.org/wiki/Canny_edge_detector>
|
||||
<https://en.wikipedia.org/wiki/Canny_edge_detector>
|
||||
|
||||
@param image 8-bit input image.
|
||||
@param edges output edge map; single channels 8-bit image, which has the same size as image .
|
||||
@@ -2168,7 +2168,7 @@ An example using the Hough line detector in python
|
||||
/** @brief Finds lines in a binary image using the standard Hough transform.
|
||||
|
||||
The function implements the standard or standard multi-scale Hough transform algorithm for line
|
||||
detection. See <http://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm> for a good explanation of Hough
|
||||
detection. See <https://homepages.inf.ed.ac.uk/rbf/HIPR2/hough.htm> for a good explanation of Hough
|
||||
transform.
|
||||
|
||||
@param image 8-bit, single-channel binary source image. The image may be modified by the function.
|
||||
@@ -2938,13 +2938,13 @@ An example using the phaseCorrelate function
|
||||
|
||||
The operation takes advantage of the Fourier shift theorem for detecting the translational shift in
|
||||
the frequency domain. It can be used for fast image registration as well as motion estimation. For
|
||||
more information please see <http://en.wikipedia.org/wiki/Phase_correlation>
|
||||
more information please see <https://en.wikipedia.org/wiki/Phase_correlation>
|
||||
|
||||
Calculates the cross-power spectrum of two supplied source arrays. The arrays are padded if needed
|
||||
with getOptimalDFTSize.
|
||||
|
||||
The function performs the following equations:
|
||||
- First it applies a Hanning window (see <http://en.wikipedia.org/wiki/Hann_function>) to each
|
||||
- First it applies a Hanning window (see <https://en.wikipedia.org/wiki/Hann_function>) to each
|
||||
image to remove possible edge effects. This window is cached until the array size changes to speed
|
||||
up processing time.
|
||||
- Next it computes the forward DFTs of each source array:
|
||||
@@ -2974,7 +2974,7 @@ CV_EXPORTS_W Point2d phaseCorrelate(InputArray src1, InputArray src2,
|
||||
|
||||
/** @brief This function computes a Hanning window coefficients in two dimensions.
|
||||
|
||||
See (http://en.wikipedia.org/wiki/Hann_function) and (http://en.wikipedia.org/wiki/Window_function)
|
||||
See (https://en.wikipedia.org/wiki/Hann_function) and (https://en.wikipedia.org/wiki/Window_function)
|
||||
for more information.
|
||||
|
||||
An example is shown below:
|
||||
@@ -3462,7 +3462,7 @@ An example using the GrabCut algorithm
|
||||
|
||||
/** @brief Runs the GrabCut algorithm.
|
||||
|
||||
The function implements the [GrabCut image segmentation algorithm](http://en.wikipedia.org/wiki/GrabCut).
|
||||
The function implements the [GrabCut image segmentation algorithm](https://en.wikipedia.org/wiki/GrabCut).
|
||||
|
||||
@param img Input 8-bit 3-channel image.
|
||||
@param mask Input/output 8-bit single-channel mask. The mask is initialized by the function when
|
||||
@@ -3792,7 +3792,7 @@ CV_EXPORTS_W Moments moments( InputArray array, bool binaryImage = false );
|
||||
/** @brief Calculates seven Hu invariants.
|
||||
|
||||
The function calculates seven Hu invariants (introduced in @cite Hu62; see also
|
||||
<http://en.wikipedia.org/wiki/Image_moment>) defined as:
|
||||
<https://en.wikipedia.org/wiki/Image_moment>) defined as:
|
||||
|
||||
\f[\begin{array}{l} hu[0]= \eta _{20}+ \eta _{02} \\ hu[1]=( \eta _{20}- \eta _{02})^{2}+4 \eta _{11}^{2} \\ hu[2]=( \eta _{30}-3 \eta _{12})^{2}+ (3 \eta _{21}- \eta _{03})^{2} \\ hu[3]=( \eta _{30}+ \eta _{12})^{2}+ ( \eta _{21}+ \eta _{03})^{2} \\ hu[4]=( \eta _{30}-3 \eta _{12})( \eta _{30}+ \eta _{12})[( \eta _{30}+ \eta _{12})^{2}-3( \eta _{21}+ \eta _{03})^{2}]+(3 \eta _{21}- \eta _{03})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}] \\ hu[5]=( \eta _{20}- \eta _{02})[( \eta _{30}+ \eta _{12})^{2}- ( \eta _{21}+ \eta _{03})^{2}]+4 \eta _{11}( \eta _{30}+ \eta _{12})( \eta _{21}+ \eta _{03}) \\ hu[6]=(3 \eta _{21}- \eta _{03})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}]-( \eta _{30}-3 \eta _{12})( \eta _{21}+ \eta _{03})[3( \eta _{30}+ \eta _{12})^{2}-( \eta _{21}+ \eta _{03})^{2}] \\ \end{array}\f]
|
||||
|
||||
@@ -4037,7 +4037,7 @@ An example using approxPolyDP function in python.
|
||||
|
||||
The function cv::approxPolyDP approximates a curve or a polygon with another curve/polygon with less
|
||||
vertices so that the distance between them is less or equal to the specified precision. It uses the
|
||||
Douglas-Peucker algorithm <http://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm>
|
||||
Douglas-Peucker algorithm <https://en.wikipedia.org/wiki/Ramer-Douglas-Peucker_algorithm>
|
||||
|
||||
@param curve Input vector of a 2D point stored in std::vector or Mat
|
||||
@param approxCurve Result of the approximation. The type should match the type of the input curve.
|
||||
@@ -4286,6 +4286,9 @@ ellipse/rotatedRect data contains negative indices, due to the data points being
|
||||
border of the containing Mat element.
|
||||
|
||||
@param points Input 2D point set, stored in std::vector\<\> or Mat
|
||||
|
||||
@note Input point types are @ref Point2i or @ref Point2f and at least 5 points are required.
|
||||
@note @ref getClosestEllipsePoints function can be used to compute the ellipse fitting error.
|
||||
*/
|
||||
CV_EXPORTS_W RotatedRect fitEllipse( InputArray points );
|
||||
|
||||
@@ -4323,6 +4326,9 @@ CV_EXPORTS_W RotatedRect fitEllipse( InputArray points );
|
||||
\f}
|
||||
|
||||
@param points Input 2D point set, stored in std::vector\<\> or Mat
|
||||
|
||||
@note Input point types are @ref Point2i or @ref Point2f and at least 5 points are required.
|
||||
@note @ref getClosestEllipsePoints function can be used to compute the ellipse fitting error.
|
||||
*/
|
||||
CV_EXPORTS_W RotatedRect fitEllipseAMS( InputArray points );
|
||||
|
||||
@@ -4368,6 +4374,9 @@ CV_EXPORTS_W RotatedRect fitEllipseAMS( InputArray points );
|
||||
The scaling factor guarantees that \f$A^T C A =1\f$.
|
||||
|
||||
@param points Input 2D point set, stored in std::vector\<\> or Mat
|
||||
|
||||
@note Input point types are @ref Point2i or @ref Point2f and at least 5 points are required.
|
||||
@note @ref getClosestEllipsePoints function can be used to compute the ellipse fitting error.
|
||||
*/
|
||||
CV_EXPORTS_W RotatedRect fitEllipseDirect( InputArray points );
|
||||
|
||||
@@ -4375,6 +4384,20 @@ CV_EXPORTS_W RotatedRect fitEllipseDirect( InputArray points );
|
||||
An example for fitting line in python
|
||||
*/
|
||||
|
||||
/** @brief Compute for each 2d point the nearest 2d point located on a given ellipse.
|
||||
|
||||
The function computes the nearest 2d location on a given ellipse for a vector of 2d points and is based on @cite Chatfield2017 code.
|
||||
This function can be used to compute for instance the ellipse fitting error.
|
||||
|
||||
@param ellipse_params Ellipse parameters
|
||||
@param points Input 2d points
|
||||
@param closest_pts For each 2d point, their corresponding closest 2d point located on a given ellipse
|
||||
|
||||
@note Input point types are @ref Point2i or @ref Point2f
|
||||
@see fitEllipse, fitEllipseAMS, fitEllipseDirect
|
||||
*/
|
||||
CV_EXPORTS_W void getClosestEllipsePoints( const RotatedRect& ellipse_params, InputArray points, OutputArray closest_pts );
|
||||
|
||||
/** @brief Fits a line to a 2D or 3D point set.
|
||||
|
||||
The function fitLine fits a line to a 2D or 3D point set by minimizing \f$\sum_i \rho(r_i)\f$ where
|
||||
@@ -4393,7 +4416,7 @@ of the following:
|
||||
- DIST_HUBER
|
||||
\f[\rho (r) = \fork{r^2/2}{if \(r < C\)}{C \cdot (r-C/2)}{otherwise} \quad \text{where} \quad C=1.345\f]
|
||||
|
||||
The algorithm is based on the M-estimator ( <http://en.wikipedia.org/wiki/M-estimator> ) technique
|
||||
The algorithm is based on the M-estimator ( <https://en.wikipedia.org/wiki/M-estimator> ) technique
|
||||
that iteratively fits the line using the weighted least-squares algorithm. After each iteration the
|
||||
weights \f$w_i\f$ are adjusted to be inversely proportional to \f$\rho(r_i)\f$ .
|
||||
|
||||
|
||||
@@ -21,14 +21,34 @@ void HoughLinesWithAccumulator(
|
||||
InputArray image, OutputArray lines,
|
||||
double rho, double theta, int threshold,
|
||||
double srn = 0, double stn = 0,
|
||||
double min_theta = 0, double max_theta = CV_PI
|
||||
double min_theta = 0, double max_theta = CV_PI,
|
||||
bool use_edgeval = false
|
||||
)
|
||||
{
|
||||
std::vector<Vec3f> lines_acc;
|
||||
HoughLines(image, lines_acc, rho, theta, threshold, srn, stn, min_theta, max_theta);
|
||||
HoughLines(image, lines_acc, rho, theta, threshold, srn, stn, min_theta, max_theta, use_edgeval);
|
||||
Mat(lines_acc).copyTo(lines);
|
||||
}
|
||||
|
||||
/** @brief Finds circles in a grayscale image using the Hough transform and get accumulator.
|
||||
*
|
||||
* @note This function is for bindings use only. Use original function in C++ code
|
||||
*
|
||||
* @sa HoughCircles
|
||||
*/
|
||||
CV_WRAP static inline
|
||||
void HoughCirclesWithAccumulator(
|
||||
InputArray image, OutputArray circles,
|
||||
int method, double dp, double minDist,
|
||||
double param1 = 100, double param2 = 100,
|
||||
int minRadius = 0, int maxRadius = 0
|
||||
)
|
||||
{
|
||||
std::vector<Vec4f> circles_acc;
|
||||
HoughCircles(image, circles_acc, method, dp, minDist, param1, param2, minRadius, maxRadius);
|
||||
Mat(1, static_cast<int>(circles_acc.size()), CV_32FC4, &circles_acc.front()).copyTo(circles);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // OPENCV_IMGPROC_BINDINGS_HPP
|
||||
|
||||
Reference in New Issue
Block a user