Real-Time Docking Ring Detection Based on the Geometrical Shape for an On-Orbit Spacecraft

Docking ring is a circular hatch of spacecraft that allows servicing spacecraft to dock in various space missions. The detection of the ring is greatly beneficial to automatic capture, rendezvous and docking. Based on its geometrical shape, we propose a real-time docking ring detection method for on-orbit spacecraft. Firstly, we extract arcs from the edge mask and classify them into four classes according to edge direction and convexity. By developing the arc selection strategy, we select a combination of arcs possibly belonging to the same ellipse, and then estimate its parameters via the least squares fitting technique. Candidate ellipses are validated according to the fitness of the estimation with the actual edge pixels. The experiments show that our method is superior to the state-of-the-art methods, and can be used in real time application. The method can also be extended to other applications.


Introduction
With the development of space exploration, the on-orbit service [1] of automatic orbital capture and repair mechanism for faulty spacecraft [2][3][4][5] has become an urgent need. In order to achieve the automatic on-orbit service, vision system is widely used to acquire the pose of the target spacecraft. A docking ring [6] is a circular hatch of spacecraft that allows servicing spacecraft to dock in various space missions. The accurate detection of docking ring can be greatly beneficial to the target's visual tracking, recognition [7,8] and localization [9][10][11][12][13]. The geometrical shape of the docking ring is distinctive, since it is a regular circular part on the man-made spacecraft. Besides, a circle in the scene is projected into an ellipse in the image, the docking ring can be detected by finding the ellipse in the image. The ellipse parameters are usually used as input in the pose estimation procedure, so our goal is to get the ellipse parameters in the image. It is different from conventional object detection tasks [14] that try to locate the image coordinates of the object, and draw a bounding box around the object in the image. In the past few years, researchers have utilized edge contour methods to detect ellipses. Many approaches to generate the arcs are presented, such as linking short straight lines [15][16][17][18], splitting the edge contour [19][20][21][22], or connecting the edge pixels [23,24]. Instead of exhaustive search, arcs are grouped according to their relative position and constraints on the curvature [15,16,19,20,[22][23][24], or ellipse fitting error [17,18,21]. In this work, the inner boundary of docking ring is the single target ellipse to be found. This is in contrast to ellipse detection approaches finding all ellipses in the image. In practice, we must deal with several major problems. Suffering from partial occlusion, poor illumination or complex background, the on-orbit spacecraft image may be of low quality, which causes the detection more challenging. Furthermore, docking ring detection algorithm need reach high accuracy and efficiency because it is mostly just a previous step for localization, which is based on the feature correspondence between the 3D model and the 2D image.

