CN112560530B - Two-dimensional code processing method, device, medium and electronic device - Google Patents

Two-dimensional code processing method, device, medium and electronic device Download PDF

Info

Publication number
CN112560530B
CN112560530B CN202011440538.6A CN202011440538A CN112560530B CN 112560530 B CN112560530 B CN 112560530B CN 202011440538 A CN202011440538 A CN 202011440538A CN 112560530 B CN112560530 B CN 112560530B
Authority
CN
China
Prior art keywords
area
target image
dimensional code
processed
region
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.)
Active
Application number
CN202011440538.6A
Other languages
Chinese (zh)
Other versions
CN112560530A (en
Inventor
湛书航
孙登玉
周中坚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Sankuai Online Technology Co Ltd
Original Assignee
Beijing Sankuai Online Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sankuai Online Technology Co Ltd filed Critical Beijing Sankuai Online Technology Co Ltd
Priority to CN202011440538.6A priority Critical patent/CN112560530B/en
Publication of CN112560530A publication Critical patent/CN112560530A/en
Application granted granted Critical
Publication of CN112560530B publication Critical patent/CN112560530B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • 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
    • 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/06046Constructional details
    • G06K19/06103Constructional details the marking being embedded in a human recognizable image, e.g. a company logo with an embedded two-dimensional code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1447Methods for optical code recognition including a method step for retrieval of the optical code extracting optical codes from image or text carrying said optical code

Abstract

The specification discloses a two-dimensional code processing method, a device, a medium and an electronic device, comprising: receiving a target image sent by a user and a two-dimensional code to be processed; identifying content contained in the target image based on an image identification technique; determining a usable area from the target image according to the identification result; and adding the two-dimensional code to be processed to the usable area, and storing a target image containing the two-dimensional code to be processed. For a target image to be added with the two-dimensional code, a usable area for adding the two-dimensional code is determined from the target image through an image recognition technology, and then the two-dimensional code is added into the target image by utilizing a two-dimensional code adding technology, so that the processing efficiency of the two-dimensional code is improved on one hand, and on the other hand, the two-dimensional code can be accurately embedded into a proper position of the target image.

Description

Two-dimensional code processing method, device, medium and electronic device
Technical Field
The present disclosure relates to the field of internet information processing technologies, and in particular, to a two-dimensional code processing method, device, medium, and electronic apparatus.
Background
The two-dimensional code is used as an information carrier, has the advantages of large information capacity, low use cost, strong fault tolerance and the like, and is widely applied to various industries. The service scene applied by the two-dimensional code generally comprises: information acquisition, website skipping, anti-counterfeiting tracing, advertisement pushing, preferential promotion, payment, account login and other different business scenes.
However, the precondition that two-dimensional codes can be applied to these business scenarios is: two-dimensional codes need to be placed in these business scenarios. Specifically, a two-dimensional code applied to a service scene is inserted into a carrier corresponding to the service scene. For example: in a business scene of advertisement pushing, a two-dimensional code containing product information is required to be inserted into an advertisement related to the product, and if the advertisement related to the product is a poster, the two-dimensional code containing the product information is pasted at a corresponding position of the poster. Thus, after the advertisement corresponding to the product is pushed, if the user is interested in the product displayed in the advertisement, the relevant information of the product can be obtained by scanning the two-dimensional code.
However, at present, a two-dimensional code is inserted into a carrier corresponding to a service scene, and the two-dimensional code is usually copied and pasted into the carrier corresponding to the service scene in a manual mode, so that the processing efficiency of the two-dimensional code is low.
Therefore, the application provides a two-dimensional code processing method to solve the problems.
Disclosure of Invention
The specification provides a two-dimensional code processing method, a device, a medium and an electronic device, so as to partially solve the problems existing in the prior art.
The technical scheme adopted in the specification is as follows:
the two-dimensional code processing method provided by the specification comprises the following steps:
receiving a target image sent by a user and a two-dimensional code to be processed;
identifying content contained in the target image based on an image identification technique;
determining a usable area from the target image according to the identification result, wherein the usable area is other areas except the area occupied by the subject content of the target image in the target image;
and adding the two-dimensional code to be processed to the usable area, and storing a target image containing the two-dimensional code to be processed.
Optionally, before identifying the content contained in the target image based on the image identification technology, the method further includes:
detecting whether the target image contains a preset identification area or not;
if the target image is determined to contain a preset identification area, determining the preset identification area as a usable area;
Adding the two-dimensional code to be processed to the usable area specifically comprises the following steps:
and adding the two-dimensional code to be processed to the preset identification area.
Optionally, the identifying the content contained in the target image based on the image identification technology specifically includes:
and if the target image does not contain the preset identification area, identifying the salient area contained in the target image based on an image identification technology, wherein the salient area contains one or more of a text area and a pattern area.
Optionally, determining the usable area from the target image according to the identification result specifically includes:
and determining a usable area from other areas except the salient area in the target image according to the identified salient area.
Optionally, determining, according to the identified salient region, a usable region from other regions except the salient region in the target image specifically includes:
dividing other areas except the salient area in the target image into at least one area to be selected by using a specified shape detection algorithm according to the identified salient area, wherein the shape of the area to be selected is the specified shape;
For each candidate region, determining coordinates of pixel points contained in the candidate region and pixel values of the pixel points based on an image coordinate system established by the target image; determining the position and the area size of the region to be selected according to the coordinates of the pixel points, and determining the color of the region to be selected according to the pixel values of the pixel points;
and screening available areas from the determined areas to be selected according to the positions, the area sizes and the colors of the areas to be selected.
Optionally, according to the position, the area size and the color of each of the candidate areas, the available area is selected from the determined candidate areas, which specifically includes:
for each candidate region, determining a candidate weight corresponding to the candidate region according to the position, the area size and the color of the candidate region, wherein the candidate weight is used for representing the probability size of selecting the candidate region as a usable region;
and screening available areas from the determined candidate areas according to the candidate weights of the candidate areas.
Optionally, adding the two-dimensional code to be processed to the usable area specifically includes:
Creating a picture frame in the usable area;
judging whether the size of the picture frame is matched with the size of the two-dimensional code to be processed or not;
if so, adding the two-dimensional code to be processed into the picture frame;
if the two-dimensional codes are not matched, a prompt message is sent to the user, the adjusted two-dimensional codes to be processed, which are sent by the user, are received, and the adjusted two-dimensional codes to be processed are added into the picture frame; the prompting message comprises a size parameter of the picture frame.
The two-dimensional code processing apparatus that this specification provided, two-dimensional code processing apparatus includes:
the receiving unit is used for receiving the target image sent by the user and the two-dimensional code to be processed;
the identification unit is used for identifying the content contained in the target image based on an image identification technology; determining a usable area from the target image according to the identification result, wherein the usable area is other areas except the area occupied by the subject content of the target image in the target image;
and the processing unit is used for adding the two-dimensional code to be processed to the usable area and storing a target image containing the two-dimensional code to be processed.
A computer-readable storage medium provided in the present specification stores a computer program that, when executed by a processor, implements the two-dimensional code processing method described above.
The electronic device provided by the specification comprises a memory, a processor and a computer program stored on the memory and running on the processor, wherein the two-dimensional code processing method is realized when the processor executes the program.
The above-mentioned at least one technical scheme that this specification adopted can reach following beneficial effect:
according to the two-dimensional code processing method, a target image sent by a user and a two-dimensional code to be processed are received; identifying content contained in the target image based on an image identification technique; determining a usable area from the target image according to the identification result; and adding the two-dimensional code to be processed to the usable area, and storing a target image containing the two-dimensional code to be processed. For a target image to be added with the two-dimensional code, a usable area for adding the two-dimensional code is determined from the target image through an image recognition technology, and then the two-dimensional code is added into the target image by utilizing a two-dimensional code adding technology, so that the processing efficiency of the two-dimensional code is improved on one hand, and on the other hand, the two-dimensional code can be accurately embedded into a proper position of the target image.
Drawings
The accompanying drawings, which are included to provide a further understanding of the specification, illustrate and explain the exemplary embodiments of the present specification and their description, are not intended to limit the specification unduly. In the drawings:
fig. 1 is a schematic flow chart of a two-dimensional code processing method according to an embodiment of the present disclosure;
fig. 2 is a schematic flow chart of a two-dimensional code processing method according to an embodiment of the present disclosure;
fig. 3 is a schematic structural diagram of a two-dimensional code processing apparatus according to an embodiment of the present disclosure;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure.
Detailed Description
Based on the above, the present specification provides a two-dimensional code processing method, which receives a target image sent by a user and a two-dimensional code to be processed; identifying content contained in the target image based on an image identification technique; determining a usable area from the target image according to the identification result; and adding the two-dimensional code to be processed to the usable area, and storing a target image containing the two-dimensional code to be processed. For a target image to be added with the two-dimensional code, a usable area for adding the two-dimensional code is determined from the target image through an image recognition technology, and then the two-dimensional code is added into the target image by utilizing a two-dimensional code adding technology, so that the processing efficiency of the two-dimensional code is improved on one hand, and on the other hand, the two-dimensional code can be accurately embedded into a proper position of the target image.
The usable area described in the embodiments of the present disclosure is an area of the target image other than the area occupied by the subject content of the target image. That is, the subject content of the target image and the area occupied by the subject content can be determined by the image recognition technology, and then, in the target image, other areas except the area occupied by the subject content of the target image can be used as the usable area.
For the purposes of making the objects, technical solutions and advantages of the present specification more apparent, the technical solutions of the present specification will be clearly and completely described below with reference to specific embodiments of the present specification and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, of the embodiments of the present specification. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are intended to be within the scope of the present disclosure.
The following describes in detail the technical solutions provided by the embodiments of the present specification with reference to the accompanying drawings.
Fig. 1 is a flow chart of a two-dimensional code processing method according to an embodiment of the present disclosure. The method may be as follows.
And step 101, receiving a target image sent by a user and a two-dimensional code to be processed.
In the embodiment provided in the present specification, when a user needs to embed a two-dimensional code into a target image, the target image and the two-dimensional code to be embedded may be sent to a two-dimensional code processing device, and at this time, the two-dimensional code processing device receives the target image and the two-dimensional code to be embedded, which are sent by the user.
The target image may be one or a plurality of target images. Similarly, the two-dimensional code to be embedded may be one or more. The number of the target images and the two-dimensional codes to be embedded is not limited here. An example of embedding a two-dimensional code into a target image will be described below.
Step 103: and identifying the content contained in the target image based on an image identification technology.
In the embodiment provided in the present disclosure, since some target images may reserve an area in the design stage, where the reserved area is used for embedding a two-dimensional code, when receiving a target image sent by a user, a reserved area detection operation is started first, that is, whether the target image includes a preset identifier area is detected.
Specifically, the features contained in the target image are extracted, the extracted features are compared with preset identification features, and whether the target image contains a preset identification area or not is judged according to a comparison result. If the extracted features are consistent with the preset identification features as a result of the comparison, the target image is indicated to contain a preset identification region; if the extracted features are inconsistent with the preset identification features, the target image is indicated to not contain the preset identification region.
The identification area described herein may be an area including a predetermined identification feature. The preset identifying feature herein may be understood as a feature of a specified shape, such as: square boxes, may also be features of a specified shape that appear at a specified location, such as: square box in the lower right corner of the target image.
If the preset identification feature is a square frame at the right lower corner of the target image, when the target image sent by the user is received, the right lower corner of the target image is positioned, the feature at the right lower corner is further extracted, the extracted feature is compared with the preset identification feature, and whether the target image contains the preset identification region or not is judged according to the comparison result. If the extracted features are consistent with the preset identification features as a result of the comparison, the target image is indicated to contain a preset identification region; if the extracted features are inconsistent with the preset identification features, the target image is indicated to not contain the preset identification region.
And secondly, if the target image does not contain the preset identification area, identifying the salient area contained in the target image based on an image identification technology, wherein the salient area contains one or more of a character area and a pattern area.
Specifically, whether characters are contained in the target image is identified by using an EAST model, and if the identification result is that the characters are contained, the identified area where the characters are located is determined to be a salient area contained in the target image.
And identifying whether the pattern is contained in the target image by using an OpenCV saliency detection algorithm, and if the identification result is that the pattern is contained, determining the area where the identified pattern is located as a saliency area contained in the target image. The pattern region is understood to be a region containing an icon, and is understood to be a region containing a background pattern, or the like.
The pattern area here is different from the pattern included in the preset identification area described above.
Step 105: and determining a usable area from the target image according to the identification result.
The usable area is other areas of the target image except for the area occupied by the subject content of the target image.
In the embodiment provided in the present specification, since it is determined that the target image does not include the preset identification area through the reserved area detection operation, the usable area is determined from the other areas of the target image than the significant area according to the identified significant area.
Specifically, first, according to the identified salient region, using a specified shape detection algorithm, dividing other regions except the salient region in the target image into at least one region to be selected, wherein the shape of the region to be selected is the specified shape.
Assuming that the specified shape is rectangular, the region other than the salient region in the target image may be divided into a plurality of rectangular regions to be selected, which have different region sizes, using a maximum rectangular detection algorithm.
And secondly, determining the position, the area size and the color of each region to be selected for each region to be selected.
Specifically, based on an image coordinate system established by the target image, determining coordinates of pixel points contained in the candidate area and pixel values of the pixel points;
Determining the position of the region to be selected according to the coordinates of the pixel points; calculating the area size of the region to be selected according to the coordinates of the contained pixel points; and determining the color of the region to be selected according to the pixel value of the contained pixel point.
And finally, screening available areas from the determined areas to be selected according to the positions, the area sizes and the colors of the areas to be selected.
Specifically, for each candidate region, determining a candidate weight corresponding to the candidate region according to the position, the area size and the color of the candidate region, wherein the candidate weight is used for representing the probability size of selecting the candidate region as a usable region.
It should be noted that, when determining the weight to be selected corresponding to the area to be selected, the area size of the area at least needs to meet the minimum value of the two-dimensional code picture, that is, the closer the area size is to the minimum value of the two-dimensional code picture, the larger the weight to be selected of the area to be selected is; the closer the position is to the edge of the target image, the larger the weight value to be selected of the region to be selected is; the larger the color difference between the color and the color of the salient region, the larger the weight value to be selected of the region to be selected.
Specifically, for each region to be selected, sorting the regions to be selected according to the difference between the area size of the region and the minimum value of the set two-dimensional code picture, wherein the smaller the difference is, the more forward the sorting is, and at the moment, determining the weight value of the area size for each region to be selected according to the sorting result;
For each region to be selected, determining a weight value of the position of each region to be selected according to the position of the region, wherein the closer the position of the region is to the edge weight value of the target image, the larger the position of the region is;
and determining the weight value of the color of each candidate region according to the color of the region and the theme color of the target image for each candidate region, wherein the weight value is larger as the color difference between the color of the region and the theme color of the target image is larger.
And finally, calculating the weight to be selected of each area to be selected according to the weight value of the area size, the weight value of the position and the weight value of the color of each area to be selected. Wherein the specific gravity of the weight value of the area size is greater than that of the weight value of the position; the specific gravity of the weight value of the position is greater than that of the color.
For example: the candidate weight of the candidate region=w1+w2+l+w3+c, wherein W1 is greater than W2; w2 is larger than W3, and S represents a weight value corresponding to the area size; l represents a weight value corresponding to the position; c represents the weight value corresponding to the color.
And after the candidate weights of the candidate areas are obtained, screening available areas from the determined candidate areas according to the candidate weights of the candidate areas. Namely selecting the selected area with large weight value as the screened usable area.
Step 107: and adding the two-dimensional code to be processed to the usable area, and storing a target image containing the two-dimensional code to be processed.
In the embodiment provided in the specification, after screening out usable areas from the determined candidate areas, creating a picture frame in the usable areas; judging whether the size of the picture frame is matched with the size of the two-dimensional code to be processed or not; if so, adding the two-dimensional code to be processed into the picture frame; if the two-dimensional codes are not matched, a prompt message is sent to the user, the adjusted two-dimensional codes to be processed, which are sent by the user, are received, and the adjusted two-dimensional codes to be processed are added into the picture frame; the prompting message comprises a size parameter of the picture frame.
Specifically, after screening the usable area from the determined candidate areas, comparing the area value of the usable area with the area value of the two-dimensional code to be processed;
if the area value of the usable area is larger than the area value of the two-dimensional code to be processed, creating a picture frame in the usable area, and judging whether the size of the picture frame is matched with the size of the two-dimensional code to be processed; if so, adding the two-dimensional code to be processed into the picture frame; if the two-dimensional codes are not matched, a prompt message is sent to the user, the adjusted two-dimensional codes to be processed, which are sent by the user, are received, and the adjusted two-dimensional codes to be processed are added into the picture frame; the prompting message comprises a size parameter of the picture frame.
If the area value of the usable area is larger than the area value of the two-dimensional code to be processed, a picture frame is created in the usable area, and at this time, a picture frame matched with the size of the two-dimensional code to be processed can be created directly according to the area value of the two-dimensional code to be processed, so that the two-dimensional code to be processed is directly added into the picture frame.
If the area value of the usable area is not larger than the area value of the two-dimensional code to be processed, creating a maximum picture frame in the usable area, and then judging whether the size of the picture frame is matched with the size of the two-dimensional code to be processed; if so, adding the two-dimensional code to be processed into the picture frame; if the two-dimensional codes are not matched, a prompt message is sent to the user, the adjusted two-dimensional codes to be processed, which are sent by the user, are received, and the adjusted two-dimensional codes to be processed are added into the picture frame; the prompting message comprises a size parameter of the picture frame.
Optionally, if it is determined in step 103 that the target image includes a preset identified area through a reserved area detection operation, the preset identified area is determined as a usable area; and further, the two-dimensional code to be processed is added to the preset identification area, and a target image containing the two-dimensional code to be processed is stored.
Here, the method of adding the two-dimensional code to be processed to the preset identification area is similar to the method of adding the two-dimensional code to be processed to the usable area, and will not be described in detail.
Based on the technical method provided by the specification, a target image sent by a user and a two-dimensional code to be processed are received; identifying content contained in the target image based on an image identification technique; determining a usable area from the target image according to the identification result; and adding the two-dimensional code to be processed to the usable area, and storing a target image containing the two-dimensional code to be processed.
For a target image to be added with the two-dimensional code, a usable area for adding the two-dimensional code is determined from the target image through an image recognition technology, and then the two-dimensional code is added into the target image by utilizing a two-dimensional code adding technology, so that the processing efficiency of the two-dimensional code is improved on one hand, and on the other hand, the two-dimensional code can be accurately embedded into a proper position of the target image.
Based on the same inventive concept, fig. 2 is a schematic flow chart of a two-dimensional code processing method provided in the present specification. The method may be as follows.
Step 201: and receiving the target image sent by the user and the two-dimensional code to be processed.
Step 203: detecting whether the target image contains a preset identification area, if so, executing step 205; otherwise, step 207 is performed.
Step 205: and adding the two-dimensional code to be processed to the preset identification area, and storing a target image containing the two-dimensional code to be processed.
Step 207: based on an image recognition technology, a saliency region contained in the target image is recognized, wherein the saliency region contains one or more of a text region and a pattern region.
Step 209: and determining a usable area from other areas except the salient area in the target image according to the identified salient area.
Step 211: a largest picture frame is created in the usable area.
Step 213: judging whether the size of the picture frame is matched with the size of the two-dimensional code to be processed or not; if so, execute step 215; otherwise, step 217 is performed.
Step 215: and adding the two-dimensional code to be processed into the picture frame, and storing a target image containing the two-dimensional code to be processed.
Step 217: and sending a prompt message to the user, wherein the prompt message comprises the size parameter of the picture frame.
Step 219: and receiving the adjusted two-dimensional code to be processed, which is sent by the user, adding the adjusted two-dimensional code to be processed into the picture frame, and storing a target image containing the two-dimensional code to be processed.
The two-dimensional code processing method provided by the embodiment of the specification is based on the same thought, and the specification also provides corresponding equipment, storage medium and electronic equipment.
Fig. 3 is a schematic structural diagram of a two-dimensional code processing apparatus according to an embodiment of the present disclosure, where the two-dimensional code processing apparatus includes: a receiving unit 301, an identifying unit 302, and a processing unit 303, wherein:
a receiving unit 301, configured to receive a target image and a two-dimensional code to be processed, where the target image is sent by a user;
an identifying unit 302, configured to identify content contained in the target image based on an image identifying technique; determining a usable area from the target image according to the identification result, wherein the usable area is other areas except the area occupied by the subject content of the target image in the target image;
And a processing unit 303, configured to add the two-dimensional code to be processed to the usable area, and store a target image including the two-dimensional code to be processed.
In another embodiment provided in the present specification, the two-dimensional code processing apparatus includes: a detection unit 304, where the detection unit 304 is configured to detect whether a preset identification area is included in the target image before identifying content included in the target image based on an image identification technology;
the identifying unit 302 is further configured to determine, if it is determined that the target image includes a preset identified area, the preset identified area as a usable area;
the processing unit 303 adds the two-dimensional code to be processed to the usable area, specifically includes:
and adding the two-dimensional code to be processed to the preset identification area.
In another embodiment provided in the present specification, the identifying unit 302 identifies content included in the target image based on an image identification technology, and specifically includes:
if the detection unit 304 determines that the target image does not include the preset identification area, the salient area included in the target image is identified based on the image identification technology, where the salient area includes one or more of a text area and a pattern area.
In another embodiment provided in the present specification, the identifying unit 302 determines the usable area from the target image according to the identification result, and specifically includes:
and determining a usable area from other areas except the salient area in the target image according to the identified salient area.
In another embodiment provided in the present specification, the identifying unit 302 determines, according to the identified salient region, a usable region from other regions in the target image than the salient region, including:
dividing other areas except the salient area in the target image into at least one area to be selected by using a specified shape detection algorithm according to the identified salient area, wherein the shape of the area to be selected is the specified shape;
for each candidate region, determining coordinates of pixel points contained in the candidate region and pixel values of the pixel points based on an image coordinate system established by the target image; determining the position and the area size of the region to be selected according to the coordinates of the pixel points, and determining the color of the region to be selected according to the pixel values of the pixel points;
And screening available areas from the determined areas to be selected according to the positions, the area sizes and the colors of the areas to be selected.
In another embodiment provided in the present specification, the identifying unit 302 screens the usable area from the determined candidate areas according to the position, the area size and the color of the candidate areas, and specifically includes:
for each candidate region, determining a candidate weight corresponding to the candidate region according to the position, the area size and the color of the candidate region, wherein the candidate weight is used for representing the probability size of selecting the candidate region as a usable region;
and screening available areas from the determined candidate areas according to the candidate weights of the candidate areas.
In another embodiment provided in the present specification, the processing unit 303 adds the two-dimensional code to be processed to the usable area, and specifically includes:
creating a picture frame in the usable area;
judging whether the size of the picture frame is matched with the size of the two-dimensional code to be processed or not;
if so, adding the two-dimensional code to be processed into the picture frame;
If the two-dimensional codes are not matched, a prompt message is sent to the user, the adjusted two-dimensional codes to be processed, which are sent by the user, are received, and the adjusted two-dimensional codes to be processed are added into the picture frame; the prompting message comprises a size parameter of the picture frame.
It should be noted that, the two-dimensional code processing device provided in the embodiments of the present disclosure may be implemented in a hardware manner, or may be implemented in a software manner, and the implementation manner is not specifically limited herein. The two-dimensional code processing equipment receives a target image sent by a user and a two-dimensional code to be processed; identifying content contained in the target image based on an image identification technique; determining a usable area from the target image according to the identification result; and adding the two-dimensional code to be processed to the usable area, and storing a target image containing the two-dimensional code to be processed. For a target image to be added with the two-dimensional code, a usable area for adding the two-dimensional code is determined from the target image through an image recognition technology, and then the two-dimensional code is added into the target image by utilizing a two-dimensional code adding technology, so that the processing efficiency of the two-dimensional code is improved on one hand, and on the other hand, the two-dimensional code can be accurately embedded into a proper position of the target image.
The present specification also provides a computer-readable storage medium storing a computer program which, when executed by a processor, is operable to perform the two-dimensional code processing method provided in fig. 1 described above.
Based on the two-dimensional code processing method shown in fig. 1, the embodiment of the present disclosure further provides a schematic structural diagram of the electronic device shown in fig. 4. At the hardware level, as in fig. 4, the electronic device includes a processor, an internal bus, a network interface, a memory, and a non-volatile storage, although it may include hardware required for other services. The processor reads the corresponding computer program from the nonvolatile memory to the memory and then runs the computer program to realize the two-dimensional code processing method shown in the figure 1. By the method, the two-dimensional code is automatically embedded into the target image. Specifically, receiving a target image sent by a user and a two-dimensional code to be processed; identifying content contained in the target image based on an image identification technique; determining a usable area from the target image according to the identification result; and adding the two-dimensional code to be processed to the usable area, and storing a target image containing the two-dimensional code to be processed. For a target image to be added with the two-dimensional code, a usable area for adding the two-dimensional code is determined from the target image through an image recognition technology, and then the two-dimensional code is added into the target image by utilizing a two-dimensional code adding technology, so that the processing efficiency of the two-dimensional code is improved on one hand, and on the other hand, the two-dimensional code can be accurately embedded into a proper position of the target image.
Of course, other implementations, such as logic devices or combinations of hardware and software, are not excluded from the present description, that is, the execution subject of the following processing flows is not limited to each logic unit, but may be hardware or logic devices.
In the 90 s of the 20 th century, improvements to one technology could clearly be distinguished as improvements in hardware (e.g., improvements to circuit structures such as diodes, transistors, switches, etc.) or software (improvements to the process flow). However, with the development of technology, many improvements of the current method flows can be regarded as direct improvements of hardware circuit structures. Designers almost always obtain corresponding hardware circuit structures by programming improved method flows into hardware circuits. Therefore, an improvement of a method flow cannot be said to be realized by a hardware entity module. For example, a programmable logic device (Programmable Logic Device, PLD) (e.g., field programmable gate array (Field Programmable Gate Array, FPGA)) is an integrated circuit whose logic function is determined by the programming of the device by a user. A designer programs to "integrate" a digital system onto a PLD without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Moreover, nowadays, instead of manually manufacturing integrated circuit chips, such programming is mostly implemented by using "logic compiler" software, which is similar to the software compiler used in program development and writing, and the original code before the compiling is also written in a specific programming language, which is called hardware description language (Hardware Description Language, HDL), but not just one of the hdds, but a plurality of kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), lava, lola, myHDL, PALASM, RHDL (Ruby Hardware Description Language), etc., VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog are currently most commonly used. It will also be apparent to those skilled in the art that a hardware circuit implementing the logic method flow can be readily obtained by merely slightly programming the method flow into an integrated circuit using several of the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer readable medium storing computer readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, application specific integrated circuits (Application Specific Integrated Circuit, ASIC), programmable logic controllers, and embedded microcontrollers, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, atmel AT91SAM, microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller in a pure computer readable program code, it is well possible to implement the same functionality by logically programming the method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Such a controller may thus be regarded as a kind of hardware component, and means for performing various functions included therein may also be regarded as structures within the hardware component. Or even means for achieving the various functions may be regarded as either software modules implementing the methods or structures within hardware components.
The system, apparatus, module or unit set forth in the above embodiments may be implemented in particular by a computer chip or entity, or by a product having a certain function. One typical implementation is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
For convenience of description, the above devices are described as being functionally divided into various units, respectively. Of course, the functions of each element may be implemented in one or more software and/or hardware elements when implemented in the present specification.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The present description is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the specification. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory, random Access Memory (RAM), and/or nonvolatile memory, such as Read Only Memory (ROM) or Flash memory (Flash RAM), among others, in a computer readable medium. Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
It will be appreciated by those skilled in the art that embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, the present specification may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present description can take the form of a computer program product on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
The description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for system embodiments, since they are substantially similar to method embodiments, the description is relatively simple, as relevant to see a section of the description of method embodiments.
The foregoing is merely exemplary of the present disclosure and is not intended to limit the disclosure. Various modifications and alterations to this specification will become apparent to those skilled in the art. Any modifications, equivalent substitutions, improvements, or the like, which are within the spirit and principles of the present description, are intended to be included within the scope of the claims of the present description.

