CN107609446A - A kind of recognition methods of code figure, terminal and computer-readable recording medium - Google Patents

A kind of recognition methods of code figure, terminal and computer-readable recording medium Download PDF

Info

Publication number
CN107609446A
CN107609446A CN201710638928.6A CN201710638928A CN107609446A CN 107609446 A CN107609446 A CN 107609446A CN 201710638928 A CN201710638928 A CN 201710638928A CN 107609446 A CN107609446 A CN 107609446A
Authority
CN
China
Prior art keywords
code
overexposure
exposure
identification
identification 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.)
Granted
Application number
CN201710638928.6A
Other languages
Chinese (zh)
Other versions
CN107609446B (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.)
Nubia Technology Co Ltd
Original Assignee
Nubia Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Nubia Technology Co Ltd filed Critical Nubia Technology Co Ltd
Priority to CN201710638928.6A priority Critical patent/CN107609446B/en
Publication of CN107609446A publication Critical patent/CN107609446A/en
Application granted granted Critical
Publication of CN107609446B publication Critical patent/CN107609446B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of code figure recognition methods, terminal and computer-readable recording medium, overexposure causes yard figure discrimination low in being identified for existing code figure, the problem of recognition speed is slow, the image of code figure to be identified is obtained by the default identification region of camera camera module, it is determined that the exposure of code figure, when the exposure of code figure is overexposure, by obtaining code figure to be identified again with other nonoverlapping identification regions of default identification region, so as to carry out the identification of yard figure by multiple identification regions, it successfully make use of terminal camera module actually applicable identification region rather than just with default identification region, so as to improve the speed and accuracy rate of the identification of code figure.

Description