Arc Extraction
The docking ring has different reflection characteristics from the surrounding background, resulting image brightness changes sharply. Therefore, we extracted the edge pixels to determine the boundary of the docking ring. According to the basic geometric properties of the ellipse in mathematics, the gradient direction of the ellipse edge point changes continuously. Based on this feature, we proposed a method for extracting elliptic arcs from a spatially connected point sequence. The edge points with stable gradient direction changing in the edge image were extracted and connected into arc segments. The contour of the ellipse remained in these arc segments. This step was to identify candidate arcs in the image, whose key phases were elaborated as follows.
(1) Edge detection: Our method was mainly based on the edge information of the image. We applied the Canny edge detector [27] to the input image to get the edge set. Here the edge point e i = (x i , y i , θ i ) is defined by its image position (x i , y i ) and gradient direction θ i .
(2) Arc segment detection: The edge points classification is based on the grayscale difference between the target and the surrounding background. Considering the reflectance properties of the docking ring, the gray value of the region outside the contour is higher than that inside the contour, as shown in Figure 1a. According to the gradient direction of edge points, the classification of the edge point e i is expressed as follows: where the symbol ∧ represents the logical relation "and", and dx, dy are the derivative of Sobel in the x and y direction respectively. According to the signs of dx and dy, we divided the edge points into four categories, namely the four quadrants shown in Figure 1b. its edge points is within a fixed range. Then, short arcs whose pixel number is less than the threshold were eliminated. We could acquire arc segments set { } of four quadrants. (3) Arc segment classification: Since the elliptic arcs located in different quadrants have different convexity, arc segments were further selected according to their convexity. The convexity was judged by the position of the point on the arc relative to the line by connecting the two endpoints, as shown in Figure 2.
represents one point on the arc segment , the point and are the endpoints of , and is the line by connecting the endpoints. The convexity of arc is represented by (2), in which "+" represents that the arc is convex, and "−" represents a concave arc. Elliptic arcs lying in the first and second quadrants are convex arcs, and the arcs lying in the third and fourth quadrants are concave arcs.
By considering both the edge gradient direction and the convexity, the classification of arc segments is represented in (3). This step breaks the spatially connectivity of the contour with gradient direction changing sharply, and removes some arcs that do not belong to the ellipse. For edge points in the same quadrant, the 8-connected edge pixels are connected into arc segments. It means that each arc α i is a set of 8-connected edge points, and the gradient direction of its edge points is within a fixed range. Then, short arcs whose pixel number is less than the threshold T p were eliminated. We could acquire arc segments set {α i } of four quadrants.
(3) Arc segment classification: Since the elliptic arcs located in different quadrants have different convexity, arc segments were further selected according to their convexity. The convexity was judged by the position of the point on the arc relative to the line by connecting the two endpoints, as shown in Figure 2. P represents one point on the arc segment α i , the point P L and P R are the endpoints of α i , and l i is the line by connecting the endpoints. its edge points is within a fixed range. Then, short arcs whose pixel number is less than the threshold were eliminated. We could acquire arc segments set { } of four quadrants. (3) Arc segment classification: Since the elliptic arcs located in different quadrants have different convexity, arc segments were further selected according to their convexity. The convexity was judged by the position of the point on the arc relative to the line by connecting the two endpoints, as shown in Figure 2.
represents one point on the arc segment , the point and are the endpoints of , and is the line by connecting the endpoints. The convexity of arc is represented by (2), in which "+" represents that the arc is convex, and "−" represents a concave arc. Elliptic arcs lying in the first and second quadrants are convex arcs, and the arcs lying in the third and fourth quadrants are concave arcs.
By considering both the edge gradient direction and the convexity, the classification of arc segments is represented in (3).
This step breaks the spatially connectivity of the contour with gradient direction changing sharply, and removes some arcs that do not belong to the ellipse. The convexity of arc α i is represented by (2), in which "+" represents that the arc is convex, and "−" represents a concave arc. Elliptic arcs lying in the first and second quadrants are convex arcs, and the arcs lying in the third and fourth quadrants are concave arcs.
By considering both the edge gradient direction and the convexity, the classification of arc segments is represented in (3). This step breaks the spatially connectivity of the contour with gradient direction changing sharply, and removes some arcs that do not belong to the ellipse.

Ellipse Parameters Estimation
This step is to identify candidate ellipses in the image, including arc grouping and ellipse fitting.

Arc Selection Strategy
By classifying the arc segments, the contour of a complete ellipse will be divided into four parts and located in four quadrants. We recombined the arcs from the same ellipse so as to estimate the ellipse parameters. Suffering from some challenges, including image noise, uneven illumination, and partial occlusion, arcs in real images may be fractional absence or divided into several short arc segments. In order for accurate elliptic parameter estimation, sufficient contour information is needed. Taking the above factors into consideration, arc segments of three different quadrants are selected to compose a candidate ellipse ε i . The rules we made were robust to the possible arc fracture of the real image, and enough information was provided for the subsequent parameter estimation step. In order to effectively group three arcs that belong to the same ellipse, we developed arc selection strategies according to the geometric properties of an ellipse.

