Specific embodiment
The exemplary embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing in accompanying drawing
The exemplary embodiment of the disclosure is shown, it being understood, however, that may be realized in various forms the disclosure
Without that should be limited by embodiments set forth here.Conversely, there is provided these embodiments are able to more
Thoroughly understand the disclosure, and can be by the complete technology for conveying to this area of the scope of the present disclosure
Personnel.
The embodiment of the present invention provides a kind of method of camera focusing, and the method is applied to mobile terminal device
Side, as shown in figure 1, the method includes:
101st, the type of credential of certificate image to be captured is obtained.
It should be noted that the method for camera focusing provided in an embodiment of the present invention, it is adaptable to by moving
The camera of dynamic terminal device is shot in the application scenarios of the image of known type of credential, such certificate image
There is unified size, the camera of mobile terminal device can be quick according to the unified size dimension
Determine the focal length between certificate image to be captured and focus lens.
When third party application calls camera to gather certificate image, it is thus necessary to determine that the certificate figure to be captured
The type of credential of picture, to obtain the actual size information of the certificate image to be captured.As of the invention real
A kind of implementation of example is applied, when the type of credential of certificate image to be captured is obtained, mobile terminal sets
Standby camera confirms certificate to be captured by way of the conspicuousness logo in scanning certificate image to be captured
The type of credential of image.As another implementation of the embodiment of the present invention, work as mobile terminal device
Camera start when, the type of credential of output display certificate image to be captured, when user according to oneself
After demand selection type of credential, the selection instruction of type of credential is sent to camera, camera is according to the selection
Instruction determines the type of credential of certificate image to be captured.
In the present embodiment, camera is located at the mobile terminals such as smart mobile phone, panel computer, wearable device
In equipment;The type of credential of the certificate image to be captured includes but is not limited to herein below, for example:
Identity card, bank card, business license, driver's license, passport, the various countries' visa/pass, 1 cun of standard
Photo, the one-by-one inch photograph piece of standard 2 etc.;The embodiment of the present invention to the type of mobile terminal device where camera,
The specific type of credential of certificate image to be captured is not defined.
In actual applications, different types of certificate image to be captured, its logo there is also difference, or
Person, in same certificate image to be captured, may be due to the front of certificate image to be captured, reverse side
Difference, causes the logo of different faces to there is also difference;Or, different types of certificate image to be captured,
Its logo is identical, but, logo is only identical shape, and logo is relative to certificate image to be captured
Actual size size has differences.Exemplary, the logo of business license is national emblem, and bank
The logo of card is the type of credential of the identification image or word of each bank card, business license and bank card
Difference, its corresponding logo is also differed.The positive logo of identity card is facial image, and identity card
The logo of reverse side is national emblem, and type of credential is identical, but front, the logo of reverse side are different.
102nd, the actual size information of the certificate image to be captured is determined according to the type of credential.
In the embodiment of the present invention, the purpose for obtaining the actual size of certificate image to be captured is to be based on
The actual size size information quickly determines the focal length between certificate image to be captured and focus lens, keeps away
The situation of focusing failure when having exempted to shoot certificate image in conventional method.
After the type of credential of certificate image to be captured is confirmed in step 101, you can determine certificate to be captured
The actual size information of image.In the embodiment of the present invention, the actual size information of certificate image to be captured
In the database of the mobile terminal device where being stored in camera, camera it is determined that after type of credential, root
Its corresponding actual size information is searched in database according to the type of credential.In actual applications, exist
When shooting certificate image, it is desirable to the generally horizontal plane of certificate image to be captured, to ensure certificate image
With focus lens keeping parallelism, with cause shoot after image in certificate image detail section possess compared with
Resolution ratio high, therefore, the length and width of certificate image to be captured is recorded in database, this
Embodiment is to preserving the storage form of the actual size information of certificate image to be captured, storing in database
Position is not construed as limiting.
Certificate image to be captured has unified dimension information specification, exemplary, the size of identity card
Information is 85.6mm × 54.0mm, the dimension information of business license is 420mm × 297mm, bank card
Dimension information for 85.60 × 53.98mm etc..The embodiment of the present invention is unified to certificate image to be captured
Dimension information no longer enumerated herein.
103rd, the reality according to the actual size information with certificate image to be captured in present preview image
Border Pixel Dimensions determine the distance between the certificate image to be captured and focus lens value.
Actual size information according to certificate image to be captured, according to focal line composition method, calculates and waits to clap
Take the photograph actual pixels size of the certificate image in the present preview image of camera, additionally, camera itself
Lens parameters are carried, by focus lens parameter and the actual size information according to certificate image to be captured
Actual pixels size of the certificate image to be captured for calculating in present preview image, it may be determined that to be captured
The distance between certificate image and focus lens value (depth value), i.e., certificate image to be captured and focusing
Object distance between camera lens.
It is above-mentioned that certificate image to be captured is calculated in camera according to the actual size information of certificate image to be captured
Present preview image in actual pixels size, it is adaptable to certificate image to be captured is in the current of camera
The feelings that the Pixel Dimensions included in the actual pixels size and camera lens parameter of preview image are differed
Condition.If certificate image to be captured shows boundary in the size of the present preview image of camera with the shooting of camera
Face size is identical, i.e., the actual pixels size of present preview image of the certificate image to be captured in camera with
The Pixel Dimensions included in camera lens parameter are identical, then without the reality according to certificate image to be captured
Dimension information calculates actual pixels size of the certificate image to be captured in the present preview image of camera,
The Pixel Dimensions included in direct access lens parameters.
In actual applications, actual pixels size of the certificate image to be captured in present preview image with
Certificate image to be captured has direct relation, the certificate image to be captured of different size size, in camera
Actual pixels size in present preview image is different, and the actual pixels size in present preview image
Different influence the distance between certificate image to be captured and focus lens value (object distance), Jin Ergen again
According to the distance between different certificate images to be captured and focus lens value (object distance), its correspondence is obtained
Focal length.
The focus lens parameter can be including but not limited to herein below, such as:Shot attribute,
Focal length parameter, aperture parameters etc..It is relevant to be calculated according to actual size information by focus lens parameter
Actual pixels size of the certificate image to be captured in present preview image, according to certificate image to be captured
Process is implemented with actual pixels Size calculation distance value/depth value, be refer to of the prior art
Describe in detail, the embodiment of the present invention is no longer repeated one by one herein.
104th, determined according to the distance value current between the certificate image to be captured and focus lens
Focal length, and using described when front focal length as the imaging focal length of certificate image to be captured.
After the distance value that step 103 determines between certificate image to be captured and focus lens, root
Determine the front focal length of working as between certificate image to be captured and focus lens according to the distance value, and this is current
Focal length as preview image imaging focal length, user can shoot certificate image to be captured based on the focal length.
The method of camera focusing provided in an embodiment of the present invention, first, the camera in mobile terminal device
The type of credential of preset certificate image is obtained, the reality of certificate image to be captured is determined according to the type of credential
Border dimension information;Secondly, according to actual size information with certificate image to be captured in present preview image
In actual pixels size determine the distance between certificate image to be captured and focus lens value;Finally,
Front focal length of working as between certificate image to be captured and focus lens is determined according to distance value, and will be current burnt
Away from the imaging focal length as certificate image to be captured;It is true with the method for being based on auto-focusing in the prior art
Focus away from comparing, the embodiment of the present invention is based on the basis of the type of credential for confirming certificate image to be captured
On, the actual size information according to the certificate image to be captured quickly determine certificate image to be captured with it is right
The focal length of zoom lens, it is to avoid the camera circulation focusing in existing method in mobile terminal device is out of focus,
The complicated processes that camera is focused are simplified, and improve focusing speed, shorten focusing time, are lifted
The experience of user.
Further, when step 101 performs the type of credential for obtaining certificate image to be captured, can be with
Using but be not limited to following two modes and realize:
Mode one:Logo in the certificate image to be captured is determined by pre-set image recognizer,
The type of credential of the certificate image to be captured is determined according to logo.
Wherein, the logo is the unique mark of the certificate image type to be captured;The present invention is implemented
In example, the logo is usually the logo of conspicuousness, can be including but not limited to herein below, example
Such as:National emblem in identity card in positive facial image, the identity card back side and business license, driver's license,
Seal in driving license etc., the embodiment of the present invention is not construed as limiting to this.
In the specific implementation, the implementation procedure of pre-set image recognizer is a comparison process for logo,
The logo of preset quantity is stored in locally i.e. in mobile terminal device, the logo that camera scanning is arrived
Compare with the logo being locally stored, determine logo, and certificate figure to be captured is determined according to the logo
Type of credential as in;Or, under mobile terminal device networking state, based on pre-set image identification
Algorithm obtains the logo of certificate image to be captured, and sends to respective server, is determined by the server
Type of credential in the corresponding certificate image to be captured of the logo, the embodiment of the present invention is known to pre-set image
The process that implements of other algorithm is not defined.
Mode two:The prompt message of type of credential of the display comprising preset quantity, receives to type of credential
Corresponding selection instruction, the type of credential of certificate image to be captured is determined according to selection instruction.
After camera starts, in the display interface that camera shoots certificate image to be captured, display is comprising pre-
The prompt message of the certificate image type to be captured of quantity is put, is said from user level, user carries according to this
Show that information selects certificate image type to be captured, realize that aspect is said from technology, mobile terminal device camera
The corresponding selection instruction information of certificate image type to be captured is received, is determined according to the selection instruction information
Type of credential in certificate image to be captured.Carrying for the type of credential comprising preset quantity is shown in camera
When showing information, can be after camera startup, the prompting of automatic type of credential of the display comprising preset quantity
Information;Or, user triggers the prompt message for showing the type of credential comprising preset quantity manually
Function button, with display reminding information, the embodiment of the present invention is not made to the mode of display reminding information
Limit.
Exemplary, a third party application presented below calls camera to shoot the application of identity card
Scene.Fig. 2 shows the prompt message of to be captured certificate image type of the display comprising preset quantity
Schematic diagram, user is registered based on mobile terminal device by certain Third-party payment platform, in registration
During, it is necessary to uploading identity card picture carries out real-name authentication, certain Third-party payment platform calling system
Camera, after camera starts, the prompting letter of the certificate image type to be captured of automatic display preset quantity
Breath, as shown in Fig. 2 it is identity card that user selects to shoot certificate image to be captured in the prompt message
Front, and after clicking on determination button, it is the selection of identity card that camera receives certificate image type to be captured
After instruction, camera determines that the type of credential of certificate image to be captured is identity card, and determines the identity card
Actual size information, the actual size information according to identity card determines ID Card Image and focus lens
The distance between value;Determined to work as front focal length between ID Card Image and focus lens according to the distance value,
And identity card will be shot according to front focal length is deserved, ID Card Image is uploaded to certain Third-party payment platform
Carry out real-name authentication.It will be appreciated that the content in the schematic diagram is only exemplary, not as to this
The limitation of invention practical application scene.
It should be noted that being determined by pre-set image recognizer in aforesaid way one described to be captured
Logo in certificate image, it is necessary to expire when determining the type of credential of certificate image to be captured according to logo
Two necessary conditions of foot, first:It is required that the generally horizontal plane of certificate image to be captured, it is ensured that with it is right
Zoom lens keeping parallelism;Second:Certificate image to be captured includes obvious, intuitively logo.And
During camera is to the practical application of document photography, above-mentioned two condition can be met, effectively improve identification
The accuracy of logo, that is, improve the accuracy of the type of credential for recognizing certificate image to be captured.And on
Although the type of credential of image to be captured need not be determined in stating mode two by logo, in camera
In to certificate image shooting process to be captured, it is still necessary to seek the generally horizontal plane of certificate image to be captured,
Ensure with focus lens keeping parallelism, with ensure gather certificate image image quality.
The focusing efficiency of identity card is shot to further be lifted, in certificate image type to be captured
Selection instruction information determine the logo in burnt image after, can in the camera at the corresponding position of logo
The profile mark of Display Logo, to improve focusing efficiency and focusing precision.As shown in figure 3, Fig. 3 shows
The schematic diagram of the profile mark of Display Logo in camera provided in an embodiment of the present invention, the emblem at this are gone out
Target profile is designated the positive facial image of identity card, in the embodiment of the present invention, is shown in Fig. 3
Logo profile mark be with user in Fig. 2 according to the prompt message of burnt image type determine it is to be captured
The logo of certificate image is consistent.It should be noted that the exemplary only citings of Fig. 2 and Fig. 3,
The embodiment of the present invention is not defined to the content that is particularly shown of Fig. 2 and Fig. 3.
Further, although method shown in Fig. 1 can according to the type of credential of certificate image to be captured and
Actual size information, quickly determines the focal length between certificate image to be captured and focus lens, but,
The process is a thick focus process, and the image quality obtained based on the focal length may not be best
, it is optimal.Therefore, in order to obtain higher-quality image, in step 103 according to distance
Value determine between certificate image to be captured and focus lens after front focal length, to being carried out when front focal length
Micro-adjustment, and the focal length after micro-adjustment is defined as the imaging focal length of the certificate image to be captured.
To that when front focal length is micro-adjusted, can use but be not limited in the following manner realization:Based on logo
Call preset contrast algorithm (auto-focusing algorithm) to described when front focal length is micro-adjusted;According to
The image characteristic point in certificate image to be captured after micro-adjustment is to described when front focal length is modified.Its
In, relevant preset contrast algorithm (auto-focusing algorithm) is to described when front focal length is micro-adjusted
Implementation process, refer to detailed description of the prior art, and the embodiment of the present invention is no longer gone to live in the household of one's in-laws on getting married herein
State.
It should be noted that to when front focal length is micro-adjusted, preset contrast being called according to logo
Algorithm (auto-focusing algorithm) is spent to described when the purpose that front focal length is micro-adjusted is, it is determined that treating
Shoot and be ultimately imaged focal length between certificate image and focus lens;Card to be captured after according to micro-adjustment
Image characteristic point in part image to it is described when front focal length is modified it is intended that when camera is based on
Preset contrast algorithm confirm between certificate image to be captured and focus lens be ultimately imaged focal length it
Afterwards, in order to prevent user from shaking mobile terminal camera or movement certificate image to be captured, and influence most
Whole imaging focal length, camera needs the focal length to determining after micro-adjustment of intermittent to carry out the judgement of validity,
If it is determined that the focal length determined after micro-adjustment is effectively, then maintain to work as front focal length;If it is determined that determining after micro-adjustment
Focal length it is invalid, then according to the distance between certificate image to be captured and focus lens value/depth value changes
To being modified (method shown in implementation See Figure Fig. 4 of specific makeover process) when front focal length,
Redundant computation needed for unnecessary focus process can be reduced, improves certificate image focusing to be captured
Efficiency.
Further, because mobile terminal device camera is during focusing picture is shot, generally wait to clap
Taking the photograph the distance between certificate image and focus lens value/depth value will not change excessive, therefore, can use
Step-forward methods after micro-adjustment to determining to be modified when front focal length, it is to avoid the redundancy of full focus process
Calculate.Wherein, the specific embodiment of the step-forward methods is the method shown in Fig. 4, and Fig. 4 shows
Gone out it is provided in an embodiment of the present invention it is a kind of according to micro-adjustment after certificate image to be captured in image it is special
Levy a little to the method flow diagram being modified when front focal length, as shown in figure 4, methods described includes:
401st, the image characteristic point in the certificate image to be captured after micro-adjustment is extracted.
In the embodiment of the present invention, image characteristic point can be any in certificate image to be captured in theory
Pixel, but, in actual applications, for the ease of carrying out " tracking ", meeting to image characteristic point
The relatively prominent point of pixel in certificate image to be captured is defined as image characteristic point.Because each is treated
Shooting certificate image can have differences, and the image characteristic point for directly resulting in determination can have differences, and need
It is noted that it is determined that during image characteristic point, determining that image is special by preset pixel extraction algorithm
Levy a little, it may be determined that a pixel in the certificate image to be captured after micro-adjustment is used as characteristics of image
Point, it is also possible to it is determined that the continuous pixels of multiple in burnt image after to micro-adjustment are used as characteristics of image
Point.Exemplary, it is assumed that certificate image to be captured is identity card, then can be by the emblem in identity card
The corresponding continuous image vegetarian refreshments of mark national emblem is defined as image characteristic point;Or, by the face figure in identity card
As corresponding continuous image vegetarian refreshments is used as image characteristic point etc., the embodiment of the present invention is to image characteristic point
Pixel number that particular content, image characteristic point are included etc. is not defined.
402nd, after preset time interval, according to the image characteristic point meter in the certificate image to be captured
Calculate the second focal length between the certificate image to be captured and the focus lens.
By focus lens parameter according to image characteristic point calculate certificate image to be captured and focus lens it
Between distance value/depth value, certificate image to be captured and focus lens are being determined according to distance value/depth value
Between the second focal length.
The preset time interval is configurable time interval, when preset time interval is configured, no
What the time interval can be set is oversize, if time interval configuration is long, possibly cannot timely respond to micro-
The imaging focal length determined after adjustment, is easily caused the out of focus of certificate image to be captured.Set with it is preset when
Between when being spaced, can use but be not limited in the following manner, for example:It is 0.1 to set preset time interval
Second;Or, 0.2 second etc., specifically, setting of the embodiment of the present invention to preset time interval is not entered
Row is limited.
403rd, the change difference between second focal length and the 3rd focal length is calculated.
Wherein, the 3rd focal length is the imaging focal length of determination after micro-adjustment.
404th, the change difference is compared with preset change threshold, and determines the change difference
Whether the preset change threshold is exceeded.
If it is determined that the change difference exceedes the preset change threshold, then step 405 is performed;If it is determined that
The change difference then performs step 406 not less than the preset change threshold.
405th, it is right with described according to the change certificate image to be captured that redefines after micro-adjustment of difference
The 3rd focal length between zoom lens.
From above-described embodiment, focal length be according between certificate image to be captured and focus lens away from
Determine from value/depth value.In this step, certificate image to be captured is being redefined according to change difference
During three focal length between focus lens, first, the corresponding distance value of difference/depth value difference will be changed
The distance between certificate image to be captured and the focus lens determined in value, with step 103 value is folded
Plus, based on the distance value/depth value after superposition redefine certificate image to be captured and focus lens it
Between the 3rd focal length.
It should be noted that when three focal lengths is redefined, based on superposition after previous distance value/
Depth value and change difference, redefine, and focus lens can be improved to a certain extent and is focused again
Speed.
The 406th, 3rd focal length is defined as the imaging focal length of the certificate image to be captured.
It should be noted that the method for the camera focusing described in Fig. 1 is suitable for certificate image to be captured
Dimension information of known certificate image etc., and for the image taking of some unknown actual size information,
And the method shown in inapplicable Fig. 1;But, the image taking of unknown actual size information can basis
Preset contrast algorithm (auto-focusing algorithm) determines the image and focus lens of unknown dimension information
Between spacing after, then using the method shown in Fig. 4, pair focal length for determining is modified.By figure
As characteristic point is carried out " tracking ", it may be determined that go out unknown dimension information image apart from value changes,
Avoid when the change of distance value does not influence image quality, when the focus operation of redundancy and circulation focusing
Redundant computation needed for restarting independent focus process every time, improves figure of the camera to unknown dimension information
As the efficiency of focusing.
Further, as the refinement and extension to the above method, the embodiment of the present invention also provides one kind
The method of camera focusing, in the method, so that the camera of touch-screen smart mobile phone shoots business license as an example
Illustrate, business license has fixed dimension information.For ease of statement, the embodiment of the present invention is adopted
The method described in two determines the type of credential of business license in fashion described above, however, it should be clear that should
Kind explanation mode is not intended to the restriction embodiment of the present invention and is only capable of determining card to be captured using aforesaid way two
The type of credential of part image.As shown in figure 5, method provided in an embodiment of the present invention includes:
501st, camera performs enabled instruction, starts the shoot function of camera.
The operating position where touch camera by user to smart mobile phone touch-screen, sends camera and opens
Dynamic instruction, camera is received and performs the enabled instruction, to start camera shoot function.
502nd, camera shows the prompt message of the type of credential comprising preset quantity.
It is used to show the certificate class comprising preset quantity after camera starts, in user's click function selectionbar
The function button of the prompt message of type, to show the prompt message of selection type of credential.Exemplary,
As shown in fig. 6, after camera startup, camera display interface as shown in Figure 6, the boundary can be shown
Function selectionbar is included in face, the button comprising difference in functionality in function selectionbar, such as type of credential choosing
Button is selected, as illustrated, when user's finger triggers type of credential selection key, can show such as Fig. 2
The prompt message of described certificate image type of credential to be captured, after user's selection business license type,
The determination button shown in Fig. 2 is clicked on, the selection operation of certificate image type of credential to be captured is completed.
In actual applications, when camera starts, and when showing camera display interface, it is also possible to automatic
Ejection selects the prompt message of type of credential as shown in Figure 2, and without the manual Trigger Function selection of user
Type of credential selection key in column, for user's selection.And work as the cancellation that user triggered shown in Fig. 2 and press
During key, phase chance directly determines certificate to be captured using aforesaid way one by pre-set image recognizer
Logo in image, the type of credential of certificate image to be captured is determined according to logo.Above are only example
Property function description, in actual applications, the present invention in camera show content be not construed as limiting.
503rd, it is the corresponding selection instruction of business license image that camera is received to type of credential, and according to choosing
Select instruction and determine that the type of credential of certificate image to be captured is business license image.
504th, camera determines the actual size information that type of credential is business license image.
When it is determined that certificate image to be captured type of credential business license image when, be based in database
Business license image traversal simultaneously determines that the actual size information of the business license image is
420mm×297mm。
505th, the actual size information and business license image according to business license image are in current preview figure
Actual pixels size as in determines the distance between business license image and focus lens value, and according to
The distance value determines to work as front focal length between business license image and focus lens.
In this step, exist business license image is calculated according to the actual size information of business license image
Actual pixels size in present preview image, calculate between business license image and focus lens away from
From value, when front focal length when, the lens parameters carried in diagonal composition algorithm, the camera according to camera
It is determined that, the difference of lens parameters may cause the distance between business license image and focus lens value to be deposited
In difference, so cause between business license image and focus lens when front focal length has differences.
506th, the logo national emblem according to business license image calls preset contrast algorithm to when front focal length is entered
Row micro-adjustment.
Preset contrast algorithm is auto-focusing algorithm, and Contrast Detection region is logo national emblem, is excluded
The interference in weak grain background region, improves focusing precision, therefore will pass through in business license image
The image and focus lens of the business license image that preset contrast algorithm (auto-focusing algorithm) determines
Between focal length be defined as being ultimately imaged focal length.
The 507th, focal length after micro-adjustment is defined as the imaging focal length of business license image.
508th, the image characteristic point in the business license image after micro-adjustment is extracted.
In theory, image characteristic point is any pixel in business license image, but, in reality
In, it will usually select logo as image characteristic point, the embodiment of the present invention is with logo national emblem as special
Levy and a little illustrate.
509th, after preset time interval 0.2s, according to the image in the business license image after micro-adjustment
Characteristic point recalculates the imaging focal length between business license image and focus lens.
If after step 507 determines to be ultimately imaged focal length, user is not based on the imaging focal length and is clapped
Take the photograph, in order to prevent user from shaking camera or mobile operation license image, and influence is ultimately imaged focal length
It is not optimal shooting focal length, it is necessary to after preset time interval, detection is ultimately imaged focal length again is
No change, if imaging focal length is constant, continues to work as front focal length;If imaging focal length changes, but
Its focal length variations does not influence to shoot the quality of business license image, then continue to work as front focal length;If into
As focal length variations, but the influence of its focal length variations shoots the quality of business license image, then redefine
Determination in step 507 is ultimately imaged focal length.
It is superfluous without carrying out when being ultimately imaged focal length variations and not influenceing the shooting quality of business license image
Remaining focus operation again, it is to avoid the redundant computation produced each restarting focus operation, carries more
The focusing speed of business license image high.
510th, the imaging focal length in the imaging focal length and step 509 in step 507 is changed difference
Calculate, and determine whether the change difference exceedes preset change threshold.
If imaging focal length in step 507 is defined as business by the difference not less than preset change threshold
The imaging focal length of license image;If the difference exceedes preset change threshold, repeat to hold based on the difference
Row step 506.
Further, as the realization to method shown in above-mentioned Fig. 1, another embodiment of the present invention is also carried
A kind of device of camera focusing is supplied.The device embodiment is corresponding with preceding method embodiment, for ease of
Read, present apparatus embodiment is no longer repeated the detail content in preceding method embodiment one by one,
It should be understood that the device in the present embodiment can be corresponded in the whole that realize in preceding method embodiment
Hold.
The embodiment of the present invention also provides a kind of device of camera focusing, and the device is applied to mobile terminal and sets
In standby, as shown in fig. 7, the device includes:
Acquiring unit 71, the type of credential for obtaining certificate image to be captured;
First determining unit 72, the type of credential for being obtained according to the acquiring unit 71 determines
The actual size information of the certificate image to be captured;
Second determining unit 73, for the actual size determined according to first determining unit 72
Actual pixels size of the information with certificate image to be captured in present preview image determines described to be captured
The distance between certificate image and focus lens value;
3rd determining unit 74, the distance value for being determined according to second determining unit 73 is true
It is fixed to work as front focal length between the certificate image to be captured and focus lens;
4th determining unit 75, for described in the 3rd determining unit 74 is determined when front focal length is made
It is the imaging focal length of certificate image to be captured.
Further, as shown in figure 8, the acquiring unit 71 includes:
First determining module 711, for determining the certificate figure to be captured by pre-set image recognizer
Logo as in;Wherein, the logo is the unique mark of the certificate image type to be captured;
Second determining module 712, the logo for being determined according to first determining module 711 is true
The type of credential of the fixed certificate image to be captured.
Further, as shown in figure 8, the acquiring unit 71 includes:
Display module 713, the prompting letter for showing the certificate image type to be captured comprising preset quantity
Breath;
Receiver module 714, for receiving the type of credential correspondence to the display of the display module 713
Selection instruction;
3rd determining module 715, for the selection instruction received according to the receiver module 714
Information determines the type of credential of the certificate image to be captured.
Further, as shown in figure 8, described device also includes:
Adjustment unit 76, for being treated according to the distance value determines in the 3rd determining unit 74
Shoot between certificate image and focus lens after front focal length, to described when front focal length is finely adjusted
It is whole;
4th determining unit 75, is additionally operable to determine the focal length after the micro-adjustment of the adjustment unit 76
It is the imaging focal length of the certificate image to be captured.
Further, as shown in figure 8, the adjustment unit 76 includes:
Adjusting module 761, for calling preset contrast algorithm to described when front focal length is carried out based on logo
Micro-adjustment;
Correcting module 762, for according to the certificate image to be captured after the micro-adjustment of the adjusting module 761
In image characteristic point to described when front focal length is modified, described image characteristic point is for described to be captured
Any pixel in certificate image.
Further, as shown in figure 8, the correcting module 762 includes:
Extracting sub-module 7621, for extracting the characteristics of image in the certificate image to be captured after micro-adjustment
Point;
First calculating sub module 7622, for after preset time interval, according to the extracting sub-module
Image characteristic point in the certificate image described to be captured for determining calculates the certificate image to be captured and institute
State the second focal length between focus lens;
Second calculating sub module 7623, for calculating described in the calculating of the first calculating sub module 7622
Change difference between second focal length and the 3rd focal length, the 3rd focal length be micro-adjustment after determine into
As focal length;
Submodule 7624 is compared, for the difference in change for calculating second calculating sub module 7623
Value is compared with preset change threshold;
Determination sub-module 7625, for determining that the change difference exceedes when the comparison submodule 7624
During the preset change threshold, the certificate to be captured after micro-adjustment is redefined according to the change difference
The 3rd focal length between certificate image to be captured and the focus lens in image;
4th determining unit 75, is additionally operable to determine the change difference not when the adjustment unit 76
During more than the preset change threshold, the 3rd focal length is defined as the certificate image to be captured
Imaging focal length.
Further, second determining unit 73, including:
First computing module 731, for being calculated according to the actual size information of the certificate image to be captured
The actual pixels size of the certificate image to be captured in present preview image;
Second computing module 732, for by focus lens parameter according to first computing module 731
Distance value described in the actual pixels Size calculation for calculating.
Further, the embodiment of the present invention also provides a kind of mobile terminal device, and the mobile terminal sets
The device of the standby camera focusing included as shown in any width of Fig. 7 and Fig. 8.
The device and mobile terminal device of camera focusing provided in an embodiment of the present invention, it is first, mobile whole
Camera in end equipment obtains the type of credential of preset certificate image, is determined to wait to clap according to the type of credential
Take the photograph the actual size information of certificate image;Secondly, certificate figure to be captured is determined according to actual size information
As with the distance between focus lens value;Finally, according to distance value determine certificate image to be captured with it is right
Work as front focal length between zoom lens, and using when front focal length as the imaging focal length of certificate image to be captured;
Compared with the method for being based on auto-focusing in the prior art determines focal length, the embodiment of the present invention is confirming to treat
Shoot on the basis of the type of credential of certificate image, the actual size according to the certificate image to be captured is believed
Breath quickly determines the focal length of certificate image to be captured and focus lens, it is to avoid in existing method it is mobile eventually
Camera circulation focusing in end equipment is out of focus, and the complicated processes that camera is focused are simplified, and it is right to improve
Burnt speed, shortens focusing time, lifts the experience of user.
The device of the camera focusing includes processor and memory, and above-mentioned acquiring unit, first determine
Unit, the second determining unit and the 3rd determining unit etc. are stored in memory as program unit,
Corresponding function is realized by computing device storage said procedure unit in memory.
Kernel is included in processor, is gone in memory to transfer corresponding program unit by kernel.Kernel can
To set one or more, realize that mobile terminal device is clapped in the prior art by adjusting kernel parameter
Take the photograph during certificate image to be captured, focus process is complicated, focusing speed is slower, and influence user uses
The problem of mobile terminal device camera user experience, improves focusing speed, improves Consumer's Experience.
Memory potentially includes the volatile memory in computer-readable medium, random access memory
The form such as device (RAM) and/or Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash
RAM), memory includes at least one storage chip.
Present invention also provides a kind of computer program product, when being performed on data processing equipment,
It is adapted for carrying out the program code of initialization there are as below methods step:Obtain the certificate of certificate image to be captured
Type;The actual size information of the certificate image to be captured is determined according to the type of credential;According to
Actual pixels size of the actual size information with certificate image to be captured in present preview image is true
The distance between the fixed certificate image to be captured and focus lens value;Institute is determined according to the distance value
State the front focal length of working as between certificate image to be captured and focus lens, and using described when front focal length is used as treating
Shoot the imaging focal length of certificate image.
It should be understood by those skilled in the art that, embodiments herein can be provided as method, system,
Or computer program product.Therefore, the application can be implemented using complete hardware embodiment, complete software
The form of the embodiment in terms of example or combination software and hardware.And, the application can be used at one
Or multiple wherein includes the computer-usable storage medium of computer usable program code (including but not
Be limited to magnetic disk storage, CD-ROM, optical memory etc.) on the computer program product implemented
Form.
The application be with reference to according to the display methods of figure in the chart of the embodiment of the present application, device and
The flow chart and/or block diagram of computer program product is described.It should be understood that can be by computer program
Instruction realize each flow and/or square frame and flow chart in flow chart and/or block diagram and/
Or the combination of the flow and/or square frame in block diagram.These computer program instructions can be provided to general
The processor of computer, special-purpose computer, Embedded Processor or other programmable data processing devices
To produce a machine so that held by the processor of computer or other programmable data processing devices
Capable instruction is produced for realizing in one flow of flow chart or multiple one side of flow and/or block diagram
The device of the function of being specified in frame or multiple square frames.
These computer program instructions may be alternatively stored in can guide computer or other programmable datas to process
In the computer-readable memory that equipment works in a specific way so that storage is deposited in the computer-readable
Instruction in reservoir is produced and includes the manufacture of command device, and command device realization is in flow chart one
The function of being specified in flow or multiple one square frame of flow and/or block diagram or multiple square frames.
These computer program instructions can also be loaded into computer or other programmable data processing devices
On so that series of operation steps is performed on computer or other programmable devices to produce computer
The treatment of realization, so as to the instruction performed on computer or other programmable devices is provided for realizing
Specified in one flow of flow chart or multiple one square frame of flow and/or block diagram or multiple square frames
The step of function.
In a typical configuration, computing device include one or more processors (CPU), input/
Output interface, network interface and internal memory.
Memory potentially includes the volatile memory in computer-readable medium, random access memory
The form such as device (RAM) and/or Nonvolatile memory, such as read-only storage (ROM) or flash memory (flash
RAM).Memory is the example of computer-readable medium.
Computer-readable medium includes that permanent and non-permanent, removable and non-removable media can be with
Information Store is realized by any method or technique.Information can be computer-readable instruction, data knot
Structure, the module of program or other data.The example of the storage medium of computer includes, but are not limited to phase
Become internal memory (PRAM), static RAM (SRAM), dynamic random access memory
(DRAM), other kinds of random access memory (RAM), read-only storage (ROM), electricity can
Erasable programmable read-only memory (EPROM) (EEPROM), fast flash memory bank or other memory techniques, read-only light
Disk read-only storage (CD-ROM), digital versatile disc (DVD) or other optical storages, magnetic
Cassette tape, the storage of tape magnetic rigid disk or other magnetic storage apparatus or any other non-transmission medium,
Can be used to store the information that can be accessed by a computing device.Defined according to herein, computer-readable
Medium does not include temporary computer readable media (transitory media), such as data-signal and load of modulation
Ripple.
Embodiments herein is these are only, the application is not limited to.For this area skill
For art personnel, the application can have various modifications and variations.It is all spirit herein and principle it
Interior made any modification, equivalent substitution and improvements etc., should be included in claims hereof model
Within enclosing.