## 3 Methodology
### An Improved Method for Selecting Image Center Points: Strategy 2  
The Magefreehome algorithm determines the image center point by calculating the image dimensions. However, if the center point falls outside the segmentation foreground region (Figure 6a), the grayscale values of the pixels in the row or column containing the center point may drop below the set threshold, resulting in excessive cropping of the image (Figure 6b).  
Dividing an image into a 3 \(\times\) 3 grid is a widely used design technique to ensure balance and alignment of image elements. Based on this method, extracting the four intersection points located at the one-third and two-thirds positions of the image's rows and columns highlights key points in the grid. These points are typically used to identify important visual elements or to facilitate further image-processing tasks. The center points derived from the 3 \(\times\) 3 grid principle can be utilized in various image processing applications, such as alignment, cropping, and feature extraction. Based on this principle, we propose an improved method for selecting the image center point. Initially, four intersection points at one-third and two-thirds of the image's rows and columns are taken as reference points (Figure 6c). To reduce computational load, the points along the vertical and horizontal axes of these reference points are sparsified by retaining only one out of every three points. Subsequently, the grayscale values of the points in the rows and columns of these four reference points are calculated. The OTSU algorithm is then employed to compute the dynamic threshold, followed by binarization. Finally, the number of points with a grayscale value of 255 is counted, and the row or column with the highest count is selected as the  
Figure 6: (**a**) The original image before segmentation, (**b**) The image after segmentation, (**c**) The Image segmentation diagram.  
reference line. The intersection of this row and column is chosen as the center point of the segmentation foreground.  
A Method for Determining the Start/End Points of the Segmentation Region Based on Continuity Detection: Strategy 3  
The Magefreehome algorithm is highly sensitive to noise and lacks robustness in determining the segmentation start and end points. When the start or end points fall within noise areas with high grayscale values outside the segmentation foreground region, these noise areas are mistakenly considered part of the segmentation foreground, resulting in incomplete segmentation. In Figure 7a, the start point falls within a noise area, and in Figure 7b, the segmented image still contains these noise areas.  
We propose a continuity detection-based method for determining the segmentation start and end points. This method detects the continuity of coordinates with a grayscale value of 255 in the row or column where the image center point is located to identify the presence of noise. In the segmentation foreground region, the coordinates of points with a grayscale value of 255 are generally continuous without jumps (Figure 8a), whereas noise causes abrupt changes that disrupt continuity (Figure 8b). Therefore, we stipulate that if the distance between points with a grayscale value of 255 does not exceed one-tenth of the total row or column length, the coordinates are considered continuous and noise-free. In this case, we select the segment with the most such points as the target segmentation foreground region, with its two endpoints determined as the start and endpoints of the segmentation.  
Figure 8: (**a**) The grayscale value variation along the black line in a of Figure 7, (**b**) The grayscale value variation along the red line in a of Figure 7.  
Figure 7: (**a**) The original image before segmentation, (**b**) The image after segmentation.