Arc selection for two arcs:
Firstly, the constraints for the combination of two arcs were established. Two candidate arcs α i and α j were considered belonging to the same ellipse if they satisfied the following three constraints: (1) Quadrant constraint. We selected three arcs of the four quadrants to estimate an ellipse in this paper. The possible quadrants of the three arcs were indicated as follows: (I, II, III), (II, III, IV), (III, IV, I), and (I, II, IV). It shows that the three arcs were situated in three adjacent quadrants. Therefore, the combination of two arcs only combined the arcs in adjacent quadrants, as described by (4). (2) Position constraint. Based on the quadrant constraint, if arc α i and arc α j belong to a same ellipse, the endpoints of the arcs are constrained by their relative position in the image, as shown in Figure 3a. Position constraint is described by (5). (3) Tangent constraint. Assume we drew a tangent line, the ellipse was completely on one side of the tangent line. We considered the endpoint of the arc as tangent point to draw the tangent, and the tangent direction was perpendicular to the gradient direction of the endpoint, as shown in Figure 3b. Then, two arcs for combination must satisfy the constraints in (6).
where y = f L k (x) and y = f R k (x) represent the tangent equations of the left endpoint P L k and the right endpoint P R k of the arc α k respectively, the inverse equations are expressed as x = g L k (y) and x = g R k (y). For arcs α i and α j that satisfy the above constraints, the center of the ellipse was calculated, as shown in Figure 4. We connected the endpoint P L i of arc α i and the middle point P M j of α j into a line. Then we created multiple parallel lines, and fitted a line l m i to the middle points of the parallel lines. Similarly, l m j was another fitted line. The intersection P c of two straight lines l m i and l m j was the estimation of the ellipse center. For arcs and that satisfy the above constraints, the center of the ellipse was calculated, as shown in Figure 4. We connected the endpoint of arc and the middle point of into a line. Then we created multiple parallel lines, and fitted a line to the middle points of the parallel lines. Similarly, was another fitted line. The intersection of two straight lines and was the estimation of the ellipse center.   Arc selection for three arcs: Next, the rule of combining three arcs was made. Three candidate arcs would be grouped, if the following constraints were satisfied: (1) Any two of three arcs in the adjacent quadrant met the arc selection constraints for two arcs.
There were two groups of arc pair in the adjacent quadrant, each group of arcs needed to meet the arc selection for two arcs. (2) Constraints on the center of the ellipse. Three arcs originated from the same ellipse had the same ellipse center. To avoid the effect of the image noise, the centers of the ellipses calculated by two groups of arcs were required to be located within a preset distance.

Parameter Estimation for Candidate Ellipse
When dealing with 5D ellipse parameters estimation, the voting mechanism of Hough transform is time consuming. So, we adopted the least square method to get the conic expression of the ellipse, For arcs and that satisfy the above constraints, the center of the ellipse was calculated, as shown in Figure 4. We connected the endpoint of arc and the middle point of into a line. Then we created multiple parallel lines, and fitted a line to the middle points of the parallel lines. Similarly, was another fitted line. The intersection of two straight lines and was the estimation of the ellipse center.   Arc selection for three arcs: Next, the rule of combining three arcs was made. Three candidate arcs would be grouped, if the following constraints were satisfied: (1) Any two of three arcs in the adjacent quadrant met the arc selection constraints for two arcs.
There were two groups of arc pair in the adjacent quadrant, each group of arcs needed to meet the arc selection for two arcs. (2) Constraints on the center of the ellipse. Three arcs originated from the same ellipse had the same ellipse center. To avoid the effect of the image noise, the centers of the ellipses calculated by two groups of arcs were required to be located within a preset distance.

Parameter Estimation for Candidate Ellipse
When dealing with 5D ellipse parameters estimation, the voting mechanism of Hough transform is time consuming. So, we adopted the least square method to get the conic expression of the ellipse, 2. Arc selection for three arcs: Next, the rule of combining three arcs was made. Three candidate arcs would be grouped, if the following constraints were satisfied: (1) Any two of three arcs in the adjacent quadrant met the arc selection constraints for two arcs.
There were two groups of arc pair in the adjacent quadrant, each group of arcs needed to meet the arc selection for two arcs. (2) Constraints on the center of the ellipse. Three arcs originated from the same ellipse had the same ellipse center. To avoid the effect of the image noise, the centers of the ellipses calculated by two groups of arcs were required to be located within a preset distance. When dealing with 5D ellipse parameters estimation, the voting mechanism of Hough transform is time consuming. So, we adopted the least square method to get the conic expression of the ellipse, and then acquired the 5D parameters of the ellipse through the conic expression. An ellipse is a special form of a conic: By using the least square method, all points on the arcs could be fitted to the quadratic curve of (7), and then the coefficients (A, B, C, D, E, F) could be obtained.
The geometric parameters of the ellipse include the coordinates of the center (x 0 , y 0 ), the angle of ellipse rotation θ, the semi-major axis a and the semi-minor axis b, and then the standard equation of the ellipse can be expressed as The parameters of the ellipse can be calculated by equating the corresponding coefficients in (7) and (8).

Validity Verification
The ellipse set was further verified to reduce the false detection rate. In this paper, the validity of candidate ellipse was evaluated according to the fitness between the estimated ellipse and the points on the arcs.
(1) Distance definition: In this paper, the distance was calculated between pixel P on the arc and fitting ellipse E, as shown in Figure 5. We connected the edge point P and the ellipse center O, then the line OP and the ellipse E were intersected at the point M. PM is defined as the distance from the edge point to the ellipse, see Figure 5b. The distance is described in (10).
where, (2) Evaluation of candidate ellipses: The pixels on the arc of the ellipse should be located at the boundary of the estimated ellipse. Therefore, the distance between the edge point on the arc and the fitting ellipse was used to evaluate whether the candidate target meets the ellipse shape.
We could define the set N = P i : d(P i ) < T d that contains the edge points that are close to the elliptic boundary. The score s ∈ [0, 1] describes how well the points of the three arcs composing E i fit the boundary of the estimated ellipse: where N i , N j , and N k represent the number of pixels on the three arcs respectively. The candidate ellipse E i satisfying s > T s is a valid ellipse, and the ellipse E i is added to the ellipse set {E i }; Otherwise, E i is discarded which is considered as a false detection. Finally, the uniqueness detection was carried out in the ellipse set {E i }. If there were two or more ellipses with similar parameters, only the elliptic parameters with the highest score were valid. (2) Evaluation of candidate ellipses: The pixels on the arc of the ellipse should be located at the boundary of the estimated ellipse. Therefore, the distance between the edge point on the arc and the fitting ellipse was used to evaluate whether the candidate target meets the ellipse shape.
We could define the set = : | ( )| < that contains the edge points that are close to the elliptic boundary. The score ∈ 0, 1 describes how well the points of the three arcs composing fit the boundary of the estimated ellipse: where , , and represent the number of pixels on the three arcs respectively. The candidate ellipse satisfying > is a valid ellipse, and the ellipse is added to the ellipse set ; Otherwise, is discarded which is considered as a false detection. Finally, the uniqueness detection was carried out in the ellipse set . If there were two or more ellipses with similar parameters, only the elliptic parameters with the highest score were valid.

Experiment
In order to verify the performance of the proposed algorithm, we conducted experiments both on real images and video sequences. All the experiments are executed via the C++ language on the PC equipped with an Intel(R) Core(TM) i7-7700HQ CPU@2.80 GHz processor, 8.00 GB of RAM and Windows 10 as the operating system.

Test on Real Images
The test on real images was to evaluate the detection effect and processing time of the proposed algorithm for the docking ring. Meanwhile, it aimed at assessing its adaptability to images of various types of spacecraft captured in the complex and changeable space environment. We compared our method with Libuda's method [16] and Fornaciari's method [23] on real images. The codes of the compared methods are provided by their authors. The image set contained 31 images ranging in size from 275 × 183 to 1024 × 852. The real images used in this section, including various types of spacecraft in different poses, are available on the Internet.
The detection results of Libuda's algorithm, Fornaciari's algorithm and our algorithm are illustrated in Figure 6. The targets detected by each algorithm are marked with green ellipses. Our method can acquire a unique ellipse, which is the inner boundary of the docking ring, yet Libuda's

Experiment
In order to verify the performance of the proposed algorithm, we conducted experiments both on real images and video sequences. All the experiments are executed via the C++ language on the PC equipped with an Intel(R) Core(TM) i7-7700HQ CPU@2.80 GHz processor, 8.00 GB of RAM and Windows 10 as the operating system.

