1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 15:53:03 +04:00

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2022-08-14 15:50:42 +00:00
37 changed files with 246 additions and 90 deletions
+16 -5
View File
@@ -78,11 +78,15 @@ Input depth (src.depth()) | Output depth (ddepth)
--------------------------|----------------------
CV_8U | -1/CV_16S/CV_32F/CV_64F
CV_16U/CV_16S | -1/CV_32F/CV_64F
CV_32F | -1/CV_32F/CV_64F
CV_32F | -1/CV_32F
CV_64F | -1/CV_64F
@note when ddepth=-1, the output image will have the same depth as the source.
@note if you need double floating-point accuracy and using single floating-point input data
(CV_32F input and CV_64F output depth combination), you can use @ref Mat.convertTo to convert
the input data to the desired precision.
@defgroup imgproc_transform Geometric Image Transformations
The functions in this section perform various geometrical transformations of 2D images. They do not
@@ -1792,7 +1796,7 @@ with the following \f$3 \times 3\f$ aperture:
@param src Source image.
@param dst Destination image of the same size and the same number of channels as src .
@param ddepth Desired depth of the destination image.
@param ddepth Desired depth of the destination image, see @ref filter_depths "combinations".
@param ksize Aperture size used to compute the second-derivative filters. See #getDerivKernels for
details. The size must be positive and odd.
@param scale Optional scale factor for the computed Laplacian values. By default, no scaling is
@@ -2279,7 +2283,7 @@ case of multi-channel images, each channel is processed independently.
@param src input image; the number of channels can be arbitrary, but the depth should be one of
CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
@param dst output image of the same size and type as src.
@param kernel structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular
@param kernel structuring element used for dilation; if element=Mat(), a 3 x 3 rectangular
structuring element is used. Kernel can be created using #getStructuringElement
@param anchor position of the anchor within the element; default value (-1, -1) means that the
anchor is at the element center.
@@ -2809,7 +2813,7 @@ It makes possible to do a fast blurring or fast block correlation with a variabl
example. In case of multi-channel images, sums for each channel are accumulated independently.
As a practical example, the next figure shows the calculation of the integral of a straight
rectangle Rect(3,3,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the
rectangle Rect(4,4,3,2) and of a tilted rectangle Rect(5,1,2,3) . The selected pixels in the
original image are shown, as well as the relative pixels in the integral images sum and tilted .
![integral calculation example](pics/integral.png)
@@ -3174,7 +3178,14 @@ CV_EXPORTS void calcHist( const Mat* images, int nimages,
const int* histSize, const float** ranges,
bool uniform = true, bool accumulate = false );
/** @overload */
/** @overload
this variant supports only uniform histograms.
ranges argument is either empty vector or a flattened vector of histSize.size()*2 elements
(histSize.size() element pairs). The first and second elements of each pair specify the lower and
upper boundaries.
*/
CV_EXPORTS_W void calcHist( InputArrayOfArrays images,
const std::vector<int>& channels,
InputArray mask, OutputArray hist,
+15 -9
View File
@@ -1058,7 +1058,7 @@ EllipseEx( Mat& img, Point2l center, Size2l axes,
* Polygons filling *
\****************************************************************************************/
static inline void ICV_HLINE_X(uchar* ptr, int xl, int xr, const uchar* color, int pix_size)
static inline void ICV_HLINE_X(uchar* ptr, int64_t xl, int64_t xr, const uchar* color, int pix_size)
{
uchar* hline_min_ptr = (uchar*)(ptr) + (xl)*(pix_size);
uchar* hline_end_ptr = (uchar*)(ptr) + (xr+1)*(pix_size);
@@ -1083,7 +1083,7 @@ static inline void ICV_HLINE_X(uchar* ptr, int xl, int xr, const uchar* color, i
}
//end ICV_HLINE_X()
static inline void ICV_HLINE(uchar* ptr, int xl, int xr, const void* color, int pix_size)
static inline void ICV_HLINE(uchar* ptr, int64_t xl, int64_t xr, const void* color, int pix_size)
{
ICV_HLINE_X(ptr, xl, xr, reinterpret_cast<const uchar*>(color), pix_size);
}
@@ -1177,7 +1177,7 @@ FillConvexPoly( Mat& img, const Point2l* v, int npts, const void* color, int lin
edge[0].x = edge[1].x = -XY_ONE;
edge[0].dx = edge[1].dx = 0;
ptr += img.step*y;
ptr += (int64_t)img.step*y;
do
{
@@ -1206,7 +1206,7 @@ FillConvexPoly( Mat& img, const Point2l* v, int npts, const void* color, int lin
}
edge[i].ye = ty;
edge[i].dx = ((xe - xs)*2 + (ty - y)) / (2 * (ty - y));
edge[i].dx = ((xe - xs)*2 + ((int64_t)ty - y)) / (2 * ((int64_t)ty - y));
edge[i].x = xs;
edge[i].idx = idx;
break;
@@ -1480,7 +1480,7 @@ Circle( Mat& img, Point center, int radius, const void* color, int fill )
size_t step = img.step;
int pix_size = (int)img.elemSize();
uchar* ptr = img.ptr();
int err = 0, dx = radius, dy = 0, plus = 1, minus = (radius << 1) - 1;
int64_t err = 0, dx = radius, dy = 0, plus = 1, minus = (radius << 1) - 1;
int inside = center.x >= radius && center.x < size.width - radius &&
center.y >= radius && center.y < size.height - radius;
@@ -1490,8 +1490,8 @@ Circle( Mat& img, Point center, int radius, const void* color, int fill )
while( dx >= dy )
{
int mask;
int y11 = center.y - dy, y12 = center.y + dy, y21 = center.y - dx, y22 = center.y + dx;
int x11 = center.x - dx, x12 = center.x + dx, x21 = center.x - dy, x22 = center.x + dy;
int64_t y11 = center.y - dy, y12 = center.y + dy, y21 = center.y - dx, y22 = center.y + dx;
int64_t x11 = center.x - dx, x12 = center.x + dx, x21 = center.x - dy, x22 = center.x + dy;
if( inside )
{
@@ -1531,7 +1531,7 @@ Circle( Mat& img, Point center, int radius, const void* color, int fill )
{
if( fill )
{
x11 = std::max( x11, 0 );
x11 = std::max( x11, (int64_t)0 );
x12 = MIN( x12, size.width - 1 );
}
@@ -1569,7 +1569,7 @@ Circle( Mat& img, Point center, int radius, const void* color, int fill )
{
if( fill )
{
x21 = std::max( x21, 0 );
x21 = std::max( x21, (int64_t)0 );
x22 = MIN( x22, size.width - 1 );
}
@@ -1866,6 +1866,12 @@ void rectangle( InputOutputArray img, Rect rec,
{
CV_INSTRUMENT_REGION();
CV_Assert( 0 <= shift && shift <= XY_SHIFT );
// Crop the rectangle to right around the mat.
rec &= Rect(-(1 << shift), -(1 << shift), ((img.cols() + 2) << shift),
((img.rows() + 2) << shift));
if( !rec.empty() )
rectangle( img, rec.tl(), rec.br() - Point(1<<shift,1<<shift),
color, thickness, lineType, shift );
+1 -1
View File
@@ -963,7 +963,7 @@ pyrUp_( const Mat& _src, Mat& _dst, int)
if (dsize.width > ssize.width*2)
{
row[(_dst.cols-1) + x] = row[dx + cn];
row[(_dst.cols-1) * cn + x] = row[dx + cn];
}
}
+19
View File
@@ -0,0 +1,19 @@
// This file is part of OpenCV project.
// It is subject to the license terms in the LICENSE file found in the top-level directory
// of this distribution and at http://opencv.org/license.html.
#include "test_precomp.hpp"
namespace opencv_test { namespace {
TEST(Imgproc_PyrUp, pyrUp_regression_22184)
{
Mat src(100, 100, CV_16UC3, Scalar::all(255));
Mat dst(100 * 2 + 1, 100 * 2 + 1, CV_16UC3, Scalar::all(0));
pyrUp(src, dst, Size(dst.cols, dst.rows));
double min_val = 0;
minMaxLoc(dst, &min_val);
ASSERT_GT(cvRound(min_val), 0);
}
}} // namespace