CN106878617B - A kind of focusing method and system - Google Patents

A kind of focusing method and system Download PDF

Info

Publication number
CN106878617B
CN106878617B CN201710128650.8A CN201710128650A CN106878617B CN 106878617 B CN106878617 B CN 106878617B CN 201710128650 A CN201710128650 A CN 201710128650A CN 106878617 B CN106878617 B CN 106878617B
Authority
CN
China
Prior art keywords
image
test card
striped
judging result
region
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.)
Expired - Fee Related
Application number
CN201710128650.8A
Other languages
Chinese (zh)
Other versions
CN106878617A (en
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.)
China Jiliang University
Original Assignee
China Jiliang University
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 China Jiliang University filed Critical China Jiliang University
Priority to CN201710128650.8A priority Critical patent/CN106878617B/en
Publication of CN106878617A publication Critical patent/CN106878617A/en
Application granted granted Critical
Publication of CN106878617B publication Critical patent/CN106878617B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Abstract

The present invention discloses a kind of method and system of focusing.By the way that region is cut and divided to test card, takes pictures to test card, extract the image of test card picture centre region, clear-cut texture degree analysis is carried out to it, if clearly, obtaining the striped of greater degree;If unintelligible, motor driven imaging lens stepping step-length again takes pictures to test card, and obtain the striped of present level, judges its clear-cut texture degree.When high-grade clear-cut texture, then obtain the image in test card graphic quadrangle region, judge whether the clarity of present level striped is all clear, if clear indicate that focusing is completed, if unintelligible, it is parallel with test card plane then to adjust imaging lens mirror surface, take pictures again and judges whether four angular zone present level stripeds are clear.Using focusing method and system of the invention, the precision and efficiency of focusing are improved, and realizes the accuracy and real-time of auto-focusing.

Description