A kind of recognition methods of code figure, terminal and computer-readable recording medium
Technical field
, can more specifically to a kind of recognition methods of code figure, terminal and computer the present invention relates to field of terminal technology Read storage medium.
Background technology
With the development of mobile intelligent terminal, dependence of the people to mobile terminal is more and more stronger, and the use of mobile terminal In scene, the scene of barcode scanning is also more and more, its be widely used in payment, transfer accounts, shared bicycle, good friend's addition etc. use field Jing Zhong.And during actual barcode scanning, because ambient is too bright, or by flash lamp carry out light filling when, can cause The overexposure of code figure, refer to Fig. 1, Fig. 1 shows the display schematic diagram of Quick Response Code overexposure, and the acquiescence identification region in figure is exactly The identification region that various system applications or third-party application are taken, due to the fixation of identification region, and code figure under strong light Overexposure, the identification process of Quick Response Code can be caused long for this or Direct Recognition failure, user need to take more time to adjust The angle of whole terminal is to realize the change of light-inletting quantity, and the process of the more severe adjustment of environment is more cumbersome, and Consumer's Experience is also poorer.
The content of the invention
The technical problem to be solved in the present invention is how to avoid code figure overexposure under strong light to recognition speed and accuracy rate Influence, for the technical problem, there is provided a kind of recognition methods of code figure, terminal and computer-readable recording medium.
In order to solve the above technical problems, the present invention provides a kind of code figure recognition methods, the code figure recognition methods includes:
The image of code figure to be identified is obtained by the default identification region of camera module;
Determine the exposure of the code figure;
When the exposure of the code figure is overexposure, by with other nonoverlapping identification regions of the default identification region Code figure to be identified is obtained again, and other described identification regions include at least one.
Optionally, the exposure for determining the code figure includes:
The code figure is divided at least two parts according to preset rules;
The exposure of each several part of the code figure is detected respectively;
When the part of overexposure in the code figure meets preparatory condition, the exposure for judging the code figure is overexposure.
Optionally, it is described the code figure is divided at least two parts according to preset rules to include:By the code figure with Nine grids model split is nine parts;
It is described to include when the part of overexposure in the code figure meets preparatory condition:In the code figure, positioned at the portion of centre Divide overexposure;And/or in the code figure, the quantity of the part of overexposure is more than or equal to preset value.
Optionally, code to be identified is obtained again by other nonoverlapping identification regions of the default identification region described After figure, if the exposure of the code figure is still overexposure,:Prompting message is sent, the prompting message is used to remind user to adjust The whole terminal obtains the light-inletting quantity of the image of the code figure.
Optionally, other described identification regions include two, respectively positioned at the upper and lower part of the default identification region.
The present invention also provides a kind of terminal, including processor, memory, camera module and communication bus;
The communication bus is used to realize the connection communication between processor and memory;
The processor is used to perform the code figure recognizer stored in the memory, to realize following steps:
The image of code figure to be identified is obtained by the default identification region of the camera module;
Determine the exposure of the code figure;
When the exposure of the code figure is overexposure, by with other nonoverlapping identification regions of the default identification region Code figure to be identified is obtained again, and other described identification regions include at least one.
Optionally, the exposure for determining the code figure includes:
The code figure is divided at least two parts according to preset rules;
The exposure of each several part of the code figure is detected respectively;
When the part of overexposure in the code figure meets preparatory condition, the exposure for judging the code figure is overexposure.
Optionally, it is described the code figure is divided at least two parts according to preset rules to include:By the code figure with Nine grids model split is nine parts;
It is described to include when the part of overexposure in the code figure meets preparatory condition:In the code figure, positioned at the portion of centre Divide overexposure;And/or in the code figure, the quantity of the part of overexposure is more than or equal to preset value.
Optionally, code to be identified is obtained again by other nonoverlapping identification regions of the default identification region described After figure, if the exposure of the code figure is still overexposure,:Prompting message is sent, the prompting message is used to remind user to adjust The whole terminal obtains the light-inletting quantity of the image of the code figure.
The present invention also provides a kind of computer-readable recording medium, the computer-readable recording medium storage have one or The multiple programs of person, one or more of programs can be by one or more computing devices, to realize that above-mentioned code figure is known The step of other method.
Beneficial effect
The present invention provides a kind of recognition methods of code figure, terminal and computer-readable recording medium, is identified for existing code figure Middle overexposure causes the problem of yard figure discrimination is low, and recognition speed is slow, is obtained and treated by the default identification region of camera camera module The image of the code figure of identification, it is determined that the exposure of code figure, when the exposure of code figure is overexposure, by with default identification region not Other overlapping identification regions obtain code figure to be identified again, so as to carry out the identification of yard figure by multiple identification regions, into Work(make use of terminal camera module actually applicable identification region rather than just with default identification region, so as to improve code Scheme the speed and accuracy rate of identification.
Brief description of the drawings
Below in conjunction with drawings and Examples, the invention will be further described, in accompanying drawing:
Fig. 1 identifies overexposure schematic diagram for Quick Response Code in the prior art;
Fig. 2 is the hardware architecture diagram for realizing each optional mobile terminal of embodiment one of the present invention;
Fig. 3 is the code figure recognition methods basic flow sheet that first embodiment of the invention provides;
Fig. 4 is schematic diagram of the default identification region of various embodiments of the present invention offer on terminal display panel;
Fig. 5 is each identification region schematic diagram that various embodiments of the present invention provide;
Fig. 6 is the code figure nine grids dividing mode schematic diagram that various embodiments of the present invention provide;
Fig. 7 is the code figure recognition methods refined flow chart that second embodiment of the invention provides;
Fig. 8 is that the code exposure map degree that second embodiment of the invention provides determines method flow diagram;
Fig. 9 is the structural representation for the terminal that third embodiment of the invention provides.
Embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
In follow-up description, the suffix using such as " module ", " part " or " unit " for representing element is only Be advantageous to the explanation of the present invention, itself there is no a specific meaning.Therefore, " module ", " part " or " unit " can mix Ground uses.
Terminal can be implemented in a variety of manners.For example, the terminal described in the present invention can include such as mobile phone, flat board Computer, notebook computer, palm PC, personal digital assistant (Personal Digital Assistant, PDA), portable Media player (Portable Media Player, PMP), guider, wearable device, Intelligent bracelet, pedometer etc. move Dynamic terminal, and the fixed terminal such as digital TV, desktop computer.
It will be illustrated in subsequent descriptions by taking mobile terminal as an example, it will be appreciated by those skilled in the art that except special Outside element for moving purpose, construction according to the embodiment of the present invention can also apply to the terminal of fixed type.
Referring to Fig. 2, its hardware architecture diagram for a kind of mobile terminal of each embodiment of the realization present invention, the shifting Dynamic terminal 100 can include:RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit 103rd, A/V (audio/video) input block 104, sensor 105, display unit 106, user input unit 107, interface unit 108th, the part such as memory 109, processor 110 and power supply 111.It will be understood by those skilled in the art that shown in Fig. 2 Mobile terminal structure does not form the restriction to mobile terminal, and mobile terminal can be included than illustrating more or less parts, Either combine some parts or different parts arrangement.
The all parts of mobile terminal are specifically introduced with reference to Fig. 2:
Radio frequency unit 101 can be used for receiving and sending messages or communication process in, the reception and transmission of signal, specifically, by base station Downlink information receive after, handled to processor 110;In addition, up data are sent to base station.Generally, radio frequency unit 101 Including but not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier, duplexer etc..In addition, penetrate Frequency unit 101 can also be communicated by radio communication with network and other equipment.Above-mentioned radio communication can use any communication Standard or agreement, including but not limited to GSM (Global System of Mobile communication, global system for mobile telecommunications System), GPRS (General Packet Radio Service, general packet radio service), CDMA2000 (Code Division Multiple Access 2000, CDMA 2000), WCDMA (Wideband Code Division Multiple Access, WCDMA), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access, TD SDMA), FDD-LTE (Frequency Division Duplexing-Long Term Evolution, FDD Long Term Evolution) and TDD-LTE (Time Division Duplexing-Long Term Evolution, time division duplex Long Term Evolution) etc..
WiFi belongs to short range wireless transmission technology, and mobile terminal can help user to receive and dispatch electricity by WiFi module 102 Sub- mail, browse webpage and access streaming video etc., it has provided the user wireless broadband internet and accessed.Although Fig. 2 shows Go out WiFi module 102, but it is understood that, it is simultaneously not belonging to must be configured into for mobile terminal, completely can be according to need To be omitted in the essential scope for do not change invention.
Audio output unit 103 can be in call signal reception pattern, call mode, record mould in mobile terminal 100 When under the isotypes such as formula, speech recognition mode, broadcast reception mode, by radio frequency unit 101 or WiFi module 102 it is receiving or It is sound that the voice data stored in memory 109, which is converted into audio signal and exported,.Moreover, audio output unit 103 The audio output related to the specific function that mobile terminal 100 performs can also be provided (for example, call signal receives sound, disappeared Breath receives sound etc.).Audio output unit 103 can include loudspeaker, buzzer etc..
A/V input blocks 104 are used to receive audio or video signal.A/V input blocks 104 can include graphics processor (Graphics Processing Unit, GPU) 1041 and microphone 1042, graphics processor 1041 is in video acquisition mode Or the static images or the view data of video obtained in image capture mode by image capture apparatus (such as camera) are carried out Reason.Picture frame after processing may be displayed on display unit 106.Picture frame after the processing of graphics processor 1041 can be deposited Storage is transmitted in memory 109 (or other storage mediums) or via radio frequency unit 101 or WiFi module 102.Mike Wind 1042 can connect in telephone calling model, logging mode, speech recognition mode etc. operational mode via microphone 1042 Quiet down sound (voice data), and can be voice data by such acoustic processing.Audio (voice) data after processing can To be converted to the form output that mobile communication base station can be sent to via radio frequency unit 101 in the case of telephone calling model. Microphone 1042 can implement various types of noises and eliminate (or suppression) algorithm to eliminate (or suppression) in reception and send sound Caused noise or interference during frequency signal.
Mobile terminal 100 also includes at least one sensor 105, such as optical sensor, motion sensor and other biographies Sensor.Specifically, optical sensor includes ambient light sensor and proximity transducer, wherein, ambient light sensor can be according to environment The light and shade of light adjusts the brightness of display panel 1061, and proximity transducer can close when mobile terminal 100 is moved in one's ear Display panel 1061 and/or backlight.As one kind of motion sensor, accelerometer sensor can detect in all directions (general For three axles) size of acceleration, size and the direction of gravity are can detect that when static, the application available for identification mobile phone posture (such as horizontal/vertical screen switching, dependent game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, percussion) etc.; The fingerprint sensor that can also configure as mobile phone, pressure sensor, iris sensor, molecule sensor, gyroscope, barometer, The other sensors such as hygrometer, thermometer, infrared ray sensor, will not be repeated here.
Display unit 106 is used for the information for showing the information inputted by user or being supplied to user.Display unit 106 can wrap Display panel 1061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode can be used Forms such as (Organic Light-Emitting Diode, OLED) configures display panel 1061.
User input unit 107 can be used for the numeral or character information for receiving input, and produce the use with mobile terminal The key signals input that family is set and function control is relevant.Specifically, user input unit 107 may include contact panel 1071 with And other input equipments 1072.Contact panel 1071, also referred to as touch-screen, collect touch operation of the user on or near it (for example user uses any suitable objects or annex such as finger, stylus on contact panel 1071 or in contact panel 1071 Neighbouring operation), and corresponding attachment means are driven according to formula set in advance.Contact panel 1071 may include touch detection Two parts of device and touch controller.Wherein, the touch orientation of touch detecting apparatus detection user, and detect touch operation band The signal come, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and by it Contact coordinate is converted into, then gives processor 110, and the order sent of reception processing device 110 and can be performed.In addition, can To realize contact panel 1071 using polytypes such as resistance-type, condenser type, infrared ray and surface acoustic waves.Except contact panel 1071, user input unit 107 can also include other input equipments 1072.Specifically, other input equipments 1072 can wrap Include but be not limited to physical keyboard, in function key (such as volume control button, switch key etc.), trace ball, mouse, action bars etc. One or more, do not limit herein specifically.
Further, contact panel 1071 can cover display panel 1061, detect thereon when contact panel 1071 or After neighbouring touch operation, processor 110 is sent to determine the type of touch event, is followed by subsequent processing device 110 according to touch thing The type of part provides corresponding visual output on display panel 1061.Although in fig. 2, contact panel 1071 and display panel 1061 be the part independent as two to realize the input of mobile terminal and output function, but in certain embodiments, can Input and the output function of mobile terminal are realized so that contact panel 1071 and display panel 1061 is integrated, is not done herein specifically Limit.
Interface unit 108 is connected the interface that can pass through as at least one external device (ED) with mobile terminal 100.For example, External device (ED) can include wired or wireless head-band earphone port, external power source (or battery charger) port, wired or nothing Line FPDP, memory card port, the port for connecting the device with identification module, audio input/output (I/O) end Mouth, video i/o port, ear port etc..Interface unit 108 can be used for receiving the input from external device (ED) (for example, number It is believed that breath, electric power etc.) and the input received is transferred to one or more elements in mobile terminal 100 or can be with For transmitting data between mobile terminal 100 and external device (ED).
Memory 109 can be used for storage software program and various data.Memory 109 can mainly include storing program area And storage data field, wherein, storing program area can storage program area, application program (such as the sound needed at least one function Sound playing function, image player function etc.) etc.;Storage data field can store according to mobile phone use created data (such as Voice data, phone directory etc.) etc..In addition, memory 109 can include high-speed random access memory, can also include non-easy The property lost memory, a for example, at least disk memory, flush memory device or other volatile solid-state parts.
Processor 110 is the control centre of mobile terminal, utilizes each of various interfaces and the whole mobile terminal of connection Individual part, by running or performing the software program and/or module that are stored in memory 109, and call and be stored in storage Data in device 109, the various functions and processing data of mobile terminal are performed, so as to carry out integral monitoring to mobile terminal.Place Reason device 110 may include one or more processing units;Preferably, processor 110 can integrate application processor and modulatedemodulate is mediated Device is managed, wherein, application processor mainly handles operating system, user interface and application program etc., and modem processor is main Handle radio communication.It is understood that above-mentioned modem processor can not also be integrated into processor 110.
Mobile terminal 100 can also include the power supply 111 (such as battery) to all parts power supply, it is preferred that power supply 111 Can be logically contiguous by power-supply management system and processor 110, so as to realize management charging by power-supply management system, put The function such as electricity and power managed.
Although Fig. 2 is not shown, mobile terminal 100 can also will not be repeated here including bluetooth module etc..
Based on above-mentioned mobile terminal hardware configuration, each embodiment of the inventive method is proposed.
First embodiment
Fig. 3 is the code figure recognition methods basic flow sheet that the present embodiment provides, and this yard of figure recognition methods includes:
S301, the image by the default identification region acquisition of camera module code figure to be identified;
S302, the exposure for determining code figure;
S303, when the exposure of code figure is overexposure, by with other nonoverlapping identification regions of default identification region again Code figure to be identified is obtained, other identification regions include at least one.
Code figure, primarily now including two kinds of bar code and Quick Response Code, specifically, bar code be width is not waited it is multiple black Bar and blank, arranged according to certain coding rule, so as to express the identifier of a group information.Common bar code is by putting The pattern of parallel lines that the secret note and informal voucher that the rate of penetrating differs greatly are lined up.It is commonly used in bar code in commodity transaction, it can be with The producing country of expression article, manufacturer, trade name, date of manufacture, price, it can also be applied in book classification, represent figure Book classification number, it can also be applied in mail, represent many information such as the start-stop place of mail, classification, date.The knot of bar code Structure is simple, but due to its can only storage information in one direction, the capacity that it is stored is extremely limited, the appearance of its storage information Amount corresponds generally to the information of tens characters.Said on Quick Response Code definite meaning be bar code upgrading, it is specific with certain The chequered with black and white graphic recording data symbol information that is distributed in the two-dimensional direction according to certain rules of set figure, with bar code Compare, Quick Response Code can store more information, generally correspond to the information of several kilo-characters, about higher than the capacity of usual bar code Tens times.
Bar code and Quick Response Code can be identified as code figure by terminal camera module.During identification, first By the system software or third party software in terminal, code figure is gathered and opened, then obtained by the camera in terminal The image of code figure.Fig. 4 is refer to, Fig. 4 shows schematic diagram of the default identification region on terminal display panel, is normally at end The middle part of display screen is held, even so, but other positions are still that can gather image on terminal display screen.There is mirror In this, the other positions of display screen with other nonoverlapping identification regions of default identification region, will be arranged in the present embodiment, please With reference to figure 5, Fig. 5 is shown when other identification regions include two, its specific set location, respectively positioned at default cog region The upper and lower part in domain.
In S302, it is determined that the exposure of code figure.Exposure i.e. light exposure, generally by the f-number of camera module, expose Between light time and the sensitivity of photo-sensitive cell determines there be the influence of ambient brightness certainly.How ambient brightness directly results in The specific exposure status of code figure image, when ambient brightness is excessively bright, the exposure for the code figure for inevitably causing to obtain is spent Height, that is, overexposure, brightness is too high in picture, image whiting, so as to the specific features in None- identified image, causes to code figure Recognition failures.The specific calculation of exposure mainly includes following steps:
Colour picture is converted into gray scale picture first, that is, colored rgb value is converted into gray value, its tool changed Body formula is Gray=(R*30+G*59+B*11+50)/100, and wherein Gray represents the gray value of the pixel, and R, G, B divide Not Biao Shi colour picture rgb value.
Then by gray scale picture all pixels value be added, and divided by total number of pixels, it is possible to obtain gray scale and put down Average, that is, exposure.Its gray value average value is more than some value k, and it is overexposure to be considered as it, otherwise not overexposure.Specific k It is worth index, is not necessarily identical for different camera modules, but its maximum is not more than 255.
Optionally, in the present embodiment, it is determined that the exposure of code figure can include:Code figure is divided into according to preset rules At least two parts;The exposure of each several part of detection code figure respectively;When the part of overexposure in code figure meets preparatory condition, sentence The exposure for determining code figure is overexposure.By the fractionation of the image progress of code figure to a certain extent, the exposure of yard figure can be obviously improved The speed that luminosity calculates, each different part is relatively independent and interrelated, is obtained by the fractionation to code figure image The exposure of various pieces, so that according to the exposure of various pieces come the overall exposure of estimated code figure.Wherein, mistake in code figure The part of exposure meets that preparatory condition can specifically include, and the quantity of overexposure part is more, or the exposure of overexposure part is larger Etc., when these conditions are met, then it is considered that code figure overexposure.
Specifically, in the present embodiment, be divided at least two parts according to default division rule by code figure can be with Including:By code figure using nine grids model split as nine parts;Corresponding, when the part of overexposure in code figure meets default bar It can then include during part:Positioned at middle part overexposure in code figure;And/or the quantity of the part of overexposure is more than or equal in code figure Preset value.Preferably by code figure using the model split of nine grids as nine parts in the present embodiment, Fig. 6 is refer to, Fig. 6 is shown With the schematic diagram of nine grids model split code figure.It is noted that the area of each part not necessarily phase after nine grids division Together, the characteristics of being identified according to code figure, is adjusted, for example the part of centre is arranged into larger, and surrounding is relatively It is small;And it is corresponding, in this dividing mode, the preparatory condition for judging to meet needed for code figure overexposure can be, in being located at Between part overexposure, and/or, the quantity of the part of overexposure is more than or equal to preset value.Wherein, when the part overexposure positioned at centre , and middle part is the main body of whole code figure, if the so whole equal overexposure of code figure various pieces of middle overexposure can Energy property is larger, now then directly judges whole code figure overexposure;And if the quantity of the part of overexposure is more than or equal to preset value, The quantity summation for being exactly other parts overexposure is more than or equal to preset value, then it represents that what these parts may be connected to, it is same clear Show the overexposure region for being possible to large area, now can also directly judge whole code figure overexposure.In view of this, code is being carried out During the calculating of exposure map degree, the exposure of center section can be only calculated first, when the result of calculation of center section is overexposure, The calculating of other parts need not be carried out, directly judges code figure overexposure;When the result of calculation of center section is non-overexposure, then calculate The exposure of other parts, further confirm that yard figure overexposure whether.Using this exposure calculation, can significantly save The time that code exposure map degree determines.
Optionally, in the present embodiment, wait to know obtaining again by default other nonoverlapping identification regions of identification region After other yard of figure, if the exposure of code figure is still overexposure,:Prompting message is sent, prompting message is used to remind user to adjust Terminal obtains the light-inletting quantity of the image of code figure.It is used for the identification region for obtaining the image of code figure to be identified in the present embodiment, removes Outside default identification region, in addition at least one other identification region, other identification regions with default identification region not It is overlapping, together it is distributed in default identification region on the display panel of terminal.Other identification regions are maximum with default identification region Difference be that it is obtained, and the direction of image is different, and the direction of available light and light-inletting quantity are also otherwise varied;Particularly, when obtaining During the image of code fetch figure, according to terminal flash lamp carry out light filling if, due to the position between flash lamp and camera module It is fixed to put, therefore the light-inletting quantity caused by flash lamp is also certain, and flash lamp is nearer apart from camera module, directly Cause the light-inletting quantity of the default identification region among terminal display screen bigger than other regions, although brightness is higher, Be overexposure possibility it is also bigger;After the image of the code figure acquired in default identification region determines overexposure, it is possible to switch Obtained to other identification regions;The process of switching especially need not be simultaneously adjusted to terminal, it is thus only necessary to smaller In the range of adjust the space angle of terminal so that the image of code figure is presented in other identification regions.
In the present embodiment, it is one to preset identification region, when other identification regions are two, can be separately positioned on default The upper and lower part of identification region, respectively identification region one and identification region two;And in the identification process for actually carrying out code figure In, switched in these three regions according to the result of identification, entered first by default identification region in a certain order The identification of row code figure, then top can be then switched to Direct Recognition so as to produce recognition result, and if overexposure if non-overexposure Identification region one, the collection of the image of code figure is carried out by the identification region one on top;Then, if still overexposure, then Continue to be switched to the identification region two of bottom, the collection and identification of the image of code figure are carried out by the identification region two of bottom. And if, if all identification regions are identified as overexposure, then, now can sends prompting message, prompting message For reminding user to adjust the light-inletting quantity that terminal obtains the image of code figure, can be carried with pop-up prompting, sound prompting and vibrations Combination between mode, or these modes wake up etc. to prompt user, allows user or adjusting the brightness of flash lamp, or adjustment is eventually Position at end etc., to realize the change of terminal light-inletting quantity, so as to cause the change of the exposure of the image of yard figure.And adjusting Afterwards, then the acquisition and identification of code figure are carried out according to the order of default identification region-one-identification region of identification region two once again.
A kind of code figure recognition methods is present embodiments provided, is obtained by the default identification region of camera module to be identified The image of code figure, it is determined that the exposure of code figure, when the exposure of code figure is overexposure, by nonoverlapping with default identification region Other identification regions obtain code figure to be identified again, so as to carry out the identification of yard figure by multiple identification regions, successfully utilize The actual applicable identification region rather than just with default identification region of terminal camera module, so as to improve the identification of code figure Speed and accuracy rate.
Second embodiment
Fig. 7 is the code figure recognition methods refined flow chart that second embodiment of the invention provides, and this yard of figure recognition methods includes:
S701, current identification region identification code figure;
Wherein, current identification region can preset identification region, or other identification regions, including identification region one With any one in identification region two.
S702, whether identify successIf it is not, S703 is gone to, if so, then terminating flow;
S703, the exposure for determining code figure;
After recognition failures, the exposure of code figure to be identified is determined, mainly judges whether it belongs to overexposure;
S704, judge whether overexposureIf so, S705 is then gone to, if it is not, then going to S701;
If it is determined that if belonging to overexposure, due to overexposure in the case of the image of yard figure can be caused imperfect, then, now Prepare switching identification region.
S705, judge whether current identification region is identification region two;If so, S709 is then gone to, if it is not, then going to S706;
Judge whether it is that the purpose of identification region two is that the transfer sequence of identification region is from default identification region herein Identification region two is finally arrived to identification region one, if being currently identification region two, then illustrate the first two identification region Also identified and have failed as current identification region, and now then should not simply switch identification region again;And if Identification region two is currently not, then the switching of identification region also still has operating space, if being currently default identification region, cuts Change to identification region one;If being currently identification region one, identification region two is switched to.
S706, prompting user switch current identification region;
Prompt user to switch current identification region, terminal is moved in less scope so that the image of code figure is presented In identification region after handover.
S707, judge whether user confirms to switch;If so, S708 is then gone to, if it is not, then going to S701;
S708, with preset identification region-one-identification region of identification region two order switch over.
S709, prompting user adjust the light-inletting quantity of camera module, and current identification region is switched into default identification region.
In S703, it is determined that the exposure of code figure, refer to Fig. 8, following steps are specifically included:
S801, the exposure for determining the lower middle part of nine grids division;
Nine grids division is that the image of code figure is divided into nine parts in the form of nine grids, wherein various pieces Size is unnecessary identical.
S802, judge center section whether overexposure;If so, S803 is then gone to, if it is not, then going to S805;
When the part overexposure positioned at centre, and middle part is the main body of whole code figure, if middle overexposure that The possibility of the equal overexposure of whole code figure various pieces is larger, now then can directly judge whole code figure overexposure.
S803, the exposure for determining other parts;
S804, judge in other parts, whether the quantity of the part of overexposure exceedes preset value;If so, S805 is then gone to, if It is no, then go to S806;
If the quantity of the part of overexposure is more than or equal to preset value, that is, other parts overexposure quantity summation be more than or Equal to preset value, then it represents that what these parts may be connected to, the overexposure region for being possible to large area is equally declared publicly, now Whole code figure overexposure can also directly be judged.
S805, judgement are when the image overexposure of former code figure;
S806, judge image not overexposure when former code figure.
A kind of code figure recognition methods is present embodiments provided, is obtained by the default identification region of camera module to be identified The image of code figure, it is determined that the exposure of code figure, when the exposure of code figure is overexposure, by nonoverlapping with default identification region Other identification regions obtain code figure to be identified again, so as to carry out the identification of yard figure by multiple identification regions, successfully utilize The actual applicable identification region rather than just with default identification region of terminal camera module, so as to improve the identification of code figure Speed and accuracy rate.
3rd embodiment
A kind of terminal is present embodiments provided, shown in Figure 9, it includes processor 91, memory 92, camera module 93 With communication bus 94;
Communication bus 94 is used to realize the connection communication between processor 91 and memory 92;
Processor 91 is used to perform the code figure recognizer stored in memory 92, to realize following steps:
The image of code figure to be identified is obtained by the default identification region of camera module 93;
It is determined that the exposure of code figure;
When the exposure of code figure is overexposure, treated by being obtained again with other nonoverlapping identification regions of default identification region The code figure of identification, other identification regions include at least one.
Bar code and Quick Response Code can be identified as code figure by terminal camera module.During identification, first By the system software or third party software in terminal, code figure is gathered and opened, then obtained by the camera in terminal The image of code figure.Fig. 4 is refer to, Fig. 4 shows schematic diagram of the default identification region on terminal display panel, is normally at end The middle part of display screen is held, even so, but other positions are still that can gather image on terminal display screen.There is mirror In this, the other positions of display screen with other nonoverlapping identification regions of default identification region, will be arranged in the present embodiment, please With reference to figure 5, Fig. 5 is shown when other identification regions include two, its specific set location, respectively positioned at default cog region The upper and lower part in domain.
In the present embodiment, exposure i.e. light exposure, generally by the f-number of camera module, time for exposure and photosensitive The sensitivity of element determines there be the influence of ambient brightness certainly.How ambient brightness directly results in a yard tool for figure image Body exposure status, when ambient brightness is excessively bright, inevitably cause the exposure of the code figure of acquisition too high, that is, mistake Expose, brightness is too high in picture, image whiting, so as to the specific features in None- identified image, causes the recognition failures to code figure. The specific calculation of exposure mainly includes following steps:
Colour picture is converted into gray scale picture first, that is, colored rgb value is converted into gray value, its tool changed Body formula is Gray=(R*30+G*59+B*11+50)/100, and wherein Gray represents the gray value of the pixel, and R, G, B divide Not Biao Shi colour picture rgb value.
Then by gray scale picture all pixels value be added, and divided by total number of pixels, it is possible to obtain gray scale and put down Average, that is, exposure.Its gray value average value is more than some value k, and it is overexposure to be considered as it, otherwise not overexposure.Specific k It is worth index, is not necessarily identical for different camera modules, but its maximum is not more than 255.
Optionally, in the present embodiment, it is determined that the exposure of code figure can include:Code figure is divided into according to preset rules At least two parts;The exposure of each several part of detection code figure respectively;When the part of overexposure in code figure meets preparatory condition, sentence The exposure for determining code figure is overexposure.By the fractionation of the image progress of code figure to a certain extent, the exposure of yard figure can be obviously improved The speed that luminosity calculates, each different part is relatively independent and interrelated, is obtained by the fractionation to code figure image The exposure of various pieces, so that according to the exposure of various pieces come the overall exposure of estimated code figure.Wherein, mistake in code figure The part of exposure meets that preparatory condition can specifically include, and the quantity of overexposure part is more, or the exposure of overexposure part is larger Etc., when these conditions are met, then it is considered that code figure overexposure.
Specifically, in the present embodiment, be divided at least two parts according to default division rule by code figure can be with Including:By code figure using nine grids model split as nine parts;Corresponding, when the part of overexposure in code figure meets default bar It can then include during part:Positioned at middle part overexposure in code figure;And/or the quantity of the part of overexposure is more than or equal in code figure Preset value.Preferably by code figure using the model split of nine grids as nine parts in the present embodiment, Fig. 6 is refer to, Fig. 6 is shown With the schematic diagram of nine grids model split code figure.It is noted that the area of each part not necessarily phase after nine grids division Together, the characteristics of being identified according to code figure, is adjusted, for example the part of centre is arranged into larger, and surrounding is relatively It is small;And it is corresponding, in this dividing mode, the preparatory condition for judging to meet needed for code figure overexposure can be, in being located at Between part overexposure, and/or, the quantity of the part of overexposure is more than or equal to preset value.Wherein, when the part overexposure positioned at centre , and middle part is the main body of whole code figure, if the so whole equal overexposure of code figure various pieces of middle overexposure can Energy property is larger, now then directly judges whole code figure overexposure;And if the quantity of the part of overexposure is more than or equal to preset value, The quantity summation for being exactly other parts overexposure is more than or equal to preset value, then it represents that what these parts may be connected to, it is same clear Show the overexposure region for being possible to large area, now can also directly judge whole code figure overexposure.In view of this, code is being carried out During the calculating of exposure map degree, the exposure of center section can be only calculated first, when the result of calculation of center section is overexposure, The calculating of other parts need not be carried out, directly judges code figure overexposure;When the result of calculation of center section is non-overexposure, then calculate The exposure of other parts, further confirm that yard figure overexposure whether.Using this exposure calculation, can significantly save The time that code exposure map degree determines.
Optionally, in the present embodiment, wait to know obtaining again by default other nonoverlapping identification regions of identification region After other yard of figure, if the exposure of code figure is still overexposure,:Prompting message is sent, prompting message is used to remind user to adjust Terminal obtains the light-inletting quantity of the image of code figure.It is used for the identification region for obtaining the image of code figure to be identified in the present embodiment, removes Outside default identification region, in addition at least one other identification region, other identification regions with default identification region not It is overlapping, together it is distributed in default identification region on the display panel of terminal.Other identification regions are maximum with default identification region Difference be that it is obtained, and the direction of image is different, and the direction of available light and light-inletting quantity are also otherwise varied;Particularly, when obtaining During the image of code fetch figure, according to terminal flash lamp carry out light filling if, due to the position between flash lamp and camera module It is fixed to put, therefore the light-inletting quantity caused by flash lamp is also certain, and flash lamp is nearer apart from camera module, directly Cause the light-inletting quantity of the default identification region among terminal display screen bigger than other regions, although brightness is higher, Be overexposure possibility it is also bigger;After the image of the code figure acquired in default identification region determines overexposure, it is possible to switch Obtained to other identification regions;The process of switching especially need not be simultaneously adjusted to terminal, it is thus only necessary to smaller In the range of adjust the space angle of terminal so that the image of code figure is presented in other identification regions.
In the present embodiment, it is one to preset identification region, when other identification regions are two, can be separately positioned on default The upper and lower part of identification region, respectively identification region one and identification region two;And in the identification process for actually carrying out code figure In, switched in these three regions according to the result of identification, entered first by default identification region in a certain order The identification of row code figure, then top can be then switched to Direct Recognition so as to produce recognition result, and if overexposure if non-overexposure Identification region one, the collection of the image of code figure is carried out by the identification region one on top;Then, if still overexposure, then Continue to be switched to the identification region two of bottom, the collection and identification of the image of code figure are carried out by the identification region two of bottom. And if, if all identification regions are identified as overexposure, then, now can sends prompting message, prompting message For reminding user to adjust the light-inletting quantity that terminal obtains the image of code figure, can be carried with pop-up prompting, sound prompting and vibrations Combination between mode, or these modes wake up etc. to prompt user, allows user or adjusting the brightness of flash lamp, or adjustment is eventually Position at end etc., to realize the change of terminal light-inletting quantity, so as to cause the change of the exposure of the image of yard figure.And adjusting Afterwards, then the acquisition and identification of code figure are carried out according to the order of default identification region-one-identification region of identification region two once again.
A kind of terminal, including processor, memory, camera module and communication bus are present embodiments provided, passes through shooting The default identification region of module obtains the image of code figure to be identified, it is determined that the exposure of code figure, when the exposure of code figure was During exposure, by obtaining code figure to be identified again with other nonoverlapping identification regions of default identification region, so as to pass through multiple knowledges Other region carries out the identification of yard figure, successfully make use of terminal camera module actually applicable identification region rather than just with Default identification region, so as to improve the speed and accuracy rate of the identification of code figure.
Fourth embodiment
Present embodiments provide a kind of computer-readable recording medium, the computer-readable recording medium storage have one or The multiple programs of person, one or more program can by one or more computing device, with realize as first embodiment and/ Or the step of code figure recognition methods described in second embodiment, repeat no more here.
It should be noted that herein, term " comprising ", "comprising" or its any other variant are intended to non-row His property includes, so that process, method, article or device including a series of elements not only include those key elements, and And also include the other element being not expressly set out, or also include for this process, method, article or device institute inherently Key element.In the absence of more restrictions, the key element limited by sentence "including a ...", it is not excluded that including this Other identical element also be present in the process of key element, method, article or device.
The embodiments of the present invention are for illustration only, do not represent the quality of embodiment.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on such understanding, technical scheme is substantially done to prior art in other words Going out the part of contribution can be embodied in the form of software product, and the computer software product is stored in a storage medium In (such as ROM/RAM, magnetic disc, CD), including some instructions to cause a station terminal (can be mobile phone, computer, service Device, air conditioner, or network equipment etc.) perform method described in each embodiment of the present invention.
Embodiments of the invention are described above in conjunction with accompanying drawing, but the invention is not limited in above-mentioned specific Embodiment, above-mentioned embodiment is only schematical, rather than restricted, one of ordinary skill in the art Under the enlightenment of the present invention, in the case of present inventive concept and scope of the claimed protection is not departed from, it can also make a lot Form, these are belonged within the protection of the present invention.