Claims (5)

1. The two-dimensional code processing method is characterized by comprising the following steps of:
receiving a target image sent by a user and a two-dimensional code to be processed;
identifying content contained in the target image based on an image identification technique;
determining a usable area from the target image according to the identification result, wherein the usable area is other areas except the area occupied by the subject content of the target image in the target image;
Adding the two-dimensional code to be processed to the usable area;
before identifying content contained in the target image based on an image identification technique, the method further comprises:
detecting whether the target image contains a preset identification area or not;
if the target image is determined to contain a preset identification area, determining the preset identification area as a usable area;
adding the two-dimensional code to be processed to the usable area specifically comprises the following steps:
adding the two-dimensional code to be processed to the preset identification area;
based on an image recognition technology, recognizing contents contained in the target image specifically comprises:
if the target image is determined to not contain a preset identification area, identifying a salient area contained in the target image based on an image identification technology, wherein the salient area contains one or more of a text area and a pattern area;
according to the identification result, determining a usable area from the target image specifically comprises the following steps:
determining a usable area from other areas except the salient area in the target image according to the identified salient area;
According to the identified salient region, determining a usable region from other regions except the salient region in the target image, wherein the method specifically comprises the following steps:
dividing other areas except the salient area in the target image into at least one area to be selected by using a specified shape detection algorithm according to the identified salient area, wherein the shape of the area to be selected is the specified shape;
for each candidate region, determining coordinates of pixel points contained in the candidate region and pixel values of the pixel points based on an image coordinate system established by the target image; determining the position and the area size of the region to be selected according to the coordinates of the pixel points, and determining the color of the region to be selected according to the pixel values of the pixel points;
and screening available areas from the determined areas to be selected according to the positions, the area sizes and the colors of the areas to be selected.
2. The method according to claim 1, wherein the screening of the usable areas from the determined candidate areas according to the position, the area size and the color of the candidate areas comprises:
For each candidate region, determining a candidate weight corresponding to the candidate region according to the position, the area size and the color of the candidate region, wherein the candidate weight is used for representing the probability size of selecting the candidate region as a usable region;
and screening available areas from the determined candidate areas according to the candidate weights of the candidate areas.
3. The method of claim 1, wherein adding the two-dimensional code to be processed to the usable area specifically comprises:
creating a picture frame in the usable area;
judging whether the size of the picture frame is matched with the size of the two-dimensional code to be processed or not;
if so, adding the two-dimensional code to be processed into the picture frame;
if the two-dimensional codes are not matched, a prompt message is sent to the user, the adjusted two-dimensional codes to be processed, which are sent by the user, are received, and the adjusted two-dimensional codes to be processed are added into the picture frame; the prompting message comprises a size parameter of the picture frame.
4. A computer-readable storage medium, characterized in that the storage medium stores a computer program which, when executed by a processor, implements the two-dimensional code processing method of any one of the preceding claims 1 to 3.
5. An electronic device comprising a memory, a processor and a computer program stored on the memory and running on the processor, characterized in that the processor implements the two-dimensional code processing method according to any of the preceding claims 1 to 3 when executing the program.
CN202011440538.6A 2020-12-07 2020-12-07 Two-dimensional code processing method, device, medium and electronic device Active CN112560530B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011440538.6A CN112560530B (en) 2020-12-07 2020-12-07 Two-dimensional code processing method, device, medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011440538.6A CN112560530B (en) 2020-12-07 2020-12-07 Two-dimensional code processing method, device, medium and electronic device