A kind of focusing method and system
Technical field
The present invention relates to focusing fields, more particularly to a kind of focusing method and system.
Background technique
The key problem of Autofocus Technology based on image procossing is the choosing of the evaluation of image definition, focusing window It selects, to the feedback control of focusing lens.Feedback control key in autofocus system is the peak value of determining focusing evaluation function Position, thus mobile by motor driven imaging lens, this is substantially the optimization problem of an one-dimensional extreme value.Than more typical Evaluation function peak value searching method have climbing method, Fibonacci search method and functional approaching etc..
Ideal focusing evaluation function curve shows as parabolic shape, corresponds to optimal imaging position when reaching peak value, The function monotone decreasing when leaving Best Point.Climbing method is proposed according to this principle.If appraisal curve of focusing is by various Interference leads to multiple peak values occur, and climbing method is easy to search local extremum, and focusing is caused to fail.Functional approaching is to adopt Collected different location evaluation function value obtain appraisal curve after, carried out curve fitting using simple second order or function of third order, Known appraisal curve is approached by this method.Effect of this method near extreme value can be relatively good, but it to extreme value near Data have very big dependence, be easy influenced by local peaking, noise, should not be used in practical focus process. What Fibbonacci search method utilized is famous Fibbonacci function and the search strategy proposed.In practical applications, right Burnt evaluation function curve is not ideal smooth curve, if a large amount of local maximum, the searching algorithm occurs in focusing curve Be possible to fall into the adjacent domain of local maximum, and can not escape, cause accidentally to focus.
These ways of search require driving motor to the image of many station acquisition corresponding positions simultaneously and then basis is commented Valence function finds focusing position.Due to stepper motor in search can repeatedly forward and reverse transformation stepping it is best right to obtain Burnt position, and the gear of motor can have error of backlash in forward and reverse transformation, therefore, the precision of focusing and inefficient.
Summary of the invention
The object of the present invention is to provide a kind of focusing method and systems, to solve motor in traditional focusing method and system Leads to the problem of error of backlash when driving imaging lens forward and reverse transformation stepping, the precision and efficiency focused with raising.
To achieve the above object, the present invention provides following schemes:
A kind of focusing method, which comprises
It obtains and cuts test card, the cutting test card includes first area, second area, third region, the fourth region With the 5th region, the first area is the cutting test card central area, the second area, third region, the 4th area Domain and the 5th region are respectively the cutting test card center upper left side, lower left, upper right side and lower right region;
It takes pictures to the cutting test card, obtains test card graphic, the test card graphic includes the cutting test card Correspondence first area, second area, third region, the fourth region and the 5th region;
The image for obtaining the test card graphic first area, obtains the first image;
Obtain the striped at the first estate position of the first image;
Judge whether the striped at the first estate position of the first image is clear, obtains the first judging result;
When the striped at the first estate position of first judging result expression the first image is unintelligible, control electricity Machine drives imaging lens advance step-length, then returns to " taking pictures to the cutting test card, obtain test card graphic " step;
When first judging result indicates the clear-cut texture at the first estate position of the first image, described in acquisition The striped at the second grade position of the first image, second grade are greater than described the first estate.
Optionally, the clear-cut texture at the first estate position that the first image is indicated when first judging result When, the striped at the second grade position of the first image is obtained, later further include:
Judge whether the striped at the second grade position of the first image is clear, obtains the second judging result;
When second judging result indicates the clear-cut texture at the second grade position of the first image, described in acquisition The striped at the tertiary gradient position of the first image, the tertiary gradient are greater than second grade;
When the striped at the second grade position of second judging result expression the first image is unintelligible, institute is controlled Imaging lens advance step-length described in motor driven is stated, " taking pictures to the cutting test card, obtain test card graphic " step is returned.
Optionally, the clear-cut texture at the first estate position that the first image is indicated when first judging result When, the striped at the second grade position of the first image is obtained, later further include:
Judge whether the striped at the second grade position of the first image is clear, obtains third judging result;
When the third judging result indicates the clear-cut texture at the second grade position of the first image, described in acquisition Test the second area of card graphic, third region, the fourth region and the 5th region image, correspondence obtains the second image, third Image, the 4th image and the 5th image;
Judge the second grade portion of second image, the third image, the 4th image and the 5th image Whether the striped of position is all clear, obtains the 4th judging result;
When the 4th judging result indicates the second of second image, third image, the 4th image and the 5th image When the striped at grade position is not all of clear, the mirror surface for controlling the imaging lens is parallel with the cutting test card plane, Return to " taking pictures to the cutting test card, obtain test card graphic " step;
When the striped at the second grade position of third judging result expression the first image is unintelligible, institute is controlled Imaging lens advance step-length described in motor driven is stated, " taking pictures to the cutting test card, obtain test card graphic " is then returned Step.
Optionally, the clear-cut texture at the second grade position that the first image is indicated when second judging result When, the striped at the tertiary gradient position of the first image is obtained, later further include:
Judge whether the striped at the tertiary gradient position of the first image is clear, obtains the 5th judging result;
When the 5th judging result indicates the clear-cut texture at the tertiary gradient position of the first image, described in acquisition Test the second area of card graphic, third region, the fourth region and the 5th region image, correspondence obtains the 6th image, the 7th Image, the 8th image and the 9th image;
Judge the tertiary gradient portion of the 6th image, the 7th image, the 8th image and the 9th image Whether the striped of position is clear, obtains the 6th judging result;
When the 6th judging result indicates the third of the 6th image, the 7th image, the 8th image and the 9th image The striped at grade position at least one it is unintelligible when, control the imaging lens mirror surface and the cuttings test card plane put down Row returns to " taking pictures to the cutting test card " step;If testing the second area of card graphic, third region, the fourth region With the image in the 5th region always cannot it is clear simultaneously (even if camera mirror plane and test board plane are in parastate, can not It is clear simultaneously to meet), illustrate that camera lens has distortion, camera lens is unqualified, and there are problems.
When the striped at the tertiary gradient position of the 5th judging result expression the first image is unintelligible, institute is controlled Imaging lens advance step-length described in motor driven is stated, " taking pictures to the cutting test card, obtain test card graphic " step is returned.
Optionally, whether the striped at the first estate position for judging the first image is clear, specifically includes:
Utilize formulaThe gray scale for calculating the stripe pattern at the first estate position of the first image is equal Value, wherein f (i, j) is the gray value of image of the i-th row j column on the stripe pattern at the first estate position of the first image, and n is Total pixel number on the stripe pattern at the first estate position of the first image;
Utilize formulaCalculate the stripe pattern at the first estate position of the first image Variance D;
Judge whether the variance D is less than given threshold;
If the variance D is not less than given threshold, it is determined that the striped at the first estate position of the first image is clear It is clear;
If the variance D is less than given threshold, it is determined that the striped at the first estate position of the first image is unclear It is clear.
Optionally, described to control imaging lens advance step-length described in the motor driven, include: before
The difference between the given threshold and the variance D is calculated, the difference is greater than zero;
Judge whether the difference is greater than 20, obtains the 7th judging result;
When the 7th judging result indicates that the difference is greater than 20, the first step-length N of a length of advance of forward step1, First step-lengthWherein N be motor stepping imaging lens farthest one end to focus position stepping total step Number;
When the 7th judging result indicates that the difference is not more than 20, judges whether the difference is greater than 10, obtain 8th judging result;
When the 8th judging result indicates that the difference is greater than 10, the second step-length N of a length of advance of forward step2, Second step-length
When the 8th judging result indicates that the difference is not more than 10, a length of advance third step-length of forward step N3, the third step-length
A kind of focusing system, the system comprises:
It cuts test card and obtains module, cut test card for obtaining, the cutting test card includes first area, second Region, third region, the fourth region and the 5th region, the first area are the cutting test card central area, described the Two regions, third region, the fourth region and the 5th region be respectively the cutting test card center upper left side, lower left, Upper right side and lower right region;
Test card image collection module obtains test card graphic, the test card for taking pictures to the cutting test card Image includes correspondence first area, second area, third region, the fourth region and the 5th region for cutting test card;
First image collection module obtains the first image for obtaining the image of the test card graphic first area;
The first estate position striped obtains module, the striped at the first estate position for obtaining the first image;
The first estate position striped judgment module, for judge the first image the first estate position striped whether Clearly, the first judging result is obtained;
The first module of motor control, for indicating the first estate position of the first image when first judging result Striped it is unintelligible when, control motor driven imaging lens advance step-length;
The test card image collection module after being also used to motor driven imaging lens advance step-length, is surveyed the cutting Examination card is taken pictures, and test card graphic is obtained;
Second grade position striped obtains module, for indicating the first of the first image when first judging result When the clear-cut texture at grade position, the striped at the second grade position of the first image is obtained, second grade is greater than institute State the first estate.
Optionally, the system also includes:
Second grade position striped first judgment module, the striped at the second grade position for judging the first image It is whether clear, obtain third judging result;
Second image, third image, the 4th image and the 5th image collection module, for working as the third judging result table When showing the clear-cut texture at the second grade position of the first image, second area, the third area of the test card graphic are obtained Domain, the fourth region and the 5th region image, correspondence obtain the second image, third image, the 4th image and the 5th image;
Second grade position the second judgment module of striped, for judge second image, third image, the 4th image and Whether the striped at the second grade position of the 5th image is all clear, obtains the 4th judging result;
Imaging lens control module, for indicating second image, third image, the 4th when the 4th judging result When the striped at the second grade position of image and the 5th image is not all of clear, control the mirror surfaces of the imaging lens with it is described It is parallel to cut test card plane;
The test card image collection module, mirror surface and the cutting test card plane for being also used to the imaging lens are flat It after row, takes pictures to the cutting test card, obtains test card graphic;
The second module of motor control, for indicating the second grade position of the first image when the third judging result Striped it is unintelligible when, control imaging lens advance step-length described in the motor driven;
The test card image collection module, after being also used to the second step-length of advance of imaging lens described in the motor driven, It takes pictures to the cutting test card, obtains test card graphic.
Optionally, the first estate position striped judgment module specifically includes:
Gray average computing unit, for utilizing formulaCalculate the first estate portion of the first image The gray average of the stripe pattern of position, wherein f (i, j) is i-th on the stripe pattern at the first estate position of the first image The gray value of image of row j column, n are total pixel number on the stripe pattern at the first estate position of the first image;
Variance computing unit, for utilizing formulaCalculate first etc. of the first image The variance D of the stripe pattern at grade position;
Variance judging unit, for judging whether the variance D is less than given threshold;
Clear-cut texture determination unit, for determining the of the first image when the variance D is not less than given threshold The clear-cut texture at one grade position;
The unintelligible determination unit of striped, for determining the of the first image when the variance D is less than given threshold The striped at one grade position is unintelligible.
Optionally, the system also includes:
Difference calculating module, for calculating the difference between the given threshold and the variance D, the difference is greater than Zero;
7th judgment module obtains the 7th judging result for judging whether the difference is greater than 20;Sentence when the described 7th When disconnected result indicates that the difference is greater than 20, the first step-length N of a length of advance of forward step1, first step-length Wherein N be motor stepping imaging lens farthest one end to focus position stepping total step number;
8th judgment module, for judging the difference when the 7th judging result indicates that the difference is not more than 20 Whether value is greater than 10, obtains the 8th judging result;When the 8th judging result indicates that the difference is greater than 10, the advance Step-length is the second step-length N that advances2, second step-lengthWhen the 8th judging result indicates that the difference is little When 10, a length of advance third step-length N of forward step3, the third step-length
The specific embodiment provided according to the present invention, the invention discloses following technical effects:
In focus process, motor driven imaging lens one direction stepping does not need moving back and forth for search by hill climbing method, The error of backlash that generates when avoiding the forward and reverse transformation stepping of motor, and by analysis clarity, accurately control motor advance Improve the precision and efficiency of focusing;Clarity identification is carried out by single-frame images, can be realized by acquiring image for several times The step number of auto-focusing, stepping is less, and the speed focused in this way is faster;With the algorithm complexity of Resolution analysis test card graphic It is low, to realize the accuracy and real-time of auto-focusing;It has also been found that lens distortion judges whether camera lens is qualified in turn.
Detailed description of the invention
It in order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, below will be to institute in embodiment Attached drawing to be used is needed to be briefly described, it should be apparent that, the accompanying drawings in the following description is only some implementations of the invention Example, for those of ordinary skill in the art, without any creative labor, can also be according to these attached drawings Obtain other attached drawings.
Fig. 1 is focusing method flow chart of the present invention;
Fig. 2 is focusing system structure chart of the present invention;
Fig. 3 is the cutting test card structure chart obtained in focusing method of the present invention and system.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
Mobile phone camera and monitor camera are before factory, generally by special camera manufacturer by camera Camera lens is mounted on printed circuit board, on pedestal, powers on when manual focusing to camera at present, alignment lens international standard is tested Block such as resolving power test graph card, the image on computer is observed while rotating lens, when observation interested main in image Region, when can differentiate clear such as surrounding border circular areas and central fringer area image details, then it is assumed that focusing is completed, and nothing is then used Solidification process is fixed and passed through to lens location by shadow glue, fixes its lens focus.Therefore the camera in user's actual use Focal length be it is fixed, cannot at will focus, and the present invention is directed in production process dispensing lens focusing link before curing In view of the deficiencies of the prior art, a kind of fast automatic focusing method based on 12233 test card picture resolution of ISO is proposed.
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, with reference to the accompanying drawing and specific real Applying mode, the present invention is described in further detail.
Fig. 1 is focusing method flow chart of the present invention.As shown in Figure 1, which comprises
Step 101: obtaining and cut test card, be specifically as follows and ISO12233 test card is cut, after specific cutting Test card can be found in Fig. 3.Test card after cutting includes first area, second area, third region, the fourth region and the 5th Region, the first area are the cutting test card central area, the second area, third region, the fourth region and the Five regions are respectively the cutting test card center upper left side, lower left, upper right side and lower right region;Referring specifically to figure 3。
Step 102: obtaining test card graphic, specially take pictures to the test card after cutting, obtain test card photo, as Card graphic is tested, since the test card after cutting includes first area, second area, third region, the fourth region and the 5th area Domain, therefore testing card graphic also includes correspondence first area, second area, third region, the 4th area for cutting test card Domain and the 5th region.
Step 103: obtaining the first image, specially extract the image of test card graphic first area, that is, center The image in domain obtains the first image.
Step 104: obtaining the striped at the first estate position of the first image, the operation specifically carried out can be for the first figure As being split, the striped at the first estate position in the first image is extracted.Wherein the first estate can be center as shown in Figure 3 1 grade of striped of area image.
Step 105: judging whether the striped at the first estate position of the first image is clear;The not high table of the readability of image What is revealed is exactly that image is fuzzy, its variance is then smaller when image is fuzzy, and the variance of image is bigger, and image is more clear, the side of image Difference characterizes its clarity situation.Therefore we judge whether image striped is clear using the variance of image, when item to be judged It is then clear when the variance of the focus image of the close calibration of the variance of print image, it is on the contrary then unintelligible.It is specifically as follows:
Utilize formulaThe gray scale for calculating the stripe pattern at the first estate position of the first image is equal Value, wherein f (i, j) is the gray value of image of the i-th row j column on the stripe pattern at the first estate position of the first image, and n is Total pixel number on the stripe pattern at the first estate position of the first image;
Utilize formulaCalculate the stripe pattern at the first estate position of the first image Variance D;
Judge whether the variance D is less than given threshold;
If the variance D is not less than given threshold, it is determined that the striped at the first estate position of the first image is clear It is clear;
If the variance D is less than given threshold, it is determined that the striped at the first estate position of the first image is unclear It is clear.
Wherein different camera lenses corresponds to different threshold values, and threshold value determination method can be with are as follows:
Camera to be calibrated is allowed to be in focusing state against test card;Obtain the focusing figure under test card current state Piece;The 6 grade stripeds of quadrangle and 1 grade, 3 grades and the 6 grade stripeds at middle part of focusing picture are extracted respectively;To institute The striped of extraction seeks variance respectively, and the variance acquired is the threshold value of corresponding grade striped.
Such as we know that the variance of the 1 grade stripe pattern when camera is in focusing state (can for 88.7337 by test It is that 88.7337), in the piece image that we obtain at random, extraction obtains 1 grade stripe pattern with given threshold, after calculating It is 59.8024 to its variance, is much smaller than 88.7337, then illustrates that test stripe pattern is unintelligible.When first of the first image etc. When the clear-cut texture at grade position, step 107 is executed;It is no to then follow the steps 106.
Step 106: control motor driven imaging lens advance step-length, step-length include the first step-length, the second step-length and third The type of step-length, advance step-length can be determined by following manner:
The difference between the given threshold and the variance D is calculated, the difference is greater than zero;
Judge whether the difference is greater than 20, obtains the 7th judging result;
When the 7th judging result indicates that the difference is greater than 20, the first step-length N of a length of advance of forward step1, First step-lengthWherein N be motor stepping imaging lens farthest one end to focus position stepping total step Number;
When the 7th judging result indicates that the difference is not more than 20, judges whether the difference is greater than 10, obtain 8th judging result;
When the 8th judging result indicates that the difference is greater than 10, the second step-length N of a length of advance of forward step2, Second step-length
When the 8th judging result indicates that the difference is not more than 10, a length of advance third step-length of forward step N3, the third step-length
Step 107: obtaining the striped at first the second grade of image position.
Step 108: judging whether the striped at first the second grade of image position is clear, specific judgment method and step 105 Method is identical, and the second grade can be 3 grades in test card shown in Fig. 3.When the clear-cut texture at first the second grade of image position When, step 1012 is executed, it is no to then follow the steps 109.
Step 109: control motor driven imaging lens advance step-length, the determination method of step-length are identical as step 106.
Step 1010: taking pictures to the test card after cutting, reacquire test card graphic.
Step 1011: extraction being split to the test card graphic of reacquisition, obtains the image of first area, obtains Six images.
Step 1012: obtaining the second grade striped of the second image, third image, the 4th image and the 5th image, specifically For extract first the test second area of card graphic, third region, the fourth region and the 5th region image, correspondence obtains second Then image, third image, the 4th image and the 5th image extract the second image, third image, the 4th image and the 5th respectively Second grade position striped of image.
Step 1013: judging the second grade position striped of the second image, third image, the 4th image and the 5th image is No whole is clear, judges whether the second grade position striped of four width images is clear respectively first, then judges that four width images are The whole clearly conditions of no satisfaction.If all clear, focusing terminates;Otherwise, step 1014 is executed.
Step 1014: the mirror surface for adjusting imaging lens is parallel with test card plane is cut.
Step 1015: taking pictures again to cutting test card, obtain test card graphic.If testing the secondth area of card graphic Domain, third region, the fourth region and the 5th region image always cannot be clear (even if camera mirror plane and test board plane simultaneously In parastate, can not meet while clear), illustrate that camera lens has distortion, camera lens is unqualified, and there are problems.
Another embodiment as focusing method of the present invention may be:
(1) ISO12233 test card is cut, camera acquisition obtains an ISO12233 and tests card graphic A;
(2) segmentation is extracted in the middle part of image A, to obtain image B;
(3) striped at 1 grade position in image B is extracted in segmentation, carries out variance calculating to the striped of extraction, judges that it is It is no clear;
(4) it if the striped at 1 grade position in image B is unintelligible, controls the big step-length of motor and advances, be then return to step (1), it is assumed that the total step number of the position stepping from farthest one end of motor stepping to picture auto-focusing is N, then big step-length is N/ 2, middle step-length is N/4, a length of N/8 of small step;
(5) if the clear-cut texture at 1 grade position in image B, continue the striped for extracting 3 grade positions in image B, Resolution analysis is carried out to the striped of extraction, judges whether it is clear;
(6) it if the striped at 3 grade positions in image B is unintelligible, controls in motor step-length and advances, then camera is again Acquisition obtains new images A1, while dividing and extracting new images A1Middle part, to obtain new images B1, eventually pass back to step (5);
(7) if the clear-cut texture at 3 grade positions in image B, continue the striped for extracting 6 grade positions in image B, Resolution analysis is carried out to the striped of extraction, judges whether it is clear;
(8) it if the striped at 6 grade positions in image B is unintelligible, controls the small step-length of motor and advances, then camera is again Acquisition obtains new images A2, while dividing and extracting new images A2Middle part, to obtain new images B2, eventually pass back to step (7);
(9) if the clear-cut texture at 6 grade positions in image B, four corners position in image A is extracted respectively to obtain four Image e, f, g, h are opened, then extracts the striped at the 6 grade positions of image e, f, g, h respectively, resolving power point is carried out to the striped of extraction Analysis, judges whether it is clear;
(10) if all clear is not clear for the striped at the 6 grade positions of image e, f, g, h, illustrate the mirror surface and test card plane of camera Not parallel, then ajusting camera keeps the mirror surface of camera parallel with test card plane, and then camera, which resurveys, obtains new images A3, together When segmentation extract new images A3Middle part, to obtain new images B3, eventually pass back to step (7);
If the striped at the 6 grade positions of image e, f, g, h is all clear, the auto-focusing of camera is completed
The a length of big step-length of forward step, middle step-length or small step-length are related with the grade of striped in the present embodiment.
Fig. 2 is focusing system structure chart of the present invention.As shown in Fig. 2, shown system includes: to cut test card to obtain module 201, test card image collection module 202, the first image collection module 203, the first estate striped acquisition module 204, first etc. Grade striped judgment module 205, the first module of motor control 206, the second grade striped obtains module 207, the second grade position item Line first judgment module 208, the second module of motor control 209, second and third, the four, the 5th image collection module 2010, second etc. The second judgment module of grade striped 2011, imaging lens control module 2012.
It wherein cuts test card and obtains module 201, cut test card for obtaining, test card can test for ISO12233 Card, the test card after cutting is as shown in figure 3, cutting test card includes first area, second area, third region, the fourth region With the 5th region, the first area is the cutting test card central area, the second area, third region, the 4th area Domain and the 5th region are respectively the cutting test card center upper left side, lower left, upper right side and lower right region.
Test card image collection module 202 obtains test card graphic, due to surveying for taking pictures to the cutting test card Examination card includes first area, second area, third region, the fourth region and the 5th region, therefore it includes described for testing card graphic Cut correspondence first area, second area, third region, the fourth region and the 5th region of test card.
First image collection module 203 is obtained for obtaining the test card graphic first area i.e. image of central area To the first image.
The first estate striped obtains module 204, the striped at the first estate position for extracting the first image of segmentation.
The first estate striped judgment module 205, the bar graph at the first estate position of the first image for judging to extract Seem it is no clear, first with formulaCalculate the stripe pattern at the first estate position of the first image Gray average, wherein f (i, j) is the image grayscale of the i-th row j column on the stripe pattern at the first estate position of the first image Value, n are total pixel number on the stripe pattern at the first estate position of the first image;Then formula is utilizedCalculate the variance D of the stripe pattern at the first estate position of the first image;Judge the side Whether poor D is less than given threshold;If the variance D is not less than given threshold, it is determined that the first estate of the first image The clear-cut texture at position;If the variance D is less than given threshold, it is determined that the item at the first estate position of the first image Line is unintelligible.
The first module of motor control 206, for when the striped at the first estate position of the first image is unintelligible, control to be electric Machine drive imaging lens advance step-length, the advance type of step-length referring to Fig.1 in step 106, details are not described herein again.
Test card image collection module 202 after being also used to motor driven imaging lens advance step-length, tests the cutting Card is taken pictures, and test card graphic is obtained.
Second grade striped obtains module 207, for obtaining when the clear-cut texture at the first estate position of the first image The striped at the second grade position of the first image, second grade are greater than described the first estate.
Second grade position striped first judgment module 208, the striped at the second grade position for judging the first image It is whether clear.
The second module of motor control 209, for controlling institute when the striped at the second grade position of the first image is unintelligible State imaging lens advance step-length described in motor driven.
Test card image collection module 202, after being also used to imaging lens advance step-length described in the motor driven, to described It cuts test card to take pictures, obtains test card graphic.
Second and third, the four, the 5th image collection module 2010, for when the first image the second grade position striped it is clear When clear, obtain the test second area of card graphic, third region, the fourth region and the 5th region image, correspondence obtains Second image, third image, the 4th image and the 5th image.
Second the second judgment module of grade striped 2011, for judging the second image, third image, the 4th image and the 5th Whether the striped at the second grade position of image is all clear.
Imaging lens control module 2012, for when the second of the second image, third image, the 4th image and the 5th image When the striped at grade position is not all of clear, the mirror surface for controlling the imaging lens is parallel with the cutting test card plane.
Test card image collection module 202, mirror surface and the cutting test card plane for being also used to the imaging lens are flat It after row, takes pictures to the cutting test card, obtains test card graphic.
Fig. 3 is the cutting test card structure chart obtained in focusing method of the present invention and system.As shown in figure 3, test card can Think ISO12233 test card, the test card after cutting includes first area 301, second area 302, third region the 303, the 4th Region 304 and the 5th region 305, first area 301 are the cutting test card central area, second area 302, third region 303, the fourth region 304 and the 5th region 305 are respectively the cutting test card center upper left side, lower left, upper right side With lower right region.
Each embodiment in this specification is described in a progressive manner, the highlights of each of the examples are with other The difference of embodiment, the same or similar parts in each embodiment may refer to each other.For system disclosed in embodiment For, since it is corresponded to the methods disclosed in the examples, so being described relatively simple, related place is said referring to method part It is bright.
Used herein a specific example illustrates the principle and implementation of the invention, and above embodiments are said It is bright to be merely used to help understand method and its core concept of the invention;At the same time, for those skilled in the art, foundation Thought of the invention, there will be changes in the specific implementation manner and application range.In conclusion the content of the present specification is not It is interpreted as limitation of the present invention.

