CN103810514A - Art two-dimension code encoding method - Google Patents
Art two-dimension code encoding method Download PDFInfo
- Publication number
- CN103810514A CN103810514A CN201310630507.0A CN201310630507A CN103810514A CN 103810514 A CN103810514 A CN 103810514A CN 201310630507 A CN201310630507 A CN 201310630507A CN 103810514 A CN103810514 A CN 103810514A
- Authority
- CN
- China
- Prior art keywords
- quick response
- response code
- base map
- gray
- artistic
- 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.)
- Pending
Links
Images
Landscapes
- Image Processing (AREA)
Abstract
The invention discloses an art two-dimension code encoding method. Traditional two-dimension code is a white background with black blocks, or blocks with other colors, and is not transparent. The method provided by the invention comprises the following steps of: (1), logging in a platform; (2), uploading a two-dimension code base image; (3), adjusting the two-dimension code and the size and color of the base image; (4), analyzing the color and gray value of the base image; (5), computing the gray value of the base image; (6), computing the color lump and transparency of the two-dimension code; (7), performing fuzzy processing to the base image and the two-dimension code; (8), compounding the base image and the two-dimension code. The art two-dimension code encoding method is applied to encoding art two-dimension codes.
Description
technical field:
the present invention relates to a kind of artistic Quick Response Code coding method.
background technology:
development language adopts Java, J2SE framework, and the technology relating to has the cutting of image, gray count, and pixel operation, image is synthetic etc.
conventional two-dimensional code is white background black block, or the piece of other colors, and opaque.
summary of the invention:
the object of this invention is to provide a kind of artistic Quick Response Code coding method.
above-mentioned object realizes by following technical scheme:
a kind of artistic Quick Response Code coding method, the method comprises the steps:
(1) landing platform;
(2) Quick Response Code base map is uploaded;
(3) adjust Quick Response Code and base map size and color;
(4) analyze base map color and gray-scale value;
(5) gray-scale value of calculating base map;
(6) calculate Quick Response Code color lump and transparency;
(7) base map and Quick Response Code Fuzzy Processing;
(8) base map and Quick Response Code are synthetic.
described artistic Quick Response Code coding method, in described step (2), Quick Response Code base map is uploaded the Flash technology that adopts, in select File, carry out uploading of annex, and divide folder management to the annex of uploading according to the current system time, prevent that like this file from crossing multisystem excessively slow.
described artistic Quick Response Code coding method, in described step (3), Quick Response Code framework adopts HTML5 to show, adopt translucent effect, and adopt JS to carry out the adjustment of dynamic size, adopt the painting canvas of HTML5 to redraw framework, in controlling, can adjust the anglec of rotation of Quick Response Code, 90 degree are supported in each rotation.
described artistic Quick Response Code coding method, described step (4), described step (5) are analyzed base map color and gray-scale value, adjust the size of Quick Response Code according to step 3, intercept corresponding position from base map, calculate the gray-scale value of each pixel, and calculating mean value.
described artistic Quick Response Code coding method, described step (6), calculates Quick Response Code color lump and transparency, according to the gray-scale value of base map, calculates the transparency of Quick Response Code.
described artistic Quick Response Code coding method, described step (7), base map and Quick Response Code are synthetic, the Quick Response Code of generation are arranged to transparent and without background, then merge according to position and the base map of selecting Quick Response Code.
described artistic Quick Response Code coding method, described step (8) base map and Quick Response Code are synthetic, the Quick Response Code of generation is arranged to transparent and without background, is then merged according to position and the base map of selecting Quick Response Code, the file layout that finally generates base map is downloaded for user.
beneficial effect:
the art up Quick Response Code of the present invention adopts translucent effect, and every adopts square and Double Layer Circular pattern, and anchor point adopts fillet form.
the art up Quick Response Code of the present invention can, according to the different transparencies of automatically adjusting Quick Response Code of the color of base map, can accurately be identified in generating.
the art up Quick Response Code of the present invention can be created on the optional position of base map.
the art up Quick Response Code of the present invention can carry out the amplification of base map to be dwindled.
the art up Quick Response Code of the present invention, under content same case, can generate different figures, i.e. the arrangement mode difference of square.
the art up Quick Response Code of the present invention can rotate by 360 degree, does not affect identification.
the art up Quick Response Code square of the present invention can be adjusted random color.
accompanying drawing explanation:
accompanying drawing 1 is the present invention's art Quick Response Code product process figure.
accompanying drawing 2 is schematic diagram of QR figure of the present invention.
embodiment:
embodiment 1:
a kind of artistic Quick Response Code coding method, the method comprises the steps:
(1) landing platform;
(2) Quick Response Code base map is uploaded;
(3) adjust Quick Response Code and base map size and color;
(4) analyze base map color and gray-scale value;
(5) gray-scale value of calculating base map;
(6) calculate Quick Response Code color lump and transparency;
(7) base map and Quick Response Code Fuzzy Processing;
(8) base map and Quick Response Code are synthetic.
embodiment 2:
according to the artistic Quick Response Code coding method described in embodiment 1, in described step (2), Quick Response Code base map is uploaded the Flash technology that adopts, in select File, carry out uploading of annex, and divide folder management to the annex of uploading according to the current system time, prevent that like this file from crossing multisystem excessively slow.
upload program:
String?realPath?=?ServletActionContext.
getServletContext().getRealPath("/bgimages/");
DateFormat?f?=?
new?SimpleDateFormat("yyyy-MM-dd");
String?strtDate?=?f.format(
new?Date());
String?year?=?strtDate.split("-")[0];
String?month?=?strtDate.split("-")[1];
String?day?=?strtDate.split("-")[2];
File?dir?=?
new?File(realPath?+?File.
separator?+?year?+?File.
separator?+?month?+?File.
separator?+?day);
if?(!dir.exists())
dir.mkdirs();
if?(
this.getUpload()?!=?
null?&&?
this.getUpload().size()?>?0)?{
for?(
int?i?=?0;?i?<?
this.getUpload().size();?i++)?{
File?file?=?
this.getUpload().get(i);
String?date?=?getDateFileName();
String?filename?=?date?+?getExtName(
this.getUploadFileName().get(i));
String?desrcFile?=?dir.getPath()?+?File.
separator?+?filename;
file.renameTo(
new?File(desrcFile));
bgFileName?=?year?+?"/"?+?month?+?"/"?+?day?+?"/"?+?filename;
}}
embodiment 3:
according to the artistic Quick Response Code coding method described in embodiment 1, in described step (3), Quick Response Code framework adopts HTML5 to show, adopt translucent effect, and adopt JS to carry out the adjustment of dynamic size, adopt the painting canvas of HTML5 to redraw framework, in controlling, can adjust the anglec of rotation of Quick Response Code, 90 degree are supported in each rotation.
adjust big or small algorithm:
function?presize($obj,?w,?h)
{
var?nw?=?$obj.width(),
nh?=?$obj.height();
if?((nw?>?w)?&&?w?>?0)?{
nw?=?w;
nh?=?(w?/?$obj.width())?*?$obj.height();
}
if?((nh?>?h)?&&?h?>?0)?{
nh?=?h;
nw?=?(h?/?$obj.height())?*?$obj.width();
}
xscale?=?$obj.width()?/?nw;
yscale?=?$obj.height()?/?nh;
$obj.width(nw).height(nh);
}
rotation Algorithm:
_rotate?:?(function()
{
var?rad?=?Math.PI/180;
if?(IE)
return?function(angle)
{
this._angle?=?angle;
this._container.style.rotation=(angle%360)+"deg";
this._vimage.style.top?=?-(this._rotationCenterY?-?this._imgHeight/2)?+?"px";
this._vimage.style.left?=?-(this._rotationCenterX?-?this._imgWidth/2)?+?"px";
this._container.style.top?=?this._rotationCenterY?-?this._imgHeight/2?+?"px";
this._container.style.left?=?this._rotationCenterX?-?this._imgWidth/2?+?"px";
}
else?if?(supportedCSS)
return?function(angle){
this._angle?=?angle;
this._img.style[supportedCSS]="rotate("+(angle%360)+"deg)";
this._img.style[supportedCSSOrigin]=this._parameters.center.join("?");
}
else
return?function(angle)
{
this._angle?=?angle;
angle=(angle%360)*?rad;
this._canvas.width?=?this._width;//+this._widthAdd;
this._canvas.height?=?this._height;//+this._heightAdd;
this._cnv.translate(this._imgWidth*this._aspectW,this._imgHeight*this._aspectH);
this._cnv.translate(this._rotationCenterX,this._rotationCenterY);
this._cnv.rotate(angle);
this._cnv.translate(-this._rotationCenterX,-this._rotationCenterY);
this._cnv.scale(this._aspectW,this._aspectH);
this._cnv.drawImage(this._img,?0,?0);
}
})()
}
embodiment 4:
according to the artistic Quick Response Code coding method described in embodiment 1, base map color and gray-scale value are analyzed in described step (4), (5), adjust the size of Quick Response Code according to step 3, intercept corresponding position from base map, calculate the gray-scale value of each pixel, and calculating mean value, algorithm is as follows:
private?void?calGray(BufferedImage?image,?int?x,?int?y,?int?w,?int?h)?{
int?graysum?=?0;
for?(int?xx?=?x;?xx?<?w?+?x;?xx++)?{
for?(int?yy?=?y;?yy?<?h?+?y;?yy++)?{
int?rgb?=?image.getRGB(xx,?yy);
int?r?=?(rgb?&?0xff0000)?>>?16;
int?g?=?(rgb?&?0xff00)?>>?8;
int?b?=?(rgb?&?0xff);
int?gray?=?(int)?(r?*?0.3?+?g?*?0.59?+?b?*?0.11);
imgGray[xx][yy]?=?gray;
graysum?+=?gray;
}
}
avggray?=?graysum?/?(w?*?h);
}。
embodiment 5:
according to the artistic Quick Response Code coding method described in embodiment 1, it is characterized in that: described step (6), calculate Quick Response Code color lump and transparency, according to the gray-scale value of base map, calculate the transparency of Quick Response Code, algorithm is as follows:
private?float?pinAlpha()?{
if?(bgImage?!=?null)?{
If (avggray < 50) // more black
return?1.0f;
Else if (avggray > 200) // whiter
return?0.9f;
else?if?(avggray?>?51?&&?avggray?<?128)
return?1.0f;
else
return?0.9f;
}?else
return?pinAlpha;
}
private?float?blackSquareAlpha(int?x,?int?y)?{
if?(bgImage?!=?null)?{
int?gray?=?avggray;
If (gray < 50) // more black
return?0.2f;
Else if (gray > 200) // whiter
return?0.3f;
else?if?(gray?>?51?&&?gray?<?128)
return?0.4f;
else
return?0.3f;
}?else
return?blackSquare;
}
private?float?blackCircleAlpha(int?x,?int?y)?{
if?(bgImage?!=?null)?{
int?gray?=?avggray;
If (gray < 50) // more black
return?0.3f;
Else if (gray > 200) // whiter
return?0.3f;
else?if?(gray?>?51?&&?gray?<?128)
return?0.5f;
else
return?0.4f;
}?else
return?blackCircle;
}
private?float?whiteSquareAlpha(int?x,?int?y)?{
if?(bgImage?!=?null)?{
int?gray?=?avggray;
If (gray < 50) // more black
return?0.2f;
Else if (gray > 200) // whiter
return?0.2f;
else?if?(gray?>?51?&&?gray?<?128)
return?0.4f;
else
return?0.3f;
}?else
return?whiteSquare;
}
private?float?whiteCircleAlpha(int?x,?int?y)?{
if?(bgImage?!=?null)?{
int?gray?=?avggray;
If (gray < 50) // more black
return?0.3f;
Else if (gray > 200) // whiter
return?0.3f;
else?if?(gray?>?51?&&?gray?<?128)
return?0.5f;
else
return?0.4f;
}?else
return?whiteCircle;
}
embodiment 6:
according to the artistic Quick Response Code coding method described in embodiment 1, described step (7), base map and Quick Response Code are synthetic, the Quick Response Code of generation are arranged to transparent and without background, then merge according to position and the base map of selecting Quick Response Code, and algorithm is as follows:
public?BufferedImage?filter(BufferedImage?src,?BufferedImage?dst,?int?x,?int?y,?int?width,?int?height)?{
int?width1?=?src.getWidth();
int?height1?=?src.getHeight();
if?(dst?==?null)
dst?=?createCompatibleDestImage(src,?null);
int?p[]?=?new?int[width1?*?height1];
src.getRGB(0,?0,?width1,?height1,?p,?0,?width1);
dst.setRGB(0,?0,?width1,?height1,?p,?0,?width1);
int[]?inPixels?=?new?int[width?*?height];
int[]?outPixels?=?new?int[width?*?height];
src.getRGB(x,?y,?width,?height,?inPixels,?0,?width);
if?(radius?>?0)?{
convolveAndTranspose(kernel,?inPixels,?outPixels,?width,?height,?alpha,?alpha?&&?premultiplyAlpha,?false,?CLAMP_EDGES);
convolveAndTranspose(kernel,?outPixels,?inPixels,?height,?width,?alpha,?false,?alpha?&&?premultiplyAlpha,?CLAMP_EDGES);
}
dst.setRGB(x,?y,?width,?height,?inPixels,?0,?width);
return?dst;
}
embodiment 7:
according to the artistic Quick Response Code coding method described in embodiment 1, it is characterized in that: described step (8) base map and Quick Response Code are synthetic, the Quick Response Code of generation is arranged to transparent and without background, then merge according to position and the base map of selecting Quick Response Code, the file layout that finally generates base map is downloaded for user.
embodiment 8:
according to the artistic Quick Response Code coding method described in embodiment 1, Quick Response Code coding principle:
according to the standard document explanation of QR code, the error correction of QR code is divided into 4 ranks, respectively:
level L: maximum 7% mistake can be repaired;
level M: maximum 15% mistake can be repaired;
level Q: maximum 25% mistake can be repaired;
level H: maximum 30% mistake can be repaired;
the 4th, structuring; Seem random figure, in fact there is to strict definition in region, figure below be exactly a pattern 2, version 1 QR graph structure as shown in Figure 2.
in accompanying drawing 1, in the matrix of 21*21, the region of " 1 ", " 2 " is designated as fixing position in QR code standard, is called view finding figure and positioning pattern.The coordinate of helping decoding program and determine concrete symbol in figure for view finding figure and positioning pattern.
the region of " 4 " is used for preserving the data content and the error correction information code that are encoded.
the region of " 3 ", is used for identifying rank and so-called " the Mask pattern " of error correction, and this region is called as " formatted message ".
the pattern of QR code and version
mentioned pattern and the version of QR code above.QR code is divided into Model1 and two kinds of patterns of Model2, and Model1 is the original definition to QR, and Model2 is the expansion to Model1, uses at present comparatively generally Model2, and all explanations are herein also only for Model2.
the size of QR figure is defined as version, version number from 1 to 40.Version 1 is exactly the matrix of a 21*21, version number of every increase, and the size of matrix just increases by 4 modules, and therefore, edition 40 is exactly the matrix of a 177*177.(version is higher, means that the content of storage is more, and error correcting capability is also stronger).
the encoded content that QR code is supported
the content of QR code support coding is including pure digi-tal, numeral and character hybrid coding, octet code and comprise the multibyte character Chinese character.Wherein:
numeral: every three are one group and are compressed into 10bit.
alpha-numerical: every two is one group, is compressed into 11bit.
8bit byte data: directly preserve without compression.
multibyte character: each character is compressed into 13bit.
version 1 ~ 9 data capacity, error correcting code capacity contrast as following table:
embodiment 3:
according to the artistic Quick Response Code coding method described in embodiment 1,
art up Quick Response Code scanning platform adopts short network address mode to manage, i.e. http://opes.me/xxxxxx.
art up Quick Response Code captures corresponding data in scanning, and adds up for scanning result.Comprising IP address, scanning platform type, browser type etc.
short network address is propagated image in 2 D code and is supported blazer's query statistic simultaneously.
the short network address redirect of scanning Quick Response Code supports advertisement to implant simultaneously, definable Implantation Time.
Claims (7)
1. an artistic Quick Response Code coding method, is characterized in that: the method comprises the steps:
(1) landing platform;
(2) Quick Response Code base map is uploaded;
(3) adjust Quick Response Code and base map size and color;
(4) analyze base map color and gray-scale value;
(5) gray-scale value of calculating base map;
(6) calculate Quick Response Code color lump and transparency;
(7) base map and Quick Response Code Fuzzy Processing;
(8) base map and Quick Response Code are synthetic.
2. artistic Quick Response Code coding method according to claim 1, it is characterized in that: in described step (2), Quick Response Code base map is uploaded the Flash technology that adopts, in select File, carry out uploading of annex, and divide folder management to the annex of uploading according to the current system time, prevent that like this file from crossing multisystem excessively slow.
3. artistic Quick Response Code coding method according to claim 1 and 2, it is characterized in that: in described step (3), Quick Response Code framework adopts HTML5 to show, adopt translucent effect, and adopt JS to carry out the adjustment of dynamic size, adopt the painting canvas of HTML5 to redraw framework, in controlling, can adjust the anglec of rotation of Quick Response Code, 90 degree are supported in each rotation.
4. according to the artistic Quick Response Code coding method described in claim 1 or 2 or 3, it is characterized in that: described step (4), described step (5) are analyzed base map color and gray-scale value, adjust the size of Quick Response Code according to step 3, intercept corresponding position from base map, calculate the gray-scale value of each pixel, and calculating mean value.
5. according to the artistic Quick Response Code coding method described in claim 1 or 2 or 3 or 4, it is characterized in that: described step (6), calculate Quick Response Code color lump and transparency, according to the gray-scale value of base map, calculate the transparency of Quick Response Code.
6. according to the artistic Quick Response Code coding method described in claim 1 or 2 or 3 or 4 or 5, it is characterized in that: described step (7), base map and Quick Response Code are synthetic, the Quick Response Code of generation are arranged to transparent and without background, then merge according to position and the base map of selecting Quick Response Code.
7. according to the artistic Quick Response Code coding method described in claim 1 or 2 or 3 or 4 or 5 or 6, it is characterized in that: described step (8) base map and Quick Response Code are synthetic, the Quick Response Code of generation is arranged to transparent and without background, then merge according to position and the base map of selecting Quick Response Code, the file layout that finally generates base map is downloaded for user.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310630507.0A CN103810514A (en) | 2013-12-02 | 2013-12-02 | Art two-dimension code encoding method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310630507.0A CN103810514A (en) | 2013-12-02 | 2013-12-02 | Art two-dimension code encoding method |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103810514A true CN103810514A (en) | 2014-05-21 |
Family
ID=50707255
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310630507.0A Pending CN103810514A (en) | 2013-12-02 | 2013-12-02 | Art two-dimension code encoding method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103810514A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104123572A (en) * | 2014-07-22 | 2014-10-29 | 上海高研明鉴信息技术有限公司 | Two-dimensional code generating method |
CN105069393A (en) * | 2015-09-09 | 2015-11-18 | 杭州甄别网络科技有限公司 | Two-dimensional code malicious reading-preventing method and device |
CN107563476A (en) * | 2017-07-25 | 2018-01-09 | 浙江惠码科技有限公司 | A kind of Quick Response Code beautifies false proof method |
CN107914468A (en) * | 2017-03-05 | 2018-04-17 | 黄燕云 | Quick Response Code generation system, reading device |
CN109325570A (en) * | 2018-09-18 | 2019-02-12 | 苏州广立信息技术有限公司 | The generation method of dot matrix three-dimension code intelligence doorplate |
-
2013
- 2013-12-02 CN CN201310630507.0A patent/CN103810514A/en active Pending
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104123572A (en) * | 2014-07-22 | 2014-10-29 | 上海高研明鉴信息技术有限公司 | Two-dimensional code generating method |
CN104123572B (en) * | 2014-07-22 | 2017-04-05 | 上海高研明鉴信息技术有限公司 | two-dimensional code generation method |
CN105069393A (en) * | 2015-09-09 | 2015-11-18 | 杭州甄别网络科技有限公司 | Two-dimensional code malicious reading-preventing method and device |
CN105069393B (en) * | 2015-09-09 | 2017-10-10 | 杭州甄别网络科技有限公司 | The anti-malice read method of Quick Response Code and device |
CN107914468A (en) * | 2017-03-05 | 2018-04-17 | 黄燕云 | Quick Response Code generation system, reading device |
CN107914468B (en) * | 2017-03-05 | 2019-11-08 | 宁波市民卡运营管理有限公司 | Two dimensional code generates system, reading device |
CN107563476A (en) * | 2017-07-25 | 2018-01-09 | 浙江惠码科技有限公司 | A kind of Quick Response Code beautifies false proof method |
CN107563476B (en) * | 2017-07-25 | 2020-05-15 | 浙江惠码科技有限公司 | Two-dimensional code beautifying and anti-counterfeiting method |
CN109325570A (en) * | 2018-09-18 | 2019-02-12 | 苏州广立信息技术有限公司 | The generation method of dot matrix three-dimension code intelligence doorplate |
CN109325570B (en) * | 2018-09-18 | 2022-03-15 | 苏州广立信息技术有限公司 | Method for generating lattice three-dimensional code intelligent doorplate |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103810514A (en) | Art two-dimension code encoding method | |
KR102104219B1 (en) | Method and system for recognizing location information in 2D code | |
CN103310443B (en) | High-resolution remote sensing image immediate processing method and system | |
WO2016058450A1 (en) | Image code for processing information and device and method for generating and parsing same | |
DE60232363D1 (en) | RECONSTRUCTION OF A VIRTUAL GRID | |
Li et al. | An aesthetic QR code solution based on error correction mechanism | |
CN102799920A (en) | Two-dimensional code generation system and method and two-dimensional code identification system and method in combination with image | |
CN101694615A (en) | Browser-based construction system of three-dimensional ultra-large scene | |
US10991065B2 (en) | Methods and systems for processing graphics | |
CN114756937B (en) | Visualization system and method based on UE4 engine and Cesium framework | |
CN111339599B (en) | Conversion method from BIM model to GIS model | |
CN110660125B (en) | Three-dimensional modeling device for power distribution network system | |
US20170228913A1 (en) | Determining and presenting solar flux information | |
CN108717729A (en) | A kind of online method for visualizing of landform multi-scale TIN of the Virtual earth | |
CN105550977A (en) | Parallel mode grid image slicing method | |
CN107085505A (en) | A kind of CDR files are automatically processed and automatic comparison method and system | |
CN103745019A (en) | Mass data processing method | |
CN113779656A (en) | Stamping method, electronic file platform and computer readable storage medium | |
CN102708204A (en) | Meteorogram overlay application method based on different projection methods | |
CN104166715A (en) | Vxworks platform electronic chart engine | |
CN101394489A (en) | Subtitle rendering efficiency bottle neck automatically positioning method based on template and parameter step length | |
CN112465962A (en) | Dynamic updating method for large-scene three-dimensional live-action data | |
CN102867322A (en) | Method and device for realizing Chinese marking in three-dimensional scene | |
CN102622629A (en) | Generating method for customizing QR (Quick Response) code | |
CN102841926B (en) | Scale-adaptive bitmap embedded coding method of element of vector data set |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20140521 |