Publications (2)

Publication Number Publication Date
CN112560530A CN112560530A (en) 2021-03-26
CN112560530B true CN112560530B (en) 2024-02-23

Family

ID=75062145

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011440538.6A Active CN112560530B (en) 2020-12-07 2020-12-07 Two-dimensional code processing method, device, medium and electronic device

Country Status (1)

Country Link
CN (1) CN112560530B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113962240B (en) * 2021-10-12 2023-09-15 北京百度网讯科技有限公司 Picture processing method, device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008172758A (en) * 2006-12-15 2008-07-24 Ricoh Co Ltd Image processing method, image processing device and image processing program
JP2009230474A (en) * 2008-03-24 2009-10-08 Kyocera Mita Corp Image forming apparatus and location information processing method
CN102648623A (en) * 2009-12-08 2012-08-22 株式会社资生堂 Invisible information embedding device, invisible information recognition device, invisible information embedding method, invisible information recognition method, and recording medium
CN104077624A (en) * 2013-03-26 2014-10-01 中国银联股份有限公司 Methods and systems for generating and checking electronic note with anti-counterfeiting two-dimension code
CN108764422A (en) * 2018-05-15 2018-11-06 普联技术有限公司 Quick Response Code insertion, extracting method and the device of image
CN111507446A (en) * 2019-01-31 2020-08-07 北京骑胜科技有限公司 Two-dimensional code generation and identification method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008172758A (en) * 2006-12-15 2008-07-24 Ricoh Co Ltd Image processing method, image processing device and image processing program
JP2009230474A (en) * 2008-03-24 2009-10-08 Kyocera Mita Corp Image forming apparatus and location information processing method
CN102648623A (en) * 2009-12-08 2012-08-22 株式会社资生堂 Invisible information embedding device, invisible information recognition device, invisible information embedding method, invisible information recognition method, and recording medium
CN104077624A (en) * 2013-03-26 2014-10-01 中国银联股份有限公司 Methods and systems for generating and checking electronic note with anti-counterfeiting two-dimension code
CN108764422A (en) * 2018-05-15 2018-11-06 普联技术有限公司 Quick Response Code insertion, extracting method and the device of image
CN111507446A (en) * 2019-01-31 2020-08-07 北京骑胜科技有限公司 Two-dimensional code generation and identification method and device

