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:
@@ -1585,7 +1585,40 @@ double cv::solvePoly( InputArray _coeffs0, OutputArray _roots0, int maxIters )
|
||||
break;
|
||||
}
|
||||
|
||||
C p(1, 0), r(1, 1);
|
||||
// Related issue: https://github.com/opencv/opencv/issues/23644,
|
||||
// This the initialization scheme of "Initial approximations in Durand-Kerner's root finding method" by Guggenheimer.
|
||||
// https://link.springer.com/article/10.1007/BF01935059
|
||||
// We put the initial points equidistantly on a circle on the complex plane. This code computes the circle radius as in the paper.
|
||||
Mat absCoeffs(n + 1, 1, CV_64F);
|
||||
for( i = 0; i <= n; i++ )
|
||||
absCoeffs.at<double>(i) = abs(coeffs[i]);
|
||||
|
||||
int nonZeroCoeffs = 0;
|
||||
Mat u(n, 1, CV_64F, Scalar(0)), v(n, 1, CV_64F, Scalar(0));
|
||||
for( i = 0; i <= n; i++ )
|
||||
{
|
||||
double coeff = absCoeffs.at<double>(i);
|
||||
if( coeff > DBL_EPSILON )
|
||||
{
|
||||
if( i != n )
|
||||
u.at<double>(i) = 2.0 * pow(coeff / absCoeffs.at<double>(n), 1.0 / (n - i));
|
||||
if( i != 0 )
|
||||
v.at<double>(i - 1) = 0.5 * pow(absCoeffs.at<double>(0) / coeff, 1.0 / i);
|
||||
nonZeroCoeffs++;
|
||||
}
|
||||
}
|
||||
double scale = 1;
|
||||
if( nonZeroCoeffs > 2 )
|
||||
{
|
||||
Point maxU, minV;
|
||||
minMaxLoc(u, nullptr, nullptr, nullptr, &maxU);
|
||||
minMaxLoc(v, nullptr, nullptr, &minV);
|
||||
u.at<double>(maxU) = 0;
|
||||
v.at<double>(minV) = 0;
|
||||
scale = (sum(u).val[0] + sum(v).val[0]) / (2 * nonZeroCoeffs - 2);
|
||||
}
|
||||
|
||||
C p(scale, 0), r(cos(CV_2PI / n), sin(CV_2PI / n));
|
||||
|
||||
for( i = 0; i < n; i++ )
|
||||
{
|
||||
|
||||
@@ -1596,8 +1596,7 @@ static void
|
||||
transform_32f( const float* src, float* dst, const float* m, int len, int scn, int dcn )
|
||||
{
|
||||
// Disabled for RISC-V Vector (scalable), because of:
|
||||
// 1. v_matmuladd for RVV is 128-bit only but not scalable, this will fail the test `Core_Transform.accuracy`.
|
||||
// 2. Both gcc and clang can autovectorize this, with better performance than using Universal intrinsic.
|
||||
// 1. Both gcc and clang can autovectorize this, with better performance than using Universal intrinsic.
|
||||
#if (CV_SIMD || CV_SIMD_SCALABLE) && !defined(__aarch64__) && !defined(_M_ARM64) && !defined(_M_ARM64EC) && !(CV_TRY_RVV && CV_RVV)
|
||||
int x = 0;
|
||||
if( scn == 3 && dcn == 3 )
|
||||
|
||||
@@ -1283,7 +1283,7 @@ struct MaskedNormInf_SIMD<float, float> {
|
||||
v_float32 acc = vx_setzero_f32();
|
||||
|
||||
for (; i <= len - vstep; i += vstep) {
|
||||
v_uint32 m = v_reinterpret_as_u32(vx_load_expand(mask + i));
|
||||
v_uint32 m = vx_load_expand_q(mask + i);
|
||||
v_uint32 cmp = v_gt(m, vx_setzero_u32());
|
||||
v_float32 s = vx_load(src + i);
|
||||
s = v_abs(s);
|
||||
|
||||
Reference in New Issue
Block a user