Design and Research of Handheld Automatic Refractor

The existing refractors are mainly fixed devices, and require different degrees of cooperation during the refraction process, which takes a long time and is relatively easy for adults, but it is difficult for preschoolers and people with difficulties in cooperation. Optometry. In this paper, by designing a handheld automatic refractor, the composition, working principle and working process of the refractor are introduced. Through benchmarking experiments with the existing traditional refractor, the experiment shows that the accuracy of the diopter detection by the algorithm in this paper is less than 0.05D, and the detection time is about 5s. The speed is fast and the operation is simple, which solves the problem of vision screening for preschool children or those with disabilities.


Introduction
Eyes are our most important means of gaining access to the external world, so having good eyes and vision is very important for anyone. Our country's General Secretary Xi Jinping put forward important instructions on the implementation of students' vision problems, especially elementary and middle school students, and requested that the prevention and optometry of children and adolescents be strengthened. Therefore, we must protect children's eyes so that they have a better future. This is the responsibility and mission of every educator and scientific researcher. As early as 1974, the American scholar Professor Howland had invented a optometry method of orthogonal photography [1], which can accurately determine and measure the degree of refraction of the examinee with only one image. Then Professor Kaakinen, a Finnish scholar, proposed an eccentric photography optometry method in 1979 [2]. Based on these theories, a variety of photographic refractors have been developed, such as the photographic refractor of Polaroid Corporation in the United States and so on. However, due to the outdated data processing methods of these photographic refractors, the accuracy is poor, and the time required to measure the diopter of the examinee is too long, and the cost of the refractor is very high, making this type of refractor basically no market [3][4][5]. With the development of society and the advancement of science and technology, the emergence of handheld photorefractors has become an objective refractor that can automatically detect the diopter of the human eye. It is suitable for carrying out census work, especially for preschool children and people with poor cooperation ability. Eyesight survey is convenient, fast and accurate. Therefore, our team has developed a handheld automatic refractor on this basis, with simple operation, high accuracy, and real-time operation equipment 2 The composition and working principle of the handheld automatic refractor

Image acquisition device
The image acquisition device is mainly a CMOS industrial digital black-and-white camera exposed by Daheng's Mercury series USB interface, the model is MER-131-210U3M, its resolution is 1280*1024, the sensor size is 1/3" inch, and the frame rate is 210fps, due to its small size, high resolution, stable signal, low CPU resource occupation, so it is very suitable for handheld automatic refractor, the camera and infrared filter combination, with 6 sets of infrared LED lights [6] Get 6 pictures in different states.
When working, the 6 groups of LEDs light up in a clockwise direction. Due to limited space, take two images as an example, as shown in Figure 1.  We know that the left eye of the tested person is normal, and the right eye has a large degree of myopia. From the two directions in the figure, it can be seen that when the tested person's infrared LED lights in different directions are on, the light and dark areas in the pupil are relatively different. Large changes, so we can calculate the pupil diopter based on the ratio of the area of the light to dark area in the pupil.

