You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This issue is expalantion of pr #25337 closed for creating new one.
Function ICAngles calculates the centroid of a pixel in the surrounding circular area. Since the process area is symmetric, consider four points: $v_1=a[-x_0,-y_0], \quad v_2=a[x_0,-y_0], \quad v_3=a[-x_0,y_0], \quad v_4=a[x_0,y_0]$, then opencv now use a for loop iterating x, and process pixel with same absolute y value together:
for (int v = 1; v <= half_k; ++v)
{
// Proceed over the two lines
int v_sum = 0;
int d = u_max[v];
for (int u = -d; u <= d; ++u)
{
int val_plus = center[u + v*step], val_minus = center[u - v*step];
v_sum += (val_plus - val_minus);
m_10 += u * (val_plus + val_minus);
}
m_01 += v * v_sum;
}
which means sum for point 1,3 is $sum_{1,3}=y_0(v_3-v_1)-x_0(v_3+v_1)$, and for point 2,4 is $sum_{2,4}=y_0(v_4-v_2)+x_0(v_4+v_2)$. Now I want to combine sum for these four points as $sum_{1,3}+sum_{2,4}=y_0(v_3-v_1+v_4-v_2)+x_0(v_4+v_2-v_3-v_1)$
total operation nums for these four points:
mult
add
no optimization
8
8
opencv now
4
8
pr 25337
2
8
Reduced ratio of operation nums is 1/6, consistent with time test in pr 25337.
Is there any problems? If not, I will make a new pr again.
Steps to reproduce
Issue submission checklist
I report the issue, it's not a question
I checked the problem with documentation, FAQ, open issues,
forum.opencv.org, Stack Overflow, etc and have not found any solution
I updated to the latest OpenCV version and the issue is still there
There is reproducer code and related data files: videos, images, onnx, etc
The text was updated successfully, but these errors were encountered:
System information (version)
Detailed description
This issue is expalantion of pr #25337 closed for creating new one.
Function ICAngles calculates the centroid of a pixel in the surrounding circular area. Since the process area is symmetric, consider four points:$v_1=a[-x_0,-y_0], \quad v_2=a[x_0,-y_0], \quad v_3=a[-x_0,y_0], \quad v_4=a[x_0,y_0]$ , then opencv now use a for loop iterating x, and process pixel with same absolute y value together:
which means sum for point 1,3 is$sum_{1,3}=y_0(v_3-v_1)-x_0(v_3+v_1)$ , and for point 2,4 is $sum_{2,4}=y_0(v_4-v_2)+x_0(v_4+v_2)$ . Now I want to combine sum for these four points as $sum_{1,3}+sum_{2,4}=y_0(v_3-v_1+v_4-v_2)+x_0(v_4+v_2-v_3-v_1)$
total operation nums for these four points:
Reduced ratio of operation nums is 1/6, consistent with time test in pr 25337.
Is there any problems? If not, I will make a new pr again.
Steps to reproduce
Issue submission checklist
forum.opencv.org, Stack Overflow, etc and have not found any solution
The text was updated successfully, but these errors were encountered: