Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides the slit-lamp microscope automatic focusing method and the slit-lamp microscope, which can realize the automatic focusing of the slit-lamp microscope without manual adjustment, reduce the manpower input during the focusing of the slit-lamp microscope and improve the focusing efficiency and precision.
The purpose of the invention is realized by the following technical scheme:
an automatic focusing method of a slit-lamp microscope comprises the following steps:
s1: the tracking camera acquires a face image and uploads the face image to the upper computer, and the upper computer identifies human eyes in the image and calculates the central coordinates of the human eyes;
s2: the control main board obtains the center coordinates of human eyes and compares the center coordinates with the center coordinates of the image, and respectively sends control instructions to control the rotation of the x-axis motor and the y-axis motor according to the comparison result so that the center of the image tends to the center coordinates of the human eyes;
s3: the eye ground camera acquires a human eye image and uploads the human eye image to the upper computer, and the upper computer identifies the definition of the human eye image;
s4: the control mainboard acquires the definition of the human eye image, compares the definition with the standard definition, and sends a control instruction to control the rotation of the z-axis motor when the definition of the human eye image is judged to be lower than the standard definition, so that the definition of the human eye image tends to the standard definition.
Further, in the process of making the image center tend to the center coordinates of the human eyes, the image center is made to coincide with the center coordinates of the human eyes by adopting a method of judging successive approximation for a plurality of times, that is, after steps S1-S2 are carried out each time and a certain time is set, steps S1-S2 are repeated again, and the steps are repeated for a plurality of times until the image center coincides with the center coordinates of the human eyes.
And when the coordinate difference value between the image center and the human eye center is within two pixels, the image center is considered to be coincided with the human eye center coordinate.
And when the definition of the human eye image is judged to be lower than the standard definition, the control main board sends a control instruction to control the z-axis motor to rotate forwards or backwards, the step S3 is repeated after a certain time interval, whether the definition of the newly acquired human eye image is higher than that of the original human eye image is judged, if yes, the z-axis motor is controlled to continue to rotate along the direction, and otherwise, the z-axis motor is controlled to change the direction to rotate.
When the human eye image definition is enabled to approach the standard definition, the human eye image definition is enabled to reach the standard definition by adopting a method of judging successive approximation for many times, namely, after steps S3-S4 are carried out every time and a certain time is set, the steps S3-S4 are repeated again, and the steps are repeated for many times until the human eye image definition reaches the standard definition.
In the method of judging successive approximation for a plurality of times, the time interval of each judgment is 400 milliseconds.
The upper computer is a computer, wherein the specific method for calculating the center coordinates of the human eyes by the upper computer comprises the following steps:
s11: extracting 6 characteristic points of each human eye by using a Dlib library;
s12: and averaging the coordinates of the 6 characteristic points of each human eye, and taking the average value as the central coordinates of the human eye.
When two human eyes are identified in the face image, respectively calculating the human eye center coordinates of the two human eyes; focusing work is carried out on one of the human eyes until the fundus of the human eye is photographed, and then focusing work is carried out on the other human eye and fundus photographing is finished.
The image center is a coordinate corresponding to the center of the human eye image shot by the eye fundus camera in the human face image, namely, a coordinate value corresponding to the center of the human eye image in the coordinate system of the human face image is calculated according to the position relation between the tracking camera and the eye fundus camera.
A slit lamp microscope capable of achieving automatic focusing comprises a base assembly, a microscope assembly and a slit lamp assembly, wherein the base assembly comprises a z-axis driving assembly, an x-axis driving assembly and a y-axis driving assembly which are arranged from bottom to top, and the z-axis driving assembly comprises a z-axis moving seat and a z-axis motor used for driving the z-axis moving seat to move in the z-axis direction; the x-axis driving assembly is arranged on the z-axis moving seat and comprises an x-axis moving seat and an x-axis motor used for driving the x-axis moving seat to move in the x-axis direction; the y-axis driving assembly is mounted on the x-axis moving seat, the y-axis driving assembly comprises a y-axis moving seat and a y-axis motor used for driving the y-axis moving seat to move in the y-axis direction, and the microscope assembly and the slit lamp assembly are mounted on the y-axis moving seat;
the microscope component comprises a microscope arm, a microscope, a tracking camera and an eyeground camera, wherein the microscope and the tracking camera are respectively arranged on the microscope arm, and the eyeground camera is connected with the microscope.
The invention has the following beneficial effects: the invention discloses an automatic focusing method of a slit-lamp microscope and the slit-lamp microscope. Compared with the prior art that focusing is manually adjusted, the slit lamp microscope focusing device can realize automatic focusing without manual adjustment, so that the labor input during focusing of the slit lamp microscope can be greatly reduced, and the focusing efficiency and precision are improved.
Detailed Description
The present invention will be described in further detail with reference to the following examples, which are given in the accompanying drawings.
It should be noted that the x, y, and z directions in the present invention are based on the xyz coordinate system shown in fig. 1, and the xyz coordinate system used in the present invention is only for convenience of description, and does not indicate that the scope of the present invention is limited to the coordinate system shown in fig. 1.
An automatic focusing method of a slit-lamp microscope comprises the following steps:
s1: a patient sits in front of a slit-lamp microscope, a tracking camera acquires a face image and uploads the face image to an upper computer, and the upper computer identifies human eyes in the image and calculates the central coordinates of the human eyes;
s2: the control main board obtains the center coordinates of human eyes and compares the center coordinates with the center coordinates of the image, and respectively sends control instructions to control the rotation of the x-axis motor and the y-axis motor according to the comparison result so that the center of the image tends to the center coordinates of the human eyes;
s3: the eye ground camera acquires a human eye image and uploads the human eye image to the upper computer, and the upper computer identifies the definition of the human eye image;
s4: the control mainboard acquires the definition of the human eye image, compares the definition with the standard definition, and sends a control instruction to control the rotation of the z-axis motor when the definition of the human eye image is judged to be lower than the standard definition, so that the definition of the human eye image tends to the standard definition.
In the process of making the image center tend to the center coordinate of the human eye, the image center is made to coincide with the center coordinate of the human eye by adopting a method of judging successive approximation for a plurality of times, namely, after steps S1-S2 are carried out each time and a certain time interval is left, steps S1-S2 are repeated again, and the steps are repeated for a plurality of times until the image center coincides with the center coordinate of the human eye, wherein the time interval is 400 milliseconds each time. Because the coordinates of the human eyes change after the movement of the x axis and the y axis, the method of judging successive approximation for multiple times is adopted, the judgment of the coordinates of the human eyes and the updating of the control instruction can be carried out again after every 400 milliseconds, so that the image center can accurately move towards the center of the human eyes in the moving process, and the coincidence of the image center and the coordinates of the human eyes can be finally realized.
And when the coordinate difference value between the image center and the human eye center is within two pixels, the image center is considered to be coincided with the human eye center coordinate. The coincidence of the image center and the human eye center is provided with a certain tolerance, so that the use purpose can be met, the automatic focusing difficulty is reduced on the premise that the fundus camera 7 can be completely arranged on the fundus image, and the focusing efficiency can be improved.
And when the definition of the human eye image is judged to be lower than the standard definition, the control main board sends a control instruction to control the z-axis motor to rotate forwards or backwards, the step S3 is repeated after a certain time interval, whether the definition of the newly acquired human eye image is higher than that of the original human eye image is judged, if yes, the z-axis motor is controlled to continue to rotate along the direction, and otherwise, the z-axis motor is controlled to change the direction to rotate. When the definition of the eye image is lower than the standard definition, the eye fundus camera is probably too far away or too close to the eye, the definition of the eye fundus camera is judged by acquiring a new eye image again after the eye fundus camera is close to or away from the eye for a certain distance along the z-axis direction, and then the fact that the moving direction of the eye fundus camera is correct or wrong before the eye fundus camera is judged again can be judged. The standard definition referred to in this embodiment is a definition value that is preset in the control main board and meets the medical judgment requirement, and an operator can preset the standard definition value according to actual needs.
Further, when the human eye image definition is made to approach the standard definition, the human eye image definition reaches the standard definition by adopting a method of judging successive approximation for a plurality of times, that is, after steps S3-S4 are performed each time and a certain time is spaced, steps S3-S4 are repeated again, and the steps are repeated for a plurality of times until the human eye image definition reaches the standard definition, wherein the time interval is 400 milliseconds each time. In the process that the eye fundus camera is close to or far away from eyes in the z-axis direction, the focal length of the eye fundus camera is changed all the time, the definition of images of shot personnel is changed, and in order to ensure that when the standard cleaning degree is reached, a z-axis motor can be quickly and accurately stopped and an appropriate focal length is kept, so that a method of judging successive approximation for multiple times is adopted, continuous comparison and judgment can be carried out in the focusing process, and the quick and accurate butt joint is ensured.
As an optional mode of this embodiment, the upper computer is a computer, wherein a specific method for the upper computer to calculate the coordinates of the center of the human eye includes:
s11: extracting 6 characteristic points of each human eye by using a Dlib library;
s12: and averaging the coordinates of the 6 characteristic points of each human eye, and taking the average value as the central coordinates of the human eye.
When two human eyes are identified in the face image, respectively calculating the human eye center coordinates of the two human eyes; focusing work is carried out on one of the human eyes until the fundus of the human eye is photographed, and then focusing work is carried out on the other human eye and fundus photographing is finished.
The final purpose of focusing is to shoot clear fundus images through the fundus camera, the shooting range of the fundus camera is small, when a patient sits in front of the slit lamp microscope, eyes are not always in the shooting range of the fundus camera, and the fundus camera cannot automatically find the positions of the eyes to automatically focus at the moment, so that a tracking camera with a wider shooting range is needed, as shown in fig. 10, the shooting range of the tracking camera is wide, when the patient sits in front of the slit lamp microscope, the tracking camera can shoot the whole face of the person, and the eyes of the person must be contained in the face images shot by the tracking camera, so that the positions of the eyes of the person can be accurately found through the face images. Since it is eventually necessary to capture an image of a human eye by a fundus camera, it is necessary to adjust the capturing range of the fundus camera to a position capable of covering the entire human eye.
Therefore, in this embodiment, the image center is a coordinate corresponding to the center of the human eye image captured by the fundus camera in the human face image, and since the coordinate of the human eye position in the human face image obtained by calculation after the computer recognizes is a coordinate in the human face image and a certain distance is provided between the tracking camera and the fundus camera, the coordinate of the center of the human face image obtained by the tracking camera is different from the coordinate of the center of the human eye image obtained by the fundus camera, when calculating the corresponding coordinate of the image center in the human face image, it is necessary to calculate the coordinate value corresponding to the center of the human eye image in the coordinate system of the human face image according to the positional relationship between the tracking camera and the fundus camera, or, the coordinate value corresponding to the center of the human eye image in the coordinate system of the human face image can be obtained by comparing the coordinates through a plurality of tests.
The slit lamp microscope capable of achieving automatic focusing is provided as follows, referring to fig. 1-9, including a base assembly 10, a microscope assembly 20 and a slit lamp assembly (not shown), where the base assembly 10 includes a z-axis driving assembly 1, an x-axis driving assembly 2 and a y-axis driving assembly 3 arranged from bottom to top, the z-axis driving assembly 1 includes a z-axis moving seat 15 and a z-axis motor 11 for driving the z-axis moving seat 15 to move in a z-axis direction; the x-axis driving assembly 2 is mounted on the z-axis moving base 15, so that when the z-axis moving base 15 moves in the z-axis direction, the whole x-axis driving assembly 2 will move along with the z-axis moving base 15, and the x-axis driving assembly 2 comprises an x-axis moving base 22 and an x-axis motor 21 for driving the x-axis moving base 22 to move in the x-axis direction; the y-axis driving assembly 3 is mounted on the x-axis moving base 22, so that when the x-axis moving base moves along the z-axis direction or the x-axis direction, the y-axis driving assembly 3 will move therewith, the y-axis driving assembly 3 comprises a y-axis moving base 35 and a y-axis motor 31 for driving the y-axis moving base 35 to move in the y-axis direction, and the microscope assembly 20 and the slit lamp assembly are mounted on the y-axis moving base 35; the microscope component comprises a microscope arm 5, a microscope 6, a tracking camera 8 and an eyeground camera 7, wherein the microscope 6 and the tracking camera 7 are respectively arranged on the microscope arm 5, and the eyeground camera 7 is connected with the microscope 6. The tracking camera 8 and the fundus camera 7 are respectively connected with the computer data, the control mainboard is connected with the upper computer in a data mode, the tracking camera 8 and the fundus camera 7 can upload images to the upper computer after shooting the images, the upper computer can analyze and process the images and send analysis and processing data results to the control mainboard, the control mainboard can be combined with received data to calculate and send corresponding control instructions to the drive plates of the corresponding motors, the drive plates control the corresponding motors to work according to the received control instructions, and therefore the microscope assembly can be moved in the x-axis direction, the y-axis direction or the z-axis direction, and the automatic focusing function is achieved.
Therefore, under the drive of the z-axis motor 11, the x-axis motor 21 and the y-axis motor 31, the microscope assembly 20 and the slit lamp assembly mounted on the y-axis moving seat 35 can move in three directions of x, y and z, when the fundus images are photographed by using the microscope assembly 20, the focusing adjustment can be realized by driving the rotation of each motor in an electric control mode, compared with the existing mode that focusing can be realized only in a manual adjustment mode, the electric driving mode has the advantages of high adjusting speed, high adjusting precision, labor saving and the like. Furthermore, the tracking camera 8 and the fundus camera 7 are combined, the shooting range of the tracking camera 8 is wide, human eyes can be shot, the position of the human eyes can be conveniently identified by a computer, and after the positions of the human eyes are found and the fundus camera 7 is adjusted to a proper shooting angle, clear fundus pictures can be shot by the fundus camera 7.
In order to realize control of each motor, the x-axis motor 21 is connected with an x-axis drive plate, the y-axis motor 31 is connected with a y-axis drive plate, and the z-axis motor 11 is connected with a z-axis drive plate; the base assembly 10 further comprises a control main board, and the x-axis drive board, the y-axis drive board and the z-axis drive board are respectively connected with the control main board. Each drive plate can directly control the action of each motor, and the control mainboard can respectively send the direction and the adjustment quantity that each motor needs to be adjusted to each drive plate to this realizes the rotation of controlling each motor and realizes focusing.
Referring to fig. 6, the base assembly 10 further includes a fixed bottom case 4, the z-axis driving assembly 1 further includes a z-axis slide rail 14, a z-axis screw 12 and a z-axis screw sleeve 13, the z-axis slide rail 14 and the z-axis motor 11 are respectively fixed in the fixed bottom case 4, the z-axis moving base 15 is slidably mounted on the z-axis slide rail 14, the z-axis motor 11 is connected to the z-axis screw 12, the z-axis screw sleeve 13 is screwed to the z-axis screw 12, the z-axis screw sleeve 13 is connected to the z-axis moving base 15, and when the z-axis motor 11 drives the z-axis screw 12 to rotate, the z-axis screw 12 pushes the z-axis screw sleeve 13, the z-axis moving base 15 and upper components thereof to move along the z-axis direction. The z-axis slide 14 is configured to provide support for the z-axis movable base 15 and limit the moving track thereof, so as to ensure that the z-axis movable base 15 can stably move on the z-axis slide 14.
Referring to fig. 3-4 and 7, the x-axis driving assembly 2 further includes an x-axis slide rail 25, an x-axis screw 23 and an x-axis screw 24, the x-axis slide rail 25 and the x-axis motor 21 are respectively fixed on the x-axis moving base 22, the x-axis slide rail 25 is slidably connected to the z-axis moving base 15, the x-axis motor 21 is connected to the x-axis screw 23, the x-axis screw 24 is screwed to the x-axis screw 23, the x-axis screw 24 is connected to the z-axis moving base 15, and when the x-axis motor 21 drives the x-axis screw 23 to rotate, the x-axis screw 24 reversely pushes the x-axis screw 23, the x-axis moving base 22 and the upper member thereof to move along the x-axis direction. The x-axis slide rail 25 is connected with the z-axis moving seat 15 in a sliding manner, and the x-axis slide rail 25 is fixedly connected with the x-axis moving seat 22, so that the x-axis slide rail 25 can be used as a supporting member for the whole x-axis moving seat 22 and an upper member thereof to be installed on the z-axis moving seat 15, and in addition, the x-axis slide rail 25 can also play a limiting role in the movement of the whole x-axis driving assembly 2 in the x-axis direction, thereby ensuring the stability of the x-axis driving assembly in the movement process. Because the x-axis screw 24 is fixed on the z-axis moving base 15, the x-axis screw 24 cannot move in the x-axis direction at this time, when the x-axis motor 21 rotates to drive the x-axis screw 23 to rotate, the fixed x-axis screw 24 will push the x-axis screw 23 to move in the x-axis direction at this time, and because the x-axis screw 23 is fixed on the x-axis moving base 22, the x-axis screw 23 will push the whole x-axis moving base 22 to move at this time, thereby achieving the purpose of pushing the x-axis moving base 22 to move in the x-axis direction by using the x-axis motor 21.
One arrangement of the x-axis drive assembly of this embodiment is provided below, and referring to figures 3-5 and 8-9, the y-axis driving assembly 3 further comprises a y-axis screw 39 and a y-axis screw sleeve 33, the y-axis screw 39 is in screw connection with the y-axis screw sleeve 33, the y-axis motor 31 is connected with a driving gear 32, the y-axis thread insert 33 is sleeved with a driven gear 34, the y-axis motor 31 is fixed on the x-axis moving base 22, the y-axis screw sleeve 33 is rotatably installed on the x-axis moving base 22, the upper end of the y-axis screw rod 39 is fixedly connected with the y-axis moving seat 35, the lower end is in threaded connection with the y-axis screw sleeve 39, when the y-axis motor 31 drives the y-axis thread insert 33 to rotate through the driving gear 32 and the driven gear 34, the y-axis screw 33 pushes the y-axis screw 39 and the y-axis moving base 35 and its upper member to move in the y-axis direction. Since the y-axis screw 33 is installed on the x-axis moving base 22, the y-axis screw 33 cannot move along the y-axis direction, when the y-axis motor 31 drives the y-axis screw 33 to rotate, the y-axis screw 39 screwed with the y-axis screw is pushed back to move along the y-axis direction, and at this time, the y-axis screw 39 pushes the y-axis moving base 35 to move along the y-axis direction.
As an implementation manner of this embodiment, the x-axis moving base 22 includes a mounting tube 224 protruding upward for mounting the y-axis screw 34 and the y-axis screw 39, a rotation bearing 312 is fixed at the inner lower end of the mounting tube 224, and the y-axis screw 33 is fixed inside the rotation bearing 312. The installation barrel 224 is arranged, besides enough installation space can be provided for the y-axis screw sleeve 34, the y-axis screw rod 39 can be supported from the outer wall of the y-axis screw rod 39, specifically, a rotating sleeve can be sleeved between the y-axis screw rod 39 and the installation barrel 224, friction between the y-axis screw rod 39 and the installation barrel 224 can be avoided through the rotating sleeve, meanwhile, the installation barrel 224 can indirectly provide support for the y-axis screw rod 39 through the rotating sleeve, therefore, the y-axis screw rod 39 is prevented from being inclined, transverse pressure is applied to the y-axis screw sleeve 33, and the y-axis screw rod 39 can be ensured to stably move in the y-axis direction.
As an implementation manner of this embodiment, the mounting cylinder 224 is sleeved with a supporting spring 36, and the supporting spring 36 is compressed between the x-axis moving seat 22 and the y-axis moving seat 35. The supporting spring 36 is arranged to always provide upward supporting elastic force to the y-axis moving seat 35, so that the pressure of the y-axis moving seat 35 on the y-axis screw 39 can be reduced, and the stability and reliability of the structure can be ensured; meanwhile, when the y-axis screw 39 pushes the y-axis moving base 35 to move upward in the y-axis direction, the resistance of the upward movement of the y-axis screw 39 can be reduced due to the support spring 36, thereby reducing the operation load of the y-axis motor 31.
Specifically, the x-axis moving base 22 includes a horizontal mounting plate 221, an upper surrounding wall 222 and a lower surrounding wall 223, the upper surrounding wall 222 is located at the upper end of the horizontal mounting plate 221, and the lower surrounding wall 223 is located at the lower end of the horizontal mounting plate 221; the driven gear 34 is connected to the lower end of the y-axis threaded sleeve 33, the y-axis motor 31 is mounted at the upper end of the horizontal mounting plate 221, and the driving gear 32 penetrates through the horizontal mounting plate 221 from top to bottom to be meshed with the driven gear 34; the x-axis slide rail 25, the x-axis screw 23 and the x-axis motor 21 are respectively installed on the lower end surface of the horizontal installation plate 221, and the upper surrounding wall 222 and the lower surrounding wall 223 are enclosed on the peripheries of the x-axis drive component 2 and the y-axis drive component 3. The upper surrounding wall 222 and the lower surrounding wall 223 are arranged, so that internal parts of the x-axis driving assembly 2 and the y-axis driving assembly 3 can be protected in a surrounding way, and the x-axis movable seat 22 can be used as a part of the shell of the base assembly 10, so that materials are saved, and the occupied space of equipment is reduced; the y-axis motor 31 is arranged on the horizontal mounting plate 221, and the driving gear 32 penetrates through the horizontal mounting plate 221 to be meshed with the driven gear 34, so that the upper space and the lower space of the horizontal mounting plate 221 are reasonably utilized, the whole base assembly 10 is compact in structure, and the occupied space is reduced.
Further, a guide sleeve 37 is arranged at the upper end of the horizontal mounting plate 221, a guide rod 38 penetrates through the guide sleeve 37, and the upper end of the guide rod 38 is fixedly connected with the y-axis moving seat 35. The guide sleeve 37 and the guide rod 38 are arranged, so that in the process that the y-axis moving seat 35 moves up and down, the guide and limiting effects can be achieved for the movement of the y-axis moving seat 35, and the stability and reliability of the moving process are guaranteed.
As an implementation manner of this embodiment, referring to fig. 6, 7, and 9, the z-axis driving assembly 1 includes a z-axis photoelectric sensor pair 16, the z-axis photoelectric sensor pair 16 is connected to the z-axis driving plate, the z-axis thread sleeve 13 is connected to a z-axis light blocking sheet 17, two photoelectric sensors 18 of the z-axis photoelectric sensor pair 16 are located at two ends of a moving stroke of the z-axis light blocking sheet 17, the z-axis light blocking sheet 17 is disposed on the z-axis thread sleeve 13, the z-axis light blocking sheet 17 will move along with the z-axis thread sleeve, and when the z-axis light blocking sheet 17 moves to block the photoelectric sensors 18, the z-axis driving plate receives a signal, so that an alarm signal can be sent and the z-axis motor 11 stops rotating continuously, thereby avoiding a fault caused by over-transduction; the x-axis driving assembly 2 comprises an x-axis photoelectric sensor pair 26, the x-axis photoelectric sensor pair 26 is connected with the x-axis driving plate, the x-axis screw 24 is connected with an x-axis light barrier 27 in a sleeved mode, and two photoelectric sensors of the x-axis photoelectric sensor pair 26 are located at two ends of a moving stroke of the x-axis light barrier 27; the y-axis driving assembly 3 comprises a y-axis photoelectric sensor pair 310, the y-axis photoelectric sensor pair 310 is connected with the y-axis driving plate, the y-axis moving seat 35 is connected with a y-axis light blocking sheet 311, and two photoelectric sensors of the y-axis photoelectric sensor pair 310 are located at two ends of a moving stroke of the y-axis light blocking sheet 311. The working principle and the function of the x-axis photoelectric sensor pair 26 and the y-axis photoelectric sensor pair 310 are the same as those of the z-axis photoelectric sensor pair 16, and no redundant description is provided herein, and reference may be specifically made to the description of the z-axis photoelectric sensor pair 16.
The above description is only a preferred embodiment of the present invention, but not intended to limit the scope of the invention, and all simple equivalent changes and modifications made in the claims and the description of the invention are within the scope of the invention.