Two-dimensional code identification method, device, mobile terminal and readable storage medium storing program for executingTechnical field
The present invention relates to field of mobile terminals more particularly to a kind of two-dimensional code identification method, device, mobile terminals and readableStorage medium.
Background technique
With the development of mobile internet with the popularization and application of smart phone, two dimensional code using more and more extensive, especiallyMany cities open two dimensional code barcode scanning ride in a bus, the function of subway, greatly facilitate the trip of the masses.But mobile phone screen twoWhen dimension code is placed on the scanning area of two dimensional code identification equipment, because the not parallel posture and manpower of mobile phone screen and scanning area are notEvitable shake, recognition speed is slow frequent occurrence, low success rate of situation.
Summary of the invention
It is a primary object of the present invention to propose a kind of two-dimensional code identification method, device, mobile terminal and readable storage mediumMatter, it is intended to which when solving mobile terminal and carrying out two dimensional code identification, recognition speed is slow, low success rate of problem.
To achieve the above object, a kind of two-dimensional code identification method provided by the invention, comprising:
Obtain the posture information of mobile terminal;
The plane of scanning motion information that two dimensional code identifies equipment is acquired by the camera of mobile terminal;
According to the two dimensional code on the posture information and plane of scanning motion information adjustment mobile terminal.
Optionally, the two dimensional code packet according on the posture information and plane of scanning motion information adjustment mobile terminalIt includes:
Equipment is identified according to the posture information and the plane of scanning motion acquisition of information mobile terminal and the two dimensional codeRelative position;
It distorts depending on that relative position to the two dimensional code on the mobile terminal, two dimensional code and institute after making distortionIt is parallel to state surface sweeping plane.
Optionally, the distortion includes: rotation and inclination.
Optionally, the posture information for obtaining mobile terminal specifically:
The posture information of mobile terminal is obtained by gyroscope and acceleration transducer.
Optionally, after the posture information that mobile terminal is obtained by gyroscope and acceleration transducer further include:
The wobble information of mobile terminal is detected according to the posture information;
The display position for adjusting two dimensional code in real time according to the wobble information makes the two dimensional code and the surface sweeping plane phaseTo static.
Optionally, it is described according to the posture information and the plane of scanning motion information adjustment mobile terminal on two dimensional code itAfterwards further include:
Identify that equipment identifies the two dimensional code on the mobile terminal by the two dimensional code.
In addition, to achieve the above object, the present invention also proposes a kind of two-dimension code recognition device, comprising:
Module is obtained, for obtaining the posture information of mobile terminal;
Acquisition module acquires the plane of scanning motion information that two dimensional code identifies equipment for the camera by mobile terminal;
Module is adjusted, for according to the two dimension on the posture information and plane of scanning motion information adjustment mobile terminalCode.
Optionally, further includes:
Disappear and tremble module, for detecting the wobble information of mobile terminal according to the posture information;And believed according to the shakeBreath adjusts the display position of two dimensional code in real time, keeps the two dimensional code and the surface sweeping plane opposing stationary.
In addition, to achieve the above object, the present invention also proposes a kind of mobile terminal, comprising: memory, processor and storageOn the memory and the two dimensional code recognizer that can run on the processor, the two dimensional code recognizer are describedThe step of processor realizes above-mentioned two-dimensional code identification method when executing.
In addition, to achieve the above object, the present invention also proposes a kind of computer readable storage medium, described computer-readableStorage medium is stored with two dimensional code recognizer, and the two dimensional code recognizer realizes above-mentioned two dimensional code when being executed by processorThe step of recognition methods.
A kind of two-dimensional code identification method, device, mobile terminal and readable storage medium storing program for executing proposed by the present invention, this method packetIt includes: obtaining the posture information of mobile terminal;The plane of scanning motion letter that two dimensional code identifies equipment is acquired by the camera of mobile terminalBreath;According to the two dimensional code on the posture information and plane of scanning motion information adjustment mobile terminal;Before mobile terminalThe plane of scanning motion of camera initiative recognition two dimensional code identification equipment is set, while acquiring the data of accelerometer and gyroscope, is obtainedThe posture information of mobile terminal distorts according to the plane of scanning motion and posture information active accommodation two dimensional code, keeps two dimensional code and scanning flatFace is parallel, improves the recognition speed and success rate of two dimensional code, improves user experience.
Detailed description of the invention
The hardware structural diagram of Fig. 1 mobile terminal of each embodiment to realize the present invention;
Fig. 2 is the wireless communication system schematic diagram of mobile terminal as shown in Figure 1;
Fig. 3 is a kind of flow chart for two-dimensional code identification method that the embodiment of the present invention one provides;
Fig. 4 is that the two dimensional code that the embodiment of the present invention one provides identifies scene schematic diagram;
Fig. 5 is that the two dimensional code that the embodiment of the present invention one provides identifies the collected two dimensional code schematic diagram of equipment;
Fig. 6 is the method flow diagram of step S30 in Fig. 3;
Fig. 7 is the flow chart for another two-dimensional code identification method that the embodiment of the present invention one provides;
Fig. 8 is the flow chart for another two-dimensional code identification method that the embodiment of the present invention one provides;
Fig. 9 is the image in 2 D code in the mobile terminal that the embodiment of the present invention one provides;
Figure 10 is the image in 2 D code in the mobile terminal after the distortion that the embodiment of the present invention one provides;
Figure 11 is the image in 2 D code when mobile terminal that the embodiment of the present invention one provides rotates left and right;
Figure 12 is the image in 2 D code when mobile terminal after the distortion that the embodiment of the present invention one provides rotates left and right;
Figure 13 is a kind of exemplary block diagram of two-dimension code recognition device provided by Embodiment 2 of the present invention;
Figure 14 is the exemplary block diagram for another two-dimension code recognition device that the embodiment of the present invention three provides;
Figure 15 is a kind of module diagram for mobile terminal that the embodiment of the present invention four provides.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific 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 subsequent description, it is only using the suffix for indicating such as " module ", " component " or " unit " of elementBe conducive to explanation of the invention, itself there is no a specific meaning.Therefore, " module ", " component " or " unit " can mixGround uses.
Terminal can be implemented in a variety of manners.For example, terminal described in the present invention may include such as mobile phone, plateComputer, laptop, palm PC, personal digital assistant (Personal Digital Assistant, PDA), portableMedia player (Portable Media Player, PMP), navigation device, wearable device, Intelligent bracelet, pedometer etc. moveThe fixed terminals such as dynamic terminal, and number TV, desktop computer.
It will be illustrated by taking mobile terminal as an example in subsequent descriptions, it will be appreciated by those skilled in the art that in addition to specialExcept element for moving purpose, the construction of embodiment according to the present invention can also apply to the terminal of fixed type.
Referring to Fig. 1, a kind of hardware structural diagram of its mobile terminal of each embodiment to realize the present invention, the shiftingDynamic terminal 100 may include: RF (Radio Frequency, radio frequency) unit 101, WiFi module 102, audio output unit103, A/V (audio/video) input unit 104, sensor 105, display unit 106, user input unit 107, interface unit108, the components such as memory 109, processor 110 and power supply 111.It will be understood by those skilled in the art that shown in Fig. 1Mobile terminal structure does not constitute the restriction to mobile terminal, and mobile terminal may include components more more or fewer than diagram,Perhaps certain components or different component layouts are combined.
It is specifically introduced below with reference to all parts of the Fig. 1 to mobile terminal:
Radio frequency unit 101 can be used for receiving and sending messages or communication process in, signal sends and receivees, specifically, by base stationDownlink information receive after, to processor 110 handle;In addition, the data of uplink are sent to base station.In general, radio frequency unit 101Including but not limited to antenna, at least one amplifier, transceiver, coupler, low-noise amplifier, duplexer etc..In addition, penetratingFrequency unit 101 can also be communicated with network and other equipment by wireless communication.Any communication can be used in above-mentioned wireless communicationStandard or agreement, including but not limited to GSM (Global System of Mobile communication, global system for mobile telecommunicationsSystem), GPRS (General Packet Radio Service, general packet radio service), CDMA2000 (CodeDivision Multiple Access 2000, CDMA 2000), WCDMA (Wideband Code DivisionMultiple Access, wideband code division multiple access), TD-SCDMA (Time Division-Synchronous CodeDivision Multiple Access, TD SDMA), FDD-LTE (Frequency DivisionDuplexing-Long Term Evolution, frequency division duplex long term evolution) and TDD-LTE (Time DivisionDuplexing-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 102Sub- mail, browsing webpage and access streaming video etc., it provides wireless broadband internet access for user.Although Fig. 1 showsGo out WiFi module 102, but it is understood that, and it is not belonging to must be configured into for mobile terminal, it completely can be according to needIt to omit within the scope of not changing the essence of the invention.
Audio output unit 103 can be in call signal reception pattern, call mode, record mould in mobile terminal 100When under the isotypes such as formula, speech recognition mode, broadcast reception mode, by radio frequency unit 101 or WiFi module 102 it is received orThe audio data stored in memory 109 is converted into audio signal and exports to be sound.Moreover, audio output unit 103Audio output relevant to the specific function that mobile terminal 100 executes can also be provided (for example, call signal receives sound, disappearsBreath receives sound etc.).Audio output unit 103 may include loudspeaker, buzzer etc..
A/V input unit 104 is for receiving audio or video signal.A/V input unit 104 may include graphics processor(Graphics Processing Unit, GPU) 1041 and microphone 1042, graphics processor 1041 is in video acquisition modeOr the image data of the static images or video obtained in image capture mode by image capture apparatus (such as camera) carries outReason.Treated, and picture frame may be displayed on display unit 106.Through graphics processor 1041, treated that picture frame can be depositedStorage is sent in memory 109 (or other storage mediums) or via radio frequency unit 101 or WiFi module 102.MikeWind 1042 can connect in telephone calling model, logging mode, speech recognition mode etc. operational mode via microphone 1042Quiet down sound (audio data), and can be audio data by such acoustic processing.Audio that treated (voice) data canTo be converted to the format output that can be sent to mobile communication base station via radio frequency unit 101 in the case where telephone calling model.Microphone 1042 can be implemented various types of noises elimination (or inhibition) algorithms and send and receive sound to eliminate (or inhibition)The noise generated during frequency signal or interference.
Mobile terminal 100 further includes at least one sensor 105, such as optical sensor, motion sensor and other biographiesSensor.Specifically, optical sensor includes ambient light sensor and proximity sensor, wherein ambient light sensor can be according to environmentThe light and shade of light adjusts the brightness of display panel 1061, and proximity sensor can close when mobile terminal 100 is moved in one's earDisplay panel 1061 and/or backlight.As a kind of motion sensor, accelerometer sensor can detect in all directions (generalFor three axis) size of acceleration, it can detect that size and the direction of gravity when static, can be used to identify the application of 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 sensor, details are not described herein.
Display unit 106 is for showing information input by user or being supplied to the information of user.Display unit 106 can wrapDisplay panel 1061 is included, liquid crystal display (Liquid Crystal Display, LCD), Organic Light Emitting Diode can be usedForms such as (Organic Light-Emitting Diode, OLED) configure display panel 1061.
User input unit 107 can be used for receiving the number or character information of input, and generate the use with mobile terminalFamily setting and the related key signals input of function control.Specifically, user input unit 107 may include touch panel 1071 withAnd other input equipments 1072.Touch panel 1071, also referred to as touch screen collect the touch operation of user on it or nearby(for example user uses any suitable objects or attachment such as finger, stylus on touch panel 1071 or in touch panel 1071Neighbouring operation), and corresponding attachment device is driven according to preset formula.Touch panel 1071 may include touch detectionTwo parts of device and touch controller.Wherein, the touch orientation of touch detecting apparatus detection user, and detect touch operation bandThe signal come, transmits a signal to touch controller;Touch controller receives touch information from touch detecting apparatus, and by itIt is converted into contact coordinate, then gives processor 110, and order that processor 110 is sent can be received and executed.In addition, canTo realize touch panel 1071 using multiple types such as resistance-type, condenser type, infrared ray and surface acoustic waves.In addition to touch panel1071, user input unit 107 can also include other input equipments 1072.Specifically, other input equipments 1072 can wrapIt includes but is not limited in physical keyboard, function key (such as volume control button, switch key etc.), trace ball, mouse, operating stick etc.It is one or more, specifically herein without limitation.
Further, touch panel 1071 can cover display panel 1061, when touch panel 1071 detect on it orAfter neighbouring touch operation, processor 110 is sent to determine the type of touch event, is followed by subsequent processing device 110 according to touch thingThe type of part provides corresponding visual output on display panel 1061.Although in Fig. 1, touch panel 1071 and display panel1061 be the function that outputs and inputs of realizing mobile terminal as two independent components, but in certain embodiments, it canThe function that outputs and inputs of mobile terminal is realized so that touch panel 1071 and display panel 1061 is integrated, is not done herein specificallyIt limits.
Interface unit 108 be used as at least one external device (ED) connect with mobile terminal 100 can by interface.For example,External device (ED) may include wired or wireless headphone port, external power supply (or battery charger) port, wired or nothingLine data port, memory card port, the port for connecting the device with identification module, audio input/output (I/O) endMouth, video i/o port, ear port etc..Interface unit 108 can be used for receiving the input from external device (ED) (for example, numberIt 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 withFor transmitting data between mobile terminal 100 and external device (ED).
Memory 109 can be used for storing software program and various data.Memory 109 can mainly include storing program areaThe storage data area and, wherein storing program area can (such as the sound of application program needed for storage program area, at least one functionSound playing function, image player function etc.) etc.;Storage data area can store according to mobile phone use created data (such asAudio data, phone directory etc.) etc..In addition, memory 109 may include high-speed random access memory, it can also include non-easyThe 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 entire mobile terminal of connectionA part by running or execute the software program and/or module that are stored in memory 109, and calls and is stored in storageData in device 109 execute the various functions and processing data of mobile terminal, to carry out integral monitoring to mobile terminal.PlaceManaging device 110 may include one or more processing units;Preferably, processor 110 can integrate application processor and modulatedemodulate is mediatedManage device, wherein the main processing operation system of application processor, user interface and application program etc., modem processor is mainProcessing wireless 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) powered to all parts, it is preferred that power supply 111Can be logically contiguous by power-supply management system and processor 110, to realize management charging by power-supply management system, putThe functions such as electricity and power managed.
Although Fig. 1 is not shown, mobile terminal 100 can also be including bluetooth module etc., and details are not described herein.
Embodiment to facilitate the understanding of the present invention, the communications network system that mobile terminal of the invention is based below intoRow description.
Referring to Fig. 2, Fig. 2 is a kind of communications network system architecture diagram provided in an embodiment of the present invention, the communication network systemSystem is the LTE system of universal mobile communications technology, which includes UE (User Equipment, the use of successively communication connectionFamily equipment) (the land Evolved UMTS Terrestrial Radio Access Network, evolved UMTS 201, E-UTRANGround wireless access network) 202, EPC (Evolved Packet Core, evolved packet-based core networks) 203 and operator IP operation204。
Specifically, UE201 can be above-mentioned terminal 100, and details are not described herein again.
E-UTRAN202 includes eNodeB2021 and other eNodeB2022 etc..Wherein, eNodeB2021 can be by returningJourney (backhaul) (such as X2 interface) is connect with other eNodeB2022, and eNodeB2021 is connected to EPC203,ENodeB2021 can provide the access of UE201 to EPC203.
EPC203 may include MME (Mobility Management Entity, mobility management entity) 2031, HSS(Home Subscriber Server, home subscriber server) 2032, other MME2033, SGW (Serving Gate Way,Gateway) 2034, PGW (PDN Gate Way, grouped data network gateway) 2035 and PCRF (Policy andCharging Rules Function, policy and rate functional entity) 2036 etc..Wherein, MME2031 be processing UE201 andThe control node of signaling, provides carrying and connection management between EPC203.HSS2032 is all to manage for providing some registersSuch as the function of home location register (not shown) etc, and preserves some related service features, data rates etc. and useThe dedicated information in family.All customer data can be sent by SGW2034, and PGW2035 can provide the IP of UE 201Address distribution and other functions, PCRF2036 are strategy and the charging control strategic decision-making of business data flow and IP bearing resourcePoint, it selects and provides available strategy and charging control decision with charge execution function unit (not shown) for strategy.
IP operation 204 may include internet, Intranet, IMS (IP Multimedia Subsystem, IP multimediaSystem) or other IP operations etc..
Although above-mentioned be described by taking LTE system as an example, those skilled in the art should know the present invention is not onlySuitable for LTE system, be readily applicable to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA withAnd the following new network system etc., herein without limitation.
Based on above-mentioned mobile terminal hardware configuration and communications network system, each embodiment of the method for the present invention is proposed.
Embodiment one
As shown in figure 3, in the present embodiment, a kind of two-dimensional code identification method, comprising:
S10, the posture information for obtaining mobile terminal;
S20, the plane of scanning motion information that two dimensional code identifies equipment is acquired by the camera of mobile terminal;
S30, according to the posture information and the plane of scanning motion information adjustment mobile terminal on two dimensional code.
In the present embodiment, identify that the scanning of equipment is flat by the front camera initiative recognition two dimensional code of mobile terminalFace, while the data of accelerometer and gyroscope are acquired, the posture information of mobile terminal is obtained, is believed according to the plane of scanning motion and postureThe distortion of active accommodation two dimensional code is ceased, keeps two dimensional code parallel with the plane of scanning motion, improves the recognition speed and success rate of two dimensional code, mentionHigh user experience.
In the present embodiment, mobile terminal is that can show two dimensional code and the intelligent terminal with front camera, such as intelligenceMobile phone, tablet computer, palm PC etc..
In the present embodiment, it is provided with gyroscope in mobile terminal, the posture of mobile terminal can be perceived, such as tilted, turn overTurn etc., the wobble information of mobile terminal can also be perceived, this wobble information can be caused by the shake of the hand of user.
In the present embodiment, it is provided with acceleration transducer in mobile terminal, acceleration is big in detectable all directionsIt is small, it can detect that size and the direction of gravity when static, can be used to identify the application of mobile phone posture.
In the present embodiment, as shown in figure 4, when people carry out barcode scanning using smart phone, for example payment, barcode scanning multiply public affairsFriendship, barcode scanning are taken the subway, because the not parallel posture or manpower of mobile phone screen and the scanning area of two dimensional code identification equipment can not be kept awayThe shake exempted from will cause the distortion of the two dimensional code identification collected two dimensional code of equipment.
A kind of schematic diagram of the collected two dimensional code of equipment is identified for two dimensional code as shown in fig. 5-1, at this time existing for two dimensional codeCaused by up-small and down-big problem is precisely due to mobile phone screen and scanning area are not parallel, backward (far from two dimensional code at the top of mobile phoneIdentify equipment) inclination when, will result in two dimensional code identification the collected two dimensional code of equipment it is up-small and down-big;Similarly, at the top of mobile phoneIt is up big and down small to will result in the two dimensional code identification collected two dimensional code of equipment when inclination (close to two dimensional code identification equipment) forward.
If Fig. 5-2 show the two dimensional code identification collected two dimensional code another kind schematic diagram of equipment, two dimensional code exists at this timeInclination the problem of be as mobile phone screen and scanning area outline border it is unjustified caused by, the scanning of general two dimensional code identification equipmentTwo frames up and down of area's outline border (being mostly rectangle) are two horizontal outline borders, and two other frame is vertical outline border.When user'sWhen mobile phone screen rotates left and right, the upper and lower side frame of two dimensional code and two frames up and down of scanning area are not parallel, just produce figureSchematic diagram shown in 5-2.
When mobile phone screen and scanning area not only have the case where tilting forward and back, but also there is the case where rotating left and right, two dimensional code is knownThe other collected two dimensional code of equipment schematic diagram as shown in Fig. 5-3.
For the problem that three cases above, existing two dimensional code identification equipment, which needs first to correct, to be tilted forward and back, and is then rotatedImage, then identified.Increase the burden of two dimensional code identification equipment.Cause the decline of recognition speed and success rate.DirectlyUser experience long, the poor user experience that just waits for the time.
And the method in the application is used, according to the data that gyroscope, acceleration transducer, camera acquire, detect handThe relative position of machine and two dimensional code identification equipment, so that the standard two-dimensional code image of mobile phone screen display originally is distorted,So that two dimensional code identify equipment it is collected be that standard two-dimensional code improves to reduce the recognition time of two-dimentional decoding apparatusThe recognition speed and success rate of two dimensional code, improve user experience.
As shown in fig. 6, in the present embodiment, the step S30 includes:
S31, it is set according to the posture information and the identification of the plane of scanning motion acquisition of information mobile terminal and the two dimensional codeStandby relative position;
S32, it distorts depending on that relative position to the two dimensional code on the mobile terminal, the two dimensional code after making distortionIt is parallel with the surface sweeping plane.
In the present embodiment, the relative position be it is shown in fig. 5 tilt forward and back, rotate left and right, can be according to appearanceState information and the plane of scanning motion information obtain specific tilt angle and distance, just by two at mobile terminal in the present embodimentDimension code distorts, and the two dimensional code after making distortion is parallel with the surface sweeping plane, is then known again by two dimensional code identification equipmentNot, reduce the work of two dimensional code identification equipment, and this work to distort to two dimensional code carrys out existing mobile terminalIt says and is easily accomplished, generally improve the recognition speed and success rate of two dimensional code, improve user experience.
In the present embodiment, the distortion includes: rotation and inclination, wherein rotation refers to left rotation and right rotation, and inclination refers to front and backInclination.
In the present embodiment, the step S10 specifically:
The posture information of mobile terminal is obtained by gyroscope and acceleration transducer.
As shown in fig. 7, in the present embodiment, after the step S10 further include:
S11, the wobble information that mobile terminal is detected according to the posture information;
S12, the display position for adjusting two dimensional code in real time according to the wobble information keep the two dimensional code and the surface sweeping flatFace is opposing stationary.
In the present embodiment, user holds the mobile terminals such as mobile phone, inevitably will appear jitter conditions, this shakeIt is difficult to the identification of mobile phone screen two dimensional code to will lead to two dimensional code identification equipment, in the present embodiment, mobile phone is according to gyroscope, accelerationThe data for spending sensor, detect the jitter conditions of mobile phone, the position that active accommodation two dimensional code is shown makes two that mobile phone screen is shownDimension code image is remain stationary relative to two dimensional code identification equipment, then two dimensional code identification equipment of being more convenient for is to mobile phone screen two dimensional codeIdentification.
As shown in figure 8, in the present embodiment, after the step S30 further include:
S40, identify that equipment identifies the two dimensional code on the mobile terminal by the two dimensional code.
In the present embodiment, existing two dimensional code identification equipment is needed first to correct the problem of tilting forward and back, then rotation figurePicture, then the course of work identified are transferred to completion at mobile terminal, and just two dimensional code distorts at mobile terminal, makesTwo dimensional code after distortion is parallel with the surface sweeping plane, is then identified again by two dimensional code identification equipment, reduces two dimensional codeIdentify the work of equipment, and this work to distort to two dimensional code is easily accomplished for existing mobile terminal, alwaysThe recognition speed and success rate that two dimensional code is improved on body, improve user experience.
The image in 2 D code being illustrated in figure 9 in mobile terminal is opposite with two dimensional code identification equipment according to mobile terminalPosition, is image in 2 D code shown in Fig. 10 after which is distorted, Figure 10-1 be at the top of mobile terminal forwardThe case where inclination, it is up big and down small to identify that the collected two dimensional code of equipment there is a problem of for two dimensional code at this time, by distortion, will moveTwo dimensional code in terminal is adjusted to up-small and down-big image, and specific adjustment parameter is by posture information and plane of scanning motion information acquisition;Figure 10-2 is the case where tilting backwards at the top of mobile terminal, at this time the two dimensional code identification collected two dimensional code of equipment there are it is upper it is small underTwo dimensional code in mobile terminal is adjusted to up big and down small image, specific adjustment parameter is by posture by distortion by big problemInformation and plane of scanning motion information acquisition;Figure 10-3 is that mobile terminal not only there are problems that tilting forward and back but also existing tilting, slightlyAobvious complexity, but method is similar, does not repeat hereby.By the distortion of situations several in Figure 10, two dimensional code identifies equipment collected twoTieing up code will be and the consistent standard two-dimensional code image of Fig. 9.
As shown in figure 11, the image in 2 D code in mobile terminal when rotating left and right for mobile terminal, two dimensional code is known at this timeThere is inclination in the other collected two dimensional code of equipment, by distortion, the two dimensional code in mobile terminal is adjusted to such as Figure 12Shown in image, specific adjustment parameter is by posture information and plane of scanning motion information acquisition;Two dimensional code identification equipment in this way collectsTwo dimensional code be square-folded nonangular image, it is easier to identify.
Embodiment two
As shown in figure 13, in the present embodiment, a kind of two-dimension code recognition device, comprising:
Module 31 is obtained, for obtaining the posture information of mobile terminal;
Acquisition module 32 acquires the plane of scanning motion information that two dimensional code identifies equipment for the camera by mobile terminal;
Module 33 is adjusted, for according to the two dimension on the posture information and plane of scanning motion information adjustment mobile terminalCode.
In the present embodiment, identify that the scanning of equipment is flat by the front camera initiative recognition two dimensional code of mobile terminalFace, while the data of accelerometer and gyroscope are acquired, the posture information of mobile terminal is obtained, is believed according to the plane of scanning motion and postureThe distortion of active accommodation two dimensional code is ceased, keeps two dimensional code parallel with the plane of scanning motion, improves the recognition speed and success rate of two dimensional code, mentionHigh user experience.
In the present embodiment, mobile terminal is that can show two dimensional code and the intelligent terminal with front camera, such as intelligenceMobile phone, tablet computer, palm PC etc..
In the present embodiment, it is provided with gyroscope in mobile terminal, the posture of mobile terminal can be perceived, such as tilted, turn overTurn etc., the wobble information of mobile terminal can also be perceived, this wobble information can be caused by the shake of the hand of user.
In the present embodiment, it is provided with acceleration transducer in mobile terminal, acceleration is big in detectable all directionsIt is small, it can detect that size and the direction of gravity when static, can be used to identify the application of mobile phone posture.
In the present embodiment, as shown in figure 4, when people carry out barcode scanning using smart phone, for example payment, barcode scanning multiply public affairsFriendship, barcode scanning are taken the subway, because the not parallel posture or manpower of mobile phone screen and the scanning area of two dimensional code identification equipment can not be kept awayThe shake exempted from will cause the distortion of the two dimensional code identification collected two dimensional code of equipment.
A kind of schematic diagram of the collected two dimensional code of equipment is identified for two dimensional code as shown in fig. 5-1, at this time existing for two dimensional codeCaused by up-small and down-big problem is precisely due to mobile phone screen and scanning area are not parallel, backward (far from two dimensional code at the top of mobile phoneIdentify equipment) inclination when, will result in two dimensional code identification the collected two dimensional code of equipment it is up-small and down-big;Similarly, at the top of mobile phoneIt is up big and down small to will result in the two dimensional code identification collected two dimensional code of equipment when inclination (close to two dimensional code identification equipment) forward.
If Fig. 5-2 show the two dimensional code identification collected two dimensional code another kind schematic diagram of equipment, two dimensional code exists at this timeInclination the problem of be as mobile phone screen and scanning area outline border it is unjustified caused by, the scanning of general two dimensional code identification equipmentTwo frames up and down of area's outline border (being mostly rectangle) are two horizontal outline borders, and two other frame is vertical outline border.When user'sWhen mobile phone screen rotates left and right, the upper and lower side frame of two dimensional code and two frames up and down of scanning area are not parallel, just produce figureSchematic diagram shown in 5-2.
When mobile phone screen and scanning area not only have the case where tilting forward and back, but also there is the case where rotating left and right, two dimensional code is knownThe other collected two dimensional code of equipment schematic diagram as shown in Fig. 5-3.
For the problem that three cases above, existing two dimensional code identification equipment, which needs first to correct, to be tilted forward and back, and is then rotatedImage, then identified.Increase the burden of two dimensional code identification equipment.Cause the decline of recognition speed and success rate.DirectlyUser experience long, the poor user experience that just waits for the time.
And the method in the application is used, according to the data that gyroscope, acceleration transducer, camera acquire, detect handThe relative position of machine and two dimensional code identification equipment, so that the standard two-dimensional code image of mobile phone screen display originally is distorted,So that two dimensional code identify equipment it is collected be that standard two-dimensional code improves to reduce the recognition time of two-dimentional decoding apparatusThe recognition speed and success rate of two dimensional code, improve user experience.
In the present embodiment, the workflow of the adjustment module 30 includes:
Equipment is identified according to the posture information and the plane of scanning motion acquisition of information mobile terminal and the two dimensional codeRelative position;
It distorts depending on that relative position to the two dimensional code on the mobile terminal, two dimensional code and institute after making distortionIt is parallel to state surface sweeping plane.
In the present embodiment, the relative position be it is shown in fig. 5 tilt forward and back, rotate left and right, can be according to appearanceState information and the plane of scanning motion information obtain specific tilt angle and distance, just by two at mobile terminal in the present embodimentDimension code distorts, and the two dimensional code after making distortion is parallel with the surface sweeping plane, is then known again by two dimensional code identification equipmentNot, reduce the work of two dimensional code identification equipment, and this work to distort to two dimensional code carrys out existing mobile terminalIt says and is easily accomplished, generally improve the recognition speed and success rate of two dimensional code, improve user experience.
In the present embodiment, the distortion includes: rotation and inclination, wherein rotation refers to left rotation and right rotation, and inclination refers to front and backInclination.
In the present embodiment, the workflow for obtaining module specifically:
The posture information of mobile terminal is obtained by gyroscope and acceleration transducer.
In the present embodiment, user holds the mobile terminals such as mobile phone, inevitably will appear jitter conditions, this shakeIt is difficult to the identification of mobile phone screen two dimensional code to will lead to two dimensional code identification equipment, in the present embodiment, mobile phone is according to gyroscope, accelerationThe data for spending sensor, detect the jitter conditions of mobile phone, the position that active accommodation two dimensional code is shown makes two that mobile phone screen is shownDimension code image is remain stationary relative to two dimensional code identification equipment, then two dimensional code identification equipment of being more convenient for is to mobile phone screen two dimensional codeIdentification.
In the present embodiment, existing two dimensional code identification equipment is needed first to correct the problem of tilting forward and back, then rotation figurePicture, then the course of work identified are transferred to completion at mobile terminal, and just two dimensional code distorts at mobile terminal, makesTwo dimensional code after distortion is parallel with the surface sweeping plane, is then identified again by two dimensional code identification equipment, reduces two dimensional codeIdentify the work of equipment, and this work to distort to two dimensional code is easily accomplished for existing mobile terminal, alwaysThe recognition speed and success rate that two dimensional code is improved on body, improve user experience.
The image in 2 D code being illustrated in figure 9 in mobile terminal is opposite with two dimensional code identification equipment according to mobile terminalPosition, is image in 2 D code shown in Fig. 10 after which is distorted, Figure 10-1 be at the top of mobile terminal forwardThe case where inclination, it is up big and down small to identify that the collected two dimensional code of equipment there is a problem of for two dimensional code at this time, by distortion, will moveTwo dimensional code in terminal is adjusted to up-small and down-big image, and specific adjustment parameter is by posture information and plane of scanning motion information acquisition;Figure 10-2 is the case where tilting backwards at the top of mobile terminal, at this time the two dimensional code identification collected two dimensional code of equipment there are it is upper it is small underTwo dimensional code in mobile terminal is adjusted to up big and down small image, specific adjustment parameter is by posture by distortion by big problemInformation and plane of scanning motion information acquisition;Figure 10-3 is that mobile terminal not only there are problems that tilting forward and back but also existing tilting, slightlyAobvious complexity, but method is similar, does not repeat hereby.By the distortion of situations several in Figure 10, two dimensional code identifies equipment collected twoTieing up code will be and the consistent standard two-dimensional code image of Fig. 9.
As shown in figure 11, the image in 2 D code in mobile terminal when rotating left and right for mobile terminal, two dimensional code is known at this timeThere is inclination in the other collected two dimensional code of equipment, by distortion, the two dimensional code in mobile terminal is adjusted to such as Figure 12Shown in image, specific adjustment parameter is by posture information and plane of scanning motion information acquisition;Two dimensional code identification equipment in this way collectsTwo dimensional code be square-folded nonangular image, it is easier to identify.
Embodiment three
As shown in figure 14, in the present embodiment, two-dimension code recognition device further include:
Disappear and tremble module 34, for detecting the wobble information of mobile terminal according to the posture information;And according to the shakeInformation adjusts the display position of two dimensional code in real time, keeps the two dimensional code and the surface sweeping plane opposing stationary.
In the present embodiment, user holds the mobile terminals such as mobile phone, inevitably will appear jitter conditions, this shakeIt is difficult to the identification of mobile phone screen two dimensional code to will lead to two dimensional code identification equipment, in the present embodiment, mobile phone is according to gyroscope, accelerationThe data for spending sensor, detect the jitter conditions of mobile phone, the position that active accommodation two dimensional code is shown makes two that mobile phone screen is shownDimension code image is remain stationary relative to two dimensional code identification equipment, then two dimensional code identification equipment of being more convenient for is to mobile phone screen two dimensional codeIdentification.
Example IV
As shown in figure 15, in the present embodiment, a kind of mobile terminal, comprising: memory 10, processor 20 and be stored in instituteThe two-dimension code recognition device 30 that can be run on memory and on the processor is stated, the two-dimension code recognition device is by the placeManage the step of realizing the two-dimensional code identification method of embodiment one when device executes.
In the present embodiment, the memory includes at least a type of readable storage medium storing program for executing, is installed on for storingThe operating system of the mobile terminal and types of applications software, such as the program code of two-dimension code recognition device etc., in addition, describedMemory can be also used for temporarily storing the Various types of data that has exported or will export.
In the present embodiment, the processor can be central processing unit (Central in some embodimentsProcessing Unit, CPU), controller, microcontroller, microprocessor or other data processing chips.The processor is logicalIt is usually used in controlling the overall operation of the mobile terminal, in the present embodiment, the processor is for running in the memoryThe program code or processing data of storage, such as run the two-dimension code recognition device etc..
In the present embodiment, two-dimension code recognition device, comprising:
Module 31 is obtained, for obtaining the posture information of mobile terminal;
Acquisition module 32 acquires the plane of scanning motion information that two dimensional code identifies equipment for the camera by mobile terminal;
Module 33 is adjusted, for according to the two dimension on the posture information and plane of scanning motion information adjustment mobile terminalCode.
In the present embodiment, identify that the scanning of equipment is flat by the front camera initiative recognition two dimensional code of mobile terminalFace, while the data of accelerometer and gyroscope are acquired, the posture information of mobile terminal is obtained, is believed according to the plane of scanning motion and postureThe distortion of active accommodation two dimensional code is ceased, keeps two dimensional code parallel with the plane of scanning motion, improves the recognition speed and success rate of two dimensional code, mentionHigh user experience.
In the present embodiment, mobile terminal is that can show two dimensional code and the intelligent terminal with front camera, such as intelligenceMobile phone, tablet computer, palm PC etc..
In the present embodiment, it is provided with gyroscope in mobile terminal, the posture of mobile terminal can be perceived, such as tilted, turn overTurn etc., the wobble information of mobile terminal can also be perceived, this wobble information can be caused by the shake of the hand of user.
In the present embodiment, it is provided with acceleration transducer in mobile terminal, acceleration is big in detectable all directionsIt is small, it can detect that size and the direction of gravity when static, can be used to identify the application of mobile phone posture.
In the present embodiment, as shown in figure 4, when people carry out barcode scanning using smart phone, for example payment, barcode scanning multiply public affairsFriendship, barcode scanning are taken the subway, because the not parallel posture or manpower of mobile phone screen and the scanning area of two dimensional code identification equipment can not be kept awayThe shake exempted from will cause the distortion of the two dimensional code identification collected two dimensional code of equipment.
A kind of schematic diagram of the collected two dimensional code of equipment is identified for two dimensional code as shown in fig. 5-1, at this time existing for two dimensional codeCaused by up-small and down-big problem is precisely due to mobile phone screen and scanning area are not parallel, backward (far from two dimensional code at the top of mobile phoneIdentify equipment) inclination when, will result in two dimensional code identification the collected two dimensional code of equipment it is up-small and down-big;Similarly, at the top of mobile phoneIt is up big and down small to will result in the two dimensional code identification collected two dimensional code of equipment when inclination (close to two dimensional code identification equipment) forward.
If Fig. 5-2 show the two dimensional code identification collected two dimensional code another kind schematic diagram of equipment, two dimensional code exists at this timeInclination the problem of be as mobile phone screen and scanning area outline border it is unjustified caused by, the scanning of general two dimensional code identification equipmentTwo frames up and down of area's outline border (being mostly rectangle) are two horizontal outline borders, and two other frame is vertical outline border.When user'sWhen mobile phone screen rotates left and right, the upper and lower side frame of two dimensional code and two frames up and down of scanning area are not parallel, just produce figureSchematic diagram shown in 5-2.
When mobile phone screen and scanning area not only have the case where tilting forward and back, but also there is the case where rotating left and right, two dimensional code is knownThe other collected two dimensional code of equipment schematic diagram as shown in Fig. 5-3.
For the problem that three cases above, existing two dimensional code identification equipment, which needs first to correct, to be tilted forward and back, and is then rotatedImage, then identified.Increase the burden of two dimensional code identification equipment.Cause the decline of recognition speed and success rate.DirectlyUser experience long, the poor user experience that just waits for the time.
And the method in the application is used, according to the data that gyroscope, acceleration transducer, camera acquire, detect handThe relative position of machine and two dimensional code identification equipment, so that the standard two-dimensional code image of mobile phone screen display originally is distorted,So that two dimensional code identify equipment it is collected be that standard two-dimensional code improves to reduce the recognition time of two-dimentional decoding apparatusThe recognition speed and success rate of two dimensional code, improve user experience.
In the present embodiment, the workflow of the adjustment module 30 includes:
Equipment is identified according to the posture information and the plane of scanning motion acquisition of information mobile terminal and the two dimensional codeRelative position;
It distorts depending on that relative position to the two dimensional code on the mobile terminal, two dimensional code and institute after making distortionIt is parallel to state surface sweeping plane.
In the present embodiment, the relative position be it is shown in fig. 5 tilt forward and back, rotate left and right, can be according to appearanceState information and the plane of scanning motion information obtain specific tilt angle and distance, just by two at mobile terminal in the present embodimentDimension code distorts, and the two dimensional code after making distortion is parallel with the surface sweeping plane, is then known again by two dimensional code identification equipmentNot, reduce the work of two dimensional code identification equipment, and this work to distort to two dimensional code carrys out existing mobile terminalIt says and is easily accomplished, generally improve the recognition speed and success rate of two dimensional code, improve user experience.
In the present embodiment, the distortion includes: rotation and inclination, wherein rotation refers to left rotation and right rotation, and inclination refers to front and backInclination.
In the present embodiment, the workflow for obtaining module specifically:
The posture information of mobile terminal is obtained by gyroscope and acceleration transducer.
In the present embodiment, user holds the mobile terminals such as mobile phone, inevitably will appear jitter conditions, this shakeIt is difficult to the identification of mobile phone screen two dimensional code to will lead to two dimensional code identification equipment, in the present embodiment, mobile phone is according to gyroscope, accelerationThe data for spending sensor, detect the jitter conditions of mobile phone, the position that active accommodation two dimensional code is shown makes two that mobile phone screen is shownDimension code image is remain stationary relative to two dimensional code identification equipment, then two dimensional code identification equipment of being more convenient for is to mobile phone screen two dimensional codeIdentification.
In the present embodiment, existing two dimensional code identification equipment is needed first to correct the problem of tilting forward and back, then rotation figurePicture, then the course of work identified are transferred to completion at mobile terminal, and just two dimensional code distorts at mobile terminal, makesTwo dimensional code after distortion is parallel with the surface sweeping plane, is then identified again by two dimensional code identification equipment, reduces two dimensional codeIdentify the work of equipment, and this work to distort to two dimensional code is easily accomplished for existing mobile terminal, alwaysThe recognition speed and success rate that two dimensional code is improved on body, improve user experience.
The image in 2 D code being illustrated in figure 9 in mobile terminal is opposite with two dimensional code identification equipment according to mobile terminalPosition, is image in 2 D code shown in Fig. 10 after which is distorted, Figure 10-1 be at the top of mobile terminal forwardThe case where inclination, it is up big and down small to identify that the collected two dimensional code of equipment there is a problem of for two dimensional code at this time, by distortion, will moveTwo dimensional code in terminal is adjusted to up-small and down-big image, and specific adjustment parameter is by posture information and plane of scanning motion information acquisition;Figure 10-2 is the case where tilting backwards at the top of mobile terminal, at this time the two dimensional code identification collected two dimensional code of equipment there are it is upper it is small underTwo dimensional code in mobile terminal is adjusted to up big and down small image, specific adjustment parameter is by posture by distortion by big problemInformation and plane of scanning motion information acquisition;Figure 10-3 is that mobile terminal not only there are problems that tilting forward and back but also existing tilting, slightlyAobvious complexity, but method is similar, does not repeat hereby.By the distortion of situations several in Figure 10, two dimensional code identifies equipment collected twoTieing up code will be and the consistent standard two-dimensional code image of Fig. 9.
As shown in figure 11, the image in 2 D code in mobile terminal when rotating left and right for mobile terminal, two dimensional code is known at this timeThere is inclination in the other collected two dimensional code of equipment, by distortion, the two dimensional code in mobile terminal is adjusted to such as Figure 12Shown in image, specific adjustment parameter is by posture information and plane of scanning motion information acquisition;Two dimensional code identification equipment in this way collectsTwo dimensional code be square-folded nonangular image, it is easier to identify.
Embodiment five
In the present embodiment, a kind of computer readable storage medium, the computer-readable recording medium storage have two dimensionCode recognizer, realizes the step of the two-dimensional code identification method of embodiment one when the two dimensional code recognizer is executed by processorSuddenly.
Computer readable storage medium provided by the invention passes through the front camera initiative recognition two dimensional code of mobile terminalIt identifies the plane of scanning motion of equipment, while acquiring the data of accelerometer and gyroscope, obtain the posture information of mobile terminal, according toThe plane of scanning motion and the distortion of posture information active accommodation two dimensional code, keep two dimensional code parallel with the plane of scanning motion, improve the knowledge of two dimensional codeOther speed and success rate, improve user experience.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-rowHis property includes, so that the process, method, article or the device that include a series of elements not only include those elements, andAnd further include other elements that are not explicitly listed, or further include for this process, method, article or device institute it is intrinsicElement.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to doThere is also other identical elements in the process, method of element, article or device.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment sideMethod can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many casesThe former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior artThe part contributed out can be embodied in the form of software products, which is stored in a storage mediumIn (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that a terminal (can be mobile phone, computer, serviceDevice, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The embodiment of the present invention is described with above attached drawing, but the invention is not limited to above-mentioned specificEmbodiment, the above mentioned embodiment is only schematical, rather than restrictive, those skilled in the artUnder the inspiration of the present invention, without breaking away from the scope protected by the purposes and claims of the present invention, it can also make very muchForm, all of these belong to the protection of the present invention.