CN111698420A - Automatic focusing method for image analyzer - Google Patents

Automatic focusing method for image analyzer Download PDF

Info

Publication number
CN111698420A
CN111698420A CN202010418779.4A CN202010418779A CN111698420A CN 111698420 A CN111698420 A CN 111698420A CN 202010418779 A CN202010418779 A CN 202010418779A CN 111698420 A CN111698420 A CN 111698420A
Authority
CN
China
Prior art keywords
definition
picture
camera
image
target
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010418779.4A
Other languages
Chinese (zh)
Inventor
赵明权
潘泓锦
莫常东
石鑫若
农柳华
唐雪辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Urit Medical Electronic Co Ltd
Original Assignee
Urit Medical Electronic Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Urit Medical Electronic Co Ltd filed Critical Urit Medical Electronic Co Ltd
Priority to CN202010418779.4A priority Critical patent/CN111698420A/en
Publication of CN111698420A publication Critical patent/CN111698420A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/64Computer-aided capture of images, e.g. transfer from script file into camera, check of taken image quality, advice or proposal for image composition or decision on when to take image
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • H04N23/673Focus control based on electronic image sensor signals based on contrast or high frequency components of image signals, e.g. hill climbing method

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)
  • Automatic Focus Adjustment (AREA)

Abstract

The invention discloses an automatic focusing method for an image analyzer, which comprises the steps of resetting the height of a camera; driving the camera to descend once from the top by a large number of steps and taking a picture continuously to obtain a first picture; processing all the first pictures to obtain noise-free gray pictures; calculating the definition of the picture; saving pictures with the definition greater than or equal to the initial threshold definition; storing the picture position with the maximum definition in the process of the large step descending; judging whether the definition peak value is reached; adjusting the height of the camera again, driving the camera to descend from the position by small steps once, and taking a picture to obtain a second picture; and calculating the definition of the second picture, and determining the target height of the camera according to whether the falling edge of the definition is reached. The camera has the advantages that the optimal height for setting the camera is effectively and automatically found, the problem that pictures are fuzzy due to focusing is avoided, focusing accuracy is improved, and meanwhile, a large amount of labor cost is saved.

Description