Claims (6)

1. a kind of focusing method, which is characterized in that the described method includes:
It obtains and cuts test card, the cutting test card is the test card cut to ISO12233 test card, described Cutting test card includes first area, second area, third region, the fourth region and the 5th region, and the first area is institute It states and cuts test card central area, the second area, third region, the fourth region and the 5th region are respectively that the cutting is surveyed Try card center upper left side, lower left, upper right side and lower right region;
It takes pictures to the cutting test card, obtains test card graphic, the test card graphic includes that the cutting test card is corresponding First area, second area, third region, the fourth region and the 5th region;
The image for obtaining the test card graphic first area, obtains the first image;
Obtain the striped at the first estate position of the first image;
Judge whether the striped at the first estate position of the first image is clear, obtains the first judging result;It specifically includes: benefit Use formulaCalculate the first image the first estate position stripe pattern gray average, wherein f (i, It j) is the gray value of image of the i-th row j column on the stripe pattern at the first estate position of the first image, n is first figure Total pixel number on the stripe pattern at the first estate position of picture;Utilize formulaDescribed in calculating The variance D of the stripe pattern at the first estate position of the first image;Judge whether the variance D is less than given threshold;If institute Variance D is stated not less than given threshold, it is determined that the clear-cut texture at the first estate position of the first image;If the variance D is less than given threshold, it is determined that the striped at the first estate position of the first image is unintelligible;
When the striped at the first estate position of first judging result expression the first image is unintelligible, control motor is driven Then dynamic imaging lens advance step-length returns to " taking pictures to the cutting test card, obtain test card graphic " step;The advance The type of step-length is determined by following manner: calculating the difference between the given threshold and the variance D, the difference is greater than Zero;Judge whether the difference is greater than 20, obtains the 7th judging result;When the 7th judging result indicates that the difference is greater than When 20, the first step-length N of a length of advance of forward step1, first step-lengthWherein N is motor stepping imaging lens Farthest one end to focusing position stepping total step number;When the 7th judging result indicates that the difference is not more than 20, Judge whether the difference is greater than 10, obtains the 8th judging result;When the 8th judging result indicates that the difference is greater than 10 When, the second step-length N of a length of advance of forward step2, second step-lengthWhen the 8th judging result indicates institute When stating difference no more than 10, a length of advance third step-length N of forward step3, the third step-length
When first judging result indicates the clear-cut texture at the first estate position of the first image, described first is obtained The striped at the second grade position of image, second grade are greater than described the first estate.
2. the method according to claim 1, wherein described when first judging result indicates first figure When the clear-cut texture at the first estate position of picture, the striped at the second grade position of the first image is obtained, later further include:
Judge whether the striped at the second grade position of the first image is clear, obtains the second judging result;
When second judging result indicates the clear-cut texture at the second grade position of the first image, described first is obtained The striped at the tertiary gradient position of image, the tertiary gradient are greater than second grade;
When the striped at the second grade position of second judging result expression the first image is unintelligible, the electricity is controlled Machine drives the imaging lens advance step-length, returns to " taking pictures to the cutting test card, obtain test card graphic " step.
3. the method according to claim 1, wherein described when first judging result indicates first figure When the clear-cut texture at the first estate position of picture, the striped at the second grade position of the first image is obtained, later further include:
Judge whether the striped at the second grade position of the first image is clear, obtains third judging result;
When the third judging result indicates the clear-cut texture at the second grade position of the first image, the test is obtained The second area of card graphic, third region, the fourth region and the 5th region image, it is corresponding obtain the second image, third image, 4th image and the 5th image;
Judge the second grade position of second image, the third image, the 4th image and the 5th image Whether striped is all clear, obtains the 4th judging result;
When the 4th judging result indicates second image, the third image, the 4th image and the 5th figure When the striped at the second grade position of picture is not all of clear, mirror surface and the cutting test card for controlling the imaging lens are flat Face is parallel, returns to " taking pictures to the cutting test card, obtain test card graphic " step;
When the striped at the second grade position of third judging result expression the first image is unintelligible, the electricity is controlled Machine drives the imaging lens advance step-length, then returns to " taking pictures to the cutting test card, obtain test card graphic " step.
4. according to the method described in claim 2, it is characterized in that, described when second judging result indicates first figure When the clear-cut texture at the second grade position of picture, the striped at the tertiary gradient position of the first image is obtained, later further include:
Judge whether the striped at the tertiary gradient position of the first image is clear, obtains the 5th judging result;
When the 5th judging result indicates the clear-cut texture at the tertiary gradient position of the first image, the test is obtained The second area of card graphic, third region, the fourth region and the 5th region image, it is corresponding obtain the 6th image, the 7th image, 8th image and the 9th image;
Judge the tertiary gradient position of the 6th image, the 7th image, the 8th image and the 9th image Whether striped is clear, obtains the 6th judging result;
When the 6th judging result indicates the tertiary gradient of the 6th image, the 7th image, the 8th image and the 9th image The striped at position at least one it is unintelligible when, the mirror surface for controlling the imaging lens is parallel with the cutting test card plane, returns Return " taking pictures to the cutting test card " step;
When the striped at the tertiary gradient position of the 5th judging result expression the first image is unintelligible, the electricity is controlled Machine drives the imaging lens advance step-length, returns to " taking pictures to the cutting test card, obtain test card graphic " step.
5. a kind of focusing system, which is characterized in that the system comprises:
It cuts test card and obtains module, cut test card for obtaining, the cutting test card is to stick into ISO12233 test Row cuts obtained test card, and the cutting test card includes first area, second area, third region, the fourth region and the Five regions, the first area be the cutting test card central area, the second area, third region, the fourth region and 5th region is respectively the cutting test card center upper left side, lower left, upper right side and lower right region;
Test card image collection module obtains test card graphic, the test card graphic for taking pictures to the cutting test card Including the corresponding first area of the cutting test card, second area, third region, the fourth region and the 5th region;
First image collection module obtains the first image for obtaining the image of the test card graphic first area;
The first estate position striped obtains module, the striped at the first estate position for obtaining the first image;
The first estate position striped judgment module, for judging whether the striped at the first estate position of the first image is clear It is clear, obtain the first judging result;The first estate position striped judgment module specifically includes: gray average computing unit, uses In utilize formulaThe gray average of the stripe pattern at the first estate position of the first image is calculated, wherein F (i, j) is the gray value of image of the i-th row j column on the stripe pattern at the first estate position of the first image, and n is described the Total pixel number on the stripe pattern at the first estate position of one image;Variance computing unit, for utilizing formulaCalculate the variance D of the stripe pattern at the first estate position of the first image;Variance judgement is single Member, for judging whether the variance D is less than given threshold;Clear-cut texture determination unit, for being set when the variance D is not less than When determining threshold value, the clear-cut texture at the first estate position of the first image is determined;The unintelligible determination unit of striped, for working as institute When stating variance D less than given threshold, determine that the striped at the first estate position of the first image is unintelligible;
The first module of motor control, the item at the first estate position for indicating the first image when first judging result When line is unintelligible, motor driven imaging lens advance step-length is controlled;
The test card image collection module, after being also used to motor driven imaging lens advance step-length, to the cutting test card It takes pictures, obtains test card graphic;
Second grade position striped obtains module, for indicating the first estate of the first image when first judging result When the clear-cut texture at position, the striped at the second grade position of the first image is obtained, second grade is greater than described the One grade;
The system also includes:
Difference calculating module, for calculating the difference between the given threshold and the variance D, the difference is greater than zero;
7th judgment module obtains the 7th judging result for judging whether the difference is greater than 20;When the 7th judgement knot When fruit indicates that the difference is greater than 20, the first step-length N of a length of advance of forward step1, first step-lengthWherein N For motor stepping imaging lens farthest one end to focusing position stepping total step number;
8th judgment module, for judging that the difference is when the 7th judging result indicates that the difference is not more than 20 It is no to be greater than 10, obtain the 8th judging result;When the 8th judging result indicates that the difference is greater than 10, the advance step-length For the second step-length N that advances2, second step-lengthWhen the 8th judging result indicates that the difference is not more than 10 When, a length of advance third step-length N of forward step3, the third step-length
6. system according to claim 5, which is characterized in that the system also includes:
Second grade position striped first judgment module, for judge the first image the second grade position striped whether Clearly, third judging result is obtained;
Second image, third image, the 4th image and the 5th image collection module, for indicating institute when the third judging result When stating the clear-cut texture at the second grade position of the first image, the test second area of card graphic, third region, the are obtained The image in four regions and the 5th region, correspondence obtain the second image, third image, the 4th image and the 5th image;
Second grade position the second judgment module of striped, for judging second image, the third image, the 4th figure Whether the striped at the second grade position of picture and the 5th image is all clear, obtains the 4th judging result;
Imaging lens control module, for indicating second image, the third image, described when the 4th judging result When the striped at the second grade position of the 4th image and the 5th image is not all of clear, the mirror of the imaging lens is controlled Face is parallel with the cutting test card plane;
The test card image collection module, the mirror surface for being also used to the imaging lens are parallel with the cutting test card plane Afterwards, it takes pictures to the cutting test card, obtains test card graphic;
The second module of motor control, the item at the second grade position for indicating the first image when the third judging result When line is unintelligible, imaging lens advance step-length described in the motor driven is controlled;
The test card image collection module, after being also used to the second step-length of advance of imaging lens described in the motor driven, to institute It states cutting test card to take pictures, obtains test card graphic.
CN201710128650.8A 2017-03-06 2017-03-06 A kind of focusing method and system Expired - Fee Related CN106878617B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710128650.8A CN106878617B (en) 2017-03-06 2017-03-06 A kind of focusing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710128650.8A CN106878617B (en) 2017-03-06 2017-03-06 A kind of focusing method and system

