mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
Merge branch 4.x
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
// Copyright (C) 2000-2008, 2018, Intel Corporation, all rights reserved.
|
||||
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
|
||||
// Copyright (C) 2014-2015, Itseez Inc., all rights reserved.
|
||||
// Copyright (C) 2025, Advanced Micro Devices, all rights reserved.
|
||||
// Third party copyrights are property of their respective owners.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
@@ -174,8 +175,8 @@ bilateralFilter_8u( const Mat& src, Mat& dst, int d,
|
||||
return;
|
||||
}
|
||||
|
||||
double gauss_color_coeff = -0.5/(sigma_color*sigma_color);
|
||||
double gauss_space_coeff = -0.5/(sigma_space*sigma_space);
|
||||
float gauss_color_coeff = (float)(-0.5/(sigma_color*sigma_color));
|
||||
float gauss_space_coeff = (float)(-0.5/(sigma_space*sigma_space));
|
||||
|
||||
if( d <= 0 )
|
||||
radius = cvRound(sigma_space*1.5);
|
||||
@@ -195,15 +196,31 @@ bilateralFilter_8u( const Mat& src, Mat& dst, int d,
|
||||
int* space_ofs = &_space_ofs[0];
|
||||
|
||||
// initialize color-related bilateral filter coefficients
|
||||
i = 0;
|
||||
#if (CV_SIMD || CV_SIMD_SCALABLE)
|
||||
int nlanes = VTraits<v_float32>::vlanes();
|
||||
v_float32 v_gauss_color_coeff = vx_setall_f32(gauss_color_coeff);
|
||||
float counter[16] = {0.0, 1., 2., 3., 4., 5., 6., 7.,
|
||||
8., 9., 10., 11., 12., 13., 14., 15.};
|
||||
v_float32 v_i = vx_load(counter);
|
||||
v_float32 v_inc = vx_setall_f32(float(nlanes));
|
||||
|
||||
for( i = 0; i < 256*cn; i++ )
|
||||
for( ; i < (256*cn) - nlanes; i += nlanes )
|
||||
{
|
||||
v_float32 v_color_weight = v_mul(v_mul(v_i,v_i), v_gauss_color_coeff);
|
||||
v_store(color_weight + i, v_exp(v_color_weight));
|
||||
v_i = v_add(v_i, v_inc);
|
||||
}
|
||||
#endif
|
||||
for(; i < 256*cn; i++ )
|
||||
{
|
||||
color_weight[i] = (float)std::exp(i*i*gauss_color_coeff);
|
||||
}
|
||||
|
||||
// initialize space-related bilateral filter coefficients
|
||||
for( i = -radius, maxk = 0; i <= radius; i++ )
|
||||
{
|
||||
j = -radius;
|
||||
|
||||
for( ; j <= radius; j++ )
|
||||
{
|
||||
double r = std::sqrt((double)i*i + (double)j*j);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2035,9 +2035,12 @@ void fillPoly( InputOutputArray _img, const Point** pts, const int* npts, int nc
|
||||
edges.reserve( total + 1 );
|
||||
for (i = 0; i < ncontours; i++)
|
||||
{
|
||||
if (npts[i] > 0 && pts[i])
|
||||
const Point* currentContour = pts[i];
|
||||
const int currentContourLength = npts[i];
|
||||
if ( (currentContourLength > 0) && currentContour )
|
||||
{
|
||||
std::vector<Point2l> _pts(pts[i], pts[i] + npts[i]);
|
||||
AutoBuffer<Point2l> _pts(currentContourLength);
|
||||
std::copy(currentContour, currentContour+currentContourLength, _pts.data());
|
||||
CollectPolyEdges(img, _pts.data(), npts[i], edges, buf, line_type, shift, offset);
|
||||
}
|
||||
}
|
||||
@@ -2064,8 +2067,11 @@ void polylines( InputOutputArray _img, const Point* const* pts, const int* npts,
|
||||
|
||||
for( int i = 0; i < ncontours; i++ )
|
||||
{
|
||||
std::vector<Point2l> _pts(pts[i], pts[i]+npts[i]);
|
||||
PolyLine( img, _pts.data(), npts[i], isClosed, buf, thickness, line_type, shift );
|
||||
const Point* currentContour = pts[i];
|
||||
const int currentContourLength = npts[i];
|
||||
AutoBuffer<Point2l> _pts(currentContourLength);
|
||||
std::copy(currentContour, currentContour+currentContourLength, _pts.data());
|
||||
PolyLine( img, _pts.data(), currentContourLength, isClosed, buf, thickness, line_type, shift );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user