Automatic focusing method for image analyzer
Technical Field
The invention relates to the field of digital image processing, in particular to an automatic focusing method for an image analyzer.
Background
With the advancement of technology, more and more automated products are coming out. Many automated products require images to be captured and the image data to be analyzed. In the past, the camera height is adjusted manually to achieve the purpose of focusing, but manual adjustment is relatively more costly. With the deepening of the degree of automation, how to design an automatic method capable of automatically adjusting the height of a camera to achieve the purpose of focusing becomes a problem to be solved urgently.
Disclosure of Invention
The invention aims to provide an automatic focusing method for an image analyzer, and aims to solve the problems that camera focusing adjustment is carried out manually at present, the labor cost is high, and the accuracy is low.
To achieve the above object, the present invention provides an auto-focusing method for an image analyzer, comprising:
resetting the height of the camera, and placing the camera at the top end position;
driving the camera to descend once from the top end according to a first preset step number, simultaneously carrying out continuous shooting according to a first preset frequency, and sequentially storing all first pictures to be shot;
acquiring all the first pictures, and performing gray scale and filtering processing to obtain a gray scale image which eliminates the influence of noise;
carrying out segmentation screening processing on the gray level image to obtain an impurity-free clear image, and calculating the definition of the impurity-free clear image;
judging whether the definition of the impurity-free clear picture is smaller than an initial threshold value or not, and storing the definition larger than or equal to the initial threshold value and the corresponding impurity-free clear picture as a qualified picture;
comparing the corresponding definitions of the qualified pictures, and reserving the first definition arranged in a descending order, the corresponding qualified pictures and the position heights of the qualified pictures;
judging whether the first definition arranged in descending order reaches a definition peak value or not;
if so, adjusting the height of the camera to a first preset distance above the position of the qualified picture corresponding to the first definition;
driving the camera to descend from the position once according to a second preset step number, taking a picture and storing the picture as a second picture;
calculating a plurality of definitions of the second picture, and determining the target height of the camera according to whether all the definitions reach the falling edge of the definition of the picture;
if not, the image is decreased once again according to the second preset step number, and the image is taken once.
In an embodiment, acquiring all the first pictures to perform gray scale and filtering processing to obtain a gray scale map without noise influence, and the specific steps include:
and carrying out graying processing on all the first pictures and then carrying out median filtering to obtain a grayscale image which eliminates the influence of noise.
In one embodiment, the method includes the steps of performing segmentation screening processing on the gray-scale image to obtain an impurity-free clear image, and calculating the definition of the impurity-free clear image, and includes the following specific steps:
dividing the gray scale image into four parts of upper left, upper right, lower left and lower right, calculating the standard deviation of the image of each part, and recording the first standard deviation which is arranged in the front in an ascending order as the definition of the clear picture without impurities.
In one embodiment, the determining whether the sharpness of the clear picture without impurities is less than an initial threshold includes:
if the number of the images is smaller than the initial threshold value, discarding the corresponding clear image without impurities;
and if the definition is greater than or equal to the initial threshold, saving the definition and the corresponding clear picture without impurities as a qualified picture.
In one embodiment, the step of comparing the definitions corresponding to the qualified pictures and retaining the first definition, the corresponding qualified pictures and the position heights of the qualified pictures in descending order includes the steps of:
acquiring the definition of a first qualified picture as a first target definition, and sequentially acquiring the definition of the next qualified picture to be compared with the first target definition;
if the definition of the first target is larger than that of the next qualified picture, the definition of the first target is saved;
and if the definition of the first target is smaller than that of the next qualified picture, updating the definition of the next qualified picture to be the new definition of the first target.
In one embodiment, the method for determining whether the first definition in descending order reaches the definition peak value comprises the following specific steps:
calculating the variance by taking the definition of a preset number of qualified pictures as a group and storing the variance as a second target definition;
sequentially obtaining the definition of the next qualified picture to replace the definition of the previous qualified picture, calculating a new variance, and comparing the new variance with the definition of the second target to obtain the definition of the new second target;
and judging whether the new second target definition is larger than a preset change amplitude.
In one embodiment, the method for calculating a new variance and comparing the new variance with a second target definition to obtain a new second target definition comprises the following specific steps:
if the second target definition is greater than the new variance, saving the second target definition;
and if the second target definition is smaller than the new variance, updating the new variance to be the new second target definition.
In one embodiment, the determining whether the new second target definition is greater than the preset variation range includes:
if the amplitude is larger than the preset variation amplitude, the definition peak value is reached;
if the variation amplitude is smaller than or equal to the preset variation amplitude, the clear peak value is not reached, the camera is driven to descend once again from the position according to the first preset step number, meanwhile, uninterrupted shooting is carried out according to the first preset frequency, and all first pictures shot are stored in sequence.
In an embodiment, the calculating the plurality of resolutions of the second picture includes:
and performing median filtering and directional filtering on the second picture, eliminating noise, solving a plurality of parameters, and simultaneously representing the definition of the second picture by using the plurality of parameters, wherein the plurality of parameters comprise the mean value of the picture after the directional filtering, the standard deviation of the grey image of the picture and the mean value after the grey image is masked.
In one embodiment, the determining the target height of the camera according to whether each sharpness reaches the falling edge of the sharpness of the picture includes:
if the definition of the second picture is greater than the threshold value, storing, setting the corresponding definition as a new threshold value, and decreasing once again according to a second preset step number;
and if the definition of each second picture is smaller than the threshold value, the camera is lifted by a second preset distance, and focusing is finished.
The automatic focusing method for the image analyzer drives the camera to descend once from the top by a large step number by resetting the height of the camera without taking pictures discontinuously, filters the obtained picture, calculates the definition of the picture, stores the qualified picture, stores the picture position with the maximum definition and the value of the definition, judges whether the picture reaches the definition peak value, resets the height of the camera again, descends by a small step number and takes pictures, determines the optimal height of the camera, realizes that the optimal position of the camera is roughly estimated by using the large step focusing of the camera and is accurately positioned by using the small step focusing of the camera, can effectively find the optimal height of the camera by using automation, not only avoids the problem of unclear picture due to focusing reasons, improves the accuracy, but also can save a large amount of labor cost.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a schematic flow chart of an auto-focusing method for an image analyzer according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating step S105 according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating step S106 according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating step S107 according to an embodiment of the present invention;
FIG. 5 is a flowchart illustrating step S109 according to an embodiment of the present invention;
FIG. 6 is a schematic flowchart of an auto-focusing method for an image analyzer according to an embodiment of the present invention;
FIG. 7 is a general flow diagram of a large step focus of an embodiment of the present invention;
FIG. 8 is a general flow diagram of the fine step focusing of an embodiment of the present invention;
FIG. 9 is a picture segmentation of a "decontamination algorithm" with reduced contaminants in accordance with an embodiment of the present invention;
FIG. 10 is a slice through the variation of FIG. 9, showing a "decontamination algorithm" when there are more contaminants;
fig. 11 is a waveform diagram of picture sharpness when the camera height changes according to the embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
Referring to fig. 1, fig. 1 is a schematic flow chart illustrating an auto-focusing method for an image analyzer according to an embodiment of the present invention. Specifically, the auto-focusing method for an image analyzer may include the steps of:
s101, resetting the height of the camera, and placing the camera at the top end position;
in the embodiment of the invention, the height of the camera is reset, so that instrument faults are avoided.
S102, driving the camera to descend once from the top end according to a first preset step number, simultaneously carrying out continuous shooting according to a first preset frequency, and sequentially storing all first pictures to be shot;
in the embodiment of the present invention, the first preset step number is a large step number, that is, the first preset step number is moved for a certain distance, and the continuous shooting is performed according to a first preset frequency, that is, the shooting is performed for 20 times in 1 minute, that is, the number of times of the periodic change is completed in a unit time, so as to obtain 20 first pictures of the shot object, and then the first pictures are stored according to the time sequence.
S103, acquiring all the first pictures, and performing gray scale and filtering processing to obtain a gray scale image which eliminates the influence of noise;
in the embodiment of the present invention, the filtering process is a filtering algorithm such as low-pass filtering, median filtering, high-pass filtering, directional filtering (Sobel), laplacian transform, and the like, where the median filtering is preferred, and specifically, the median filtering is performed after graying all the first pictures, so as to obtain a grayscale image with noise influence removed. The method can effectively eliminate the noise on the picture without being influenced by environmental factors.
S104, carrying out segmentation screening processing on the gray level image to obtain an impurity-free clear image, and calculating the definition of the impurity-free clear image;
in the embodiment of the invention, the gray-scale image is divided into four parts, namely, upper left part, upper right part, lower left part and lower right part, the image standard deviation of each part is calculated, the first standard deviation which is arranged in the front in an ascending order is recorded as the definition of the clear picture without impurities, and the first standard deviation is used as the standard deviation of the whole picture and is also the measurement standard of the definition. Specifically, referring to fig. 9, fig. 9 is a picture segmentation diagram of a "decontamination algorithm" with less impurities, as shown in fig. 9, solid black dots are impurities on a lens or a glass slide, and hollow dots are objects to be observed. The whole picture is divided into four areas, the standard deviation in each area is obtained, and the area with the larger standard deviation shows that the difference of the internal features of the area is more obvious. Display deviceIt is easy to see that the difference of the characteristics of the regions with impurities is much larger than that of the regions without impurities, so the region with the smallest standard deviation is taken to represent the whole picture. Referring to fig. 10, fig. 10 is a picture segmentation diagram of the "decontamination algorithm" in the case of the deformed impurities of fig. 9, and when the deformed impurities are widely distributed, the image can be segmented into more blocks as shown in fig. 10. The standard deviation is calculated as: std ═ sqrt (((x)1-E(x))2+(x2-E(x))2+…(xn-E(x))2)/(n-1))。
S105, judging whether the definition of the impurity-free clear picture is smaller than an initial threshold value or not, and storing the definition larger than or equal to the initial threshold value and the corresponding impurity-free clear picture as a qualified picture;
in the embodiment of the present invention, please refer to fig. 2, if the value is smaller than the initial threshold, the corresponding clear picture without impurities is discarded; and if the definition is greater than or equal to the initial threshold, saving the definition and the corresponding clear picture without impurities as a qualified picture.
S106, comparing the corresponding definitions of the qualified pictures, and reserving the first definition arranged in a descending order, the corresponding qualified pictures and the position heights of the qualified pictures;
in the embodiment of the present invention, please refer to fig. 3, the definition of the first qualified picture is obtained as the first target definition, and the definition of the next qualified picture is sequentially obtained to be compared with the first target definition; if the definition of the first target is larger than that of the next qualified picture, the definition of the first target is saved; and if the definition of the first target is smaller than that of the next qualified picture, updating the definition of the next qualified picture to be the new definition of the first target. The definition alpha of the first picture is stored as the maximum definition Max, then the definition alpha of the next picture is sequentially taken and compared with the definition alpha of the Max, and the larger definition alpha is stored as the new Max. And finally, the definition stored by the Max is the maximum definition in the descending process of the camera, and the product of the picture sequence number corresponding to the Max and the descending frequency is the optimal shooting position in the descending process of the camera.
S107, judging whether the first definition arranged in descending order reaches a definition peak value;
in the embodiment of the present invention, please refer to fig. 4, the definition of a predetermined number of qualified pictures is taken as a group to calculate the variance and store the variance as the second target definition; sequentially obtaining the definition of the next qualified picture to replace the definition of the previous qualified picture, calculating a new variance, and comparing the new variance with the definition of the second target to obtain the definition of the new second target; specifically, if the definition of the second target is greater than the new variance, the definition of the second target is stored; and if the second target definition is smaller than the new variance, updating the new variance to be the new second target definition. Judging whether the new second target definition is larger than a preset change amplitude or not; if the amplitude is larger than the preset variation amplitude, the definition peak value is reached; if the variation amplitude is smaller than or equal to the preset variation amplitude, the clear peak value is not reached, the camera is driven to descend from the current position once according to a first preset step number, meanwhile, uninterrupted shooting is carried out according to a first preset frequency, and all first pictures shot are stored in sequence. Specifically, the definition of a plurality of pictures is taken as a group to calculate the variance val and store the variance val to MaxV, the definition of the picture at the upper end is replaced by the definition of the next picture each time, a new val is calculated, and the MaxV and the val are compared, and the larger value is stored as the new MaxV. And finally, the value reserved by the MaxV is the maximum variation amplitude in the descending process of the camera. If MaxV is larger than the set variation range ζ, it is indicated that the peak value of the definition has passed in the current descending process. Referring to fig. 11, fig. 11 is a waveform diagram of the sharpness of the picture when the height of the camera changes, wherein the abscissa represents the height of the camera and the ordinate represents the sharpness of the picture. As shown in fig. 11, the sharpness value changes sharply only when the camera height is close to the peak, and changes very slowly when the camera is at other heights. Therefore, the invention puts a plurality of pictures in a group to form a window, calculates the definition of each picture in the window, and then calculates the variance of the window about the definition. As is known, the variance describes the range of the value fluctuation, the larger the variance is, the larger the value fluctuation is, that is, the greater the definition change is, and when the variance value is greater than the threshold value, it can be said that the window reaches the peak value of the definition.
S108, adjusting the height of the camera to a first preset distance above the position of the qualified picture corresponding to the first definition; driving the camera to descend from the position once according to a second preset step number, taking a picture and storing the picture as a second picture;
in the embodiment of the invention, after the definition peak value is reached, the height of the camera is reset, and the optimal height of the camera is accurately found. The second preset step number is a small step number, namely, the second preset step number moves for a small distance and is photographed after the second preset step number is descended; if the definition peak value is not reached, the image is decreased once again according to the second preset step number, and the image is taken once.
S109, calculating a plurality of definitions of the second picture, and determining the target height of the camera according to whether all the definitions reach the falling edge of the definition of the picture.
In the embodiment of the present invention, referring to fig. 5, a specific process of calculating the definition of the second picture includes performing median filtering and directional filtering on the second picture, eliminating noise, obtaining a plurality of parameters, and simultaneously representing the definition of the second picture by using the plurality of parameters, where the plurality of parameters include a mean value of the picture after the directional filtering, a standard deviation of a gray image of the picture, and a mean value after masking the gray image. The specific process of comparing the definition with the threshold value is that if the definition of the second picture is larger than the threshold value, the definition is updated to a new threshold value, and the height of the camera is reduced again according to a second preset step number; if the definition of the second picture is smaller than the threshold value, the camera is raised by a small height, and the height is determined as the target height.
Referring to fig. 6, the present invention can be roughly divided into two parts, namely, a camera "large step focusing" algorithm and a camera "small step focusing" algorithm. The camera "step focus" algorithm is used to roughly estimate the best position of the camera, and the camera "step focus" algorithm is used to pinpoint the best position of the camera. If only "large-step focusing" is used, the optimum position of the camera cannot be accurately obtained, and if only "small-step focusing" is used, the focusing efficiency is lowered.
Specifically, the core of the camera 'large step focusing' algorithm comprises four parts, namely a 'filtering algorithm', a 'impurity removing algorithm', a 'peak judgment algorithm' and a 'definition representation method'. The filtering algorithm is to graye the image and then to median filter the obtained grayscale image; the 'impurity removal algorithm' is to divide the picture into four regions as shown in fig. 9, calculate the standard deviation of each region, and select the part with the minimum standard deviation; the 'judgment peak value algorithm' is to obtain the variance of the definition of a group of pictures, judge the fluctuation of the group of pictures by using the variance, and if the fluctuation is large, the group of pictures comprises the peak value of the definition; the definition in the step focusing is described by using the standard deviation of the picture, and the larger the standard deviation of the picture is, the clearer the picture is. The basic content is to lower the camera down by a relatively large distance, determine whether the distance includes the optimal height of the camera, if so, enter "small step focusing", and if not, then lower down by a relatively large distance, and fig. 7 is a flow chart of "large step focusing".
Specifically, in step S0, the camera is lowered by a relatively large distance, which cannot be selected at will, and the distance is too small, which may reduce the searching efficiency; if the distance is too large, the subsequent small step focusing will take more steps, and the efficiency of the whole algorithm will be reduced, so the distance of large step focusing needs to be controlled reasonably according to the application situation.
Specifically, in step S1, a picture is taken at regular intervals and saved during the lowering of the camera. The frequency of taking the pictures is the same as the descending distance, and the pictures cannot be selected at will. If the shooting frequency is too low, the deviation between the estimated optimal position and the accurate optimal position is too large, the efficiency of small-step focusing is reduced, pictures near the shooting definition peak value can be missed seriously, and the peak value picture cannot be found in the whole large-step focusing process; if the shooting frequency is too high, a large amount of resources are consumed to store and process the pictures, the processor is burdened, the time for processing the pictures is increased, and the efficiency is reduced.
Specifically, in step S2, the picture is scaled down to increase the processing speed of the picture, the scaled-down picture is converted into a gray-scale picture, the gray-scale picture is filtered to eliminate noise points on the picture, the picture is divided by the method shown in fig. 9 to find a portion without impurities, and the standard deviation of the portion is used to represent the definition of the picture. The definition of the picture is expressed by standard deviation at this stage, and can be expressed by the mean of the gradient, the mean after Sobel filtering, the mean after masking or the variance according to the situation.
The camera can calculate a maximum sharpness from the pictures taken with a large distance descent each time, and the key to determining how to determine the optimum height of the camera for the distance descent is step S3. Specifically, step S3 is to put a plurality of pictures into one group, calculate the standard deviation of the window definition, replace one picture in sequence, calculate the standard deviation of the new window definition, compare the original standard deviation with the new standard deviation, and keep the larger standard deviation. And repeating the steps until all the pictures are replaced. When the maximum definition standard deviation reserved in the descending process is larger than the set standard deviation threshold value, the descending process includes the optimal camera height. The standard deviation threshold value needs to be reasonably set according to the environment, the definition peak value cannot be found if the standard deviation threshold value is too large, the definition which is not the peak value can be mistaken as the definition peak value by an algorithm if the standard deviation threshold value is too small, and inaccurate focusing is caused.
The camera takes pictures at a certain frequency, the descending speed is constant, and the descending distance of a picture taken by the camera can be correspondingly calculated. And then the descending height of the camera when the picture is shot can be calculated through the sequence of the pictures. Specifically, step S4 is to raise the camera to the height at which the sharpest picture was taken. Because the distance of descending the camera is relatively large, the optimal position of the camera for taking pictures is probably above the optimal height obtained by the camera for large step focusing, and therefore, the height of the camera needs to be increased by a small distance.
Specifically, the core of the camera 'fine focus' algorithm comprises two parts, namely 'filtering algorithm' and 'expression method of definition'. Wherein the filtering algorithm comprises median filtering and directional (Sobel) filtering; the definition of the 'small-step focusing' is composed of four parameters of a mean value mean after Sobel filtering is carried out on a picture, a standard deviation std after gray level of the picture is carried out, a mean value diff after the gray level picture is masked, a result obtained after mixed calculation of the mean value mean and the standard deviation std, the standard deviation diff and the gray level picture, and the like. The representation by a plurality of parameters enables a more accurate representation of the sharpness. The basic content is that the camera descends once from the height and takes a picture, a plurality of parameters of the picture are calculated, the optimal height of the camera is accurately found according to the parameters of the picture, and focusing is completed. Fig. 8 is a flowchart of "fine step focusing".
Specifically, step S5 is to lower the height of the camera by a relatively small distance, and then take and save the picture. It should be noted that in the "focus step" algorithm, the camera's descent distance cannot be too large, otherwise a large error may be caused.
Specifically, step S6 is to calculate a plurality of parameters that can represent the sharpness of the picture, such as the mean value of the image after Sobel filtering, the standard deviation of the image after graying, the mean value of the grayscale image after masking, and so on. According to different application environments, other parameters capable of representing definition can be replaced.
Specifically, in step S7, a threshold is set, and when the resolution of the shot picture is greater than the threshold, the resolution is updated to a new threshold, and step S5, step S6 and step S7 are repeated; and if the definition of each shot picture is smaller than the threshold value, moving the camera up by a small distance to represent that the focusing is finished.
The invention provides a set of complete automatic focusing technical scheme. The scheme has strong universality and can exert good effect under the condition that the camera can automatically adjust the distance or adjust the focal length.
The impurity removal algorithm provided by the invention can be used for separating more areas according to different conditions, and can play a certain role even in an environment with more impurities.
The peak value judgment algorithm provided by the invention can find the peak value point of the data by adjusting the threshold value of the data variance under various conditions.
The definition representation method provided by the invention can be used in most environments and can also provide ideas for definition representation under more complex conditions.
Through the technical scheme, the camera can be effectively and quickly focused, the automation degree of the instrument is deepened, the labor cost is saved, the profit can be increased for enterprises, and new convenience can be brought to the society. According to the scheme, a plurality of technical algorithms can be utilized in most environments, the universality is high, and the guiding effect can be achieved in a plurality of more complex environments. The scheme not only can make a complete set of complete flow to bring forward steps for the road of automatic development, but also can bring small promotion to the automatic process by the technical algorithm in the scheme.
While the invention has been described with reference to a preferred embodiment, it will be understood by those skilled in the art that various changes in form and detail may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. An auto-focusing method for an image analyzer, comprising:
resetting the height of the camera, and placing the camera at the top end position;
driving the camera to descend once from the top end according to a first preset step number, simultaneously carrying out continuous shooting according to a first preset frequency, and sequentially storing all first pictures to be shot;
acquiring all the first pictures, and performing gray scale and filtering processing to obtain a gray scale image which eliminates the influence of noise;
carrying out segmentation screening processing on the gray level image to obtain an impurity-free clear image, and calculating the definition of the impurity-free clear image;
judging whether the definition of the impurity-free clear picture is smaller than an initial threshold value or not, and storing the definition larger than or equal to the initial threshold value and the corresponding impurity-free clear picture as a qualified picture;
comparing the corresponding definitions of the qualified pictures, and reserving the first definition arranged in a descending order, the corresponding qualified pictures and the position heights of the qualified pictures;
judging whether the first definition arranged in descending order reaches a definition peak value or not;
if so, adjusting the height of the camera to a first preset distance above the position of the qualified picture corresponding to the first definition;
driving the camera to descend from the position once according to a second preset step number, taking a picture and storing the picture as a second picture;
calculating a plurality of definitions of the second picture, and determining the target height of the camera according to whether all the definitions reach the falling edge of the definition of the picture;
if not, the image is decreased once again according to the second preset step number, and the image is taken once.
2. The auto-focusing method for an image analyzer according to claim 1, wherein all the first pictures are acquired for gray scale and filtering processing to obtain a gray scale image excluding the influence of noise, and the specific steps include:
and carrying out graying processing on all the first pictures and then carrying out median filtering to obtain a grayscale image which eliminates the influence of noise.
3. The auto-focusing method for an image analyzer according to claim 1, wherein the gray-scale image is segmented and screened to obtain a clear image without impurities, and the definition of the clear image without impurities is calculated, and the method comprises the following steps:
dividing the gray scale image into four parts of upper left, upper right, lower left and lower right, calculating the standard deviation of the image of each part, and recording the first standard deviation which is arranged in the front in an ascending order as the definition of the clear picture without impurities.
4. The auto-focusing method for an image analyzer according to claim 1, wherein the step of determining whether the sharpness of the clear picture without impurities is less than an initial threshold value comprises the steps of:
if the number of the images is smaller than the initial threshold value, discarding the corresponding clear image without impurities;
and if the definition is greater than or equal to the initial threshold, saving the definition and the corresponding clear picture without impurities as a qualified picture.
5. The auto-focusing method for an image analyzer according to claim 1, wherein the corresponding definitions of the qualified pictures are compared, and the first definition, the corresponding qualified picture and the position height of the qualified picture in descending order are retained, the specific steps including:
acquiring the definition of a first qualified picture as a first target definition, and sequentially acquiring the definition of the next qualified picture to be compared with the first target definition;
if the definition of the first target is larger than that of the next qualified picture, the definition of the first target is saved;
and if the definition of the first target is smaller than that of the next qualified picture, updating the definition of the next qualified picture to be the new definition of the first target.
6. The auto-focusing method for an image analyzer according to claim 1, wherein the step of determining whether the first resolution in descending order reaches the resolution peak value comprises the steps of:
calculating the variance by taking the definition of a preset number of qualified pictures as a group and storing the variance as a second target definition;
sequentially obtaining the definition of the next qualified picture to replace the definition of the previous qualified picture, calculating a new variance, and comparing the new variance with the definition of the second target to obtain the definition of the new second target;
and judging whether the new second target definition is larger than a preset change amplitude.
7. The auto-focusing method for an image analyzer according to claim 6, wherein a new variance is calculated and compared with the second target definition to obtain a new second target definition, and the specific steps include:
if the second target definition is greater than the new variance, saving the second target definition;
and if the second target definition is smaller than the new variance, updating the new variance to be the new second target definition.
8. The auto-focusing method for an image analyzer according to claim 7, wherein the step of determining whether the new second target resolution is greater than the predetermined variation range comprises:
if the amplitude is larger than the preset variation amplitude, the definition peak value is reached;
if the variation amplitude is smaller than or equal to the preset variation amplitude, the clear peak value is not reached, the camera is driven to descend once again from the position according to the first preset step number, meanwhile, uninterrupted shooting is carried out according to the first preset frequency, and all first pictures shot are stored in sequence.
9. The auto-focusing method for an image analyzer according to claim 1, wherein the calculating of the plurality of resolutions of the second picture comprises:
and performing median filtering and directional filtering on the second picture, eliminating noise, solving a plurality of parameters, and simultaneously representing the definition of the second picture by using the plurality of parameters, wherein the plurality of parameters comprise the mean value of the picture after the directional filtering, the standard deviation of the grey image of the picture and the mean value after the grey image is masked.
10. The auto-focusing method for an image analyzer of claim 9, wherein the target height of the camera is determined according to whether each sharpness reaches the falling edge of the sharpness of the picture, and the specific steps include:
if the definition of the second picture is greater than the threshold value, storing, setting the corresponding definition as a new threshold value, and decreasing once again according to a second preset step number;
and if the definition of each second picture is smaller than the threshold value, the camera is lifted by a second preset distance, and focusing is finished.
CN202010418779.4A 2020-05-18 2020-05-18 Automatic focusing method for image analyzer Pending CN111698420A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010418779.4A CN111698420A (en) 2020-05-18 2020-05-18 Automatic focusing method for image analyzer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010418779.4A CN111698420A (en) 2020-05-18 2020-05-18 Automatic focusing method for image analyzer

