Content of the invention
The embodiment of the present invention provides a kind of two-dimensional code scanning processing method and processing device, in order to solve Quick Response Code in prior artThe slow defect of scanning processing method decoding speed.
The embodiment of the present invention provides a kind of two-dimensional code scanning processing method, comprising:
When startup photographic head is scanned to target Quick Response Code, the default resolution of described photographic head is reduced to scanningResolution;
Gather the image of described target Quick Response Code based on described scanning resolution, and Quick Response Code decoding is carried out to described imageProcess.
Alternatively, described based on described scanning resolution gather described target Quick Response Code image include:
Gather the image of described target Quick Response Code based on described scanning resolution, and cutting process is carried out to described image.
Alternatively, described described image is carried out after cutting process, methods described also includes:
If judging, the position sensing figure knowing Quick Response Code in the image that cutting is processed is not default in described imageOn position, then rotation processing is carried out to described image.
Alternatively, described Quick Response Code decoding process carried out to described image include:
In c linguistic level, Quick Response Code decoding process is carried out to described image.
Alternatively, described scanning resolution is the 1/2 of described default resolution.
Two-dimensional code scanning processing method provided in an embodiment of the present invention, reduces when scanning target Quick Response Code by photographic headThe resolution of photographic head, using the image of the resolution acquisition target Quick Response Code after reducing, reduces required for decoding Quick Response CodeThe size of processing data, improves decoding speed, may be implemented in the scanning to target Quick Response Code during motion of mobile terminals.
The embodiment of the present invention provides a kind of two-dimensional code scanning processing meanss, comprising:
Resolution setting unit, for when startup photographic head is scanned to target Quick Response Code, by described photographic headDefault resolution is reduced to scanning resolution;
Two-dimensional code scanning unit, for gathering the image of described target Quick Response Code, and to institute based on described scanning resolutionState image and carry out Quick Response Code decoding process.
Alternatively, described two-dimensional code scanning unit includes:
Image capture module, for gathering the image of described target Quick Response Code based on described scanning resolution;
Image cropping module, for being acquired to described image processing;
Decoder module, for being decoded to described image processing.
Alternatively, described two-dimensional code scanning unit also includes:
Image rotation module, judges the position sensing figure knowing Quick Response Code in the image that cutting is processed not for working asOn the predeterminated position of described image, then rotation processing is carried out to described image.
Alternatively, described two-dimensional code scanning unit, is further used for, in c linguistic level, carrying out Quick Response Code solution to described imageCode is processed.
Alternatively, described scanning resolution is the 1/2 of described default resolution.
Two-dimensional code scanning processing meanss provided in an embodiment of the present invention, resolution setting unit scans target by photographic headThe resolution of photographic head is reduced, two-dimensional code scanning unit is using the resolution acquisition target Quick Response Code after reducing during Quick Response CodeImage, reduces the size of processing data required for decoding Quick Response Code, improves decoding speed, may be implemented in motion of mobile terminalsDuring scanning to target Quick Response Code.
Specific embodiment
Purpose, technical scheme and advantage for making the embodiment of the present invention are clearer, below in conjunction with the embodiment of the present inventionIn accompanying drawing, the technical scheme in the embodiment of the present invention is clearly and completely described it is clear that described embodiment isThe a part of embodiment of the present invention, rather than whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the artThe every other embodiment being obtained under the premise of not making creative work, broadly falls into the scope of protection of the invention.
Fig. 1 is the flow chart of two-dimensional code scanning processing method embodiment of the present invention.As shown in figure 1, the two dimension of the present embodimentCode scanning processing method includes:
S11: when startup photographic head is scanned to target Quick Response Code, the default resolution of described photographic head is reduced toScanning resolution;
Wherein, default resolution refers to the resolution of photographic head default setting, and scanning resolution refers to photographic head and existsThe resolution arranging during to two-dimensional code scanning;Scanning resolution is less than default resolution.
It should be noted that the embodiment of the present invention can be using any intelligence having and being provided with two-dimensional code scanning recognizerEnergy mobile phone, panel computer etc., the embodiment of the present invention is without limitation.Two-dimensional code scanning recognizer can be mounted in movementApp in terminal, can be by being scanned to the picture with Quick Response Code knowing to the positioning of Quick Response Code, segmentation and decoding operateNot.
For example, the resolution of the photographic head of mobile terminal has 1024 × 768,1600 × 1200,2048 × 1,536 3Kind, its default resolution is 2048 × 1536, and scanning resolution is set to 1024 × 768.Starting photographic head to target two dimensionCode when being scanned, the resolution of photographic head is reduced to scanning resolution, and that is, 1024 × 768.
S12: gather the image of described target Quick Response Code based on described scanning resolution, and Quick Response Code is carried out to described imageDecoding process.
It will be appreciated that it is not necessary to high-resolution image, the therefore present invention are implemented for scanning image in 2 D codePhotographic head after reducing resolution for the example gathers the image of target Quick Response Code, reduces the size of view data, reduces and understandsRequired for code Quick Response Code, the size of processing data, improves decoding speed.
Specifically, the positioning to Quick Response Code, segmentation and decoding operate are included to the process of Quick Response Code decoding process, comprising:
The image-region of the bar code symbol of Quick Response Code is converted to bianry image, dilation operation is carried out to two finger images and obtainsBianry image after expansion, the profile to obtain the bar code region of Quick Response Code for the edge of bianry image after then detection expands;
Above-mentioned profile is modified and splits and obtain complete standard bar code image;
Grid Sampling is carried out to above-mentioned standard bar code image and is configured to bitmap, obtain the binary number in above-mentioned bar code regionAccording to and carry out error correction and translation, and be converted to code word data.
The two-dimensional code scanning processing method of the embodiment of the present invention, reduces shooting when scanning target Quick Response Code by photographic headThe resolution of head, using the image of the resolution acquisition target Quick Response Code after reducing, reduces and processes required for decoding Quick Response CodeThe size of data, improves decoding speed, may be implemented in the scanning to target Quick Response Code during motion of mobile terminals.
In the embodiment of another one two-dimensional code scanning identifying processing method of the present invention, with the embodiment of the method in Fig. 1Identical, wherein step s12 specifically includes:
Gather the image of described target Quick Response Code based on described scanning resolution, and cutting process is carried out to described image.
It should be noted that the image of the target Quick Response Code of photographic head collection is included around image in 2 D code and Quick Response CodeOther images.In order to reduce the size of processing data required for decoding Quick Response Code further, improve decoding speed, to collectionImage carries out cutting process before carrying out Quick Response Code decoding process, crops the image outside view-finder, to obtain in view-finderImage.
Preferably, described image is carried out after cutting process, methods described also includes:
If judging, the position sensing figure knowing Quick Response Code in the image that cutting is processed is not default in described imageOn position, then rotation processing is carried out to described image.
It will be appreciated that the view data of mobile terminal is from the imageing sensor of photographic head hardware, image passesSensor has the view direction of an acquiescence, the seat of the acquiescence view direction of general mobile phone camera after being fixed to mobile terminalMark initial point is located at upper left corner during mobile phone traverse.When leading to mobile phone traverse and place vertically due to the acquiescence view direction of imageing sensorIt is inconsistent in the direction of the become image of imageing sensor.
It should be noted that as shown in Fig. 2 Quick Response Code such as qr (quick-response) code includes position sensing figureShape a, position sensing figure b and position sensing figure c.When applying the photographic head collection target Quick Response Code of mobile terminal, obtainThe direction of the Quick Response Code of image may be inconsistent.In order to accelerate decoding speed, can be by two dimension before Quick Response Code decoding processThree position sensing figures of code adjust on the default position of image, and this default position can be position as shown in Figure 2Put.
In two-dimensional code scanning identifying processing method provided in an embodiment of the present invention, Quick Response Code decoding is carried out to described imageProcess and include:
In c linguistic level, Quick Response Code decoding process is carried out to described image.
It should be noted that being to call the zxing of java layer to decode storehouse to carry out in existing two-dimensional code scanning processing methodDecoding, decoding speed is slow.And the two-dimensional code scanning processing method of the embodiment of the present invention calls the zbar decoding storehouse of c layer to be solvedCode, decoding speed is fast.
Preferably, in order to ensure to ensure target Quick Response Code is accurately identified while improving decoding speed, described sweepRetouch that resolution is described default resolution 1/2.
Two-dimensional code scanning processing method provided in an embodiment of the present invention, reduces when scanning target Quick Response Code by photographic headThe resolution of photographic head, using the image of the resolution acquisition target Quick Response Code after reducing, and carries out cutting, rotation to obtaining imageTurn and process, reduce the size of processing data required for decoding Quick Response Code, in c linguistic level, Quick Response Code decoding process is carried out to imageFurther increase decoding speed, may be implemented in the scanning to target Quick Response Code during motion of mobile terminals.
Fig. 3 is the structural representation of two-dimensional code scanning processing meanss embodiment of the present invention.As shown in figure 3, the present embodimentTwo-dimensional code scanning processing meanss include resolution setting unit 31 and two-dimensional code scanning unit 32, specifically:
Resolution setting unit 31, for when startup photographic head is scanned to target Quick Response Code, by described photographic headDefault resolution be reduced to scanning resolution;Two-dimensional code scanning unit 32, for described based on the collection of described scanning resolutionThe image of target Quick Response Code, and Quick Response Code decoding process is carried out to described image.
For example, the resolution of the photographic head of mobile terminal has 1024 × 768,1600 × 1200,2048 × 1,536 3Kind, its default resolution is 2048 × 1536, and scanning resolution is set to 1024 × 768.Starting photographic head to target two dimensionCode when being scanned, the resolution of photographic head is reduced to scanning resolution, and that is, 1024 × 768.
It will be appreciated that it is not necessary to high-resolution image, the therefore present invention are implemented for scanning image in 2 D codePhotographic head after reducing resolution for the example gathers the image of target Quick Response Code, reduces the size of view data, reduces and understandsRequired for code Quick Response Code, the size of processing data, improves decoding speed.
Specifically, the positioning to Quick Response Code, segmentation and decoding operate are included to the process of Quick Response Code decoding process, comprising:
The image-region of the bar code symbol of Quick Response Code is converted to bianry image, dilation operation is carried out to two finger images and obtainsBianry image after expansion, the profile to obtain the bar code region of Quick Response Code for the edge of bianry image after then detection expands;
Above-mentioned profile is modified and splits and obtain complete standard bar code image;
Grid Sampling is carried out to above-mentioned standard bar code image and is configured to bitmap, obtain the binary number in above-mentioned bar code regionAccording to and carry out error correction and translation, and be converted to code word data.
In the embodiment of the present invention, resolution setting unit 31, will when startup photographic head is scanned to target Quick Response CodeThe default resolution of described photographic head is reduced to scanning resolution;Two-dimensional code scanning unit 32 is based on described scanning resolution collectionThe image of described target Quick Response Code, and Quick Response Code decoding process is carried out to described image.
The two-dimensional code scanning processing meanss of the embodiment of the present invention, resolution setting unit scans target two dimension by photographic headThe resolution of photographic head is reduced, two-dimensional code scanning unit is using the figure of the resolution acquisition target Quick Response Code after reducing during codePicture, reduces the size of processing data required for decoding Quick Response Code, improves decoding speed, may be implemented in motion of mobile terminals mistakeScanning to target Quick Response Code in journey.
In the embodiment of the another one two-dimensional code scanning processing meanss of the present invention, similar with the structure in Fig. 2, two dimensionCode scanning element 32 includes:
Image capture module, for gathering the image of described target Quick Response Code based on described scanning resolution;
Image cropping module, for being acquired to described image processing;
Decoder module, for being decoded to described image processing.
Preferably, two-dimensional code scanning unit 32 also includes:
Image rotation module, judges the position sensing figure knowing Quick Response Code in the image that cutting is processed not for working asOn the predeterminated position of described image, then rotation processing is carried out to described image.
Two-dimensional code scanning unit 32, is further used for, in c linguistic level, carrying out Quick Response Code decoding process to described image.
Preferably, described scanning resolution is the 1/2 of described default resolution.
The two-dimensional code scanning processing meanss of the embodiment of the present invention can be used for executing said method embodiment, its principle and skillArt effect is similar to, and here is omitted.
Fig. 3 is the entity structure schematic diagram of two-dimensional code scanning processing meanss embodiment of the present invention.As shown in figure 3, this two dimensionCode scaning treatment device includes:
Processor (processor) 41, memorizer (memory) 42 and bus 43, wherein, processor 41 and memorizer 42Mutual communication is completed by bus 43.Processor 41 can call the logical order in memorizer 42, to execute such as lower sectionMethod:
When startup photographic head is scanned to target Quick Response Code, the default resolution of described photographic head is reduced to scanningResolution;
Gather the image of described target Quick Response Code based on described scanning resolution, and Quick Response Code decoding is carried out to described imageProcess.
In a kind of optional embodiment, the described image gathering described target Quick Response Code based on described scanning resolutionIncluding:
Gather the image of described target Quick Response Code based on described scanning resolution, and cutting process is carried out to described image.
Further, described described image is carried out after cutting process, methods described also includes:
If judging, the position sensing figure knowing Quick Response Code in the image that cutting is processed is not default in described imageOn position, then rotation processing is carried out to described image.
Preferably, described Quick Response Code decoding process carried out to described image include:
In c linguistic level, Quick Response Code decoding process is carried out to described image.
Preferably, described scanning resolution is the 1/2 of described default resolution.
Additionally, the logical order in above-mentioned memorizer 42 can be realized by the form of SFU software functional unit and be used as solelyWhen vertical production marketing or use, can be stored in a computer read/write memory medium.Based on such understanding, thisPart that bright technical scheme substantially contributes to prior art in other words or this technical scheme partly can be with softThe form of part product embodies, and this computer software product is stored in a storage medium, including some instructions in order to makeObtain a computer equipment (can be personal computer, server, or network equipment etc.) and execute each embodiment of the present inventionThe all or part of step of methods described.And aforesaid storage medium includes: u disk, portable hard drive, read only memory (rom,Read-only memory), random access memory (ram, random access memory), magnetic disc or CD etc. variousCan be with the medium of store program codes.
Two-dimensional code scanning processing method provided in an embodiment of the present invention, reduces when scanning target Quick Response Code by photographic headThe resolution of photographic head, using the image of the resolution acquisition target Quick Response Code after reducing, reduces required for decoding Quick Response CodeThe size of processing data, improves decoding speed, may be implemented in the scanning to target Quick Response Code during motion of mobile terminals.
Two-dimensional code scanning processing meanss provided in an embodiment of the present invention, resolution setting unit scans target by photographic headThe resolution of photographic head is reduced, two-dimensional code scanning unit is using the resolution acquisition target Quick Response Code after reducing during Quick Response CodeImage, reduces the size of processing data required for decoding Quick Response Code, improves decoding speed, may be implemented in motion of mobile terminalsDuring scanning to target Quick Response Code.
Those skilled in the art can be understood that, convenience and letter for description are bought, only with above-mentioned each functionThe division of module is illustrated, and in practical application, can distribute above-mentioned functions by different function moulds as desiredBlock completes, and the internal structure of device will be divided into different functional modules, to complete all or part of work(described aboveEnergy.The specific work process of the system, apparatus, and unit of foregoing description, may be referred to corresponding in preceding method embodimentJourney, will not be described here.
Device embodiment described above is only that schematically the wherein said unit illustrating as separating component canTo be or to may not be physically separate, as the part that unit shows can be or may not be physics listUnit, you can with positioned at a place, or can also be distributed on multiple NEs.Can be selected it according to the actual needsIn the purpose to realize this embodiment scheme for some or all of module.Those of ordinary skill in the art are not paying creativenessWork in the case of, you can to understand and to implement.
Through the above description of the embodiments, those skilled in the art can be understood that each embodiment canMode by software plus necessary general hardware platform to be realized naturally it is also possible to pass through hardware.Based on such understanding, onThat states that technical scheme substantially contributes to prior art in other words partly can be embodied in the form of software product, shouldComputer software product can store in a computer-readable storage medium, such as rom/ram, magnetic disc, CD etc., including some fingersOrder is with so that a computer equipment (can be personal computer, server, or network equipment etc.) executes each enforcementExample or some partly described methods of embodiment.
Finally it is noted that above example, only in order to technical scheme to be described, is not intended to limit;AlthoughWith reference to the foregoing embodiments the present invention is described in detail, it will be understood by those within the art that: it still may be usedTo modify to the technical scheme described in foregoing embodiments, or equivalent is carried out to wherein some technical characteristics;And these modification or replace, do not make appropriate technical solution essence depart from various embodiments of the present invention technical scheme spirit andScope.