Skip to main content
. 2023 Nov 1;23(21):8894. doi: 10.3390/s23218894
Algorithm 1: Circle detection using Hough transform
Input: the segmented images, image coordinates (x,y).
Output: circle center coordinates (a,b), circle radius (r).
1. Initialize: A[a,b,r]=0.
2. Detect all edge points in the segmented image using the Canny operator.
3. for r=0 to the diagonal length of the image
4.          for each edge pixel (x,y) in the image
5.                     for θ = 0 to 360
6.                                a=xr×cosθ
7.                                b=yr×sinθ
8.                                A[a,b,r]=A[a,b,r]+1
9. Find the largest and second largest values of A[a,b,r], whose parameters correspond to the inner and outer circles of the weld.