Test on Real Images
The test on real images was to evaluate the detection effect and processing time of the proposed algorithm for the docking ring. Meanwhile, it aimed at assessing its adaptability to images of various types of spacecraft captured in the complex and changeable space environment. We compared our method with Libuda's method [16] and Fornaciari's method [23]   The detection results of Libuda's algorithm, Fornaciari's algorithm and our algorithm are illustrated in Figure 6. The targets detected by each algorithm are marked with green ellipses. Our method can acquire a unique ellipse, which is the inner boundary of the docking ring, yet Libuda's and Fornaciari's algorithms have many cases of false positives and false negatives. Taking full advantage of the characteristics of the docking ring, our algorithm gets better performance than others.  Libuda et al. presents a fast data driven four stage filtering process, which uses geometric features in each stage to synthesize ellipses from binary image data with the help of lines, arcs, and extended arcs. However, it suffers from a long computation time. The ellipse detector proposed by Fornaciari et al. assigns a bounding box for each arc, removes the straight edges and determines the convexity of the arc by comparing the areas of region under and over the arc. However, the method raises the detection speed at the cost of detection accuracy and robustness. The good performance of our method could be attributed to the reasonable arc selection strategy, parameter estimation, and ellipse verification. Arc selection strategy could accelerate the process of arc grouping significantly. The accuracy and efficiency of parameter estimation were guaranteed by the least square fitting technique. A reasonable ellipse validation strategy could ensure that the false detection results were filtered out. However, since our algorithm required three arcs in different quadrants in the parameter estimation of candidate ellipses, it was difficult to detect the ellipses with heavy occlusion or small ellipses that had few pixels on the boundary.
The above experiments proved the superiority of our algorithm over other algorithms. Then we conducted experiments to verify the performance of our algorithm against illumination, complex background, and occlusion. Figure 8 shows our detection results in the challenge images.  Libuda et al. presents a fast data driven four stage filtering process, which uses geometric features in each stage to synthesize ellipses from binary image data with the help of lines, arcs, and extended arcs. However, it suffers from a long computation time. The ellipse detector proposed by Fornaciari et al. assigns a bounding box for each arc, removes the straight edges and determines the convexity of the arc by comparing the areas of region under and over the arc. However, the method raises the detection speed at the cost of detection accuracy and robustness. The good performance of our method could be attributed to the reasonable arc selection strategy, parameter estimation, and ellipse verification. Arc selection strategy could accelerate the process of arc grouping significantly. The accuracy and efficiency of parameter estimation were guaranteed by the least square fitting technique. A reasonable ellipse validation strategy could ensure that the false detection results were filtered out. However, since our algorithm required three arcs in different quadrants in the parameter estimation of candidate ellipses, it was difficult to detect the ellipses with heavy occlusion or small ellipses that had few pixels on the boundary.
The above experiments proved the superiority of our algorithm over other algorithms. Then we conducted experiments to verify the performance of our algorithm against illumination, complex background, and occlusion. Figure 8 shows our detection results in the challenge images. Libuda et al. presents a fast data driven four stage filtering process, which uses geometric features in each stage to synthesize ellipses from binary image data with the help of lines, arcs, and extended arcs. However, it suffers from a long computation time. The ellipse detector proposed by Fornaciari et al. assigns a bounding box for each arc, removes the straight edges and determines the convexity of the arc by comparing the areas of region under and over the arc. However, the method raises the detection speed at the cost of detection accuracy and robustness. The good performance of our method could be attributed to the reasonable arc selection strategy, parameter estimation, and ellipse verification. Arc selection strategy could accelerate the process of arc grouping significantly. The accuracy and efficiency of parameter estimation were guaranteed by the least square fitting technique. A reasonable ellipse validation strategy could ensure that the false detection results were filtered out. However, since our algorithm required three arcs in different quadrants in the parameter estimation of candidate ellipses, it was difficult to detect the ellipses with heavy occlusion or small ellipses that had few pixels on the boundary.
The above experiments proved the superiority of our algorithm over other algorithms. Then we conducted experiments to verify the performance of our algorithm against illumination, complex background, and occlusion. Figure 8 shows our detection results in the challenge images. Figure 8a Figure 8k, it is difficult to extract the edge points of the ellipse because of the low contrast. In Figure 8j,l, the reason of the failure lies in the heavy occlusion and image blur.

Video Sequence Test
In this section, we tested the performance of the proposed algorithm on two video sequences. The video sequences were derived from the Orbital Express project and the docking mission of the Space Shuttle Atlantis to the International Space Station. The videos are available at https://www.youtube.com/watch?v=YUnQCs77PoY and https://www.youtube.com/watch?v=7M1PeXWTSSQ.

Video Sequence Test
In this section, we tested the performance of the proposed algorithm on two video sequences. The video sequences were derived from the Orbital Express project and the docking mission of the Space Shuttle Atlantis to the International Space Station. The videos are available at https://www. youtube.com/watch?v=YUnQCs77PoY and https://www.youtube.com/watch?v=7M1PeXWTSSQ.
The experiments on video sequences were used to test the performance of the proposed algorithm in practical space application and the effectiveness of dealing with real docking mission. In addition, the running time of each step of the algorithm was analyzed in detail.
The autonomously docking video sequence in the Orbital Express project [28] was used to test the effectiveness of the algorithm. The video sequence consisted of 144 images with a resolution of 480 × 360. The images were captured in the open space with no earth or other stars in the background, as shown in Figure 9a. Canny edge detection results are shown in Figure 9b. According to the gradient direction, edge points were divided into four quadrants as shown in Figure 9c-f. The similar pixel points connected in the eight adjacent areas were connected into an arc, and the arcs with a length less than the threshold are removed. The arcs shown in Figure 9g were obtained by judging the convexity. The four quadrants of arcs are represented in white, yellow, red, and green respectively. As can be seen from Figure 9g, after the steps, there were six arcs obtained for the complex image, including one arc in quadrant I, one arc in quadrant II, two arcs in quadrant III, and two arcs in quadrant IV. Finally, the detection result was obtained through ellipse fitting and validation, and the detection result in green is shown in Figure 9h. algorithm in practical space application and the effectiveness of dealing with real docking mission. In addition, the running time of each step of the algorithm was analyzed in detail.
The autonomously docking video sequence in the Orbital Express project [28] was used to test the effectiveness of the algorithm. The video sequence consisted of 144 images with a resolution of 480 × 360. The images were captured in the open space with no earth or other stars in the background, as shown in Figure 9a. Canny edge detection results are shown in Figure 9b. According to the gradient direction, edge points were divided into four quadrants as shown in Figure 9c-f. The similar pixel points connected in the eight adjacent areas were connected into an arc, and the arcs with a length less than the threshold are removed. The arcs shown in Figure 9g were obtained by judging the convexity. The four quadrants of arcs are represented in white, yellow, red, and green respectively. As can be seen from Figure 9g, after the steps, there were six arcs obtained for the complex image, including one arc in quadrant I, one arc in quadrant II, two arcs in quadrant III, and two arcs in quadrant IV. Finally, the detection result was obtained through ellipse fitting and validation, and the detection result in green is shown in Figure 9h.
Due to the low contrast, the edge extraction was incomplete, and the docking rings in some images were not detected. The right detection rate of our algorithm for this video sequence was 98.61%, and the average detection time was 6.96 milliseconds. Figure 10 illustrates some examples of results.
The size of each image in video sequence was consistent and the content of the image was similar, so the factors affecting the speed of the algorithm could be analyzed through the average running time of each step in the algorithm. Table 1 shows the average process time of each step of our algorithm. It could be seen that edge detection step took the most time, followed by arc detection and classification. After screening, the number of remaining arcs was small and the processing speed of subsequent steps was high.    [29] was selected to further test the effectiveness of our algorithm in a space application. The video sequence included 5692 frames of images with a resolution of 852 × 480. As shown in Figure 11a, the Due to the low contrast, the edge extraction was incomplete, and the docking rings in some images were not detected. The right detection rate of our algorithm for this video sequence was 98.61%, and the average detection time was 6.96 milliseconds. Figure 10 illustrates some examples of results.    [29] was selected to further test the effectiveness of our algorithm in a space application. The video sequence included 5692 frames of images with a resolution of 852 × 480. As shown in Figure 11a, the The size of each image in video sequence was consistent and the content of the image was similar, so the factors affecting the speed of the algorithm could be analyzed through the average running time of each step in the algorithm. Table 1 shows the average process time of each step of our algorithm. It could be seen that edge detection step took the most time, followed by arc detection and classification. After screening, the number of remaining arcs was small and the processing speed of subsequent steps was high. (2) Video sequence of the Space Shuttle Atlantis docked with the International Space Station.
The video sequence of the Space Shuttle Atlantis docked to the International Space Station (ISS) [29] was selected to further test the effectiveness of our algorithm in a space application. The video sequence included 5692 frames of images with a resolution of 852 × 480. As shown in Figure 11a, the Space Shuttle itself occupied most of the background of the image. Figure 11 shows the intermediate results, among which Figure 11b was the edge detection result, Figure 11c-f were four quadrants of edge points divided according to the direction of gradient, Figure 11g was the extraction result of four quadrants of arc segments, and Figure 11h shows the green ellipse as the final detection result. Space Shuttle itself occupied most of the background of the image. Figure 11 shows the intermediate results, among which Figure 11b was the edge detection result, Figure 11c-f were four quadrants of edge points divided according to the direction of gradient, Figure 11g was the extraction result of four quadrants of arc segments, and Figure 11h shows the green ellipse as the final detection result. Our algorithm achieved a 100% right detection rate for the video sequence of the Space Shuttle Atlantis docked with the International Space Station. The average detection time was 41.79 ms. Figure  12 illustrates some examples of the detection results. The green ellipse represents the detection results of our algorithm. Our algorithm achieved a 100% right detection rate for the video sequence of the Space Shuttle Atlantis docked with the International Space Station. The average detection time was 41.79 ms. Figure 12 illustrates some examples of the detection results. The green ellipse represents the detection results of our algorithm.  Table 2 shows the average processing time of each step of our algorithm. Compared with the video sequence of the Orbital Express project autonomously docking, the image resolution of this sequence was larger and the background was more complex. There were more edge points to be dealt with and the process time was longer. The running time was related to the size of the image and the complexity of image content. These two factors mainly affected the efficiency of edge detection and arc extraction. In addition, the speed of arc classification mainly depended on the threshold of arc length and the number of arcs that changing continuously in the direction of gradient. After extracting the arcs, the arc selection strategy effectively reduced the number of arc combinations and improved the accuracy, thus reducing the subsequent time of ellipse fitting and verification.
To sum up, the two video sequences verified the accuracy and efficiency of our detection algorithm, and also proved that it could be used for actual space applications.

Conclusions
In this paper, we proposed a docking ring detection algorithm based on geometrical shape from on-orbit spacecraft images. By taking advantage of the continuous change of gradient direction of the target elliptic contour, this algorithm selects pixels with relatively stable gradient direction change from the edge image and connects them into an arc to avoid the edge points with abrupt gradient direction change in the arc. On this basis, a variety of arc selection strategies are adopted to effectively reduce the number of ellipse fitting in the arc combination process, thus improving the detection efficiency. Finally, the target ellipse obtained after arc grouping is further verified to reduce the false  Table 2 shows the average processing time of each step of our algorithm. Compared with the video sequence of the Orbital Express project autonomously docking, the image resolution of this sequence was larger and the background was more complex. There were more edge points to be dealt with and the process time was longer. The running time was related to the size of the image and the complexity of image content. These two factors mainly affected the efficiency of edge detection and arc extraction. In addition, the speed of arc classification mainly depended on the threshold of arc length and the number of arcs that changing continuously in the direction of gradient. After extracting the arcs, the arc selection strategy effectively reduced the number of arc combinations and improved the accuracy, thus reducing the subsequent time of ellipse fitting and verification. To sum up, the two video sequences verified the accuracy and efficiency of our detection algorithm, and also proved that it could be used for actual space applications.

Conclusions
In this paper, we proposed a docking ring detection algorithm based on geometrical shape from on-orbit spacecraft images. By taking advantage of the continuous change of gradient direction of the target elliptic contour, this algorithm selects pixels with relatively stable gradient direction change from