Publications (1)

Publication Number Publication Date
CN111698420A true CN111698420A (en) 2020-09-22

Family

ID=72477932

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010418779.4A Pending CN111698420A (en) 2020-05-18 2020-05-18 Automatic focusing method for image analyzer

Country Status (1)

Country Link
CN (1) CN111698420A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112561992A (en) * 2020-12-01 2021-03-26 浙江大华技术股份有限公司 Position determination method and device, storage medium and electronic device
CN113459084A (en) * 2021-05-21 2021-10-01 广东拓斯达科技股份有限公司 Robot parameter calibration method, device, equipment and storage medium
CN113639630A (en) * 2021-04-01 2021-11-12 浙江大学台州研究院 Dimension measuring instrument system based on multi-template matching and automatic focusing functions

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120027393A1 (en) * 2010-07-27 2012-02-02 Sanyo Electric Co., Ltd. Electronic equipment
CN104301601A (en) * 2013-11-27 2015-01-21 中国航空工业集团公司洛阳电光设备研究所 Coarse tuning and fine tuning combined infrared image automatic focusing method
CN105306825A (en) * 2015-11-18 2016-02-03 成都中昊英孚科技有限公司 Novel infrared image focusing system and use method thereof
CN106990518A (en) * 2017-04-17 2017-07-28 深圳大学 A kind of blood film self-focusing micro imaging method
CN107870406A (en) * 2017-11-06 2018-04-03 北京大恒图像视觉有限公司 A kind of fast automatic focusing algorithm based on liquid lens
CN109696788A (en) * 2019-01-08 2019-04-30 武汉精立电子技术有限公司 A kind of fast automatic focusing method based on display panel

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120027393A1 (en) * 2010-07-27 2012-02-02 Sanyo Electric Co., Ltd. Electronic equipment
CN104301601A (en) * 2013-11-27 2015-01-21 中国航空工业集团公司洛阳电光设备研究所 Coarse tuning and fine tuning combined infrared image automatic focusing method
CN105306825A (en) * 2015-11-18 2016-02-03 成都中昊英孚科技有限公司 Novel infrared image focusing system and use method thereof
CN106990518A (en) * 2017-04-17 2017-07-28 深圳大学 A kind of blood film self-focusing micro imaging method
CN107870406A (en) * 2017-11-06 2018-04-03 北京大恒图像视觉有限公司 A kind of fast automatic focusing algorithm based on liquid lens
CN109696788A (en) * 2019-01-08 2019-04-30 武汉精立电子技术有限公司 A kind of fast automatic focusing method based on display panel

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112561992A (en) * 2020-12-01 2021-03-26 浙江大华技术股份有限公司 Position determination method and device, storage medium and electronic device
CN113639630A (en) * 2021-04-01 2021-11-12 浙江大学台州研究院 Dimension measuring instrument system based on multi-template matching and automatic focusing functions
CN113459084A (en) * 2021-05-21 2021-10-01 广东拓斯达科技股份有限公司 Robot parameter calibration method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111698420A (en) Automatic focusing method for image analyzer
TWI673750B (en) Sample observation device and sample observation method
US8369650B2 (en) Image defect map creation using batches of digital images
US9307134B2 (en) Automatic setting of zoom, aperture and shutter speed based on scene depth map
CN109782414B (en) Automatic focusing method based on definition of non-reference structure
US20080152255A1 (en) Automated statistical self-calibrating detection and removal of blemishes in digital images dependent upon changes in extracted parameter values
JPH10506206A (en) Automatic focusing device for medical and biological specimens
US11188779B2 (en) Image processing apparatus
JPH0736613B2 (en) Focus adjustment method for imaging device
CN110517213B (en) Laplacian pyramid-based real-time depth of field extension method for microscope
CN110987886B (en) Full-automatic microscopic image fluorescence scanning system
CN113923358A (en) Online automatic focusing method and system in flying shooting mode
CN109272525B (en) Light guide plate white point defect detection method
CN110324536B (en) Image change automatic sensing focusing method for microscope camera
CN112465895A (en) Bubble volume calculation method in air tightness detection based on computer vision
CN114785953B (en) SFR-based camera automatic focusing method and device
CN116931247A (en) Multi-region slice scanning-oriented rapid focusing method
US20060126136A1 (en) Image inspecting apparatus, image inspecting method, control program and computer-readable storage medium
CN112839168B (en) Method for automatically adjusting camera imaging resolution in AOI detection system
JP3532014B2 (en) Threshold calculation method
CN115714858A (en) Automatic gain value and exposure value adjusting method for industrial camera
CN115242979A (en) Focusing method and system applied to blood shooting, intelligent equipment and storage medium
CN113920423A (en) Immunoblotting image identification method
CN113869363B (en) Mountain climbing focusing searching method based on image evaluation network and image evaluation function
JPH09186935A (en) Image extraction device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200922

RJ01 Rejection of invention patent application after publication