# Recognizing and Recovering Ball Motion Based on Low-Frame-Rate Monocular Camera
## 3 Method
### Acquiring Contours
#### 3.2.1 Fitting Streak Profiles  
The edges of the streak of a fast-moving sphere gradually merge with the background, making it difficult to obtain an accurate boundary. The Canny algorithm is a commonly used edge detection algorithm, which could roughly identify the edge of the streaks. However, due to the pixel offset problem in the Canny algorithm, there is an offset in the output contours [12]. On the other hand, contours obtained by Canny may be too tortuous in a local area. Thus, contour points are distorted in these areas. Both phenomena result in inaccurate output streak contours. To obtain accurate contours, researchers have focused on the pixel intensity of the streaks and found that the closer to the center of the streak, the closer the pixel intensity value is to the sphere. Therefore, based on the above feature, they use a profile fitting model to derive the contour points.  
The cross section perpendicular to the lateral contour of a streak is called a profile. A pixel point \(C_{xy}\) on the profile is a convex linear combination of the ball intensity \(F_{xy}\) and the background pixels intensity \(B_{xy}\):  
\[C_{xy}=\alpha F_{xy}+(1-\alpha)B_{xy} \tag{1}\]  
where \(\alpha\) is the ratio of the sphere coverage time to the exposure duration at the image point \((x,y)\). Along the profile, with Equation (1), a sequence of \(\alpha\) is obtained. Since the \(\alpha\) values have a semi-elliptic shape, they can be fitted using nonlinear least-squares minimization. In nonlinear least-squares minimization, the updating parameter list \(b=[c,r,t]^{T}\) consists of the center \(c\) of the semi-ellipse on the horizontal axis, a horizontal axis of radius \(r\), and a vertical axis of radius \(k\). The error \(R_{i}\) for each sample \(i\) and the cost function \(\phi(b)\) are as follows:  
\[R_{i}=\sqrt{\frac{(x_{i}-c)^{2}}{r^{2}}+\frac{y^{2}}{k^{2}}}-1 \tag{2}\]  
\[\phi(b)=\frac{1}{2}\sum_{i=0}^{m}R_{i}(b)^{2} \tag{3}\]  
The right part in Equation (3) is multiplied by \(\frac{1}{2}\) for ease of derivation. The aim is to obtain \(b\) that minimizes \(\phi\); thus we calculate Jacobi matrix \(J_{R}\) for \(R\) and then expect the partial derivative \(\
abla\phi\) of \(\phi\) to be \(\vec{0}\):  
\[\
abla\phi = J_{R}(b)^{T}R(b) \tag{4}\] \[where\{J_{R}(b)\}_{ij}=\frac{\partial R_{i}(b)}{\partial b_{j}},J _{R}\in\mathbb{R}^{m\times 3}\]  
Due to the nonlinear relationship between \(R_{i}\) and \(b\), the Newton method is used to obtain increments \(\triangle b\) for updating \(b\):  
\[\triangle b=-\Big{(}J_{R}(b)^{T}J_{R}(b)\Big{)}^{-1}\Big{(}J_{R}(b)^{T}J_{R}(b )\Big{)} \tag{5}\]  
Taking Figure 3 for example, the blue curve represents the \(\alpha\) values, and the green curve is the fitting result.  
Based on the profile fitting model, given a point in the streak and the streak direction, we can deduce two contour points of the streak and the center of these two points. The contour points output by the model have higher confidence than those output by the Canny algorithm since the model has exploited pixel intensity information within the streak.