Publications (2)

Publication Number Publication Date
CN106878617A CN106878617A (en) 2017-06-20
CN106878617B true CN106878617B (en) 2019-05-31

Family

ID=59170417

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710128650.8A Expired - Fee Related CN106878617B (en) 2017-03-06 2017-03-06 A kind of focusing method and system

Country Status (1)

Country Link
CN (1) CN106878617B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107255903A (en) * 2017-07-21 2017-10-17 杭州维讯机器人科技有限公司 A kind of method that lens focus is measured based on Newton's ring
CN110730309A (en) * 2019-11-21 2020-01-24 深圳市圆周率软件科技有限责任公司 Focusing method of camera module
CN111698428B (en) * 2020-06-23 2021-07-16 广东小天才科技有限公司 Document shooting method and device, electronic equipment and storage medium
CN111800579B (en) * 2020-08-27 2021-08-20 杭州涂鸦信息技术有限公司 Lens focusing method and system and related equipment

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1874529A (en) * 2005-05-31 2006-12-06 华为技术有限公司 System and method for testing focusing performance of pick-up head
CN103217855A (en) * 2013-04-02 2013-07-24 金三立视频科技(深圳)有限公司 Automatic focusing method of camera
CN103257510A (en) * 2013-04-27 2013-08-21 宁波舜宇光电信息有限公司 Rapid automatic focusing method
CN103731665A (en) * 2013-12-25 2014-04-16 广州计量检测技术研究院 Digital camera image quality comprehensive detection device and method
CN104469153A (en) * 2014-12-02 2015-03-25 广东威创视讯科技股份有限公司 Quick focusing method and system
CN106154690A (en) * 2016-09-20 2016-11-23 照旷科技(上海)有限公司 A kind of method controlling the fast automatic focusing of platform courses camera

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2482022A (en) * 2010-07-16 2012-01-18 St Microelectronics Res & Dev Method for measuring resolution and aberration of lens and sensor

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1874529A (en) * 2005-05-31 2006-12-06 华为技术有限公司 System and method for testing focusing performance of pick-up head
CN103217855A (en) * 2013-04-02 2013-07-24 金三立视频科技(深圳)有限公司 Automatic focusing method of camera
CN103257510A (en) * 2013-04-27 2013-08-21 宁波舜宇光电信息有限公司 Rapid automatic focusing method
CN103731665A (en) * 2013-12-25 2014-04-16 广州计量检测技术研究院 Digital camera image quality comprehensive detection device and method
CN104469153A (en) * 2014-12-02 2015-03-25 广东威创视讯科技股份有限公司 Quick focusing method and system
CN106154690A (en) * 2016-09-20 2016-11-23 照旷科技(上海)有限公司 A kind of method controlling the fast automatic focusing of platform courses camera