Claims (10)

1. a kind of yard figure recognition methods, it is characterised in that the code figure recognition methods includes:
The image of code figure to be identified is obtained by the default identification region of camera module;
Determine the exposure of the code figure;
When the exposure of the code figure is overexposure, by being obtained again with other nonoverlapping identification regions of the default identification region Code figure to be identified is taken, other described identification regions include at least one.
2. as claimed in claim 1 yard of figure recognition methods, it is characterised in that the exposure for determining the code figure includes:
The code figure is divided at least two parts according to preset rules;
The exposure of each several part of the code figure is detected respectively;
When the part of overexposure in the code figure meets preparatory condition, the exposure for judging the code figure is overexposure.
3. as claimed in claim 2 yard of figure recognition methods, it is characterised in that described to divide the code figure according to preset rules Include at least two parts:By the code figure using nine grids model split as nine parts;
It is described to include when the part of overexposure in the code figure meets preparatory condition:In the code figure, the part mistake positioned at centre Expose;And/or in the code figure, the quantity of the part of overexposure is more than or equal to preset value.
4. the code figure recognition methods as described in claim any one of 1-3, it is characterised in that pass through the default identification described After other nonoverlapping identification regions of region obtain code figure to be identified again, if the exposure of the code figure is still overexposure,: Prompting message is sent, the prompting message is used to remind user to adjust the light-inletting quantity that the terminal obtains the image of the code figure.
5. the code figure recognition methods as described in claim any one of 1-3, it is characterised in that other described identification regions include two It is individual, respectively positioned at the upper and lower part of the default identification region.
6. a kind of terminal, it is characterised in that including processor, memory, camera module and communication bus;
The communication bus is used to realize the connection communication between processor and memory;
The processor is used to perform the code figure recognizer stored in the memory, to realize following steps:
The image of code figure to be identified is obtained by the default identification region of the camera module;
Determine the exposure of the code figure;
When the exposure of the code figure is overexposure, by being obtained again with other nonoverlapping identification regions of the default identification region Code figure to be identified is taken, other described identification regions include at least one.
7. terminal as claimed in claim 6, it is characterised in that the exposure for determining the code figure includes:
The code figure is divided at least two parts according to preset rules;
The exposure of each several part of the code figure is detected respectively;
When the part of overexposure in the code figure meets preparatory condition, the exposure for judging the code figure is overexposure.
8. terminal as claimed in claim 7, it is characterised in that described that the code figure is divided at least two according to preset rules Individual part includes:By the code figure using nine grids model split as nine parts;
It is described to include when the part of overexposure in the code figure meets preparatory condition:In the code figure, the part mistake positioned at centre Expose;And/or in the code figure, the quantity of the part of overexposure is more than or equal to preset value.
9. the terminal as described in claim 6-8, it is characterised in that it is described by the default identification region it is nonoverlapping its After his identification region obtains code figure to be identified again, if the exposure of the code figure is still overexposure,:Send prompting message, The prompting message is used to remind user to adjust the light-inletting quantity that the terminal obtains the image of the code figure.
A kind of 10. computer-readable recording medium, it is characterised in that the computer-readable recording medium storage have one or Multiple programs, one or more of programs can be by one or more computing devices, to realize such as claim 1 to 5 Any one of code figure recognition methods the step of.
CN201710638928.6A 2017-07-31 2017-07-31 Code pattern recognition method, terminal and computer readable storage medium Active CN107609446B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710638928.6A CN107609446B (en) 2017-07-31 2017-07-31 Code pattern recognition method, terminal and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710638928.6A CN107609446B (en) 2017-07-31 2017-07-31 Code pattern recognition method, terminal and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN107609446A true CN107609446A (en) 2018-01-19
CN107609446B CN107609446B (en) 2020-07-31