Working process of handheld automatic refractor
The composition of a handheld automatic refractor is as follows. The LED light source and infrared light source are placed in front of the receiving lens. The light emitted from the center of the light source passes through the entire pupil of the eye to be inspected and is reflected back to the camera, thus making the CMOS target surface sensitive. The handheld automatic refractor that presents pupils is mainly divided into two parts: the upper computer module and the lower computer control module: The main function of the lower computer is the control of sound, light and distance. It controls the infrared LED lights to turn on and off in a clockwise order, and communicates with the RS232 serial port for data interaction. The distance sensor controls the distance between the handheld refractor and the human eye. When it is too far, it will display too far on the interface. At this time, the optometrist will move forward to the tested person, and when it is too close, it will move in the opposite direction. When the distance is right, it will prompt by voice and automatically collect the image.
The upper computer realizes the image processing algorithm through the collected multiple images, and displays the results on the interface of the refractometer, and sends the test results to the cloud at the same time, so that the testee can view the test report in real time through the mobile phone. The specific software design part flow chart is as follows.
The ability to determine the position of the pupil on the subject's face is the cornerstone of image processing in a handheld automatic refractor. There are many ways to find the position of the pupil. Among them, the segmentation method based on the global threshold has the advantages of simple algorithm and fast detection speed. Very good application, so this paper realizes real-time pupil detection based on the region of interest and global threshold segmentation method.
The region of interest search method is a very simple, but very practical and efficient method. Due to the position of the human eye in the middle of the face, by manually delineating the region of interest (ROI), and then only processing the small image in the ROI area, the efficiency of image processing can be improved. The ROI area of the human eye is shown in the figure: grayscale image, there are 256 grayscale levels. In order to analyze the grayscale value and characteristics of the image more accurately and simplify the calculation, we often convert the target grayscale image into a binary image, so that an image has only two gray levels, 0 and 1, namely the target gray level image and the background. A key point of binarization is the selection of the threshold. If the threshold is selected too high, too many target points will be misjudged as the background. If the threshold is selected too low, the opposite situation may occur. Among them, the histogram segmentation method is a relatively simple and common segmentation method that uses the grayscale histogram of the image to segment. The pupil part in the ROI area presents the part with a higher gray level, so the gray level 60 to 164 is selected as The target image, with the rest as the background image, the segmentation threshold histogram and segmentation results are shown in Figures 4 and 5. For the image segmented by the global threshold, the pupil area is filtered by manually adding feature conditions, such as according to the size of the pupil area, Features such as roundness, remove other parts in the ROI area, and only retain the pupil area, and finally the location of the pupil can be determined. It can be seen from Figure 5 that the histogram threshold segmentation method has a better segmentation effect. Since the handheld automatic refractor mainly works indoors and the ambient light brightness does not change much, the global threshold segmentation method is suitable for automatic pupil segmentation.

Results & Discussion
According to the principle of pupil detection introduced, this article proposes a method of combining ROI detection and global threshold segmentation algorithm to accurately extract the pupil area and obtain a 763*2430 resolution image. Through the histogram threshold segmentation method mentioned earlier, accurately extract the pupil area.
Taking into account the symmetry of the circle, you can use the centroid method to find the center coordinates of the pupil. Define the area of the target in the binary image as the number of pixels occupied by the target, that is, the number of pixels contained in the boundary of the region, denoted by k. For the binary image M*N, the target object f(x, y)=1, the background is 0, and the center of mass (X,Y) is defined as [8]: The radius of the circle is the average of the distances between the points on the circle and the center of the circle. If the number of boundary points is m, then the radius is: Among them, X and Y are the center coordinates of the pupil, and R is the radius of the pupil. Due to the color difference between the ambient light and the pupil of the human eye, the contrast of the pupil in the image is not consistent, so it is necessary to calculate the average gray level of the pupil area. Then count the area occupied by the pixels whose brightness is less than the average value in the pupil. And the overall area of the pupil is obtained, and the height of the dark area can be derived by formula 5, and then the diopter formula 1 can be used to calculate the value of the diopter D [9].
The tester uses the traditional digital refractor to proofread with the refractor independently developed by our team. The specific experimental data table is as follows. From the table, it can be seen that the calculation of the handheld automatic refractor and the traditional digital refractor The diopter difference is less than 0.05D, and the traditional detection time is about 32s, while the detection time of our handheld automatic refractor only needs about 5s, which is far less than the traditional refraction time, so it can show that the equipment developed by our team is satisfactory for the work Claim.

Conclusions
Through the self-developed handheld automatic refractor, the ROI algorithm is combined with the global threshold segmentation method based on histogram. The experiment shows that the handheld automatic refractor takes 5s to detect the diopter in the experiment, and the detection accuracy is higher than 0.05D. The equipment has been verified by a large number of experiments, and its reliability and accuracy meet the requirements of use.