| With the continuous development of microscope camera automation,auto focusing is widely used in microscope system,and auto focusing microscope cameras have also emerged.However,the hill-climbing search method for microscopic camera currently has certain defects,it is easy to fall into a local peak,and the focus search direction cannot be correctly identified.These all affect the focusing performance of the microscope camera.This paper proposes an adaptive auto focusing algorithm,which is improved based on the hill-climbing search method,and adds adaptive steering and adaptive threshold functions on the basis of the hill-climbing search method.The adaptive steering takes three steps as the calculation unit,calculates the average value of the image evaluation function obtained in the three consecutive steps,and compares them to accurately identify the focus search direction.The adaptive threshold determines the maximum value threshold of the current focus stroke according to the maximum image evaluation function value in the previous focus stroke.The maximum value of the image evaluation function value found by the hill-climbing search needs to be greater than the maximum threshold value before it can be finally judged as the best focus point.These two methods can effectively shorten the focus stroke,avoid the influence of local peaks,and increase the stability of the algorithm.Secondly,this paper innovatively proposes a control method of auto focusing function based on UVC protocol.The host receives the video stream collected by the microscope camera through the USB3.0 interface and controls the microscope camera to auto focus.The data transmitted between the host and camera is divided into video stream data and private control data.Both types of data are encapsulated based on the UVC protocol.The application program running on the host transmits the private auto focusing command to the microscope camera through the USB3.0,and the camera program parses the data and performs corresponding operation processing according to the parsed command.Thirdly,this paper designs and implements the hardware circuit and mechanical structure of the microscope camera.The auto focusing of this paper is completed by controlling the relative position of the image sensor and the microscope objective lens.The focusing structure is integrated in the microscope camera.According to the auto focusing algorithm,the stepper motor drives the image sensor to move.The microscopic auto focusing camera with USB3.0 interface,which is small in size,convenient to carry,and always maintains the conjugate relationship between the object and image,can be used in machine vision scenes in addition to microscope.Fourthly,this paper develops related function software and control software on the camera and the host respectively.On the camera,auto focusing functions such as single focusing,auto focusing,C mount correction,and manual focusing are researched and analyzed.An auto focusing module supporting ToupView software is developed on the host.It receives the video stream and camera instructions that the camera transmits to the host through the USB3.0 interface,and sends control commands to the camera to complete the judgment and control of the camera state.Finally,this paper will test the focusing performance of the developed USB3.0 interface microscope auto focusing camera in different scenarios.The test results prove that the auto focusing studied in this paper has faster focusing speed,stable focusing performance and higher focusing accuracy. |