Family

ID=61064272

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710638928.6A Active CN107609446B (en) 2017-07-31 2017-07-31 Code pattern recognition method, terminal and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN107609446B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108537085A (en) * 2018-03-07 2018-09-14 阿里巴巴集团控股有限公司 A kind of barcode scanning image-recognizing method, device and equipment
CN113065374A (en) * 2021-04-01 2021-07-02 支付宝(杭州)信息技术有限公司 Two-dimensional code identification method, device and equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102473236A (en) * 2009-07-29 2012-05-23 讯宝科技公司 Method of setting amount of exposure for photodetector array in barcode scanner
CN103218596A (en) * 2013-04-17 2013-07-24 苏州斯普锐智能系统有限公司 Bar-code scanner with dynamic multi-angle illuminating system and bar-code scanning method thereof
US20150146925A1 (en) * 2013-11-22 2015-05-28 Samsung Electronics Co., Ltd. Method for recognizing a specific object inside an image and electronic device thereof
CN104781833A (en) * 2012-11-13 2015-07-15 共同印刷株式会社 Two-dimensional code
CN106295443A (en) * 2016-08-03 2017-01-04 浙江华睿科技有限公司 The localization method in a kind of bar code region and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102473236A (en) * 2009-07-29 2012-05-23 讯宝科技公司 Method of setting amount of exposure for photodetector array in barcode scanner
CN104781833A (en) * 2012-11-13 2015-07-15 共同印刷株式会社 Two-dimensional code
CN103218596A (en) * 2013-04-17 2013-07-24 苏州斯普锐智能系统有限公司 Bar-code scanner with dynamic multi-angle illuminating system and bar-code scanning method thereof
US20150146925A1 (en) * 2013-11-22 2015-05-28 Samsung Electronics Co., Ltd. Method for recognizing a specific object inside an image and electronic device thereof
CN106295443A (en) * 2016-08-03 2017-01-04 浙江华睿科技有限公司 The localization method in a kind of bar code region and device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108537085A (en) * 2018-03-07 2018-09-14 阿里巴巴集团控股有限公司 A kind of barcode scanning image-recognizing method, device and equipment
WO2019169965A1 (en) * 2018-03-07 2019-09-12 阿里巴巴集团控股有限公司 Code-scanning image recognition method, apparatus and device
TWI769360B (en) * 2018-03-07 2022-07-01 開曼群島商創新先進技術有限公司 A scanning code image recognition method, device and equipment
CN113065374A (en) * 2021-04-01 2021-07-02 支付宝(杭州)信息技术有限公司 Two-dimensional code identification method, device and equipment
CN113065374B (en) * 2021-04-01 2023-10-27 支付宝(杭州)信息技术有限公司 Two-dimensional code identification method, device and equipment