Also Published As

Publication number Publication date
CN112560530A (en) 2021-03-26

Similar Documents

Publication Publication Date Title
US10846556B2 (en) Vehicle insurance image processing method, apparatus, server, and system
TW201913449A (en) Target image code recognition method and device
CN112347512A (en) Image processing method, device, equipment and storage medium
CN114332873A (en) Training method and device for recognition model
CN109791703B (en) Generating three-dimensional user experience based on two-dimensional media content
CN109978044B (en) Training data generation method and device, and model training method and device
CN112560530B (en) Two-dimensional code processing method, device, medium and electronic device
CN109102026A (en) A kind of vehicle image detection method, apparatus and system
CN111368902A (en) Data labeling method and device
CN113888415B (en) Model training and image restoration method and device
CN111881393A (en) Page rendering method, device, medium and electronic equipment
CN116246276A (en) Information identification method, device, equipment and readable storage medium
CN114065868B (en) Training method of text detection model, text detection method and device
CN114359935A (en) Model training and form recognition method and device
CN115984154A (en) Image fusion method and device, storage medium and electronic equipment
CN115689676A (en) Industry identification method and apparatus, storage medium and electronic device
CN114440903A (en) High-precision map construction method and device, storage medium and electronic equipment
CN114926437A (en) Image quality evaluation method and device
CN114863206A (en) Model training method, target detection method and device
CN114219812A (en) Label avoiding method and device, electronic equipment and storage medium
CN110968513B (en) Recording method and device of test script
CN113887351A (en) Obstacle detection method and obstacle detection device for unmanned driving
CN111523539A (en) Character detection method and device
CN111899264A (en) Target image segmentation method, device and medium
CN110659372A (en) Picture input and access method, device and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant