WO2017219562A1 - Method and apparatus for generating two-dimensional code - Google Patents

Method and apparatus for generating two-dimensional code Download PDF

Info

Publication number
WO2017219562A1
WO2017219562A1 PCT/CN2016/103091 CN2016103091W WO2017219562A1 WO 2017219562 A1 WO2017219562 A1 WO 2017219562A1 CN 2016103091 W CN2016103091 W CN 2016103091W WO 2017219562 A1 WO2017219562 A1 WO 2017219562A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
sample
terminal device
url
back image
Prior art date
Application number
PCT/CN2016/103091
Other languages
French (fr)
Chinese (zh)
Inventor
曾慧鹏
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2017219562A1 publication Critical patent/WO2017219562A1/en

Links

Images

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
    • 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

Definitions

  • the present invention relates to the field of mobile communications, and in particular, to a method and an apparatus for generating a two-dimensional code.
  • QR codes have been seen everywhere in people's lives.
  • the two-dimensional code records the data symbol information by using a certain geometric pattern in a black and white pattern distributed in a plane according to a certain rule; in the coding, a plurality of geometric shapes corresponding to the binary are used to represent the numerical value information of the text.
  • the image input device or the photoelectric scanning device automatically reads to realize automatic information processing.
  • QR code corresponds to a Uniform Resource Locator (URL), which is the address of a standard resource on the Internet. It is a simple way to locate and access resources that can be obtained from the Internet. Said. If there are multiple URLs, multiple QR codes need to be generated for the user to select. Thus, for the same resource, the user needs subjective judgment to scan which QR code, and cannot automatically determine the QR code required by the user. Users bring some inconvenience and reduce the user experience.
  • URL Uniform Resource Locator
  • the QR code of the application has been generated, and the user needs to determine which two-dimensional code to scan according to the operating system of the mobile terminal; once the scanning error occurs, If the problem cannot be downloaded or cannot be installed after downloading, the user needs to scan again.
  • the operation process is cumbersome and is not conducive to improving the user experience.
  • the embodiment of the invention provides a method and a device for generating a two-dimensional code, which aims to solve the problem that the existing two-dimensional code generation method cannot automatically determine the two-dimensional code required by the user, which brings certain inconvenience to the user and reduces The problem of the user's experience.
  • an embodiment of the present invention provides a two-dimensional code generating method, and a packet include:
  • a two-dimensional code corresponding to the first URL is generated according to the first URL.
  • the step of matching the first back image with the sample image in the pre-established sample library to obtain the first sample image matching the first back image comprises:
  • the binary image is matched with the sample image in the pre-established sample library to obtain a first sample image that matches the binary image.
  • the step of performing image processing on the first back image to obtain a binary image of the first back image comprises:
  • the ruled area above the grip edge is taken from the back area, and the ruled area is determined to be a binary image of the first back image, and the grip edge is the edge of the grip area of the first terminal device held by the user.
  • the step of acquiring the first back image of the first terminal device comprises:
  • the back of the first terminal device is photographed, and the captured first back image is acquired.
  • the method further comprises:
  • the binary image of the second back image is taken as a sample image and stored in the sample library corresponding to the second URL.
  • an embodiment of the present invention further provides a two-dimensional code generating apparatus, including:
  • a first acquiring module configured to acquire a first back image of the first terminal device
  • a matching module configured to match the first back image with the sample image in the pre-established sample library to obtain a first sample image that matches the first back image
  • a second acquiring module configured to acquire a first URL corresponding to the first sample image according to a correspondence between the pre-established sample image and the uniform resource locator URL;
  • And generating a module configured to generate a two-dimensional code corresponding to the first URL according to the first URL.
  • the matching module comprises:
  • An image processing sub-module configured to perform image processing on the first back image to obtain a binary image of the first back image
  • the image matching sub-module is configured to match the binary image with the sample image in the pre-established sample library to obtain a first sample image that matches the binary image.
  • the image processing sub-module comprises:
  • An edge detecting unit configured to perform image binarization processing and edge detection on the first back image to obtain an edge binary image of the first back image
  • a row and column scanning unit configured to perform a row and column scan on the edge binary image to determine a back region of the first terminal device
  • the area intercepting unit is configured to intercept the ruled area above the grip edge from the back area, and determine that the rule area is a binary image of the first back image, and the grip edge is an edge of the grip area of the first terminal device that the user holds.
  • the first obtaining module comprises:
  • the photographing sub-module is configured to: when detecting that the first terminal device scans the two-dimensional code, take a photo of the back of the first terminal device, and acquire the captured first back image.
  • the device further comprises:
  • a sample establishing module configured to acquire a second URL of the second terminal device and a second back image
  • the binary image of the second back image is taken as a sample image and stored in the sample library corresponding to the second URL.
  • a computer storage medium is further provided, and the computer storage medium may store an execution instruction for performing the implementation of the two-dimensional code generation method in the above embodiment.
  • the method and device for generating a two-dimensional code obtained by the embodiment of the present invention obtains a back image of the terminal device and matches the sample image in the sample library, thereby obtaining a URL corresponding to the terminal device and automatically generating a two-dimensional code, when present
  • the user's terminal device can be accurately identified, and the user does not need to subjectively select which two-dimensional code to scan; and the back image is subjected to image processing to intercept the ruled area above the grip edge, and the accuracy is better.
  • the invention improves the user experience and solves the problem that the existing two-dimensional code generation method cannot automatically determine the two-dimensional code required by the user, which brings a certain inconvenience to the user.
  • FIG. 1 is a flow chart showing the basic steps of a method for generating a two-dimensional code according to a first embodiment of the present invention
  • Figure 2 is a diagram showing a scenario of an example of the first embodiment of the present invention.
  • Figure 3 is a block diagram showing a two-dimensional code generating apparatus according to a second embodiment of the present invention.
  • Figure 4 is a diagram showing a scenario of an example of a second embodiment of the present invention.
  • Fig. 5 is a block diagram showing a two-dimensional code generating apparatus according to a third embodiment of the present invention.
  • a first embodiment of the present invention provides a method for generating a two-dimensional code, including:
  • Step 101 Acquire a first back image of the first terminal device.
  • the first terminal device may be a mobile phone or a tablet computer.
  • the back image refers to an image of the back of the terminal device when the end face where the main display screen of the terminal device is located as the front side. Under normal circumstances, the back image of the terminal device has a strong recognition. Taking the mobile phone as an example, the back of the mobile phone usually has a camera, a flash, and a brand logo LOGO. Different types of terminal devices usually have a unique back layout, so the first terminal device can be identified based on the back image.
  • Step 102 Match the first back image with the sample image in the pre-established sample library to obtain a first sample image that matches the first back image.
  • the first back image is matched with the sample image in the sample library, and after the matching is successful, the first sample image matching the first back image is obtained; specifically, the preset similarity algorithm can be used in the sample
  • the sample image in the library is found to have a similarity with the first back image within a predetermined range. If there are multiple sample images satisfying the condition, the sample image with the highest similarity is selected as the first sample image.
  • the first sample image may correspond to the model information of the first terminal device; when the first sample image is determined, the model information of the first terminal device may be determined, so that the back of the terminal device may be implemented.
  • the image automatically recognizes the model information.
  • Step 103 Acquire a first URL corresponding to the first sample image according to a correspondence between the pre-established sample image and the uniform resource locator URL.
  • the URL is an address of a standard resource on the Internet; a URL corresponding to the first sample image is a URL corresponding to the first back image.
  • Step 104 Generate a two-dimensional code corresponding to the first URL according to the first URL.
  • the two-dimensional code generated according to the first URL is a two-dimensional code corresponding to the first terminal device, and when the back image of the first terminal device is obtained, a two-dimensional code corresponding to the first terminal device is generated;
  • the QR code is used, the user does not need to subjectively select which QR code to scan.
  • step 102 includes:
  • image processing is performed on the first back image to obtain a binary image of the first back image.
  • the binary image refers to an image in which each pixel is not black or white, and the gray value has no intermediate transition; the binary image can more intuitively reflect the contour feature of the first back image.
  • the binary image is matched with the sample image in the pre-established sample library to obtain a first sample image that matches the binary image.
  • the binary image is matched with the sample image in the sample library to obtain a first sample image; wherein the sample image in the sample library is also in the form of a binary image, so as to be a matching sample.
  • the first step mentioned above comprises:
  • the ruled area above the grip edge is taken from the back area, and the ruled area is determined to be a binary image of the first back image, and the grip edge is the edge of the grip area of the first terminal device held by the user.
  • the binarization process will bring the whole image to a distinct black and white effect;
  • the edge of the image refers to the part of the image where the brightness of the local area changes significantly, and the gray level profile of the area can generally be regarded as a step, that is, from a gray scale.
  • the value changes sharply in a small buffer area to another gray value with a large difference in gray scale.
  • the edge part of the image concentrates most of the information of the image.
  • the determination and extraction of the edge of the image is very important for the recognition and understanding of the entire image scene. It is also an important feature that the image segmentation depends on.
  • the edge detection is mainly the gray level change of the image.
  • edge detection can greatly reduce the amount of data processed by the image, eliminate information that is not related to the edge, and retain the important structural properties of the image.
  • Image binarization processing and edge detection are performed on the first back image to obtain an edge binary image.
  • the texture feature analysis positioning algorithm may be used to perform row and column scanning on the edge binary image, determine a candidate region containing the mobile phone feature line segment in the column direction, determine the starting row coordinate and height of the region, and then perform the region on the region.
  • Column scan determines its column coordinates and width, thus The back area of the first terminal device is determined.
  • the scene identifying the terminal device is usually the user holding the terminal device, it is necessary to intercept the regular region above the grip edge from the back region as a binary image of the first back image.
  • the obtained edge binary image is as shown in FIG. 2, and only the upper part of the back of the terminal device, that is, the holding edge, can be recognized due to the presence of the holding area.
  • the three sides of the back of the terminal device and an irregular grip edge are filtered out, and then the ruled area above the grip edge is intercepted from the back region as the terminal device.
  • step 101 includes:
  • the back of the first terminal device is photographed, and the captured first back image is acquired.
  • the first terminal device scans the two-dimensional code through the camera
  • the first back image is obtained by taking a picture of the back of the first terminal device.
  • a camera can be deployed on the two-dimensional code or around the two-dimensional code for photographing. In this way, for the same resource, such as an application, only one two-dimensional code can be set; when the user scans the two-dimensional code with the terminal device, the terminal device is photographed to obtain a URL corresponding to the terminal device, and then generated.
  • the two-dimensional code corresponding to the URL is a two-dimensional code that matches the user's terminal device.
  • the method further comprises:
  • the binary image of the second back image is taken as a sample image and stored in the sample library corresponding to the second URL.
  • the second terminal device obtains the second URL and the second back image of the second terminal device when the second terminal device does not have the sample image in the sample library, and performs image processing on the second back image to obtain a sample image, which is compared with the second URL.
  • Correspondence is stored in the sample library to update the sample library.
  • the back image of the terminal device is acquired and matched with the sample image in the sample library, thereby obtaining a URL corresponding to the terminal device and automatically generating a two-dimensional image.
  • Code when there are multiple two-dimensional codes, the user's terminal device can be accurately identified, and the user does not need to subjectively select which two-dimensional code to scan; and the back image is subjected to image processing to intercept the ruled area above the grip edge
  • the invention has high accuracy; the invention improves the user experience and solves the problem that the existing two-dimensional code generation method cannot automatically determine the two-dimensional code required by the user, which brings certain inconvenience to the user.
  • a second embodiment of the present invention introduces a two-dimensional code generating method provided by the present invention with a specific example.
  • the two-dimensional code generating device shown in FIG. 3 includes the following modules:
  • the two-dimensional code display module 301 is configured to convert the URL into a two-dimensional code.
  • the camera module 302 is configured to capture an image of the back of the mobile phone.
  • the data module 303 stores information about the existing mobile phone, including the back pattern of each mobile phone and the corresponding URL address.
  • the logic module 304 is configured to control the camera, capture, sample, compare data, and obtain a URL.
  • the device mainly performs the following processes:
  • the sample library can be built locally or in the cloud. Collecting the back image of each brand of mobile phone, the upper part of the northern part of most mobile phones has a camera, flash, logo and other logo contrast.
  • Image edge recognition such as OpenCV's cvCanny function, can be implemented by graying the original image, Gaussian filtering the image to quantify the data, and finally converting it into a binary image.
  • FIG. 4 is a binary image of a back image of a mobile phone.
  • the two-dimensional code generating device mainly performs the following processes:
  • the camera module 302 is used to capture the image of the back of the mobile phone; the camera can be driven into the monitoring mode by software to collect images in real time.
  • the user who recognizes the mobile phone is a handheld mobile phone, only the upper part of the back of the mobile phone can be recognized. According to the smoothness of the edge of the mobile phone, the three sides of the back of the mobile phone and an irregular handshake edge are filtered out, and then from the edge of the handshake. Cut off at the highest point and get the final segment for feature analysis.
  • the edge binary image is further extracted, and then the logic module 304 compares the binary image with the feature library in the data module 303, obtains the relevant URL, and displays the QR code.
  • Module 301 generates a two-dimensional code from the URL.
  • the algorithm for converting the two-dimensional code by the URL generates the real-time generated two-dimensional code, and the mobile phone can scan the mobile phone, and the mobile phone automatically guides to the corresponding URL to realize the intelligent jump function.
  • a third embodiment of the present invention provides a two-dimensional code generating apparatus, including:
  • the first obtaining module 501 is configured to acquire a first back image of the first terminal device
  • the matching module 502 is configured to match the first back image with the sample image in the pre-established sample library to obtain a first sample image that matches the first back image;
  • the second obtaining module 503 is configured to acquire a first URL corresponding to the first sample image according to the correspondence between the pre-established sample image and the uniform resource locator URL;
  • the generating module 504 is configured to generate a two-dimensional code corresponding to the first URL according to the first URL.
  • the matching module 502 includes:
  • An image processing sub-module configured to perform image processing on the first back image to obtain a first back a binary image of a partial image
  • the image matching sub-module is configured to match the binary image with the sample image in the pre-established sample library to obtain a first sample image that matches the binary image.
  • the image processing sub-module comprises:
  • An edge detecting unit configured to perform image binarization processing and edge detection on the first back image to obtain an edge binary image of the first back image
  • a row and column scanning unit configured to perform a row and column scan on the edge binary image to determine a back region of the first terminal device
  • the area intercepting unit is configured to intercept the ruled area above the grip edge from the back area, and determine that the rule area is a binary image of the first back image, and the grip edge is an edge of the grip area of the first terminal device that the user holds.
  • the first obtaining module 501 includes:
  • the photographing sub-module is configured to: when detecting that the first terminal device scans the two-dimensional code, take a photo of the back of the first terminal device, and acquire the captured first back image.
  • the device further comprises:
  • a sample establishing module configured to acquire a second URL of the second terminal device and a second back image
  • the binary image of the second back image is taken as a sample image and stored in the sample library corresponding to the second URL.
  • the URL corresponding to the terminal device is obtained and the two-dimensional code is automatically generated, when there are multiple two-dimensional codes.
  • the user can accurately identify the terminal device of the user, and the user does not need to subjectively select which two-dimensional code to scan; and the back image is subjected to image processing to intercept the regular region above the grip edge, and the accuracy is high;
  • the user's experience solves the problem that the existing two-dimensional code generation method cannot automatically determine the two-dimensional code required by the user, which brings a certain inconvenience to the user.
  • the two-dimensional code generating device provided by the embodiment of the present invention is a device applying the above method, that is, all the embodiments of the foregoing method are applicable to the device, and all of the same or similar beneficial effects can be achieved.
  • the foregoing technical solution provided by the embodiment of the present invention can be applied to the process of generating a two-dimensional code by acquiring the back image of the terminal device and matching the sample image in the sample library, thereby obtaining a URL corresponding to the terminal device and automatically generating the URL.
  • the two-dimensional code when there are multiple two-dimensional codes, can accurately identify the user's terminal device, and the user does not need to subjectively select which two-dimensional code to scan; and the back image is image-processed and intercepts the grip edge.
  • the rule area has high precision; the invention improves the user experience and solves the problem that the existing two-dimensional code generation method cannot automatically determine the two-dimensional code required by the user, which brings certain inconvenience to the user.

Abstract

A method and apparatus for generating a two-dimensional code. The method comprises: acquiring a first back image of a first terminal device (101); matching the first back image and a sample image in a pre-established sample library to obtain a first sample image matching the first back image (102); according to a correlation between the pre-established sample image and a uniform resource locator (URL), acquiring a first URL corresponding to the first sample image (103); and according to the first URL, generating a two-dimensional code corresponding to the first URL (104). By means of the method, the usage experience of a user is improved, and the problem of a certain inconvenience brought to a user due to the fact that an existing two-dimensional code generation method cannot automatically determine a two-dimensional code required by the user is solved.

Description

一种二维码生成方法及装置Method and device for generating two-dimensional code 技术领域Technical field
本发明涉及移动通信领域,特别涉及一种二维码生成方法及装置。The present invention relates to the field of mobile communications, and in particular, to a method and an apparatus for generating a two-dimensional code.
背景技术Background technique
随着移动通信技术的发展,二维码已经在人们的生活中随处可见。二维码是用某种特定的几何图形按一定规律在平面分布的黑白相间的图形来记录数据符号信息的;在代码编制上使用若干个与二进制相对应的几何形体来表示文字数值信息,通过图像输入设备或光电扫描设备自动识读以实现信息自动处理。With the development of mobile communication technology, QR codes have been seen everywhere in people's lives. The two-dimensional code records the data symbol information by using a certain geometric pattern in a black and white pattern distributed in a plane according to a certain rule; in the coding, a plurality of geometric shapes corresponding to the binary are used to represent the numerical value information of the text. The image input device or the photoelectric scanning device automatically reads to realize automatic information processing.
通常情况下,一个二维码对应一个统一资源定位符(URL,Uniform Resource Locator);URL是互联网上标准资源的地址,是对可以从互联网上得到的资源的位置和访问方法的一种简洁的表示。如果存在多个URL,则需要生成多个二维码供用户选择,这样,对于同一个资源,用户需要主观判断去扫描哪一个二维码,而无法自动判断用户所需要的二维码,给用户带来了一定的不便,降低用户的使用体验。比如,当用户通过移动终端扫描二维码下载应用程序时,该应用程序的二维码已经生成,用户需要根据的移动终端的操作系统去判断扫描哪一个二维码;一旦扫描错误,将会出现无法下载或者下载后无法安装的问题,用户还需要再次扫描,操作过程繁琐,不利于提升用户的使用体验。Usually, a QR code corresponds to a Uniform Resource Locator (URL), which is the address of a standard resource on the Internet. It is a simple way to locate and access resources that can be obtained from the Internet. Said. If there are multiple URLs, multiple QR codes need to be generated for the user to select. Thus, for the same resource, the user needs subjective judgment to scan which QR code, and cannot automatically determine the QR code required by the user. Users bring some inconvenience and reduce the user experience. For example, when the user scans the QR code to download the application through the mobile terminal, the QR code of the application has been generated, and the user needs to determine which two-dimensional code to scan according to the operating system of the mobile terminal; once the scanning error occurs, If the problem cannot be downloaded or cannot be installed after downloading, the user needs to scan again. The operation process is cumbersome and is not conducive to improving the user experience.
发明内容Summary of the invention
本发明实施例提供了一种二维码生成方法及装置,其目的是为了解决现有的二维码生成方法无法自动判断用户所需要的二维码,给用户带来了一定的不便,降低用户的使用体验的问题。The embodiment of the invention provides a method and a device for generating a two-dimensional code, which aims to solve the problem that the existing two-dimensional code generation method cannot automatically determine the two-dimensional code required by the user, which brings certain inconvenience to the user and reduces The problem of the user's experience.
为了达到上述目的,本发明的实施例提供了一种二维码生成方法,包 括:In order to achieve the above object, an embodiment of the present invention provides a two-dimensional code generating method, and a packet include:
获取第一终端设备的第一背部图像;Obtaining a first back image of the first terminal device;
将第一背部图像与预先建立的样本库中的样本图像进行匹配,得出与第一背部图像相匹配的第一样本图像;Matching the first back image with the sample image in the pre-established sample library to obtain a first sample image that matches the first back image;
根据预先建立的样本图像与统一资源定位符URL的对应关系,获取与第一样本图像相对应的第一URL;Obtaining, according to a correspondence between the pre-established sample image and the uniform resource locator URL, a first URL corresponding to the first sample image;
根据第一URL,生成与第一URL相对应的二维码。A two-dimensional code corresponding to the first URL is generated according to the first URL.
优选地,将第一背部图像与预先建立的样本库中的样本图像进行匹配,得出与第一背部图像相匹配的第一样本图像的步骤,包括:Preferably, the step of matching the first back image with the sample image in the pre-established sample library to obtain the first sample image matching the first back image comprises:
对第一背部图像进行图像处理,得到第一背部图像的二值图像;Performing image processing on the first back image to obtain a binary image of the first back image;
将二值图像与预先建立的样本库中的样本图像进行匹配,得出与二值图像相匹配的第一样本图像。The binary image is matched with the sample image in the pre-established sample library to obtain a first sample image that matches the binary image.
优选地,对第一背部图像进行图像处理,得到第一背部图像的二值图像的步骤,包括:Preferably, the step of performing image processing on the first back image to obtain a binary image of the first back image comprises:
对第一背部图像进行图像二值化处理以及边缘检测,得到第一背部图像的边缘二值图像;Performing image binarization processing and edge detection on the first back image to obtain an edge binary image of the first back image;
对边缘二值图像进行行列扫描,确定第一终端设备的背部区域;Performing a row and column scan on the edge binary image to determine a back region of the first terminal device;
从背部区域中截取握持边缘以上的规则区域,确定规则区域为第一背部图像的二值图像,握持边缘为用户握持第一终端设备的握持区域的边缘。The ruled area above the grip edge is taken from the back area, and the ruled area is determined to be a binary image of the first back image, and the grip edge is the edge of the grip area of the first terminal device held by the user.
优选地,获取第一终端设备的第一背部图像的步骤,包括:Preferably, the step of acquiring the first back image of the first terminal device comprises:
检测到第一终端设备扫描二维码时,对第一终端设备的背部拍照,获取所拍摄的第一背部图像。When detecting that the first terminal device scans the two-dimensional code, the back of the first terminal device is photographed, and the captured first back image is acquired.
优选地,该方法还包括:Preferably, the method further comprises:
获取第二终端设备的第二URL以及第二背部图像;Obtaining a second URL of the second terminal device and a second back image;
对第二背部图像进行图像处理,得到第二背部图像的二值图像;Performing image processing on the second back image to obtain a binary image of the second back image;
将第二背部图像的二值图像作为样本图像,与第二URL相对应存储在样本库中。 The binary image of the second back image is taken as a sample image and stored in the sample library corresponding to the second URL.
为了实现上述目的,本发明的实施例还提供了一种二维码生成装置,包括:In order to achieve the above object, an embodiment of the present invention further provides a two-dimensional code generating apparatus, including:
第一获取模块,设置为获取第一终端设备的第一背部图像;a first acquiring module, configured to acquire a first back image of the first terminal device;
匹配模块,设置为将第一背部图像与预先建立的样本库中的样本图像进行匹配,得出与第一背部图像相匹配的第一样本图像;a matching module configured to match the first back image with the sample image in the pre-established sample library to obtain a first sample image that matches the first back image;
第二获取模块,设置为根据预先建立的样本图像与统一资源定位符URL的对应关系,获取与第一样本图像相对应的第一URL;a second acquiring module, configured to acquire a first URL corresponding to the first sample image according to a correspondence between the pre-established sample image and the uniform resource locator URL;
生成模块,设置为根据第一URL,生成与第一URL相对应的二维码。And generating a module, configured to generate a two-dimensional code corresponding to the first URL according to the first URL.
优选地,匹配模块包括:Preferably, the matching module comprises:
图像处理子模块,设置为对第一背部图像进行图像处理,得到第一背部图像的二值图像;An image processing sub-module configured to perform image processing on the first back image to obtain a binary image of the first back image;
图像匹配子模块,设置为将二值图像与预先建立的样本库中的样本图像进行匹配,得出与二值图像相匹配的第一样本图像。The image matching sub-module is configured to match the binary image with the sample image in the pre-established sample library to obtain a first sample image that matches the binary image.
优选地,图像处理子模块包括:Preferably, the image processing sub-module comprises:
边缘检测单元,设置为对第一背部图像进行图像二值化处理以及边缘检测,得到第一背部图像的边缘二值图像;An edge detecting unit configured to perform image binarization processing and edge detection on the first back image to obtain an edge binary image of the first back image;
行列扫描单元,设置为对边缘二值图像进行行列扫描,确定第一终端设备的背部区域;a row and column scanning unit configured to perform a row and column scan on the edge binary image to determine a back region of the first terminal device;
区域截取单元,设置为从背部区域中截取握持边缘以上的规则区域,确定规则区域为第一背部图像的二值图像,握持边缘为用户握持第一终端设备的握持区域的边缘。The area intercepting unit is configured to intercept the ruled area above the grip edge from the back area, and determine that the rule area is a binary image of the first back image, and the grip edge is an edge of the grip area of the first terminal device that the user holds.
优选地,第一获取模块包括:Preferably, the first obtaining module comprises:
拍照子模块,设置为检测到第一终端设备扫描二维码时,对第一终端设备的背部拍照,获取所拍摄的第一背部图像。The photographing sub-module is configured to: when detecting that the first terminal device scans the two-dimensional code, take a photo of the back of the first terminal device, and acquire the captured first back image.
优选地,该装置还包括:Preferably, the device further comprises:
样本建立模块,设置为获取第二终端设备的第二URL以及第二背部图像; a sample establishing module, configured to acquire a second URL of the second terminal device and a second back image;
对第二背部图像进行图像处理,得到第二背部图像的二值图像;Performing image processing on the second back image to obtain a binary image of the second back image;
将第二背部图像的二值图像作为样本图像,与第二URL相对应存储在样本库中。The binary image of the second back image is taken as a sample image and stored in the sample library corresponding to the second URL.
在本发明实施例中,还提供了一种计算机存储介质,该计算机存储介质可以存储有执行指令,该执行指令用于执行上述实施例中的二维码生成方法的实现。In an embodiment of the present invention, a computer storage medium is further provided, and the computer storage medium may store an execution instruction for performing the implementation of the two-dimensional code generation method in the above embodiment.
本发明实施例的上述方案至少包括以下有益效果:The above solution of the embodiment of the present invention at least includes the following beneficial effects:
本发明实施例提供的二维码生成方法及装置,通过获取终端设备的背部图像,并与样本库中的样本图像匹配,进而得到与终端设备相对应的URL并自动生成二维码,当存在多个二维码时,可对用户的终端设备进行精确识别,用户无需再凭主观去选择扫描哪一个二维码;且背部图像经过图像处理后截取握持边缘以上的规则区域,精确度较高;本发明提高了用户的使用体验,解决了现有的二维码生成方法无法自动判断用户所需要的二维码,给用户带来了一定的不便的问题。The method and device for generating a two-dimensional code provided by the embodiment of the present invention obtains a back image of the terminal device and matches the sample image in the sample library, thereby obtaining a URL corresponding to the terminal device and automatically generating a two-dimensional code, when present When multiple QR codes are used, the user's terminal device can be accurately identified, and the user does not need to subjectively select which two-dimensional code to scan; and the back image is subjected to image processing to intercept the ruled area above the grip edge, and the accuracy is better. The invention improves the user experience and solves the problem that the existing two-dimensional code generation method cannot automatically determine the two-dimensional code required by the user, which brings a certain inconvenience to the user.
附图说明DRAWINGS
图1表示本发明的第一实施例提供的二维码生成方法的基本步骤流程图;1 is a flow chart showing the basic steps of a method for generating a two-dimensional code according to a first embodiment of the present invention;
图2表示本发明的第一实施例的示例的场景示意图;Figure 2 is a diagram showing a scenario of an example of the first embodiment of the present invention;
图3表示本发明的第二实施例提供的二维码生成装置的框图;Figure 3 is a block diagram showing a two-dimensional code generating apparatus according to a second embodiment of the present invention;
图4表示本发明的第二实施例的示例的场景示意图;Figure 4 is a diagram showing a scenario of an example of a second embodiment of the present invention;
图5表示本发明的第三实施例提供的二维码生成装置的框图。Fig. 5 is a block diagram showing a two-dimensional code generating apparatus according to a third embodiment of the present invention.
具体实施方式detailed description
为使本发明要解决的技术问题、技术方案和优点更加清楚,下面将结合附图及具体实施例进行详细描述。The technical problems, the technical solutions, and the advantages of the present invention will be more clearly described in the following description.
第一实施例 First embodiment
参见图1,本发明的第一实施例提供了一种二维码生成方法,包括:Referring to FIG. 1, a first embodiment of the present invention provides a method for generating a two-dimensional code, including:
步骤101,获取第一终端设备的第一背部图像。Step 101: Acquire a first back image of the first terminal device.
其中,第一终端设备可以是手机或平板电脑等。背部图像指以终端设备的主显示屏幕所在的端面作为正面时,终端设备的背部的图像。通常情况下,终端设备的背部图像具有较强的辨识度,以手机为例,手机的背部通常设有摄像头、闪光灯以及品牌的标识LOGO等。不同型号的终端设备通常具有一种独特的背部布局方式,因此可根据背部图像识别第一终端设备。The first terminal device may be a mobile phone or a tablet computer. The back image refers to an image of the back of the terminal device when the end face where the main display screen of the terminal device is located as the front side. Under normal circumstances, the back image of the terminal device has a strong recognition. Taking the mobile phone as an example, the back of the mobile phone usually has a camera, a flash, and a brand logo LOGO. Different types of terminal devices usually have a unique back layout, so the first terminal device can be identified based on the back image.
步骤102,将第一背部图像与预先建立的样本库中的样本图像进行匹配,得出与第一背部图像相匹配的第一样本图像。Step 102: Match the first back image with the sample image in the pre-established sample library to obtain a first sample image that matches the first back image.
其中,将第一背部图像与样本库中的样本图像进行匹配,匹配成功后,得出与第一背部图像相匹配的第一样本图像;具体地,可通过预置相似度算法,在样本库中寻找与第一背部图像的相似度在一预设范围内的样本图像,若满足条件的样本图像有多个,则选取相似度最高的样本图像作为第一样本图像。Wherein, the first back image is matched with the sample image in the sample library, and after the matching is successful, the first sample image matching the first back image is obtained; specifically, the preset similarity algorithm can be used in the sample The sample image in the library is found to have a similarity with the first back image within a predetermined range. If there are multiple sample images satisfying the condition, the sample image with the highest similarity is selected as the first sample image.
可选地,第一样本图像可与第一终端设备的型号信息相对应;当第一样本图像确定时,即可确定第一终端设备的型号信息,这样,可实现根据终端设备的背部图像自动识别型号信息。Optionally, the first sample image may correspond to the model information of the first terminal device; when the first sample image is determined, the model information of the first terminal device may be determined, so that the back of the terminal device may be implemented. The image automatically recognizes the model information.
步骤103,根据预先建立的样本图像与统一资源定位符URL的对应关系,获取与第一样本图像相对应的第一URL。Step 103: Acquire a first URL corresponding to the first sample image according to a correspondence between the pre-established sample image and the uniform resource locator URL.
具体地,URL是互联网上标准资源的地址;与第一样本图像相对应的URL即与第一背部图像相对应的URL。Specifically, the URL is an address of a standard resource on the Internet; a URL corresponding to the first sample image is a URL corresponding to the first back image.
步骤104,根据第一URL,生成与第一URL相对应的二维码。Step 104: Generate a two-dimensional code corresponding to the first URL according to the first URL.
其中,根据第一URL生成的二维码为与第一终端设备相对应的二维码,当获得第一终端设备的背部图像时,即可生成与之相符的二维码;当存在多个二维码时,用户无需再凭主观去选择扫描哪一个二维码。The two-dimensional code generated according to the first URL is a two-dimensional code corresponding to the first terminal device, and when the back image of the first terminal device is obtained, a two-dimensional code corresponding to the first terminal device is generated; When the QR code is used, the user does not need to subjectively select which QR code to scan.
优选地,步骤102包括: Preferably, step 102 includes:
第一步,对第一背部图像进行图像处理,得到第一背部图像的二值图像。In the first step, image processing is performed on the first back image to obtain a binary image of the first back image.
其中,二值图像是指每个像素不是黑就是白,其灰度值没有中间过渡的图像;通过二值图像可较为直观的体现出第一背部图像的轮廓特征。The binary image refers to an image in which each pixel is not black or white, and the gray value has no intermediate transition; the binary image can more intuitively reflect the contour feature of the first back image.
第二步,将二值图像与预先建立的样本库中的样本图像进行匹配,得出与二值图像相匹配的第一样本图像。In the second step, the binary image is matched with the sample image in the pre-established sample library to obtain a first sample image that matches the binary image.
具体地,将二值图像与样本库中的样本图像相匹配,以得到第一样本图像;其中,样本库中的样本图像也为二值图像形式,以便于作为匹配样本。Specifically, the binary image is matched with the sample image in the sample library to obtain a first sample image; wherein the sample image in the sample library is also in the form of a binary image, so as to be a matching sample.
优选地,上述第一步包括:Preferably, the first step mentioned above comprises:
对第一背部图像进行图像二值化处理以及边缘检测,得到第一背部图像的边缘二值图像;Performing image binarization processing and edge detection on the first back image to obtain an edge binary image of the first back image;
对边缘二值图像进行行列扫描,确定第一终端设备的背部区域;Performing a row and column scan on the edge binary image to determine a back region of the first terminal device;
从背部区域中截取握持边缘以上的规则区域,确定规则区域为第一背部图像的二值图像,握持边缘为用户握持第一终端设备的握持区域的边缘。The ruled area above the grip edge is taken from the back area, and the ruled area is determined to be a binary image of the first back image, and the grip edge is the edge of the grip area of the first terminal device held by the user.
其中,二值化处理即将整个图像呈现出明显的黑白效果;图像的边缘是指图像局部区域亮度变化显著的部分,该区域的灰度剖面一般可以看作是一个阶跃,即从一个灰度值在很小的缓冲区域内急剧变化到另一个灰度相差较大的灰度值。图像的边缘部分集中了图像的大部分信息,图像边缘的确定与提取对于整个图像场景的识别与理解是非常重要的,同时也是图像分割所依赖的重要特征,边缘检测主要是图像的灰度变化的度量、检测和定位;边缘检测可大幅度地减少图像处理的数据量,剔除与边缘不相关的信息,保留了图像重要的结构属性。通过对第一背部图像进行图像二值化处理以及边缘检测,以得到边缘二值图像。Among them, the binarization process will bring the whole image to a distinct black and white effect; the edge of the image refers to the part of the image where the brightness of the local area changes significantly, and the gray level profile of the area can generally be regarded as a step, that is, from a gray scale. The value changes sharply in a small buffer area to another gray value with a large difference in gray scale. The edge part of the image concentrates most of the information of the image. The determination and extraction of the edge of the image is very important for the recognition and understanding of the entire image scene. It is also an important feature that the image segmentation depends on. The edge detection is mainly the gray level change of the image. Measurement, detection and localization; edge detection can greatly reduce the amount of data processed by the image, eliminate information that is not related to the edge, and retain the important structural properties of the image. Image binarization processing and edge detection are performed on the first back image to obtain an edge binary image.
进一步地,可使用纹理特征分析定位算法,在边缘二值图像上进行行列扫描,确定在列方向上含有手机特征线段的候选区域,确定该区域的起始行坐标和高度,然后对该区域进行列扫描确定其列坐标和宽度,由此确 定第一终端设备的背部区域。Further, the texture feature analysis positioning algorithm may be used to perform row and column scanning on the edge binary image, determine a candidate region containing the mobile phone feature line segment in the column direction, determine the starting row coordinate and height of the region, and then perform the region on the region. Column scan determines its column coordinates and width, thus The back area of the first terminal device is determined.
由于识别终端设备的场景通常是用户握持终端设备,所以需要从背部区域中截取握持边缘以上的规则区域,作为第一背部图像的二值图像。Since the scene identifying the terminal device is usually the user holding the terminal device, it is necessary to intercept the regular region above the grip edge from the back region as a binary image of the first back image.
作为一个示例,参见图2,用户手持终端设备时,所获取的边缘二值图像如图2所示,由于握持区域的存在,只能识别出终端设备背部的上半部分,即握持边缘以上的部分,可根据终端设备边缘平滑的特性,过滤出终端设备背部的三个边和一个不规则的握持边缘,然后从背部区域中截取握持边缘以上的规则区域,作为该终端设备的二值图像。As an example, referring to FIG. 2, when the user holds the terminal device, the obtained edge binary image is as shown in FIG. 2, and only the upper part of the back of the terminal device, that is, the holding edge, can be recognized due to the presence of the holding area. In the above part, according to the smoothness of the edge of the terminal device, the three sides of the back of the terminal device and an irregular grip edge are filtered out, and then the ruled area above the grip edge is intercepted from the back region as the terminal device. Binary image.
可选地,步骤101包括:Optionally, step 101 includes:
检测到第一终端设备扫描二维码时,对第一终端设备的背部拍照,获取所拍摄的第一背部图像。When detecting that the first terminal device scans the two-dimensional code, the back of the first terminal device is photographed, and the captured first back image is acquired.
其中,当第一终端设备通过摄像头扫描二维码时,对第一终端设备的背部进行拍照,即可获得第一背部图像。可选地,可在二维码上或者二维码周围部署摄像头用于拍照。这样,对于同一种资源,比如应用程序,只设置一个二维码即可;当用户用终端设备扫描二维码时,对终端设备拍照,以获得与终端设备相对应的URL,再生成与该URL对应的二维码即与用户的终端设备相匹配的二维码。Wherein, when the first terminal device scans the two-dimensional code through the camera, the first back image is obtained by taking a picture of the back of the first terminal device. Alternatively, a camera can be deployed on the two-dimensional code or around the two-dimensional code for photographing. In this way, for the same resource, such as an application, only one two-dimensional code can be set; when the user scans the two-dimensional code with the terminal device, the terminal device is photographed to obtain a URL corresponding to the terminal device, and then generated. The two-dimensional code corresponding to the URL is a two-dimensional code that matches the user's terminal device.
优选地,该方法还包括:Preferably, the method further comprises:
获取第二终端设备的第二URL以及第二背部图像;Obtaining a second URL of the second terminal device and a second back image;
对第二背部图像进行图像处理,得到第二背部图像的二值图像;Performing image processing on the second back image to obtain a binary image of the second back image;
将第二背部图像的二值图像作为样本图像,与第二URL相对应存储在样本库中。The binary image of the second back image is taken as a sample image and stored in the sample library corresponding to the second URL.
其中,当第二终端设备在样本库中没有样本图像时,获取第二终端设备的第二URL以及第二背部图像时,并对第二背部图像进行图像处理得到样本图像,与第二URL相对应存储在样本库中,以更新样本库。When the second terminal device obtains the second URL and the second back image of the second terminal device when the second terminal device does not have the sample image in the sample library, and performs image processing on the second back image to obtain a sample image, which is compared with the second URL. Correspondence is stored in the sample library to update the sample library.
本发明的上述实施例中,通过获取终端设备的背部图像,并与样本库中的样本图像匹配,进而得到与终端设备相对应的URL并自动生成二维 码,当存在多个二维码时,可对用户的终端设备进行精确识别,用户无需再凭主观去选择扫描哪一个二维码;且背部图像经过图像处理后截取握持边缘以上的规则区域,精确度较高;本发明提高了用户的使用体验,解决了现有的二维码生成方法无法自动判断用户所需要的二维码,给用户带来了一定的不便的问题。In the above embodiment of the present invention, the back image of the terminal device is acquired and matched with the sample image in the sample library, thereby obtaining a URL corresponding to the terminal device and automatically generating a two-dimensional image. Code, when there are multiple two-dimensional codes, the user's terminal device can be accurately identified, and the user does not need to subjectively select which two-dimensional code to scan; and the back image is subjected to image processing to intercept the ruled area above the grip edge The invention has high accuracy; the invention improves the user experience and solves the problem that the existing two-dimensional code generation method cannot automatically determine the two-dimensional code required by the user, which brings certain inconvenience to the user.
第二实施例Second embodiment
参见图3,本发明的第二实施例以一个具体示例介绍本发明提供的二维码生成方法。以手机作为终端设备,图3所示的二维码生成装置包括以下模块:Referring to FIG. 3, a second embodiment of the present invention introduces a two-dimensional code generating method provided by the present invention with a specific example. Taking the mobile phone as the terminal device, the two-dimensional code generating device shown in FIG. 3 includes the following modules:
二维码显示模块301,设置为将URL转换成二维码。The two-dimensional code display module 301 is configured to convert the URL into a two-dimensional code.
摄像头模块302,设置为拍摄手机背部图像。The camera module 302 is configured to capture an image of the back of the mobile phone.
数据模块303,保存既有手机的信息,包括每款手机的背面图案和对应的URL地址。The data module 303 stores information about the existing mobile phone, including the back pattern of each mobile phone and the corresponding URL address.
逻辑模块304,设置为控制摄像头,拍摄,采样,对比数据,得到URL。The logic module 304 is configured to control the camera, capture, sample, compare data, and obtain a URL.
该装置主要执行以下流程:The device mainly performs the following processes:
一,样本库的建立:First, the establishment of the sample library:
其中,样本库可以建立在本地或者云端。收集各个品牌手机的背部图像,大部分手机的北部的上半部分都是有摄像头,闪光灯,logo等标志对比物。Among them, the sample library can be built locally or in the cloud. Collecting the back image of each brand of mobile phone, the upper part of the northern part of most mobile phones has a camera, flash, logo and other logo contrast.
1.1、对手机样本库中的背部图像进行边缘特征提取;1.1. Perform edge feature extraction on the back image in the mobile phone sample library;
针对采集的背部图像,进行噪声过滤,自动白平衡,自动曝光,伽马校正,对比度调整,边缘增强处理等。图像边缘识别如OpenCV的cvCanny函数都可以实现,通过对原始图像进行灰度化,对图像进行高斯滤波来量化数据,最终转换成二值图像。For the collected back image, noise filtering, automatic white balance, automatic exposure, gamma correction, contrast adjustment, edge enhancement processing, etc. Image edge recognition, such as OpenCV's cvCanny function, can be implemented by graying the original image, Gaussian filtering the image to quantify the data, and finally converting it into a binary image.
具体地,参见图4,图4为一个手机的背部图像的二值图像。Specifically, referring to FIG. 4, FIG. 4 is a binary image of a back image of a mobile phone.
1.2、建立URL和二值图像的样本库数据库;具体地,可建立URL和二值图像之间的数据库,使对应关系一目了然。 1.2. Establish a sample database database of URLs and binary images; specifically, a database between the URL and the binary image can be established to make the correspondence clear at a glance.
二,当有手机通过摄像头扫描二维码时,二维码生成装置主要执行以下流程:Second, when a mobile phone scans a two-dimensional code through a camera, the two-dimensional code generating device mainly performs the following processes:
2.1、通过摄像头模块302对拍摄手机背部图像;可通过软件驱动摄像头进入监控模式,实时采集图像。2.1. The camera module 302 is used to capture the image of the back of the mobile phone; the camera can be driven into the monitoring mode by software to collect images in real time.
2.2、通过逻辑模块304图像分析,获取特征分析段;主要是对所采集的手机背部图像做图像的整体对比度、去噪、灰度、黑白化处理,然后提取边缘图像,转换为二值边缘数据。2.2. Obtain the feature analysis segment through the image analysis of the logic module 304; mainly perform the overall contrast, denoising, grayscale, black and white processing on the back image of the collected mobile phone, and then extract the edge image and convert it into binary edge data. .
由于识别手机的场景用户是手持手机,所以只能识别出手机背面的上半部分,根据手机边缘平滑的特性,过滤出手机背面的三个边和一个不规则的握手边缘,然后从握手边缘的最高处切断,获得最终用于特征分析段。Since the user who recognizes the mobile phone is a handheld mobile phone, only the upper part of the back of the mobile phone can be recognized. According to the smoothness of the edge of the mobile phone, the three sides of the back of the mobile phone and an irregular handshake edge are filtered out, and then from the edge of the handshake. Cut off at the highest point and get the final segment for feature analysis.
获得手机背面区域的特征分析段后,进一步边提取边缘二值图像,然后逻辑模块304将该二值图像和数据模块303中特征库进行数据比对,获取相关的URL,并通过二维码显示模块301根据URL生成二维码。After obtaining the feature analysis segment of the back area of the mobile phone, the edge binary image is further extracted, and then the logic module 304 compares the binary image with the feature library in the data module 303, obtains the relevant URL, and displays the QR code. Module 301 generates a two-dimensional code from the URL.
具体地,通过URL转换二维码的算法,实时生成二维码显示出来,此时手机就可以进行扫描,扫描后手机自动引导到对应的URL上,实现智能跳转的功能。Specifically, the algorithm for converting the two-dimensional code by the URL generates the real-time generated two-dimensional code, and the mobile phone can scan the mobile phone, and the mobile phone automatically guides to the corresponding URL to realize the intelligent jump function.
第三实施例Third embodiment
参见图5,本发明的第三实施例提供了一种二维码生成装置,包括:Referring to FIG. 5, a third embodiment of the present invention provides a two-dimensional code generating apparatus, including:
第一获取模块501,设置为获取第一终端设备的第一背部图像;The first obtaining module 501 is configured to acquire a first back image of the first terminal device;
匹配模块502,设置为将第一背部图像与预先建立的样本库中的样本图像进行匹配,得出与第一背部图像相匹配的第一样本图像;The matching module 502 is configured to match the first back image with the sample image in the pre-established sample library to obtain a first sample image that matches the first back image;
第二获取模块503,设置为根据预先建立的样本图像与统一资源定位符URL的对应关系,获取与第一样本图像相对应的第一URL;The second obtaining module 503 is configured to acquire a first URL corresponding to the first sample image according to the correspondence between the pre-established sample image and the uniform resource locator URL;
生成模块504,设置为根据第一URL,生成与第一URL相对应的二维码。The generating module 504 is configured to generate a two-dimensional code corresponding to the first URL according to the first URL.
优选地,匹配模块502包括:Preferably, the matching module 502 includes:
图像处理子模块,设置为对第一背部图像进行图像处理,得到第一背 部图像的二值图像;An image processing sub-module configured to perform image processing on the first back image to obtain a first back a binary image of a partial image;
图像匹配子模块,设置为将二值图像与预先建立的样本库中的样本图像进行匹配,得出与二值图像相匹配的第一样本图像。The image matching sub-module is configured to match the binary image with the sample image in the pre-established sample library to obtain a first sample image that matches the binary image.
优选地,图像处理子模块包括:Preferably, the image processing sub-module comprises:
边缘检测单元,设置为对第一背部图像进行图像二值化处理以及边缘检测,得到第一背部图像的边缘二值图像;An edge detecting unit configured to perform image binarization processing and edge detection on the first back image to obtain an edge binary image of the first back image;
行列扫描单元,设置为对边缘二值图像进行行列扫描,确定第一终端设备的背部区域;a row and column scanning unit configured to perform a row and column scan on the edge binary image to determine a back region of the first terminal device;
区域截取单元,设置为从背部区域中截取握持边缘以上的规则区域,确定规则区域为第一背部图像的二值图像,握持边缘为用户握持第一终端设备的握持区域的边缘。The area intercepting unit is configured to intercept the ruled area above the grip edge from the back area, and determine that the rule area is a binary image of the first back image, and the grip edge is an edge of the grip area of the first terminal device that the user holds.
优选地,第一获取模块501包括:Preferably, the first obtaining module 501 includes:
拍照子模块,设置为检测到第一终端设备扫描二维码时,对第一终端设备的背部拍照,获取所拍摄的第一背部图像。The photographing sub-module is configured to: when detecting that the first terminal device scans the two-dimensional code, take a photo of the back of the first terminal device, and acquire the captured first back image.
优选地,该装置还包括:Preferably, the device further comprises:
样本建立模块,设置为获取第二终端设备的第二URL以及第二背部图像;a sample establishing module, configured to acquire a second URL of the second terminal device and a second back image;
对第二背部图像进行图像处理,得到第二背部图像的二值图像;Performing image processing on the second back image to obtain a binary image of the second back image;
将第二背部图像的二值图像作为样本图像,与第二URL相对应存储在样本库中。The binary image of the second back image is taken as a sample image and stored in the sample library corresponding to the second URL.
本发明的上述实施例中,通过获取终端设备的背部图像,并与样本库中的样本图像匹配,进而得到与终端设备相对应的URL并自动生成二维码,当存在多个二维码时,可对用户的终端设备进行精确识别,用户无需再凭主观去选择扫描哪一个二维码;且背部图像经过图像处理后截取握持边缘以上的规则区域,精确度较高;本发明提高了用户的使用体验,解决了现有的二维码生成方法无法自动判断用户所需要的二维码,给用户带来了一定的不便的问题。 In the above embodiment of the present invention, by acquiring the back image of the terminal device and matching with the sample image in the sample library, the URL corresponding to the terminal device is obtained and the two-dimensional code is automatically generated, when there are multiple two-dimensional codes. The user can accurately identify the terminal device of the user, and the user does not need to subjectively select which two-dimensional code to scan; and the back image is subjected to image processing to intercept the regular region above the grip edge, and the accuracy is high; The user's experience solves the problem that the existing two-dimensional code generation method cannot automatically determine the two-dimensional code required by the user, which brings a certain inconvenience to the user.
需要说明的是,本发明实施例提供的二维码生成装置是应用上述方法的装置,即上述方法的所有实施例均适用于该装置,且均能达到相同或相似的有益效果。It should be noted that the two-dimensional code generating device provided by the embodiment of the present invention is a device applying the above method, that is, all the embodiments of the foregoing method are applicable to the device, and all of the same or similar beneficial effects can be achieved.
以上所述是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明所述原理的前提下,还可以作出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above is a preferred embodiment of the present invention, and it should be noted that those skilled in the art can also make several improvements and retouchings without departing from the principles of the present invention. It should be considered as the scope of protection of the present invention.
工业实用性Industrial applicability
本发明实施例提供的上述技术方案,可以应用于二维码生成过程中,通过获取终端设备的背部图像,并与样本库中的样本图像匹配,进而得到与终端设备相对应的URL并自动生成二维码,当存在多个二维码时,可对用户的终端设备进行精确识别,用户无需再凭主观去选择扫描哪一个二维码;且背部图像经过图像处理后截取握持边缘以上的规则区域,精确度较高;本发明提高了用户的使用体验,解决了现有的二维码生成方法无法自动判断用户所需要的二维码,给用户带来了一定的不便的问题。 The foregoing technical solution provided by the embodiment of the present invention can be applied to the process of generating a two-dimensional code by acquiring the back image of the terminal device and matching the sample image in the sample library, thereby obtaining a URL corresponding to the terminal device and automatically generating the URL. The two-dimensional code, when there are multiple two-dimensional codes, can accurately identify the user's terminal device, and the user does not need to subjectively select which two-dimensional code to scan; and the back image is image-processed and intercepts the grip edge. The rule area has high precision; the invention improves the user experience and solves the problem that the existing two-dimensional code generation method cannot automatically determine the two-dimensional code required by the user, which brings certain inconvenience to the user.

Claims (10)

  1. 一种二维码生成方法,其中,包括:A two-dimensional code generation method, comprising:
    获取第一终端设备的第一背部图像;Obtaining a first back image of the first terminal device;
    将所述第一背部图像与预先建立的样本库中的样本图像进行匹配,得出与所述第一背部图像相匹配的第一样本图像;Matching the first back image with a sample image in a pre-established sample library to obtain a first sample image that matches the first back image;
    根据预先建立的样本图像与统一资源定位符URL的对应关系,获取与所述第一样本图像相对应的第一URL;Obtaining, according to a correspondence between the pre-established sample image and the uniform resource locator URL, a first URL corresponding to the first sample image;
    根据所述第一URL,生成与所述第一URL相对应的二维码。And generating a two-dimensional code corresponding to the first URL according to the first URL.
  2. 根据权利要求1所述的方法,其中,所述将所述第一背部图像与预先建立的样本库中的样本图像进行匹配,得出与所述第一背部图像相匹配的第一样本图像的步骤,包括:The method of claim 1, wherein the matching the first back image with a sample image in a pre-established sample library results in a first sample image that matches the first back image Steps include:
    对所述第一背部图像进行图像处理,得到所述第一背部图像的二值图像;Performing image processing on the first back image to obtain a binary image of the first back image;
    将所述二值图像与预先建立的样本库中的样本图像进行匹配,得出与所述二值图像相匹配的第一样本图像。The binary image is matched with the sample image in the pre-established sample library to obtain a first sample image that matches the binary image.
  3. 根据权利要求2所述的方法,其中,所述对所述第一背部图像进行图像处理,得到所述第一背部图像的二值图像的步骤,包括:The method according to claim 2, wherein the step of performing image processing on the first back image to obtain a binary image of the first back image comprises:
    对所述第一背部图像进行图像二值化处理以及边缘检测,得到所述第一背部图像的边缘二值图像;Performing image binarization processing and edge detection on the first back image to obtain an edge binary image of the first back image;
    对所述边缘二值图像进行行列扫描,确定所述第一终端设备的背部区域;Performing a row and column scan on the edge binary image to determine a back region of the first terminal device;
    从所述背部区域中截取握持边缘以上的规则区域,确定所述规则区域为所述第一背部图像的二值图像,所述握持边缘为用户握持所述第一终端设备的握持区域的边缘。Obtaining a ruled area above the gripping edge from the back area, determining that the ruled area is a binary image of the first back image, and the holding edge is a grip of the user holding the first terminal device The edge of the area.
  4. 根据权利要求1所述的方法,其中,所述获取所述第一终端设备的第一背部图像的步骤,包括:The method of claim 1, wherein the step of acquiring the first back image of the first terminal device comprises:
    检测到第一终端设备扫描二维码时,对所述第一终端设备的背部拍照,获取所拍摄的第一背部图像。 When detecting that the first terminal device scans the two-dimensional code, the back of the first terminal device is photographed, and the captured first back image is acquired.
  5. 根据权利要求2所述的方法,其中,所述方法还包括:The method of claim 2, wherein the method further comprises:
    获取第二终端设备的第二URL以及第二背部图像;Obtaining a second URL of the second terminal device and a second back image;
    对所述第二背部图像进行图像处理,得到所述第二背部图像的二值图像;Performing image processing on the second back image to obtain a binary image of the second back image;
    将所述第二背部图像的二值图像作为所述样本图像,与所述第二URL相对应存储在所述样本库中。A binary image of the second back image is used as the sample image, and is stored in the sample library corresponding to the second URL.
  6. 一种二维码生成装置,其中,包括:A two-dimensional code generating device, comprising:
    第一获取模块,设置为获取第一终端设备的第一背部图像;a first acquiring module, configured to acquire a first back image of the first terminal device;
    匹配模块,设置为将所述第一背部图像与预先建立的样本库中的样本图像进行匹配,得出与所述第一背部图像相匹配的第一样本图像;a matching module, configured to match the first back image with a sample image in a pre-established sample library to obtain a first sample image that matches the first back image;
    第二获取模块,设置为根据预先建立的样本图像与统一资源定位符URL的对应关系,获取与所述第一样本图像相对应的第一URL;a second acquiring module, configured to acquire a first URL corresponding to the first sample image according to a correspondence between a pre-established sample image and a uniform resource locator URL;
    生成模块,设置为根据所述第一URL,生成与所述第一URL相对应的二维码。And generating a module, configured to generate a two-dimensional code corresponding to the first URL according to the first URL.
  7. 根据权利要求6所述的装置,其中,所述匹配模块包括:The apparatus of claim 6 wherein said matching module comprises:
    图像处理子模块,设置为对所述第一背部图像进行图像处理,得到所述第一背部图像的二值图像;An image processing sub-module configured to perform image processing on the first back image to obtain a binary image of the first back image;
    图像匹配子模块,设置为将所述二值图像与预先建立的样本库中的样本图像进行匹配,得出与所述二值图像相匹配的第一样本图像。An image matching sub-module is configured to match the binary image with a sample image in a pre-established sample library to obtain a first sample image that matches the binary image.
  8. 根据权利要求7所述的装置,其中,所述图像处理子模块包括:The apparatus of claim 7, wherein the image processing sub-module comprises:
    边缘检测单元,设置为对所述第一背部图像进行图像二值化处理以及边缘检测,得到所述第一背部图像的边缘二值图像;An edge detecting unit configured to perform image binarization processing and edge detection on the first back image to obtain an edge binary image of the first back image;
    行列扫描单元,设置为对所述边缘二值图像进行行列扫描,确定所述第一终端设备的背部区域;a row and column scanning unit configured to perform a row and column scan on the edge binary image to determine a back region of the first terminal device;
    区域截取单元,设置为从所述背部区域中截取握持边缘以上的规则区域,确定所述规则区域为所述第一背部图像的二值图像,所述握持边缘为用户握持所述第一终端设备的握持区域的边缘。 The area intercepting unit is configured to intercept a regular area above the gripping edge from the back area, and determine that the regular area is a binary image of the first back image, and the holding edge is a user holding the first The edge of the holding area of a terminal device.
  9. 根据权利要求6所述的装置,其中,所述第一获取模块包括:The apparatus of claim 6, wherein the first obtaining module comprises:
    拍照子模块,设置为检测到第一终端设备扫描二维码时,对所述第一终端设备的背部拍照,获取所拍摄的第一背部图像。The photographing sub-module is configured to: when detecting that the first terminal device scans the two-dimensional code, take a photo of the back of the first terminal device to obtain the captured first back image.
  10. 根据权利要求7所述的装置,其中,所述装置还包括:The apparatus of claim 7 wherein said apparatus further comprises:
    样本建立模块,设置为获取第二终端设备的第二URL以及第二背部图像;a sample establishing module, configured to acquire a second URL of the second terminal device and a second back image;
    对所述第二背部图像进行图像处理,得到所述第二背部图像的二值图像;Performing image processing on the second back image to obtain a binary image of the second back image;
    将所述第二背部图像的二值图像作为所述样本图像,与所述第二URL相对应存储在所述样本库中。 A binary image of the second back image is used as the sample image, and is stored in the sample library corresponding to the second URL.
PCT/CN2016/103091 2016-06-20 2016-10-24 Method and apparatus for generating two-dimensional code WO2017219562A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610448787.7A CN107527083A (en) 2016-06-20 2016-06-20 A kind of two-dimensional code generation method and device
CN201610448787.7 2016-06-20

Publications (1)

Publication Number Publication Date
WO2017219562A1 true WO2017219562A1 (en) 2017-12-28

Family

ID=60734820

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/103091 WO2017219562A1 (en) 2016-06-20 2016-10-24 Method and apparatus for generating two-dimensional code

Country Status (2)

Country Link
CN (1) CN107527083A (en)
WO (1) WO2017219562A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110781985A (en) * 2019-09-04 2020-02-11 杭州利项科技有限公司 Data structuring system based on two-dimensional code

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112448881B (en) * 2019-09-03 2022-10-25 阿里巴巴集团控股有限公司 Anti-counterfeiting method and device for electronic mail and anti-counterfeiting method and device for communication message

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103679147A (en) * 2013-12-05 2014-03-26 广州绿怡信息科技有限公司 Method and device for identifying model of mobile phone
CN104318291A (en) * 2014-11-05 2015-01-28 深圳市快印客投资管理有限公司 Variable two-dimensional code generating method
CN104463264A (en) * 2014-10-23 2015-03-25 长园共创电力安全技术股份有限公司 Dynamic generation and display system for two-dimensional code and control method of dynamic generation and display system
CN104834952A (en) * 2014-02-11 2015-08-12 刘中一 Intelligent two-dimension code
US20160026626A1 (en) * 2012-10-09 2016-01-28 Robert Beadles Memorytag Hybrid Multidimensional Bar Text Code

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4881651B2 (en) * 2006-05-08 2012-02-22 ヤフー株式会社 Two-dimensional code generation program, two-dimensional code generation system, and two-dimensional code generation method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20160026626A1 (en) * 2012-10-09 2016-01-28 Robert Beadles Memorytag Hybrid Multidimensional Bar Text Code
CN103679147A (en) * 2013-12-05 2014-03-26 广州绿怡信息科技有限公司 Method and device for identifying model of mobile phone
CN104834952A (en) * 2014-02-11 2015-08-12 刘中一 Intelligent two-dimension code
CN104463264A (en) * 2014-10-23 2015-03-25 长园共创电力安全技术股份有限公司 Dynamic generation and display system for two-dimensional code and control method of dynamic generation and display system
CN104318291A (en) * 2014-11-05 2015-01-28 深圳市快印客投资管理有限公司 Variable two-dimensional code generating method

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110781985A (en) * 2019-09-04 2020-02-11 杭州利项科技有限公司 Data structuring system based on two-dimensional code
CN110781985B (en) * 2019-09-04 2023-07-07 杭州利项科技有限公司 Data structuring system based on two-dimensional code

Also Published As

Publication number Publication date
CN107527083A (en) 2017-12-29

Similar Documents

Publication Publication Date Title
CN110232369B (en) Face recognition method and electronic equipment
CN106446873B (en) Face detection method and device
US11270099B2 (en) Method and apparatus for generating facial feature
WO2019153739A1 (en) Identity authentication method, device, and apparatus based on face recognition, and storage medium
JP5318122B2 (en) Method and apparatus for reading information contained in bar code
WO2019033572A1 (en) Method for detecting whether face is blocked, device and storage medium
US10832037B2 (en) Method and apparatus for detecting image type
WO2019071664A1 (en) Human face recognition method and apparatus combined with depth information, and storage medium
WO2019061659A1 (en) Method and device for removing eyeglasses from facial image, and storage medium
TW201541364A (en) Image processing apparatus and processing method thereof
CN111582118A (en) Face recognition method and device
US20180293425A1 (en) Symbol Detection for Desired Image Reconstruction
CN105678301B (en) method, system and device for automatically identifying and segmenting text image
CN110751004A (en) Two-dimensional code detection method, device, equipment and storage medium
WO2017219562A1 (en) Method and apparatus for generating two-dimensional code
CN110717397A (en) Online translation system based on mobile phone camera
CN110490022A (en) A kind of bar code method and device in identification picture
CN112532884B (en) Identification method and device and electronic equipment
JP2017521011A (en) Symbol optical detection method
CN112052702A (en) Method and device for identifying two-dimensional code
CN106599889A (en) Method and apparatus for recognizing characters
CN114693554B (en) Big data image processing method and system
CN115601712A (en) Image data processing method and system suitable for field safety measures
US10984219B2 (en) Fingerprint processing with liveness detection
CN110532993B (en) Face anti-counterfeiting method and device, electronic equipment and medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16906102

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16906102

Country of ref document: EP

Kind code of ref document: A1