Also Published As

Publication number Publication date
CN106878617A (en) 2017-06-20

Similar Documents

Publication Publication Date Title
CN106878617B (en) A kind of focusing method and system
CN105652429B (en) A kind of microscopic cell glass slide scanning auto focusing method based on machine learning
CN101441320B (en) High dynamic image acquisition device based on microscopic imaging detection and method thereof
CN103175469B (en) Enhanced edge focusing instrument and the focus method using the instrument
CN108152869B (en) Small step focusing method suitable for bionic vision rapid focusing
CN102176245B (en) Method for focusing automatic imaging device on specimen
US7929044B2 (en) Autofocus searching method
CN107529011B (en) A kind of motorized zoom lens control method
CN101706609B (en) Image processing based fast automatic focusing method of microscope
CN105578029B (en) A kind of auto-focusing searching algorithm of multi-scale variable step size
CN109584227A (en) A kind of quality of welding spot detection method and its realization system based on deep learning algorithm of target detection
CN109696788A (en) A kind of fast automatic focusing method based on display panel
CN101762268A (en) System and method for fast approximate focus
US20120236120A1 (en) Automatic stereological analysis of biological tissue including section thickness determination
CN106873142B (en) High-quality image acquisition device and method of tubercle bacillus detector
CN104181685A (en) Automatic digital slide focusing device and method based on microscope
CN101943839A (en) Integrated automatic focusing camera device and definition evaluation method
CN106488122A (en) A kind of dynamic auto focusing algorithm based on improved sobel method
CN102930251B (en) Bidimensional collectibles data acquisition and the apparatus and method of examination
CN101701799B (en) Micro-drill machine vision detecting system and method thereof
Sakurikar et al. Composite focus measure for high quality depth maps
CN101930606A (en) Field depth extending method for image edge detection
CN106031148A (en) Imaging device and method for automatic focus in an imaging device as well as a corresponding computer program
CN104637041A (en) Wide fabric image acquiring and splicing method based on reference characteristics
CN105869148A (en) Target detection method and 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
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190531

Termination date: 20200306

CF01 Termination of patent right due to non-payment of annual fee