CN109447211A - A kind of two-dimensional code generation method, two dimension code reading method and device - Google Patents

A kind of two-dimensional code generation method, two dimension code reading method and device Download PDF

Info

Publication number
CN109447211A
CN109447211A CN201811116240.2A CN201811116240A CN109447211A CN 109447211 A CN109447211 A CN 109447211A CN 201811116240 A CN201811116240 A CN 201811116240A CN 109447211 A CN109447211 A CN 109447211A
Authority
CN
China
Prior art keywords
color
region
resetting
area
dimensional code
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
CN201811116240.2A
Other languages
Chinese (zh)
Other versions
CN109447211B (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.)
Beijing QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and 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 Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201811116240.2A priority Critical patent/CN109447211B/en
Publication of CN109447211A publication Critical patent/CN109447211A/en
Application granted granted Critical
Publication of CN109447211B publication Critical patent/CN109447211B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/10544Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum
    • G06K7/10821Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation by scanning of the records by radiation in the optical part of the electromagnetic spectrum further details of bar or optical code scanning devices

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Electromagnetism (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Analysis (AREA)

Abstract

The embodiment of the invention provides a kind of two-dimensional code generation methods, two dimension code reading method and device, it includes: multiple two dimensional codes to be processed for being set region for having been provided with color that wherein method, which includes: acquisition, which formed by three color components of three-dimensional color space;Each region that set is divided as L row × L column resetting color area, L is greater than or equal to 2;Based on pre-establishing the associated L in position from each region that set2A to be set in region, what is obtained each is set the associated L in region2It is a to be set region and each set the associated L in region2It is a to be set the respective color in region, determine the L in resetting color area2A resetting color, resetting color be the first color component changed by default number, default number change the second color component, default number third color component formed;By L2A resetting color setting obtains processed two dimensional code in L row × L column resetting color area.

Description

A kind of two-dimensional code generation method, two dimension code reading method and device
Technical field
The present invention relates to mobile solution, in particular to a kind of two-dimensional code generation method, two dimension code reading method And device.
Background technique
With the emergence of electronic business mode, two dimensional code has been widely applied among communication between electronic devices.Than Such as, mobile phone A scanning cell phone B show two dimensional code, read out mobile phone B two dimensional code be plusing good friend two dimensional code, may be implemented by The good friend that the two dimensional code of mobile phone B is shown adds as the good friend of mobile phone A user.
Due to two dimensional code be with certain specific geometric figure according to certain rules, two-dimensional surface distribution it is chequered with black and white Graphic recording data symbol information, these data symbol informations can indicate the information of plusing good friend and the information of Mobile Phone Payments etc. Deng, therefore the communication between electronic equipment can be realized by two dimensional code.User realizes the communication between above-mentioned electronic equipment, can To show on an electronic device the two dimensional code of electronic equipment, or the two dimensional code that electronic equipment is shown prints to papery version Two dimensional code, show papery version two dimensional code.
Present inventor in the implementation of the present invention, it is found that current user is scanned the two-dimensional code using mobile phone, exists Following problem.
No matter the two dimensional code of two dimensional code or papery version that electronic equipment is shown, once show two dimensional code, two dimensional code Size immobilizes.Since the size of two dimensional code immobilizes, user needs to adjust between mobile phone and the two dimensional code scanned Distance, for example, if not scanning all two dimensional codes, it is necessary to user's adjustment mobile phone is mobile to the separate two dimensional code scanned, To distinguish two dimensional code, the identification mode of such two dimensional code is more single.
Summary of the invention
The embodiment of the present invention is designed to provide a kind of two-dimensional code generation method, two dimension code reading method and device, solution The more single problem of the identification mode of certainly current two dimensional code.
Specific technical solution is as follows:
In a first aspect, present invention implementation provides a kind of two-dimensional code generation method, which comprises
Two dimensional code to be processed is obtained, the two dimensional code to be processed includes: multiple regions for having been provided with color, will have been provided with color Color region, as region is set, the color is formed by three color components of three-dimensional color space, three face Colouring component is respectively as follows: the first color component of default number change, and the of the second color component of default number and default number Three color components;
Each region that set is divided as L row × L column resetting color area, the L is greater than or equal to 2;
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each region that set and is associated with L2It is a to be set region;
The associated L in region is set based on each2It is a to be set region and each set the associated L in region2It is a to be set region respectively Color, determine resetting color area in L2A resetting color, the resetting color is the changed by the default number The third color component formation of one color component, the second color component of default number change, the default number;
By L2A resetting color setting obtains processed two dimensional code in L row × L column resetting color area.
Further, described by L2A resetting color setting obtains processed in L row × L column resetting color area Two dimensional code, comprising:
It is determined as the resetting color area that resetting color has been arranged to be set region, divides each region that set as L row × L The resetting color area of column, the L are greater than or equal to 2;
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each region that set and is associated with L2It is a to be set region;
The associated L in region is set based on each2It is a to be set region and each set the associated L in region2It is a to be set region respectively Color, determine resetting color area in L2A resetting color, the resetting color are the first of default number change What the third color component that color component, the second color component of default number change, default number change was formed;
By L2A resetting color setting obtains processed two dimensional code in L row × L column resetting color area.
Further, each to be calculated by the binary system set in binary sequence of the region for indicating the two dimensional code Symbol;
It is described to be set the associated L in region based on each2It is a to be set region and each set the associated L in region2It is a to be set region Respective color determines the L in resetting color area2A resetting color, comprising:
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each region that set and is associated with L2It is a to be set the respective binary system subsequence in region, as associated binary system subsequence, the associated sub- sequence of binary system Column are each to be set the associated L in region by described2It is a to be set what the binary operator that region respectively indicates formed;
According to the mapping relations of preset color and binary operator, determine that the binary system in associated binary system subsequence is calculated The preset color for according with mapping, as the resetting respective resetting color of color area.
Further, multiple regions that set are in P row × P column;
It is each to be set region and associated L using following steps2Position association is established in a region that set:
As the multiple region that set for being set Nth row m column in region, the N is greater than 0 in each region that set, And it is less than or equal to the integer of P, the M is greater than 0, and is less than or equal to the integer of P;
Each region respectively associated L is set with described2It is a by set region include: it is the multiple by set in regionRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region.
Second aspect, the embodiment of the invention provides two dimension code reading method, the two dimension code reading method includes:
It scans the two-dimensional code;
Obtain in the two dimensional code it is each set the divided rule in region and, divided rule is based on, from described Scanned in two dimensional code it is multiple set region, it is described it is each set the divided rule in region for division it is each set region as The resetting color area of L row × L column, it is described to be set region and have been provided with color;
If the multiple region quantities for being set region scanned are less than predeterminable area quantity, scanned from described It is multiple to be set in region, the region quantity of resetting color area is obtained, the predeterminable area quantity is all of the two dimensional code Set the region sum in region;
If the region quantity of the resetting color area is greater than or equal to the predeterminable area quantity, the resetting is read The color that color area is equipped with, the color that the resetting color area is equipped with is to be set the associated L in region based on each2It is a to be set Region and each set the associated L in region2It is a to be set what the respective color in region obtained;
From the resetting color area, the color of three-dimensional color space is extracted;
According to the mapping relations of preset color and binary operator, the color that the resetting color area is extracted, mapping At binary sequence.
Further, the method also includes:
If the multiple region quantities for being set region scanned are greater than or equal to predeterminable area quantity, swept from described Retouch it is multiple set in region, obtain each color for being set the resetting color area that region respectively divides and being equipped with;
It is set the color that the resetting color area that region respectively divides is equipped with by each and is averaged, obtain each quilt If the color average value in region;
If each color average value for being set region is higher than the second preset color, each color for being set region is averaged Value is mapped as the first binary operator;
Alternatively, being set region for each if each color average value for being set region is lower than second preset color Color average value be mapped as the second binary operator, the numerical value of first binary operator and second binary operator It is different.
Further, the mapping relations according to preset color and binary operator propose the resetting color area The color taken, is mapped to binary sequence, comprising:
Determine the number of species for the color that the resetting color area is equipped with;
From the binary operator of preset color mapping, in the mapping relations between preset color, according to type quantity, is looked for To the corresponding binary operator of color that resetting color area is equipped with described in every kind;
According to the binary operator that preset color maps, every kind of color pair in the mapping relations between the preset color The binary operator answered, the color that the resetting color area is equipped with, is mapped to binary sequence.
The third aspect, present invention implementation provide a kind of two dimensional code generating means, and the two dimensional code generating means include:
First obtains module, and for obtaining two dimensional code to be processed, the two dimensional code to be processed includes: multiple to have been provided with color Region, the region of color will be had been provided with, as region is set, the color is three color components by three-dimensional color space It is formed, three color components are respectively as follows: the first color component of default number change, the second color point of default number The third color component of amount and default number;
Division module, for dividing each region that set as L row × L column resetting color area, the L is greater than or equal to 2;
Second obtains module, for pre-establishing the associated L in position from each region that set2It is a to be set in region, it obtains The associated L in region is set to each2It is a to be set region;
First obtains module, for being set the associated L in region based on each2A region and each region that set of being set is associated with L2It is a to be set the respective color in region, determine the L in resetting color area2A resetting color, the resetting color are by described The third color of first color component of default number change, the second color component of default number change, the default number What component was formed;
Second obtains module, is used for L2A resetting color setting obtains in L row × L column resetting color area The two dimensional code of processing.
Further, described second module is obtained, is specifically used for:
It is determined as the resetting color area that resetting color has been arranged to be set region, divides each region that set as L row × L The resetting color area of column, the L are greater than or equal to 2;
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each region that set and is associated with L2It is a to be set region;
The associated L in region is set based on each2It is a to be set region and each set the associated L in region2It is a to be set region respectively Color, determine resetting color area in L2A resetting color, the resetting color are the first of default number change What the third color component that color component, the second color component of default number change, default number change was formed;
By L2A resetting color setting obtains processed two dimensional code in L row × L column resetting color area.
Further, each to be calculated by the binary system set in binary sequence of the region for indicating the two dimensional code Symbol;
Described first obtains module, is specifically used for:
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each region that set and is associated with L2It is a to be set the respective binary system subsequence in region, as associated binary system subsequence, the associated sub- sequence of binary system Column are each to be set the associated L in region by described2It is a to be set what the binary operator that region respectively indicates formed;
According to the mapping relations of preset color and binary operator, determine that the binary system in associated binary system subsequence is calculated The preset color for according with mapping, as the resetting respective resetting color of color area.
Further, multiple regions that set are in P row × P column;
Described device further include: establish module, this establishes module, each to be set region and phase for using following steps Associated L2Position association is established in a region that set:
It is each to be set region and associated L using following steps2Position association is established in a region that set:
As the multiple region that set for being set Nth row m column in region, the N is greater than 0 in each region that set, And it is less than or equal to the integer of P, the M is greater than 0, and is less than or equal to the integer of P;
Each region respectively associated L is set with described2It is a by set region include: it is the multiple by set in regionRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region.
Fourth aspect, present invention implementation provide a kind of two dimension code reading device, and the two dimension code reading device includes:
First read module, for scanning the two-dimensional code;
Second read module, for obtain in the two dimensional code it is each set region it is divided rule and, be based on quilt The rule of division, scanned from the two dimensional code it is multiple set region, it is described it is each set the divided rule in region as Divide each resetting color area for being set region and arranging as L row × L, it is described to be set region and have been provided with color;
Third obtains module, if being less than predeterminable area number for the multiple region quantities for being set region scanned Amount, then from it is described scan it is multiple set in region, obtain reset color area region quantity, the predeterminable area quantity For all region sums for being set region of the two dimensional code;
Third read module, if the region quantity for the resetting color area is greater than or equal to the predeterminable area number Amount then reads the color that the resetting color area is equipped with, and the color that the resetting color area is equipped with is set based on each The associated L in region2It is a to be set region and each set the associated L in region2It is a to be set what the respective color in region obtained;
Extraction module, for extracting the color of three-dimensional color space from the resetting color area;
Mapping block proposes the resetting color area for the mapping relations according to preset color and binary operator The color taken, is mapped to binary sequence.
Further, described device further include: the 4th obtains module, and the described 4th obtains module, is used for:
If the multiple region quantities for being set region scanned are greater than or equal to predeterminable area quantity, swept from described Retouch it is multiple set in region, obtain each color for being set the resetting color area that region respectively divides and being equipped with;
It is set the color that the resetting color area that region respectively divides is equipped with by each and is averaged, obtain each quilt If the color average value in region;
If each color average value for being set region is higher than the second preset color, each color for being set region is averaged Value is mapped as the first binary operator;
If each color average value for being set region is lower than second preset color, by each color for being set region Average value is mapped as the second binary operator, and first binary operator is different with the numerical value of second binary operator.
Further, the mapping block, is specifically used for:
Determine the number of species for the color that the resetting color area is equipped with;
From the binary operator of preset color mapping, in the mapping relations between preset color, according to type quantity, is looked for To the corresponding binary operator of color that resetting color area is equipped with described in every kind;
According to the binary operator that preset color maps, every kind of color pair in the mapping relations between the preset color The binary operator answered, the color that the resetting color area is equipped with, is mapped to binary sequence.
5th aspect, present invention implementation provide a kind of electronic equipment, including processor, communication interface, memory and logical Believe bus, wherein processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes method and step described in first aspect.
6th aspect, present invention implementation provide a kind of electronic equipment, including processor, communication interface, memory and logical Believe bus, wherein processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes method and step described in second aspect.
7th aspect, present invention implementation provide a kind of computer readable storage medium, the computer-readable storage medium Instruction is stored in matter, when run on a computer, so that computer executes any method of above-mentioned first aspect.
Eighth aspect, present invention implementation provide a kind of computer readable storage medium, the computer-readable storage medium Instruction is stored in matter, when run on a computer, so that computer executes any method of above-mentioned second aspect.
9th aspect, present invention implementation additionally provides a kind of computer program product comprising instruction, when it is in computer When upper operation, so that computer executes any method of above-mentioned first aspect.
Tenth aspect, present invention implementation additionally provides a kind of computer program product comprising instruction, when it is in computer When upper operation, so that computer executes any method of above-mentioned second aspect.
A kind of two-dimensional code generation method provided in an embodiment of the present invention is set region for each in two dimensional code to be processed, is drawn It is divided into L row × L column resetting color area;The associated L in position is pre-established from each region that set2It is a to be set in region, It obtains each being set the associated L in region2It is a to be set region;The associated L in region is set based on each2It is a to be set region and each quilt If the associated L in region2It is a to be set the respective color in region, determine the L in resetting color area2A resetting color, resetting color are By the third color point of the first color component of default number change, the second color component of default number change, default number What amount was formed;By L2A resetting color setting obtains processed two dimensional code in L row × L column resetting color area.
It can be seen that each of two dimensional code to be processed is set region, it is divided into L row × L column resetting color area, weight The size for setting color area be set region be equivalent to 1/L2Times, and all respective resetting colors of resetting color area From in all colors for being set region of two dimensional code to be processed, it is equivalent to, in being set in region for two dimensional code to be processed, is embedded in Reset the resetting color of color area.In this way, not only all of two dimensional code to be processed are set region, two dimensional code institute to be processed is shown There is the color for being set region, moreover, resetting color area, also shows that two dimensional code to be processed is set the color in region, so as to By two dimensional code set region and resetting color area recognizes processed two dimensional code, increase processed two dimensional code Identification mode, also improve the information carrying capacity of processed two dimensional code.
A kind of two dimension code reading method provided in an embodiment of the present invention obtains and each in the two dimensional code of scanning is set region quilt The rule of division and, be based on divided rule, scanned from two dimensional code it is multiple set region, it is each to be set region quilt The rule of division is that multiple each of regions that set are set region, is divided into L row × L column resetting color area, is set Region has been provided with color;If the multiple region quantities for being set region scanned are less than predeterminable area quantity, from what is scanned It is multiple to be set in region, the region quantity of resetting color area is obtained, predeterminable area quantity is that all of two dimensional code are set region Region sum;If the region quantity for resetting color area is greater than or equal to predeterminable area quantity, resetting color area is read The color being equipped with;According to the binary operator that preset color maps, mapping relations between preset color will reset color zones The color that domain is equipped with, is mapped to binary sequence.
It can be seen that compared to the prior art, if only scanning partial region in two dimensional code, that is, resetting color zones Domain, it is not all to be set region, and in the two dimensional code scanned, the quantity for resetting color area is greater than or equal to predeterminable area Quantity then reads the color that resetting color area is equipped with, is mapped to binary sequence, do not need user and adjust mobile phone and scanned The distance between two dimensional code, improve the identification of two dimensional code, improve the efficiency that user information obtains.
Certainly, it implements any of the products of the present invention or method must be not necessarily required to reach all the above excellent simultaneously Point.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described.
Fig. 1 is the first pass schematic diagram of two-dimensional code generation method provided in an embodiment of the present invention;
Fig. 2 is the idiographic flow schematic diagram of step 140 in Fig. 1 provided in an embodiment of the present invention;
Fig. 3 is the second procedure schematic diagram of two-dimensional code generation method provided in an embodiment of the present invention;
Fig. 4 is the schematic diagram of the two dimensional code to be processed of the embodiment of the present invention;
Fig. 5 is the first schematic diagram of the processed two dimensional code of the embodiment of the present invention;
Fig. 6 is the second schematic diagram of the processed two dimensional code of the embodiment of the present invention;
Fig. 7 is the first pass schematic diagram of two-dimensional code generation method provided in an embodiment of the present invention
Fig. 8 is the structural schematic diagram of the two dimensional code generating means of the embodiment of the present invention;
Fig. 9 is the structural schematic diagram of the two dimension code reading device of the embodiment of the present invention;
Figure 10 is the structural schematic diagram of the corresponding electronic equipment of two dimensional code of embodiment of the present invention generating means;
Figure 11 is the structural schematic diagram that the embodiment of the present invention is the corresponding electronic equipment of two dimension code reading device.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention is described.
Identification mode in order to solve the problems, such as prior art two dimensional code is more single, and the embodiment of the present invention provides one kind two Code generating method, two dimension code reading method and device are tieed up, is set region for each in two dimensional code to be processed, is divided into L row × L column Resetting color area;The associated L in position is pre-established from each region that set2It is a to be set in region, obtain each set The associated L in region2It is a to be set region;The associated L in region is set based on each2It is a to be set region and each to be set region associated L2It is a to be set the respective color in region, determine the L in resetting color area2A resetting color, resetting color are to be become by default number The first color component, the second color component of default number change, the third color component of default number more is formed;By L2 A resetting color setting obtains processed two dimensional code in L row × L column resetting color area.
It can be seen that each of two dimensional code to be processed is set region, it is divided into L row × L column resetting color area, The size of resetting color area be set region be equivalent to 1/L2Times, and all respective resetting colors of resetting color area It from all colors for being set region of two dimensional code to be processed, is equivalent to, in being set in region for two dimensional code to be processed, insertion The resetting color of resetting color area.In this way, not only all of two dimensional code to be processed are set region, two dimensional code to be processed is shown All colors for being set region, moreover, resetting color area, also shows that two dimensional code to be processed is set the color in region, so as to With by two dimensional code set region and resetting color area recognizes processed two dimensional code, increase processed two dimension The identification mode of code, also improves the information carrying capacity of processed two dimensional code.Compared to the prior art, if only scanning to two Partial region in code, that is, resetting color area are tieed up, it is not all to be set region, and in the two dimensional code scanned, resetting The quantity of color area is greater than or equal to predeterminable area quantity, then reads the color that is equipped with of resetting color area, be mapped to two into Sequence processed does not need the distance between the two dimensional code that user adjusts mobile phone with scanned, improves the identification of two dimensional code, improves The efficiency that user information obtains.
In a first aspect, a kind of two-dimensional code generation method provided in an embodiment of the present invention is introduced first below.
The adaptable industry of two-dimensional code generation method provided by the embodiment of the present invention, such as logistic industry, further , it is applied to the wholesale and retails industries such as market, supermarket.Two-dimensional code generation method provided by the embodiment of the present invention is adaptable Electronic equipment, such as mobile terminal, further, POS (point of sale, point-of-sale system) machine, smart phone etc..
Referring to Fig. 1, Fig. 1 is the first pass schematic diagram of two-dimensional code generation method provided in an embodiment of the present invention.The present invention A kind of two-dimensional code generation method provided by embodiment, may include steps of:
Step 110, two dimensional code to be processed is obtained, which includes: multiple regions for having been provided with color, will If the colorful one region, as region is set, color is formed by three color components of three-dimensional color space, three face Colouring component is respectively as follows: the first color component of default number change, and the of the second color component of default number and default number Three color components.
The embodiment of the present invention needs to carry out two dimensional code to reset the processing of color, and therefore, this two dimensional code is known as wait locate Manage two dimensional code.This two dimensional code to be processed of the embodiment of the present invention can be distinguished with final processed two dimensional code.Wait locate Two dimensional code is managed to illustrate to need to carry out two dimensional code resetting color, and, processed two dimensional code, which refers to, have been completed to be processed two Dimension code carries out the two dimensional code of resetting color.
If the chequered with black and white figure that two dimensional code to be processed is showed in the embodiment of the present invention, these figures are for remembering Data symbol information is recorded, illustratively, data symbol information includes: Retail commodity, storage and transportation package goods, Logistic Unit and two dimension Code mark.Each black patch figure/white block graphics in these chequered with black and white figures, is properly termed as black block/white blocks respectively. Here black block and white blocks may be collectively referred to as color lump.Position of each color lump in two dimensional code to be processed, is referred to as set area Domain.That is, setting the colorful one is set region, it is properly termed as color lump.These, which are set region, can refer to two dimensional code to be processed In it is not divided set region, be also possible to have been divided in two dimensional code to be processed, and reset color is set region.Only If comprising colored, and belonging to the region for having been provided with color in two dimensional code, belongs to the embodiment of the present invention and set region.
Wherein, the three-dimensional color space can be YUV color space, three color component packets of the YUV color space It includes: a two color difference components UV and luminance component Y.The three-dimensional color space may be RGB color, the RGB face Three color components of the colour space include: red color component R, green color component G and blue color component B.As long as can Realize that the three-dimensional color space of the scheme of the embodiment of the present invention can be not limit herein.
For YUV color space, the first color component of default number change can be color difference components U, color difference point Any one color component in V and luminance component Y is measured, in addition to the first color component of default number change, remaining two A color component in color component can be the second color component of default number, surplus in remaining two color component Color component of remaininging can be the third color component of default number.Or " the first of default number change of RGB color Color component, the second color component of default number and the third color component of default number " similarly, herein no longer specifically It is bright.
General default number is usually any value to be taken in [0,255], but optional default number is 128, each meeting It is by the color component change of a default number in three color components, and by this color component change default number Two values, the color that the two numerical value eventually form can be used to distinguish, the binary operator (0 and 1) of two dimensional code to be processed, It is namely equivalent to, obtains the mapping relations of preset color and binary operator, facilitate later period two dimension code reading.The two numerical value The numerical value that can be pre-defined optional two values can not also be done herein in [0,255] depending on being needed according to user It limits.
Illustratively, if two dimensional code to be processed by set region be not divided set region, this is set region Interior color can be original color in black or white, that is, two dimensional code to be processed;It is, color difference components U and Two color difference components of color difference components V are the second color component of default number and the third color component of default number, brightness Component Y is the first color component of default number change.The luminance component Y of default number change is where luminance component Y The brightness range in remove numerical value other than 128.The color is by the color difference components U of default number, the color difference point of default number Amount V and luminance component Y is obtained.The color difference components U of default number can be that the color difference components V of 128, default number can be 128 and luminance component Y can be negated 128 numerical value, for example, luminance component Y is 0 or 255.The case where luminance component Y is 0 Under, then original color in two dimensional code to be processed is black;Or in the case where luminance component Y is 255, then two dimension to be processed Original color in code is white.
If two dimensional code to be processed set region be have been divided, and reset color set region, then this is set Color in region, the resetting color set in region in two dimensional code exactly to be processed.It is, it is, color difference components U The second color component and color difference components V for default number change are the third color component of default number, and luminance component Y is First color component of default number change.It is, color difference components U, default number that the color is changed by default number What the color difference components V and luminance component Y of default number change was obtained.Color difference components U is the second color of default number change Component, color difference components U is the numerical value removed other than 128 within the scope of the color difference where the color difference components, for example, color difference components U is 0 or 255.Default number change color difference components U can for 0 or 255, default number color difference components V can be 128 with And luminance component Y can be 0 or 255.In this way can be on the Color mode that last time is set region, only one color of change divides Amount is equivalent to the color difference components U plane for being embedded in default number change on the two dimensional code of luminance component Y using color difference components U A two dimensional code.
Similarly, color difference components U be default number the second color component and color difference components V be default number change third Color component;Alternatively, the second color component for changing of two color difference components default numbers of color difference components U and color difference components V and The third color component of default number change;Then again by the first color component and the second color component and third color component When, luminance component Y is 0 or 255.Color difference range where above-mentioned color difference U component is [0,255], where above-mentioned color difference V component Color difference range is [0,255], and the Color Range where above-mentioned color is [0,255].It is equivalent to, above-mentioned color includes: original Color and resetting color, specific color determine according to the actual situation.
In order to get two dimensional code to be processed, this step 110 can be using following at least one possible realization side Formula obtains two dimensional code to be processed, specifically includes:
In one possible implementation, from preset two-dimensional code data library, obtain any two dimensional code, by this two Tie up code conduct, two dimensional code to be processed;Preset two-dimensional code data library is for storing the pre-stored required two dimensional code of user.In this way User is facilitated to be directly obtained two dimensional code to be processed.
Since above-mentioned preset two-dimensional code data inventory is the committed memory the problem of, to solve this problem, another In the possible implementation of kind, the binary sequence of the two dimensional code of reception user's input, the preset rules based on binary sequence, Generate two dimensional code to be processed.User can input binary sequence in real time in this way, reduce above-mentioned preset two-dimensional code data library Committed memory, generates two dimensional code to be processed in time, also meets the requirement that user inputs two dimensional code in time.
Above-mentioned binary sequence is made of binary operator, and wherein binary operator is respectively 0,1.First binary system is calculated Symbol is one in binary operator, and the second binary operator is another in binary operator.For example, the first binary system is calculated Symbol is 0, and the second binary operator is 1;Second binary operator is 1, and the first binary operator is 0.
The preset rules that following binary sequence is used in above-mentioned alternatively possible implementation, generate to be processed two Tie up code:
By every tetrad of the binary sequence of two dimensional code, it is divided into one group of binary system subsequence;By all groups Binary system subsequence, generate two dimensional code to be processed.Subsequent use is facilitated to handle every group of binary system subsequence in this way, side Just region is set where every four binary numbers of later-stage utilization to be decoded.
Step 120, each region that set is divided as L row × L column resetting color area, and L is greater than or equal to 2.
Wherein, if the unallocated color for being set region can pass through scanning as black or white in two dimensional code to be processed The color for being set region of two dimensional code to be processed or the resetting color for resetting color area, and then distinguish and obtain binary sequence.
If being set the color in region as black or white, these are already divided into L by region is set2It is a set region after, Division is obtained into L2It is a to be set region, referred to as reset color area.
In this step 120, divides each region that set and specifically included as L row × L resetting color area arranged: is irregular to draw Divide each region that set as L row × L column resetting color area.As long as the resetting color zones of respective resetting color can be shown Domain belongs to protection scope of the embodiment of the present invention.
Due to irregularly dividing each resetting color area size for being set region and may be such that two dimensional code shows It is different, it has not been convenient to which that the size of unified adjustment resetting color area it is uncomfortable also to make user's visual sense, therefore in order to solve this A problem, step 120 of the embodiment of the present invention can be using following at least one possible implementations, and division is each to be set region The resetting color area arranged for L row × L:
In one possible implementation, point each region that set is evenly dividing as L row × L column resetting color zones Domain.In this way can be according to the number of the required division of unified setting, division is each to be set region, further, it is possible to convenient uniform It shows resetting color area, improves users'comfort.
Step 130, the associated L in position is pre-established from each region that set2It is a to be set in region, obtain each set The associated L in region2It is a to be set region.
It is above-mentioned to be set that region is default to establish the associated L in position with each2It is a to be set region, that is, it is each set region with Associated L2Position association is established in a region that set, and is to be set region based on each, is established and associated L2It is a to be set region Position association.It can specifically be needed according to user or industrial requirement, the position established are associated with.
Region and associated L are set in order to each in determination two dimensional code to be processed2It is a to be set region, therefore this step Rapid 130 can use following steps, each to be set region and associated L2Position association is established in a region that set:
Multiple regions that set are in P row × P column;It is each by set region as it is multiple set Nth row m column in region set area Domain, wherein N is greater than 0, and is less than or equal to the integer of P, and M is greater than 0, and is less than or equal to the integer of P;
Region respectively associated L is set with each2It is a by set region include: it is multiple by set in regionRowColumn are set region, wherein i ∈ (0, L], j ∈ (0, L], I, j are positive integer.Every time from i ∈ (0, L] in be followed successively by i and take a fixed value when, from j ∈ (0, L] in be followed successively by j and take not With value, obtain being set region respectively associated L with each2It is a to be set region;Alternatively, every time from j ∈ (0, L] in successively i take When one fixed value, from i ∈ (0, L] in successively take different value to j, obtain being set region respectively associated L with each2It is a Set region.Specifically, referring to as follows:
Region respectively associated L is set with each2It is a by set region include: it is multiple by set in regionRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region.
First example, when the value of L is 2, L2Value be 4, resetting color area is in the column of 2 rows × 2;P=24, it is multiple Region is set to arrange in 24 rows × 24, it is each to be set region and associated L2Position association is established in a region that set:
As multiple regions that set for being set Nth row m column in region, N is greater than 0, and is less than or equal to P in each region that set Integer, M be greater than 0, and be less than or equal to P integer;
Region respectively associated 2 is set with each2A region that set includes: multiple the 2nd [(N-1) set in region Mod12]+1 row the 2nd [(M-1) mod12]+1 arrange set region, the 2nd [(M-1) mod12]+2 of the 2nd [(N-1) mod12]+1 row Column are set region, and [(M-1mod12+1 column are set region and 2N-1mod12+2 for the the 2nd [(N-1) mod12]+2 row the 2nd Row 2M-1mod12+2 column are set region.
Region each can be set in this way set region with respectively associated 4 establish positional relationship, it is convenient to grasp It is each set region in the case where, direct use is set region and is respectively set region for associated 4 with each.
Second example, when the value of L is 4, L2Value be 16, resetting color area is in the column of 4 rows × 4;P=24 is more A region that set is in 24 rows × 24 column.Here it can realize that value is 16 L by two ways2.Wherein, a kind of realization side Formula, can by divide twice it is each by set region complete.Specifically,
Each region that set is divided as 2 rows × 2 column resetting color area, and 2 row × 2 column resetting color zones Resetting color has been arranged in domain, then is determined as the resetting color area that resetting color has been arranged to be set region again;It will again really Fixed is set region division as 2 rows × 2 column resetting color area, to the resetting color area redefined, and then is obtained in 4 The resetting color area of × 4 column of row.
In this way, being set region and associated L for each according to above-mentioned first example2It is a set region establish position into Two secondary association of row, both can, complete when resetting color area in the column of 4 rows × 4, it is each to be set region and associated L2It is a to be set The associated process in position is established in region.
Another implementation, it is each by set region as it is the multiple set Nth row m column in region set region, The N is greater than 0, and is less than or equal to the integer of P, and the M is greater than 0, and is less than or equal to the integer of P;
Region respectively associated 4 is set with each2A region that set includes: multiple the 4th [(N-1) set in region Mod12]+1 row the 4th [(M-1) mod12]+1 arrange set region,
The 4th [(M-1) mod12]+2 of 4th [(N-1) mod12]+1 row column are set region,
The 4th [(M-1) mod12]+3 of 4th [(N-1) mod12]+1 row column are set region,
The 4th [(M-1) mod12]+4 of 4th [(N-1) mod12]+1 row column are set region,
The 4th [(M-1) mod12]+1 of 4th [(N-1) mod12]+2 row column are set region,
The 4th [(M-1) mod12]+2 of 4th [(N-1) mod12]+2 row column are set region,
The 4th [(M-1) mod12]+3 of 4th [(N-1) mod12]+2 row column are set region,
The 4th [(M-1) mod12]+4 of 4th [(N-1) mod12]+2 row column are set region,
The 4th [(M-1) mod12]+1 of 4th [(N-1) mod12]+3 row column are set region,
The 4th [(M-1) mod12]+2 of 4th [(N-1) mod12]+3 row column are set region,
The 4th [(M-1) mod12]+3 of 4th [(N-1) mod12]+3 row column are set region,
The 4th [(M-1) mod12]+4 of 4th [(N-1) mod12]+3 row column are set region,
The 4th [(M-1) mod12]+1 of 4th [(N-1) mod12]+4 row column are set region,
The 4th [(M-1) mod12]+2 of 4th [(N-1) mod12]+4 row column are set region,
What the 4th [(M-1) mod12]+3 of the 4th [(N-1) mod12]+4 row was arranged is set region, and,
The 2nd [(M-1) mod12]+4 of 4th [(N-1) mod12]+4 row column are set region.
Region each can be set in this way set region with respectively associated 16 establish positional relationship, it is convenient to grasp It is each set region in the case where, direct use is set region and is respectively set region for associated 16 with each.
Step 140, the associated L in region is set based on each2It is a to be set region and each set the associated L in region2It is a to be set The respective color in region determines the L in resetting color area2A resetting color, resetting color are the changed by default number The third color component formation of one color component, the second color component of default number change, default number.
The unallocated color for being set region in two dimensional code, is referred to as set the color in region in the embodiment of the present invention.This The color in region is set, can be distinguished with resetting color.The resetting color of the embodiment of the present invention refers to needs to resetting color The color that color region is reset.
Above-mentioned resetting color can be definition color;Defining color can need to be configured according to user, can also be with base The associated L in region is set in each2It is a to be set region and each set the associated L in region2It is a to be set the respective color in region, really Surely the L in color area is reset2A resetting color, the resetting color are the first color point changed by the default number It measures, the third color component of the second color component of default number change, the default number obtains.
Step 150, by L2A resetting color setting obtains processed two dimension in L row × L column resetting color area Code.
If being directed to all resetting color areas, resetting color is completed to be arranged in respective resetting color area In, it only needs to obtain processed two dimensional code at present, then this step 150 can be using following at least one implementation, by L2 A resetting color setting obtains processed two dimensional code in L row × L column resetting color area:
For all resetting color areas, by L2A resetting color is arranged in L row × L column resetting color area, All resetting color areas of resetting color will be completed, has generated processed two dimensional code.It can need to carry out this in this way Color is reset, required processed two dimensional code is obtained, quickly and easily obtains required processed two dimensional code.
Since the embodiment of the present invention uses three-dimensional color space, for all resetting color areas, by L2A weight Color setting is set in L row × L column resetting color area, it is also necessary to the resetting color zones for having completed setting resetting color Domain, then resetting color is carried out, processed two dimensional code is finally obtained, then this step 150 can be using the following first step to the 4th The step of step, is realized L2A resetting color setting obtains processed two dimensional code in L row × L column resetting color area:
The resetting color area that resetting color has been arranged is determined as being set region by the first step, and division is each to be set region For L row × L column resetting color area, L is greater than or equal to 2;
Second step pre-establishes the associated L in position from each region that set2It is a to be set in region, obtain each set The associated L in region2It is a to be set region;
Third step is set the associated L in region based on each2It is a to be set region and each set the associated L in region2It is a to be set The respective color in region determines the L in resetting color area2A resetting color, resetting color are the first of default number change What the third color component that color component, the second color component of default number change, default number change was formed;
4th step, by L2A resetting color setting obtains processed two dimension in L row × L column resetting color area Code.It can carry out repeatedly resetting color in this way, meet the needs of different user, it can also be by the resetting color zones that are repeatedly arranged Domain shows the color of a full two-dimensional code respectively, increases the identification mode of processed two dimensional code.Subsequent user can benefit The color being equipped with the color of any one two dimensional code, recognition resetting color area, is mapped to binary sequence, does not need user's tune Whole mobile phone and the distance between the two dimensional code scanned improve the identification of two dimensional code, improve the efficiency that user information obtains.
The step of by the above-mentioned first step to four step, can by by set region start divide number as 4 parts, that is, L2Value be 4;Being set region terminates the number of division as 16 parts, that is, L2Value be 16.General 4 parts can show The color of one full two-dimensional code, it is already possible to meet the needs of users, 16 parts of colors that can show a full two-dimensional code Coloured silk meets the higher demand of user.
The two-dimensional code generation method of the embodiment of the present invention is equivalent to realization for all of two dimensional code to be processed and is set region, Universal formulation is L row × L column matrix L2A region;All regions that set in each region are divided into L row × L column matrix L2A resetting color area, all resetting color areas in region each in this way include that all of two dimensional code to be processed are set The color in region.In this way can be by being set region and being formed the color of a full two-dimensional code, it can also be in all of each region The color that a full two-dimensional code is shown in color area is reset, it is, a processed two dimensional code may include one L after the color of two dimensional code to be processed, and division2The color of two dimensional code to be processed, that is, a processed two dimensional code is total to be wrapped Containing at least L2The color of+1 two dimensional code increases the identification mode of processed two dimensional code.Subsequent user can use any The color of a two dimensional code, the color that recognition resetting color area is equipped with, is mapped to binary sequence, does not need user and adjusts mobile phone With the distance between the two dimensional code scanned, the identification of two dimensional code is improved, improves the efficiency that user information obtains.
In conjunction with above-mentioned embodiment shown in FIG. 1, referring to fig. 2, Fig. 2 is step 140 in Fig. 1 provided in an embodiment of the present invention, It can realize using following steps 141 to step 142 and be set the associated L in region based on each2It is a to be set region and each set The associated L in region2It is a to be set the respective color in region, determine the L in resetting color area2A resetting color:
Each binary operator set in binary sequence of the region for indicating the two dimensional code;
Step 141, the associated L in position is pre-established from each region that set2It is a to be set in region, obtain each set The associated L in region2It is a to be set the respective binary system subsequence in region, as associated binary system subsequence, associated binary system Subsequence is to be set the associated L in region by each2It is a to be set what the binary operator that region respectively indicates formed.
This step 141, can be by following at least one possible implementation, and lookup is each to be set region associated two System subsequence:
In one possible implementation, the associated L in position is pre-established according to each region that set2The area Ge Beishe Domain directly finds out from the binary sequence of the two dimensional code of acquisition and each is set the associated binary system subsequence in region.In this way Can the associated binary system subsequence in region directly be set using each.
It is each to be set in binary sequence of the region for indicating the two dimensional code in alternatively possible implementation A binary operator;
The associated L in position is pre-established according to each region that set2It is a to be set region, from all colors set in region Coloured silk respectively obtains and each is set the associated L in region2A color for being set region;
According to the mapping relations of preset color and binary operator, the associated L in region is set based on each2It is a to be set region Color, obtain each being set the associated binary system subsequence in region.
Above-mentioned preset color can need to be configured according to user, and the mapping relations of preset color and binary operator can To be the mapping relations that will reset color and binary operator foundation, it is also possible to original color and is reflected with what binary operator was established Penetrate relationship.
Step 142, it according to the mapping relations of preset color and binary operator, determines in associated binary system subsequence The preset color of binary operator mapping, as the resetting respective resetting color of color area.
The embodiment of the present invention is set the associated binary system subsequence in region using each, by associated binary system subsequence In binary operator mapping preset color, be determined as L2A respective resetting color of resetting color area, in this way due to L2It is a Another color difference components of the respective resetting color of resetting color area corresponding first color difference components and the color for being set region Difference can distinguish the color for being set region and reset the resetting color of color area, not only all quilts of two dimensional code to be processed If region, all colors for being set region of two dimensional code to be processed are shown, moreover, resetting color area, also shows two dimension to be processed Code is set the color in region, so as to pass through being set region and resetting color area and recognize processed two in two dimensional code Code is tieed up, the identification mode of processed two dimensional code is increased, also improves the information carrying capacity of processed two dimensional code.Later period It can use the color for being set region and reset the color of color area, distinguish processed two dimensional code.
Shown in Figure 3, the specific implementation flow of the embodiment of the present invention is exemplified below.
It first explains, in Fig. 4 two dimensional code to be processed is illustrated only in Fig. 4, Fig. 5 and Fig. 6 is set region W.
Step 210, two dimensional code to be processed is obtained, two dimensional code to be processed includes: multiple regions for having been provided with color, will have been set The colorful one region, as region is set, color is formed by three color components of three-dimensional color space, three colors point Amount is respectively as follows: the first color component of default number change, the second color component of default number and the third face of default number Colouring component.
By the color difference components U of the default number for 128, it is the color difference components V of 128 default number, takes 0,255 default The luminance component Y of numerical value change forms the first color and is formed by color, and corresponding color is respectively black, white.Preset color Mapping relations with binary operator are respectively the mapping relations of binary operator 0 Yu black, and binary operator 1 is reflected with white Penetrate relationship.
As signal is set the represented partial binary operator in region in two dimensional code to be processed in Fig. 4:
The color for being set region of two dimensional code to be processed in Fig. 4: following only illustrate includes: the quilt of two dimensional code to be processed If the color of the color of the 1st row the 1st to the 1st row the 8th in the color in region, that is, 255,0,255,0,255,255,255, 0;The color of the color to the 1st row the 8th of 2nd row the 1st, that is, 0,255,0,255,255,0,0,0;The color that P row is the 1st The color of coloured silk to P row the 8th, that is, the color of the 0,255,255,255,0,255,0,255, the 1st row P, that is, the 0, the 2nd row P colors, that is, 0, and the color a to P row P, that is, 0.
Step 220, each region that set is divided as L row × L column resetting color area, and the value of L is 2.
Step 230, the associated L in position is pre-established from each region that set2It is a to be set in region, obtain each set The associated L in region2It is a to be set region.
Step 240, the associated L in region is set based on each2It is a to be set region and each set the associated L in region2It is a to be set The respective color in region determines the L in resetting color area2A resetting color, resetting color are the changed by default number The third color component formation of one color component, the second color component of default number change, default number.
In this step 240, it is determined as the respective resetting color of resetting color area and is respectively as follows: the color changed by default number Difference component U, the color difference components V of default number and default number change luminance component Y shape at.Color difference components U is default Second color component of numerical value change, color difference components U are to remove other than 128 within the scope of the color difference where the color difference components Numerical value, for example, color difference components U takes 0 or 255 respectively, the color difference components V of default number is 128, the brightness point of default number change Amount Y takes 0 or 255 respectively.
It is shown in Figure 5, it takes the color difference components U of the first numerical value, take the luminance component Y of second value and the color of default number Difference component V-arrangement at color and the second binary operator 1 between mapping relations;
Take the color difference components V-arrangement of the color difference components U of the first numerical value, the luminance component Y for taking the first numerical value and default number at Color and the first binary operator 0 between mapping relations;
Take the color difference components V-arrangement of the color difference components U of second value, the luminance component Y for taking second value and default number at Color and the second binary operator 1 between mapping relations;
Take the color difference components V-arrangement of the color difference components U of second value, the luminance component Y for taking the first numerical value and default number at Color and the first binary operator 0 between mapping relations.
The respective resetting color of the resetting color area of two dimensional code to be processed is indicated in the following way, only illustrates Fig. 4 In two dimensional code to be processed the color for being set the 1st row the 1st in the color in region to the 1st row the 4th color, that is, 255,0, 255,0;The color of the color to the 1st row the 4th of 2nd row the 1st, that is, 0,255,0,255;The color that P row is the 1st is to P The color that row is the 4th, that is, the color of the 0,255,255,255, the 1st row P, that is, the color of the 0, the 2nd row P, that is, 0, with And the color a to P row P, that is, 0 equal colors, respective resetting color of corresponding resetting color area etc., these signals The respective resetting color of the corresponding resetting color area of the color for being set region of two dimensional code to be processed in Fig. 4 out.
Step 250, the resetting color area that resetting color has been arranged is determined as being set region, division is each to be set region For L row × L column resetting color area, L is greater than or equal to 2;
Step 260, the associated L in position is pre-established from each region that set2It is a to be set in region, obtain each set The associated L in region2It is a to be set region;
Step 270, the associated L in region is set based on each2It is a to be set region and each set the associated L in region2It is a to be set The respective color in region determines the L in resetting color area2A resetting color, resetting color are the first of default number change What the third color component that color component, the second color component of default number change, default number change was formed;
Step 280, by L2A resetting color setting obtains processed two dimension in L row × L column resetting color area Code.
It is shown in Figure 6, the color difference components U of the first numerical value is taken, the luminance component Y of second value is taken and takes the first numerical value Color difference components V-arrangement at color and the second binary operator 1 between mapping relations;
The color difference components U of the first numerical value is taken, the luminance component Y of the first numerical value is taken and takes the color difference components V-arrangement of the first numerical value At color and the first binary operator 0 between mapping relations;
The color difference components U of second value is taken, the luminance component Y of second value is taken and takes the color difference components V-arrangement of the first numerical value At color and the second binary operator 1 between mapping relations;
The color difference components U of second value is taken, the luminance component Y of the first numerical value is taken and takes the color difference components V-arrangement of the first numerical value At color and the first binary operator 0 between mapping relations;
The color difference components U of the first numerical value is taken, the luminance component Y of second value is taken and takes the color difference components V-arrangement of second value At color and the second binary operator 1 between mapping relations;
The color difference components U of the first numerical value is taken, the luminance component Y of the first numerical value is taken and takes the color difference components V-arrangement of second value At color and the first binary operator 0 between mapping relations;
The color difference components U of second value is taken, the luminance component Y of second value is taken and takes the color difference components V-arrangement of second value At color and the second binary operator 1 between mapping relations;
The color difference components U of second value is taken, the luminance component Y of the first numerical value is taken and takes the color difference components V-arrangement of second value At color and the first binary operator 0 between mapping relations.
The embodiment of the present invention can carry out repeatedly resetting color due to three-dimensional color space by different colours component, this For sample using resetting color is carried out to the color for being set region twice, calculation amount is small, meets user demand.Not only two dimensional code to be processed It is all set region, show all colors for being set region of two dimensional code to be processed, moreover, resetting color area, also show to Processing two dimensional code is set the color in region, so as to pass through being set region and resetting color area and recognize in two dimensional code The two dimensional code of processing increases the identification mode of processed two dimensional code, also improves the information carrying of processed two dimensional code Ability.
Second aspect continues with and a kind of two dimension code reading method provided in an embodiment of the present invention is introduced.
Referring to Fig. 7, Fig. 7 is the first pass schematic diagram of two dimension code reading method provided in an embodiment of the present invention.The present invention A kind of two dimension code reading method provided by embodiment, may include steps of:
Step 310, it scans the two-dimensional code.
This step 310, specifically includes: electronic equipment first obtains the horizontal and vertical dimension of two dimensional code, is then set with electronics It is standby to scan the two-dimensional code;Boundary filter is subsequently used, as sobel (sobel operator, Sobel Operator) operator seeks two dimension The boundary position of code;Aligning is carried out to the two dimensional code scanned based on boundary position again, all boundaries of two dimensional code is made all to be Or horizontally or vertically, and spacing is equal;Influence of the intensity of illumination to entire two dimensional code is eliminated again;Then it asks between boundary Horizontal vertical distance.Wherein, sobel operator is one of the operator in image procossing, is mainly used as edge detection.Specific detailed mistake The Cheng Junwei prior art, details are not described herein.
Step 320, obtain two dimensional code in it is each set region it is divided rule and, be based on divided rule, from Scanned in two dimensional code it is multiple set region, each divided rule in region that set is each region that set of division as L row The resetting color area of × L column, this has been provided with color by region is set.
Step 330, judge whether the multiple region quantities for being set region scanned are less than predeterminable area quantity, preset areas Domain quantity is all region sums for being set region of two dimensional code, if so, 331 are thened follow the steps, if it is not, thening follow the steps 335. Predeterminable area quantity is determined by two dimensional code.
Step 331, from scan it is multiple set in region, obtain resetting color area region quantity.
Step 332, judge whether the region quantity for resetting color area is greater than or equal to predeterminable area quantity, if so, Step 333 is executed, if it is not, thening follow the steps 310;
Step 333, the color that resetting color area is equipped with, the color that resetting color area is equipped with, the resetting are read The color that color area is equipped with is to be set the associated L in region based on each2It is a to be set region and each set the associated L in region2It is a Set what the respective color in region obtained.
Step 334, from resetting color area, the color of three-dimensional color space is extracted.
In the case where the three-dimensional color space is YUV color space, this step 334 is mentioned from resetting color area Take the color difference components of YUV color space;The color difference components of YUV color space include: the color difference components U or color of YUV color space Difference component V and luminance component Y.
Step 335, according to the mapping relations of preset color and binary operator, the color that the resetting color area is extracted Coloured silk is mapped to binary sequence.The mapping relations of above-mentioned preset color and binary operator include: the first preset color and two into Second mapping relations of the first mapping relations of operator processed and the second preset color and binary operator, the content with above-mentioned restriction Identical, details are not described herein.
First mapping relations of the first preset color and binary operator here, can be for by the first color component, the The first preset color that second colors component and third color component are formed, in binary operator a binary operator or Mapping relations between second binary operator.
Specifically, the first numerical value and second value can in [0,255] value, binary operator include: the one or two into Operator processed and the second binary operator, illustratively, the first numerical value can be 0, and second value can be 255, the first binary system Operator be 0 and second binary operator be 1;
First mapping relations of the first preset color and binary operator can be with are as follows: by the first color point for taking the first numerical value The first preset color that amount, the second color component of default number and the third color component of default number are formed, with the one or two Mapping relations between system operator 0;
Second mapping relations of the second preset color and binary operator here, can be with are as follows: by take second value The second preset color that one color component, the second color component of default number and the third color component of default number are formed, With the mapping relations between the second binary operator 1.
First mapping relations of the first preset color and binary operator can be with are as follows:
By taking the color difference components U of the first numerical value, taking the luminance component Y of the first numerical value and the color difference components V-arrangement of default number At color and the first binary operator 0 between mapping relations;And
By taking the color difference components U of second value, taking the luminance component Y of the first numerical value and the color difference components V-arrangement of default number At color and the first binary operator 0 between mapping relations.
Second mapping relations of the second preset color and binary operator here, can be with are as follows:
Take the color difference components V-arrangement of the color difference components U of the first numerical value, the luminance component Y for taking second value and default number at Color and the second binary operator 1 between mapping relations;
Take the color difference components V-arrangement of the color difference components U of second value, the luminance component Y for taking second value and default number at Color and the second binary operator 1 between mapping relations.
First mapping relations of the first preset color and binary operator can be with are as follows:
The color difference components U of the first numerical value is taken, the luminance component Y of the first numerical value is taken and takes the color difference components V-arrangement of the first numerical value At color and the first binary operator 0 between mapping relations;
The color difference components U of second value is taken, the luminance component Y of the first numerical value is taken and takes the color difference components V-arrangement of the first numerical value At color and the first binary operator 0 between mapping relations;
The color difference components U of the first numerical value is taken, the luminance component Y of the first numerical value is taken and takes the color difference components V-arrangement of second value At color and the first binary operator 0 between mapping relations;And
The color difference components U of second value is taken, the luminance component Y of the first numerical value is taken and takes the color difference components V-arrangement of second value At color and the first binary operator 0 between mapping relations.
Second mapping relations of the second preset color and binary operator here, can be with are as follows:
The color difference components U of second value is taken, the luminance component Y of second value is taken and takes the color difference components V-arrangement of the first numerical value At color and the second binary operator 1 between mapping relations;
By taking the color difference components U of the first numerical value, taking the luminance component Y of second value and taking the color difference components V of the first numerical value Mapping relations between the color of formation and the second binary operator 1;
The color difference components U of the first numerical value is taken, the luminance component Y of second value is taken and takes the color difference components V-arrangement of second value At color and the second binary operator 1 between mapping relations;And
The color difference components U of second value is taken, the luminance component Y of second value is taken and takes the color difference components V-arrangement of second value At color and the second binary operator 1 between mapping relations.
Step 335 specifically includes: that step 1 is rapid, from scan it is multiple set in region, obtain that each to be set region each The color being equipped with from the resetting color area of division.
Second step is set each the color that the resetting color area that region respectively divides is equipped with and is averaged, is obtained every One is set the pixel average in region.
Third step judges that each pixel average for being set region is higher or lower than presetted pixel average value, if being higher than, It is rapid to then follow the steps step 4, if being lower than, it is rapid to execute step 5;
Step 4 is rapid, by each pixel average for being set region, is mapped as the first binary operator.
Presetted pixel average value can be configured according to user.Illustratively, presetted pixel average value is 128.
Step 5 is rapid, by each pixel average for being set region, is mapped as the second binary operator, the first binary system is calculated It accords with different with the numerical value of the second binary operator.Using 1 step of step to step 5 step, all pixels for being set region are averaged Value is mapped to binary operator, then is equivalent to and is mapped to binary sequence.
In order to distinguish set region and resetting color area, set the color in region, with resetting color area color not Together, when therefore two dimensional code being mapped to binary sequence, the number of species for the color that resetting color area is equipped with are needed to be grasped, it can To use following implementation, the color that the resetting color area is equipped with is mapped to binary sequence:
In one implementation, the first step determines the number of species for the color that resetting color area is equipped with.
Second step, according to the binary operator that preset color maps, every kind of color in the mapping relations between preset color Color corresponding binary operator, the color that resetting color area is equipped with, is mapped to binary sequence.
The binary operator of preset color mapping, the mapping relations between preset color can be according to resetting color The mapping relations that the number of species for the color that region is equipped with determine.For example, number of species are 2 kinds, according to both preset colors, Mapping relations are established with the binary operator of preset color mapping.Specifically, number of species are 2 kinds, this 2 kinds of preset color difference For black and white, the binary operator of black and black mapping establishes mapping relations, the binary system of white and white mapping for 0 Operator establishes mapping relations for 1.
For another example, number of species are 8 kinds, the binary operator then according to this 8 kinds of preset colors, with preset color mapping Establish mapping relations.It no longer illustrates herein.
The number of species of color that resetting color area is equipped with can be first read in this way, then according still further to number of species, from The binary operator of preset color mapping, in the mapping relations between preset color, finds every kind of resetting color area The corresponding binary operator of the color being equipped with, in this way compared to the binary operator mapped from preset color, with preset color it Between mapping relations whole table in search every kind of color for being equipped with of resetting color area, it is more efficient, can also be accurately Find the corresponding binary operator of all kinds quantity.
The embodiment of the present invention, not only all of two dimensional code to be processed are set region, are shown that two dimensional code to be processed is all and are set The color in region, moreover, resetting color area, also shows that two dimensional code to be processed is set the color in region.In this way can by Two dimensional code is set region and resetting color area identification two dimensional code, is increased the identification mode of processed two dimensional code, is also mentioned The high information carrying capacity of processed two dimensional code.Utilize the color of the color and resetting color area that are set region, recognition Processed two dimensional code.Compared to the prior art, if only scanning partial region in two dimensional code, that is, resetting color area, and It is not every to be set region, and in the two dimensional code scanned, the quantity for resetting color area is greater than or equal to predeterminable area quantity, The color that resetting color area is equipped with then is read, binary sequence is mapped to, does not need user adjusts mobile phone and scanned two The distance between code is tieed up, the identification of two dimensional code is improved, improves the efficiency that user information obtains, it is user-friendly, it improves User experience effect.
Corresponding to the two-dimensional code generation method of first aspect, continue with to a kind of two dimensional code provided in an embodiment of the present invention Generating means are introduced.
Referring to Fig. 8, Fig. 8 is the structural schematic diagram of the two dimensional code generating means of the embodiment of the present invention, and the embodiment of the present invention is also A kind of two dimensional code generating means are provided, device includes:
First obtains module 41, and for obtaining two dimensional code to be processed, the two dimensional code to be processed includes: multiple to have been provided with color Color region, will have been provided with the region of color, and as region is set, the color is three colors point by three-dimensional color space What amount was formed, three color components are respectively as follows: the first color component of default number change, the second color of default number The third color component of component and default number;
Division module 42, for dividing each region that set as L row × L column resetting color area, the L is greater than or waits In 2;
Second obtains module 43, for pre-establishing the associated L in position from each region that set2It is a to be set in region, It obtains each being set the associated L in region2It is a to be set region;
First obtains module 44, for being set the associated L in region based on each2It closes in a region and each region that set of being set The L of connection2It is a to be set the respective color in region, determine the L in resetting color area2A resetting color, the resetting color is by institute State the third face of the first color component of default number change, the second color component of default number change, the default number What colouring component was formed;
Second obtains module 45, is used for L2A resetting color setting obtains in L row × L column resetting color area Processed two dimensional code.
In one possible implementation, described second module 43 is obtained, is specifically used for:
It is determined as the resetting color area that resetting color has been arranged to be set region, divides each region that set as L row × L The resetting color area of column, the L are greater than or equal to 2;
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each region that set and is associated with L2It is a to be set region;
The associated L in region is set based on each2It is a to be set region and each set the associated L in region2It is a to be set region respectively Color, determine resetting color area in L2A resetting color, the resetting color are the first of default number change What the third color component that color component, the second color component of default number change, default number change was formed;
By L2A resetting color setting obtains processed two dimensional code in L row × L column resetting color area.
In one possible implementation, each to be set in binary sequence of the region for indicating the two dimensional code One binary operator;
Described first obtains module 41, is specifically used for:
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each region that set and is associated with L2It is a to be set the respective binary system subsequence in region, as associated binary system subsequence, the associated sub- sequence of binary system Column are each to be set the associated L in region by described2It is a to be set what the binary operator that region respectively indicates formed;
According to the mapping relations of preset color and binary operator, determine that the binary system in associated binary system subsequence is calculated The preset color for according with mapping, as the resetting respective resetting color of color area.
In one possible implementation, multiple regions that set are in P row × P column;
Described device further include: establish module, this establishes module, each to be set region and phase for using following steps Associated L2Position association is established in a region that set:
It is each to be set region and associated L using following steps2Position association is established in a region that set:
It is each to be set region and associated L using following steps2Position association is established in a region that set:
As the multiple region that set for being set Nth row m column in region, the N is greater than 0 in each region that set, And it is less than or equal to the integer of P, the M is greater than 0, and is less than or equal to the integer of P;
Each region respectively associated L is set with described2It is a by set region include: it is the multiple by set in regionRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region.
Corresponding to the two dimension code reading method of second aspect, continue with to a kind of two dimensional code provided in an embodiment of the present invention Reading device is introduced.
Referring to Fig. 9, Fig. 9 is the structural schematic diagram of the two dimension code reading device of the embodiment of the present invention, and the embodiment of the present invention is also A kind of two dimension code reading device is provided, applied to above-mentioned two dimensional code generating means, two dimension code reading device includes:
First read module 51, for scanning the two-dimensional code;
Second read module 52, for obtain in the two dimensional code it is each set region it is divided rule and, be based on Divided rule, scanned from the two dimensional code it is multiple set region, it is described each to be set the divided rule in region It is to divide each resetting color area for being set region and arranging as L row × L, it is described to be set region and have been provided with color;
Third obtains module 53, if being less than predeterminable area number for the multiple region quantities for being set region scanned Amount, then from it is described scan it is multiple set in region, obtain reset color area region quantity, the predeterminable area quantity For all region sums for being set region of the two dimensional code;
Third read module 54, if the region quantity for the resetting color area is greater than or equal to the predeterminable area Quantity then reads the color that the resetting color area is equipped with, and the color that the resetting color area is equipped with is based on each quilt If the associated L in region2It is a to be set region and each set the associated L in region2It is a to be set what the respective color in region obtained;
Extraction module 55, for extracting the color of three-dimensional color space from the resetting color area;
Mapping block 56, for the mapping relations according to preset color and binary operator, by the resetting color area The color of extraction, is mapped to binary sequence.
In one possible implementation, described device further include: the 4th obtains module, and the described 4th obtains module, For:
If the multiple region quantities for being set region scanned are greater than or equal to predeterminable area quantity, swept from described Retouch it is multiple set in region, obtain each color for being set the resetting color area that region respectively divides and being equipped with;
It is set the color that the resetting color area that region respectively divides is equipped with by each and is averaged, obtain each quilt If the color average value in region;
If each color average value for being set region is higher than the second preset color, each color for being set region is averaged Value is mapped as the first binary operator;
If each color average value for being set region is lower than second preset color, by each color for being set region Average value is mapped as the second binary operator, and first binary operator is different with the numerical value of second binary operator.
In one possible implementation, the mapping block, is specifically used for:
Determine the number of species for the color that the resetting color area is equipped with;
From the binary operator of preset color mapping, in the mapping relations between preset color, according to type quantity, is looked for To the corresponding binary operator of color that resetting color area is equipped with described in every kind;
According to the binary operator that preset color maps, every kind of color pair in the mapping relations between the preset color The binary operator answered, the color that the resetting color area is equipped with, is mapped to binary sequence.
It is the electronic equipment of the embodiment of the present invention referring to Figure 10, Figure 10 corresponding to the two-dimensional code generation method of first aspect Structural schematic diagram.The embodiment of the invention also provides a kind of electronic equipment, including processor 61, communication interface 62, memory 63 and communication bus 64, wherein processor 61, communication interface 62, memory 63 are completed mutual logical by communication bus 64 Letter,
Memory 63, for storing computer program;
Processor 61 when for executing the program stored on memory 63, realizes following steps:
Two dimensional code to be processed is obtained, the two dimensional code to be processed includes: multiple regions for having been provided with color, will have been provided with color Color region, as region is set, the color is formed by three color components of three-dimensional color space, three face Colouring component is respectively as follows: the first color component of default number change, and the of the second color component of default number and default number Three color components;
Each region that set is divided as L row × L column resetting color area, the L is greater than or equal to 2;
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each region that set and is associated with L2It is a to be set region;
The associated L in region is set based on each2It is a to be set region and each set the associated L in region2It is a to be set region respectively Color, determine resetting color area in L2A resetting color, the resetting color is the changed by the default number The third color component formation of one color component, the second color component of default number change, the default number;
By L2A resetting color setting obtains processed two dimensional code in L row × L column resetting color area
It is the electronic equipment of the embodiment of the present invention referring to Figure 11, Figure 11 corresponding to the two dimension code reading method of second aspect Structural schematic diagram.The embodiment of the invention also provides a kind of electronic equipment, including processor 71, communication interface 72, memory 73 and communication bus 74, wherein processor 71, communication interface 72, memory 73 are completed mutual logical by communication bus 74 Letter,
Memory 73, for storing computer program;
Processor 71 when for executing the program stored on memory 73, realizes following steps:
Obtain in the two dimensional code it is each set the divided rule in region and, divided rule is based on, from described Scanned in two dimensional code it is multiple set region, it is described it is each set the divided rule in region for division it is each set region as The resetting color area of L row × L column, it is described to be set region and have been provided with color;
If the multiple region quantities for being set region scanned are less than predeterminable area quantity, scanned from described It is multiple to be set in region, the region quantity of resetting color area is obtained, the predeterminable area quantity is all of the two dimensional code Set the region sum in region;
If the region quantity of the resetting color area is greater than or equal to the predeterminable area quantity, the resetting is read The color that color area is equipped with, the color that the resetting color area is equipped with is to be set the associated L in region based on each2It is a to be set Region and each set the associated L in region2It is a to be set what the respective color in region obtained;
From the resetting color area, the color of three-dimensional color space is extracted;
According to the mapping relations of preset color and binary operator, the color that the resetting color area is extracted, mapping At binary sequence.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control bus etc..For just It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), also may include non-easy The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also To be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit, CPU), network processing unit (Network Processor, NP) etc.;It can also be binary number signal processor (Digital Signal Processing, DSP), specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic Device, discrete gate or transistor logic, discrete hardware components.
Method provided in an embodiment of the present invention can be applied to electronic equipment.Specifically, the electronic equipment can be with are as follows: desk-top Computer, portable computer, intelligent mobile terminal, server etc..It is not limited thereto, it is any that electricity of the invention may be implemented Sub- equipment, all belongs to the scope of protection of the present invention.
In another embodiment provided by the invention, a kind of computer readable storage medium is additionally provided, which can It reads to be stored with instruction in storage medium, when run on a computer, so that computer executes any institute in above-described embodiment The two-dimensional code generation method stated.
In another embodiment provided by the invention, a kind of computer program product comprising instruction is additionally provided, when it When running on computers, so that computer executes any two-dimensional code generation method in above-described embodiment.
In another embodiment provided by the invention, a kind of computer readable storage medium is additionally provided, which can It reads to be stored with instruction in storage medium, when run on a computer, so that computer executes any institute in above-described embodiment The two dimension code reading method stated.
In another embodiment provided by the invention, a kind of computer program product comprising instruction is additionally provided, when it When running on computers, so that computer executes any two dimension code reading method in above-described embodiment.
For device/electronic equipment/storage medium embodiment, since it is substantially similar to the method embodiment, so It is described relatively simple, the relevent part can refer to the partial explaination of embodiments of method.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof real It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer program Product includes one or more computer instructions.When loading on computers and executing the computer program instructions, all or It partly generates according to process or function described in the embodiment of the present invention.The computer can be general purpose computer, dedicated meter Calculation machine, computer network or other programmable devices.The computer instruction can store in computer readable storage medium In, or from a computer readable storage medium to the transmission of another computer readable storage medium, for example, the computer Instruction can from a web-site, computer, server or data center by it is wired (such as coaxial cable, optical fiber, two into Number user line (DSL) processed) or wireless (such as infrared, wireless, microwave etc.) mode to another web-site, computer, service Device or data center are transmitted.The computer readable storage medium can be any usable medium that computer can access Either comprising data storage devices such as one or more usable mediums integrated server, data centers.The usable medium It can be magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or semiconductor medium (such as solid-state Hard disk Solid State Disk (SSD)) etc..
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device/ For electronic equipment/storage medium embodiment, since it is substantially similar to the method embodiment, so being described relatively simple, phase Place is closed to illustrate referring to the part of embodiment of the method.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention It is interior.

Claims (16)

1. a kind of two-dimensional code generation method, which is characterized in that the described method includes:
Two dimensional code to be processed is obtained, the two dimensional code to be processed includes: multiple regions for having been provided with color, will have been provided with color Region, as region is set, the color is formed by three color components of three-dimensional color space, three colors point Amount is respectively as follows: the first color component of default number change, the second color component of default number and the third face of default number Colouring component;
Each region that set is divided as L row × L column resetting color area, the L is greater than or equal to 2;
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each being set the associated L in region2 It is a to be set region;
The associated L in region is set based on each2It is a to be set region and each set the associated L in region2It is a to be set the respective color in region Coloured silk determines the L in resetting color area2A resetting color, the resetting color is the first face changed by the default number The third color component formation of colouring component, the second color component of default number change, the default number;
By L2A resetting color setting obtains processed two dimensional code in L row × L column resetting color area.
2. the method as described in claim 1, which is characterized in that described by L2A resetting color setting is in the resetting of L row × L column In color area, processed two dimensional code is obtained, comprising:
The resetting color area that resetting color has been arranged is determined as to be set region, division is each to be set what region arranged as L row × L Color area is reset, the L is greater than or equal to 2;
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each being set the associated L in region2 It is a to be set region;
The associated L in region is set based on each2It is a to be set region and each set the associated L in region2It is a to be set the respective color in region Coloured silk determines the L in resetting color area2A resetting color, the resetting color are the first color of default number change What the third color component that component, the second color component of default number change, default number change was formed;
By L2A resetting color setting obtains processed two dimensional code in L row × L column resetting color area.
3. method according to claim 1 or 2, which is characterized in that each region that set is for indicating the two of the two dimensional code A binary operator in system sequence;
It is described to be set the associated L in region based on each2It is a to be set region and each set the associated L in region2It is a to be set region respectively Color, determine resetting color area in L2A resetting color, comprising:
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each being set the associated L in region2 A to be set the respective binary system subsequence in region, as associated binary system subsequence, the associated binary system subsequence is Each the associated L in region is set by described2It is a to be set what the binary operator that region respectively indicates formed;
According to the mapping relations of preset color and binary operator, determine that the binary operator in associated binary system subsequence is reflected The preset color penetrated, as the resetting respective resetting color of color area.
4. the method as described in claim 1, which is characterized in that multiple regions that set are in P row × P column;
It is each to be set region and associated L using following steps2Position association is established in a region that set:
As the multiple region that set for being set Nth row m column in region, the N is greater than 0, and small in each region that set In or equal to P integer, the M be greater than 0, and be less than or equal to P integer;
Each region respectively associated L is set with described2It is a by set region include: it is the multiple by set in regionRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region.
5. a kind of two dimension code reading method, which is characterized in that the two dimension code reading method includes:
It scans the two-dimensional code;
Obtain in the two dimensional code it is each set region it is divided rule and, be based on divided rule, from the two dimension Scanned in code it is multiple set region, each divided rule in region that set is each region that set of division as L row The resetting color area of × L column, it is described to be set region and have been provided with color;
If the multiple region quantities for being set region scanned be less than predeterminable area quantity, from it is described scan it is multiple It is set in region, obtains the region quantity of resetting color area, the predeterminable area quantity is that all of the two dimensional code are set The region sum in region;
If the region quantity of the resetting color area is greater than or equal to the predeterminable area quantity, the resetting color is read The color that region is equipped with, the color that the resetting color area is equipped with is to be set the associated L in region based on each2It is a to be set region And each set the associated L in region2It is a to be set what the respective color in region obtained;
From the resetting color area, the color of three-dimensional color space is extracted;
According to the mapping relations of preset color and binary operator, the color that the resetting color area is extracted is mapped to two System sequence.
6. method as claimed in claim 5, which is characterized in that the method also includes:
If the multiple region quantities for being set region scanned be greater than or equal to predeterminable area quantity, from it is described scanning to It is multiple set in region, obtain each color for being set the resetting color area that region respectively divides and being equipped with;
It is set the color that the resetting color area that region respectively divides is equipped with by each and is averaged, obtain each being set area The color average value in domain;
If each color average value for being set region is higher than the second preset color, each color average value for being set region is reflected It penetrates as the first binary operator;
Alternatively, if each color average value for being set region is lower than second preset color, by each color for being set region Color average value is mapped as the second binary operator, and the numerical value of first binary operator and second binary operator is not Together.
7. method as claimed in claim 5, which is characterized in that the mapping according to preset color and binary operator is closed System, the color that the resetting color area is extracted, is mapped to binary sequence, comprising:
Determine the number of species for the color that the resetting color area is equipped with;
From the binary operator of preset color mapping, in the mapping relations between preset color, according to type quantity, is found every The corresponding binary operator of color that the kind resetting color area is equipped with;
According to the binary operator that preset color maps, every kind of color is corresponding in the mapping relations between the preset color Binary operator, the color that the resetting color area is equipped with, is mapped to binary sequence.
8. a kind of two dimensional code generating means, which is characterized in that described device includes:
First obtains module, and for obtaining two dimensional code to be processed, the two dimensional code to be processed includes: multiple areas for having been provided with color Domain will have been provided with the region of color, and as region is set, the color is formed by three color components of three-dimensional color space , three color components be respectively as follows: default number change the first color component, the second color component of default number and The third color component of default number;
Division module, for dividing each region that set as L row × L column resetting color area, the L is greater than or equal to 2;
Second obtains module, for pre-establishing the associated L in position from each region that set2It is a to be set in region, it obtains each Set the associated L in region2It is a to be set region;
First obtains module, for being set the associated L in region based on each2It is a to be set region and each set the associated L in region2 It is a to be set the respective color in region, determine the L in resetting color area2A resetting color, the resetting color are by described silent Recognize the third color point of the first color component of numerical value change, the second color component of default number change, the default number What amount was formed;
Second obtains module, is used for L2A resetting color setting obtains processed in L row × L column resetting color area Two dimensional code.
9. device as claimed in claim 8, which is characterized in that described second obtains module, is specifically used for:
The resetting color area that resetting color has been arranged is determined as to be set region, division is each to be set what region arranged as L row × L Color area is reset, the L is greater than or equal to 2;
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each being set the associated L in region2 It is a to be set region;
The associated L in region is set based on each2It is a to be set region and each set the associated L in region2It is a to be set the respective color in region Coloured silk determines the L in resetting color area2A resetting color, the resetting color are the first color of default number change What the third color component that component, the second color component of default number change, default number change was formed;
By L2A resetting color setting obtains processed two dimensional code in L row × L column resetting color area.
10. device as claimed in claim 8 or 9, which is characterized in that each region that set is for indicating the two of the two dimensional code A binary operator in system sequence;
Described first obtains module, is specifically used for:
The associated L in position is pre-established from each region that set2It is a to be set in region, it obtains each being set the associated L in region2 A to be set the respective binary system subsequence in region, as associated binary system subsequence, the associated binary system subsequence is Each the associated L in region is set by described2It is a to be set what the binary operator that region respectively indicates formed;
According to the mapping relations of preset color and binary operator, determine that the binary operator in associated binary system subsequence is reflected The preset color penetrated, as the resetting respective resetting color of color area.
11. device as claimed in claim 8, which is characterized in that multiple regions that set are in P row × P column;
Described device further include: establish module, this establishes module, for use following steps, it is each set region with it is associated L2Position association is established in a region that set:
It is each to be set region and associated L using following steps2Position association is established in a region that set:
As the multiple region that set for being set Nth row m column in region, the N is greater than 0, and small in each region that set In or equal to P integer, the M be greater than 0, and be less than or equal to P integer;
Each region respectively associated L is set with described2It is a by set region include: it is the multiple by set in regionRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region,
...,
TheRowColumn are set region.
12. a kind of two dimension code reading device, which is characterized in that the two dimension code reading device includes:
First read module, for scanning the two-dimensional code;
Second read module, for obtain in the two dimensional code it is each set the divided rule in region and, based on being divided Rule, scanned from the two dimensional code it is multiple set region, each divided rule in region that set is division Each resetting color area for being set region and being arranged as L row × L, it is described to be set region and have been provided with color;
Third obtains module, if being less than predeterminable area quantity for the multiple region quantities for being set region scanned, From it is described scan it is multiple set in region, obtain resetting color area region quantity, the predeterminable area quantity is institute State all region sums for being set region of two dimensional code;
Third read module, if the region quantity for the resetting color area is greater than or equal to the predeterminable area quantity, The color that the resetting color area is equipped with then is read, the color that the resetting color area is equipped with is to be set region based on each Associated L2It is a to be set region and each set the associated L in region2It is a to be set what the respective color in region obtained;
Extraction module, for extracting the color of three-dimensional color space from the resetting color area;
Mapping block extracts the resetting color area for the mapping relations according to preset color and binary operator Color is mapped to binary sequence.
13. device as claimed in claim 12, which is characterized in that described device further include: the 4th acquisition module, the described 4th Module is obtained, is used for:
If the multiple region quantities for being set region scanned be greater than or equal to predeterminable area quantity, from it is described scanning to It is multiple set in region, obtain each color for being set the resetting color area that region respectively divides and being equipped with;
It is set the color that the resetting color area that region respectively divides is equipped with by each and is averaged, obtain each being set area The color average value in domain;
If each color average value for being set region is higher than the second preset color, each color average value for being set region is reflected It penetrates as the first binary operator;
If each color average value for being set region is lower than second preset color, each color for being set region is averaged Value is mapped as the second binary operator, and first binary operator is different with the numerical value of second binary operator.
14. device as claimed in claim 13, which is characterized in that the mapping block is specifically used for:
Determine the number of species for the color that the resetting color area is equipped with;
From the binary operator of preset color mapping, in the mapping relations between preset color, according to type quantity, is found every The corresponding binary operator of color that the kind resetting color area is equipped with;
According to the binary operator that preset color maps, every kind of color is corresponding in the mapping relations between the preset color Binary operator, the color that the resetting color area is equipped with, is mapped to binary sequence.
15. a kind of electronic equipment, which is characterized in that including processor, communication interface, memory and communication bus, wherein processing Device, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any method and step of claim 1-4.
16. a kind of electronic equipment, which is characterized in that including processor, communication interface, memory and communication bus, wherein processing Device, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any method and step of claim 5-7.
CN201811116240.2A 2018-09-25 2018-09-25 Two-dimensional code generation method, two-dimensional code reading method and two-dimensional code reading device Active CN109447211B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811116240.2A CN109447211B (en) 2018-09-25 2018-09-25 Two-dimensional code generation method, two-dimensional code reading method and two-dimensional code reading device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811116240.2A CN109447211B (en) 2018-09-25 2018-09-25 Two-dimensional code generation method, two-dimensional code reading method and two-dimensional code reading device

Publications (2)

Publication Number Publication Date
CN109447211A true CN109447211A (en) 2019-03-08
CN109447211B CN109447211B (en) 2021-10-15

Family

ID=65530752

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811116240.2A Active CN109447211B (en) 2018-09-25 2018-09-25 Two-dimensional code generation method, two-dimensional code reading method and two-dimensional code reading device

Country Status (1)

Country Link
CN (1) CN109447211B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2677458A1 (en) * 2012-06-22 2013-12-25 Sick Ag Optoelectronic device and method for adjusting brightness
CN103793740A (en) * 2014-03-10 2014-05-14 上海形上投资管理有限公司 Encoding system and method and decoding system and method of micro-colored-drawing two-dimension code
CN104239927A (en) * 2014-08-01 2014-12-24 周奇 Colored two-dimension code generating method and decoding method
KR20170038468A (en) * 2015-09-30 2017-04-07 국민대학교산학협력단 Generation and recognition method of color qr code and system including the same
CN106709544A (en) * 2016-11-16 2017-05-24 区华威 Encoding system and method, and decoding system and method for graphic quick identification IQ code

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2677458A1 (en) * 2012-06-22 2013-12-25 Sick Ag Optoelectronic device and method for adjusting brightness
CN103793740A (en) * 2014-03-10 2014-05-14 上海形上投资管理有限公司 Encoding system and method and decoding system and method of micro-colored-drawing two-dimension code
CN104239927A (en) * 2014-08-01 2014-12-24 周奇 Colored two-dimension code generating method and decoding method
KR20170038468A (en) * 2015-09-30 2017-04-07 국민대학교산학협력단 Generation and recognition method of color qr code and system including the same
CN106709544A (en) * 2016-11-16 2017-05-24 区华威 Encoding system and method, and decoding system and method for graphic quick identification IQ code

Also Published As

Publication number Publication date
CN109447211B (en) 2021-10-15

Similar Documents

Publication Publication Date Title
US11720776B2 (en) System and method using a histogram and colorspaces to create a matrix barcode having a plurality of colors, an infrared layer, and an ultraviolet layer
US11799484B2 (en) System and method using a histogram and colorspaces to generate a matrix barcode having a plurality of colors and an ultraviolet layer
US20230214626A1 (en) Optimizing detection of images in relation to targets based on colorspace transformation techniques
US11798194B2 (en) System and method using a histogram and colorspaces to generate a matrix barcode having a plurality of colors and an infrared layer
CN108846401A (en) Commodity detect terminal, method, system and computer equipment, readable medium
WO2015169185A1 (en) Specific bar code and formation method therefor
JP7290294B2 (en) Color correction method for color barcode and computer readable storage medium
CN104052979B (en) For device and the technology of image processing
CN102243704A (en) Positioning system for two-dimension bar code and two-dimension bar code identification method and equipment
CN104077091B (en) A kind of display processing method and electronic equipment
CN106874818B (en) A kind of Digital Object Unique Identifier DOI recognition methods and device
CN104281830A (en) Two-dimension code identification method and device
CN106203571A (en) Image production method based on Quick Response Code and recognition methods and realize system
AU2011250827A1 (en) Image processing apparatus, image processing method, and program
CN104766354B (en) The method and mobile terminal that a kind of augmented reality is drawn
CN108737875A (en) Image processing method and device
CN109447211A (en) A kind of two-dimensional code generation method, two dimension code reading method and device
CN202267974U (en) Positioning system used for two-dimension code and two-dimension code identification device
CN109325573A (en) A kind of two-dimensional code generation method, two dimension code reading method and device
CN110059708A (en) Generate method and device, the storage medium of description
CN102999860A (en) Cellphone two-dimension code based offline consuming method
CN109886193A (en) A kind of cirrus detection method, equipment and computer readable storage medium
CN109447210A (en) A kind of two-dimensional code generation method, two dimension code reading method and device
CN109978889A (en) A kind of image processing method, system, device, storage medium and blackboard device
CN104850817A (en) Device for recognizing color higher-order implicit image code

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