Also Published As

Publication number Publication date
CN107609446B (en) 2020-07-31

Similar Documents

Publication Publication Date Title
CN108184050B (en) Photographing method and mobile terminal
CN107093418A (en) A kind of screen display method, computer equipment and storage medium
CN108270919A (en) A kind of terminal brightness adjusting method, terminal and computer readable storage medium
CN107767333A (en) Method, equipment and the computer that U.S. face is taken pictures can storage mediums
CN107507007A (en) One kind pays 2 D code verification method, terminal and computer-readable recording medium
CN107527200A (en) A kind of payment management method, mobile terminal and computer-readable recording medium
CN107729298A (en) Screen occlusion area processing method, mobile terminal and computer-readable recording medium
CN107707729A (en) A kind of terminal go out screen or bright screen method, terminal and computer-readable recording medium
CN107566635A (en) Screen intensity method to set up, mobile terminal and computer-readable recording medium
CN108319338A (en) Display screen determines method, mobile terminal and computer readable storage medium
CN107436801A (en) I/O resource regulating methods, terminal and computer-readable recording medium
CN107895352A (en) A kind of image processing method and mobile terminal
CN107181700A (en) Control method, mobile terminal and the storage medium of application program for mobile terminal
CN108536382A (en) A kind of content display method, wearable terminal and storage medium
CN107807857A (en) Method, equipment and the computer for clearing up running memory can storage mediums
CN108172161A (en) Display methods, mobile terminal and computer readable storage medium based on flexible screen
CN108230270A (en) A kind of noise-reduction method, terminal and computer readable storage medium
CN107797871A (en) EMS memory occupation method for releasing resource, mobile terminal and computer-readable recording medium
CN107404618A (en) A kind of image pickup method and terminal
CN107463897A (en) Fingerprint identification method and mobile terminal
CN107463324A (en) A kind of image display method, mobile terminal and computer-readable recording medium
CN107896287A (en) Phone number risk monitoring method and mobile terminal
CN107888759A (en) A kind of method, equipment and computer-readable recording medium realized information and sent
CN107729104A (en) A kind of display methods, mobile terminal and computer-readable storage medium
CN109995391A (en) A kind of image display method, intelligently wearing terminal and computer readable storage medium

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