## 1 Introduction  
Imaging the fundus and its underlying lesions provides indispensable evidence for diagnosing various ophthalmic diseases, such as diabetes, glaucoma, and age-related macular degeneration [1; 2; 3; 4; 5]. Non-mydriatic fundus photography (NMFP) is a non-invasive inspection technique for high-resolution imaging of the fundus [6]. Its success is attributed to NMFP eliminating the need for pupil dilation using pharmaceutical agents, which improves patient comfort and ease of examination. Combined with recently developed wide-field imaging techniques [7], NMFP applied in telemedicine is capable of imaging retina tissues, and even the entire fundus. The NMFP workflow involves adjusting the device to the ideal spatial position near the eye via near-infrared fundus preview, followed by the immediate activation of the argon arc flash to capture color fundus images [6]. Considering the differences in eye diopter, this convenient and unique NMFP mechanism also imposes a strict requirement: the objective focal plane needs to overlap with the retinal surface. Any slight defocus drastically degrades the sharpness of fundus images, potentially hiding lesions and leading to misdiagnosis [8]. However, due to the eye's structural complexity and its independence from the imaging system [9; 10], satisfying this requirement presents a formidable challenge. Throughout the focusing process, maloperations and eye micro-movements can easily cause the device to shift from its ideal position [11], leading to (i) misalignment of the pupil center (impairing imaging quality) and (ii) tiny displacements between the retina and focal plane. Consequently, NMFP devices often require swift movements of the objective lens position to compensate for eye defocus while adapting to underlying non-ideal imaging conditions. Determining the best focus position by eye is the gold standard for delivering superior image quality. However, this is cumbersome and time-consuming, particularly in community-based medical screenings that image numerous subjects. To address this issue, image-based autofocus (IBAF) methods are widely implemented in NMFP, which analyze the image to distinguish its focus degree without additional optical modifications [12; 13]. IBAF methods are mainly divided into learning-based detection (LBD) and maximum sharpness detection (MSD) [14]. LBD entails constructing and training a convolutional neural network based on extensive data, then rapidly predicting the focus position according to one or more defocused images [15; 16]. MSD has favorable applicability and is free of learning, and it drives axial scanning to determine the focal plane by calculating the sharpness value of different defocused images. Given the difficulty in collecting high-quality data from diverse patients and data labeling, this paper only concentrates on the latter, which includes two key issues: image sharpness evaluation and search strategy [17]. Sharpness evaluation describes the focus level by quantifying the sharpness characteristics of images, and the obtained evaluation curve should have good unimodality, unbiasedness, and sensitivity [18]. In NMFP scenarios, numerous studies have achieved positive progress on sharpness evaluations [11; 19; 20; 21; 22; 23]. Computing the directional variance of the normalized discrete cosine transform provides superior results [21]. To improve evaluation curve performance, the focus window of interest (usually fundus vessels and discs) is generally used to replace the entire image [24], such as manual windows [21], fixed windows [25], and multi-grid windows [18]. According to the evaluation curve of an image stack, search strategy finds the highest score to determine the focus position. To expediently find this maximum, the preference leans towards employing greedy local searches (such as hill climbing [20] and golden section search [18]) instead of stable global searches (such as exhaustive search [26] and function fitting [27]).