CN115456899A - Two-dimensional code cleaning method and device, electronic equipment and storage medium - Google Patents

Two-dimensional code cleaning method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115456899A
CN115456899A CN202211109456.2A CN202211109456A CN115456899A CN 115456899 A CN115456899 A CN 115456899A CN 202211109456 A CN202211109456 A CN 202211109456A CN 115456899 A CN115456899 A CN 115456899A
Authority
CN
China
Prior art keywords
cleaned
target
image
contour
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211109456.2A
Other languages
Chinese (zh)
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.)
Daguan Intelligent Shenzhen Co ltd
Original Assignee
Daguan Intelligent Shenzhen 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 Daguan Intelligent Shenzhen Co ltd filed Critical Daguan Intelligent Shenzhen Co ltd
Priority to CN202211109456.2A priority Critical patent/CN115456899A/en
Publication of CN115456899A publication Critical patent/CN115456899A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • G06T5/77
    • G06T5/94
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/66Analysis of geometric attributes of image moments or centre of gravity

Abstract

The embodiment of the application discloses a two-dimensional code cleaning method and device, electronic equipment and a storage medium. The method comprises the following steps: under the condition of acquiring the information of the image to be cleaned, normalizing the image to be cleaned into a picture to be cleaned in a preset format; acquiring contour information of all target contours in a picture to be cleaned, wherein the target contours have at least three levels of contours; for any target contour, determining center point position information of the target contour based on corresponding contour information; determining whether target central point location information meeting an isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists; and processing the area where the two-dimension code is located in the image to be cleaned according to a preset processing mode so as to clean the two-dimension code in the image to be cleaned. Whether the two-dimension code exists in the image can be quickly judged according to the characteristic that the two-dimension code contains positioning points which are connected into an isosceles triangle, and then the two-dimension code is cleaned.

Description

Two-dimensional code cleaning method and device, electronic equipment and storage medium
Technical Field
The embodiment of the application relates to the technical field of data cleaning, in particular to a method and a device for cleaning a two-dimensional code, electronic equipment and a storage medium.
Background
With the development of two-dimensional code technology, the two-dimensional code is more and more widely used, and the two-dimensional code is related to various aspects of life, such as articles, news, pictures, videos and other information on the internet and non-internet, and the two-dimensional code is possibly attached.
The two-dimensional code attached to the information may be a malicious link, and in the process of spreading the information, the two-dimensional code attached to the information, namely the malicious link, may be spread synchronously, so that more people may contact the malicious link, and a bad result may be possibly caused to some users, so that the method is particularly important for cleaning the two-dimensional code.
Disclosure of Invention
The embodiment of the application provides a method and a device for cleaning a two-dimension code, electronic equipment and a storage medium, so as to clean the two-dimension code in information.
In a first aspect, an embodiment of the present application provides a method for cleaning a two-dimensional code, where the method includes:
under the condition of acquiring the information of the image to be cleaned, normalizing the image to be cleaned into the image to be cleaned in a preset format;
acquiring contour information of all target contours in the picture to be cleaned, wherein the target contours have at least three levels of contours;
for any one target contour, determining center point position information of the target contour based on the corresponding contour information;
determining whether target central point location information meeting an isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists;
and processing the area of the two-dimensional code in the image to be cleaned according to a preset processing mode so as to clean the two-dimensional code in the image to be cleaned.
In a second aspect, an embodiment of the present application further provides a cleaning device for a two-dimensional code, where the cleaning device for a two-dimensional code includes:
the normalization module is used for normalizing the image to be cleaned into a picture to be cleaned in a preset format under the condition of acquiring the information of the image to be cleaned;
the acquisition module is used for acquiring contour information of all target contours in the picture to be cleaned, and the target contours have at least three levels of contours;
the central point location determining module is used for determining the central point location information of any target contour based on the corresponding contour information;
the existence judging module is used for determining whether target central point location information meeting the isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists;
and the cleaning module is used for processing the area where the two-dimension code is located in the image to be cleaned according to a preset processing mode so as to clean the two-dimension code in the image to be cleaned.
In a third aspect, an embodiment of the present application further provides an electronic device, where the electronic device includes:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors implement the two-dimensional code cleaning method provided by any embodiment of the present application.
In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the two-dimensional code cleaning method according to any embodiment of the present application.
According to the technical scheme of the embodiment of the application, under the condition that the information of the image to be cleaned is obtained, the image to be cleaned is normalized into the image to be cleaned in a preset format; acquiring contour information of all target contours in the picture to be cleaned, wherein the target contours have at least three levels of contours; for any one target contour, determining center point location information of the target contour based on the corresponding contour information; determining whether target central point location information meeting an isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists; and processing the area of the two-dimensional code in the image to be cleaned according to a preset processing mode so as to clean the two-dimensional code in the image to be cleaned. Based on the characteristics, whether the two-dimensional code exists in the image can be judged quickly according to the characteristic that the two-dimensional code comprises three positioning points which can be connected into an isosceles triangle, and then the two-dimensional code in the image information can be cleaned quickly.
Drawings
Fig. 1 is a schematic flow chart of a two-dimensional code cleaning method according to an embodiment of the present application;
fig. 2 is a schematic diagram of a picture to be cleaned according to a first embodiment of the present application;
fig. 3 is a schematic structural diagram of a two-dimensional code cleaning device according to a second embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to a third embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of and not restrictive on the broad application. It should be further noted that, for the convenience of description, only some of the structures associated with the present application are shown in the drawings, not all of them.
Example one
Fig. 1 is a schematic flow diagram of a two-dimensional code cleaning method according to an embodiment of the present application, where the present embodiment is applicable to a two-dimensional code cleaning scenario, and the method may be executed by a two-dimensional code cleaning apparatus, and the apparatus may be implemented in a hardware and/or software manner, and may be generally integrated in an electronic device such as a computer with data computation capability, and specifically includes the following steps:
101, under the condition that the information of the image to be cleaned is acquired, normalizing the image to be cleaned into the image to be cleaned in a preset format.
In this step, the information requested locally may be monitored, and as long as the information requested locally is monitored in this embodiment, it should be noted that the monitoring may be performed after obtaining the user consent.
The local terminal can be a terminal held by a user, such as a mobile phone, a tablet, a computer, a smart television, a smart projector, and the like.
In addition, after the step is monitored that the image information is acquired, the image information is determined as the image to be cleaned, and generally, the image information may be, but is not limited to, a picture link, a picture, a video, a GIF image, and the like.
The step of normalizing the image information to be cleaned is carried out, the specific processing process is different according to different types of the image information to be cleaned, and specifically, the image type of the image information to be cleaned can be judged under the condition of acquiring the image information to be cleaned.
For example, for the picture link, the picture may be requested to be locally saved according to the link, and the picture needs to be saved in a preset format during saving. For another example, if the image type is a GIF image, a first frame of the GIF image is obtained, and the first frame is converted into a preset format to obtain a picture to be cleaned.
It should be noted that the preset format may be a format that can be supported by opencv, such as a Windows bitmap file: BMP, DIB; JPEG file: JPEG, JPG, JPE; portable network picture: PNG; portable image format: PBM, PGM, PPM; sun rasters: SR, RAS; TIFF file: TIFF, TIF; openEXR HDR picture: EXR; JPEG 2000 picture: jp2, and the like.
After the picture to be cleaned is obtained, in order to efficiently perform the subsequent processing, the picture to be cleaned may be subjected to graying processing, binarization processing and noise processing in sequence. The grayscale processing may use a cv2.Cvtcolor tool, the binarization processing may use a cv2.Threshold tool, and the noise processing may use a filter to filter out noise in the picture.
It should be noted that, the above processing procedures and the tools used in the above processing procedures can refer to related technologies, and are not described herein again.
And 102, acquiring contour information of all target contours in the picture to be cleaned, wherein the target contours have at least three levels of contours.
In this step, all the contours in the picture to be cleaned are obtained first, and an initial target contour having at least three levels of contours is screened out from all the contours. In specific implementation, the image to be cleaned can be obtained by using a cv2.Findcontours tool, as shown in fig. 2, fig. 2 is a schematic diagram of the image to be cleaned provided in the first embodiment of the present application.
As shown in fig. 2, it includes a plurality of contours, such as contour 201, contour 202, and contour 203. In which, profile 201 completely includes profile 202, and profile 202 completely includes profile 203, so that profile 201 is a three-level profile, where the next level is profile 202, and the next level is profile 203, and thus profile 201 is the initial target profile.
Since the cv2.Findcontours tool can identify the level relation between the outlines besides the outline information in the picture, it usually marks a code for each outline, the code can uniquely identify the corresponding outline, and the codes with the level relation are put together according to the inclusion relation.
In one specific example, the information identified by the cv2.Findcontours tool is as follows:
points=[[(312,697),(312,697),(311,698),9,10,11],[(474,551),(474,551),(475,549),15,16,17],[(312,551),(312,551),(311,549),37,38,39]]。
in the above description, the [ (312, 697), (311, 698), 9,10,11] is taken as an example, and refers to center point position information of three contours (9, 10, 11) having a three-level contour relationship, where, (312, 697) is a pixel coordinate of a center point position of the contour 9, (312, 697) is a pixel coordinate of a center point position of the contour 10, and (311, 698) is a pixel coordinate of a center point position of the contour 11.
For the contours in the above specific example, since the contours all have three levels of contours, the contours are all initial target contours, and for any initial target contour, it is determined whether the areas of the contours at each level are all larger than the respective corresponding contour threshold, and if so, the initial target contour is determined to be the target contour.
Also in the above-described examples of [ (312, 697), (311, 698), 9,10, and 11], it is determined whether the contour 9 is larger than the threshold 1, whether the contour 10 is larger than the threshold 2, and whether the contour 11 is larger than the threshold 3, in this order, and if both are true, it is determined that the contour 9 is the target contour.
It should be noted that, the thresholds 1, 2, and 3 may be preset, but the whole area of the two-dimensional code region in the acquired picture to be cleaned may be large or small, so before this step, the wechat _ qrcode module in opencv may be used to identify the region of the two-dimensional code, and then the region may be reduced or enlarged to the target area.
Of course, the thresholds 1, 2, and 3 may also be set to be dynamic, and since the ratio of the area of the anchor point to the entire area of the two-dimensional code region is fixed in order to identify the three anchor points of the two-dimensional code, before this step, the wechat _ qrcode module in opencv may be used to identify the area of the two-dimensional code region, and then the threshold may be calculated by using the ratio, which is generally the product of the area of the two-dimensional code region and the ratio.
The fixed proportion is 3, and the fixed proportion corresponds to the profiles of different levels respectively, so that the threshold values 1, 2 and 3 can be calculated.
And 103, for any target contour, determining the center point information of the target contour based on the corresponding contour information.
It should be noted that, since the foregoing steps have already obtained the contour information of each target contour, the contour information includes the center point position information of each level of contour in the target contour. Therefore, the center point information of each level of contour in the target contour can be extracted from the contour information; and then determining the center point location information of the target contour based on the center point location information of each level of contour.
In one specific example, the profile information is as follows:
points=[[(312,697),(312,697),(311,698),9,10,11],[(474,551),(474,551),(475,549),15,16,17],[(312,551),(312,551),(311,549),37,38,39]]。
taking target outlines [ (312, 697), (311, 698), 9,10,11] as an example, the center point location information of each level of outline is (312, 697), (311, 698) in sequence, it should be noted that, because the center point locations of each level of outline in the two-dimensional code are overlapped under an ideal state, the phase difference is not too large even if there is an error, one of the center point location information can be arbitrarily taken as the center point location information of the target outline.
Of course, in order to pursue better accuracy, an averaging process may be performed with three center points as information, such as ((312 + 311)/3, (697 + 698)/3) as the center point information of the target contour.
And step 104, determining whether target central point position information meeting the isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point position information exists in the picture to be cleaned under the condition that the target central point position information exists.
In this step, since there are 3 positioning points of the two-dimensional code and the connecting line of the central points is an isosceles triangle, the feature can be used for determination. Specifically, for any three pieces of center point position information, whether a triangle formed by corresponding center point positions is an isosceles triangle is judged; if yes, determining the three central point location information as target central point location information, and determining that target central point location information meeting the isosceles triangle relationship exists.
In a specific example, since the pixel point coordinates of each center point location are known, the distance between two points can be obtained, and if more than two equal connecting lines exist in the connecting lines between two center point locations, it can be determined that the three center point locations can form an isosceles triangle.
And 105, processing the area where the two-dimension code is located in the image to be cleaned according to a preset processing mode so as to clean the two-dimension code in the image to be cleaned.
In this step, the preset processing mode may be coding processing or matting processing. It should be noted that the area where the two-dimensional code is located may be determined by three target outlines corresponding to the target center point location information, and a rectangle surrounded by the three target outlines is the area where the two-dimensional code is located.
In the embodiment, under the condition that the information of the image to be cleaned is acquired, the image to be cleaned is normalized into the image to be cleaned in the preset format; acquiring contour information of all target contours in a picture to be cleaned, wherein the target contours have at least three levels of contours; for any target contour, determining center point position information of the target contour based on corresponding contour information; determining whether target central point location information meeting an isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists; and processing the area where the two-dimension code is located in the image to be cleaned according to a preset processing mode so as to clean the two-dimension code in the image to be cleaned. Based on the characteristic that the two-dimensional code comprises three positioning points which can be connected into an isosceles triangle, whether the two-dimensional code exists in the image can be judged quickly, and then the two-dimensional code in the image information can be cleaned quickly.
Example two
Referring to fig. 3, fig. 3 is a schematic structural diagram of a two-dimensional code cleaning device according to a second embodiment of the present application. The cleaning device for the two-dimensional code, provided by the embodiment of the application, can execute the cleaning method for the two-dimensional code provided by any embodiment of the application, and has the corresponding functional modules and beneficial effects of the execution method. The device can be realized in a software and/or hardware mode, as shown in fig. 3, the cleaning device for the two-dimensional code specifically comprises: a normalization module 301, an acquisition module 302, an acquisition module 303, a presence determination module 304, and a cleaning module 305.
The device comprises a normalization module, a display module and a control module, wherein the normalization module is used for normalizing an image to be cleaned into a picture to be cleaned in a preset format under the condition of acquiring information of the image to be cleaned;
the acquisition module is used for acquiring contour information of all target contours in the picture to be cleaned, and the target contours have at least three levels of contours;
the central point location determining module is used for determining the central point location information of the target contour based on the corresponding contour information for any target contour;
the existence judging module is used for determining whether target central point location information meeting the isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists;
and the cleaning module is used for processing the area where the two-dimension code in the image to be cleaned is located according to a preset processing mode so as to clean the two-dimension code in the image to be cleaned.
In the embodiment, under the condition that the information of the image to be cleaned is acquired, the image to be cleaned is normalized into the image to be cleaned in the preset format; acquiring contour information of all target contours in a picture to be cleaned, wherein the target contours have at least three levels of contours; for any target contour, determining center point position information of the target contour based on corresponding contour information; determining whether target central point location information meeting an isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists; and processing the area where the two-dimension code is located in the image to be cleaned according to a preset processing mode so as to clean the two-dimension code in the image to be cleaned. Based on the characteristic that the two-dimensional code comprises three positioning points which can be connected into an isosceles triangle, whether the two-dimensional code exists in the image can be judged quickly, and then the two-dimensional code in the image information can be cleaned quickly.
Further, the normalization module includes:
the judging unit is used for judging the image type of the image information to be cleaned under the condition of acquiring the image information to be cleaned;
and the intercepting unit is used for acquiring a first frame of the GIF image if the image type is the GIF image, and converting the first frame into a preset format to obtain the picture to be cleaned.
Further, the apparatus further comprises:
and the preprocessing module is used for carrying out graying processing, binarization processing and noise processing on the picture to be cleaned in sequence.
Further, the acquisition module includes:
the acquisition unit is used for acquiring all contours in the picture to be cleaned and screening out initial target contours with at least three-level contours from all the contours;
and the area judgment unit is used for judging whether the areas of all the contours are larger than the respective corresponding contour threshold value or not for any initial target contour, and if so, determining the initial target contour as the target contour.
Further, the center point location determining module includes:
the extracting unit is used for extracting the center point position information of each level of contour in the target contour from the contour information;
and the central point position determining unit is used for determining the central point position information of the target contour based on the central point position information of each level of contour.
Further, the presence determination module includes:
the triangle judging unit is used for judging whether a triangle formed by corresponding central point positions of any three pieces of central point position information is an isosceles triangle or not;
and the existence judging unit is used for determining that the three central point location information are the target central point location information and determining that the target central point location information meeting the isosceles triangle relationship exists if the target central point location information meets the isosceles triangle relationship.
Further, the preset processing mode comprises:
coding processing or matting processing.
EXAMPLE III
Fig. 4 is a schematic structural diagram of an electronic device according to a third embodiment of the present application, as shown in fig. 4, the electronic device includes a processor 410, a memory 420, an input device 430, and an output device 440; the number of the processors 410 in the electronic device may be one or more, and one processor 410 is taken as an example in fig. 4; the processor 410, the memory 420, the input device 430 and the output device 440 in the electronic apparatus may be connected by a bus or other means, and the bus connection is exemplified in fig. 4.
The memory 420 serves as a computer-readable storage medium, and can be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the two-dimensional code cleaning method in the embodiment of the present application (for example, the normalization module 301, the acquisition module 302, the acquisition module 303, the existence determination module 304, and the cleaning module 305 in the two-dimensional code cleaning device). The processor 410 executes various functional applications and data processing of the electronic device by executing software programs, instructions and modules stored in the memory 420, that is, implements the two-dimensional code cleaning method described above.
That is, under the condition that the information of the image to be cleaned is acquired, the image to be cleaned is normalized into the image to be cleaned in the preset format;
acquiring contour information of all target contours in a picture to be cleaned, wherein the target contours have at least three levels of contours;
for any target contour, determining center point position information of the target contour based on corresponding contour information;
determining whether target central point location information meeting an isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists;
and processing the area where the two-dimension code is located in the image to be cleaned according to a preset processing mode so as to clean the two-dimension code in the image to be cleaned.
In the embodiment, under the condition that the information of the image to be cleaned is acquired, the image to be cleaned is normalized into the image to be cleaned in the preset format; acquiring contour information of all target contours in a picture to be cleaned, wherein the target contours have at least three levels of contours; for any target contour, determining center point position information of the target contour based on corresponding contour information; determining whether target central point location information meeting an isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists; and processing the area where the two-dimension code is located in the image to be cleaned according to a preset processing mode so as to clean the two-dimension code in the image to be cleaned. Based on the characteristic that the two-dimensional code comprises three positioning points which can be connected into an isosceles triangle, whether the two-dimensional code exists in the image can be judged quickly, and then the two-dimensional code in the image information can be cleaned quickly.
Further, under the condition of acquiring the information of the image to be cleaned, the image to be cleaned is normalized into the image to be cleaned in the preset format, and the method comprises the following steps:
under the condition of acquiring the image information to be cleaned, judging the image type of the image information to be cleaned;
and if the image type is the GIF image, acquiring a first frame of the GIF image, and converting the first frame into a preset format to obtain the image to be cleaned.
Further, before contour information of all target contours in the picture to be cleaned is acquired, the target contours have at least three levels of contours, the method further comprises the following steps:
and carrying out graying processing, binarization processing and noise processing on the picture to be cleaned in sequence.
Further, acquiring contour information of all target contours in the picture to be cleaned, wherein the target contours have at least three levels of contours, and the method comprises the following steps:
acquiring all contours in a picture to be cleaned, and screening out an initial target contour with at least three levels of contours from all the contours;
and for any initial target contour, judging whether the area of each level of contour is larger than the respective corresponding contour threshold, and if so, determining the initial target contour as the target contour.
Further, determining the center point location information of the target contour based on the corresponding contour information includes:
extracting center point position information of each level of contour in the target contour from the contour information;
and determining the center point location information of the target contour based on the center point location information of each level of contour.
Further, determining whether target center point location information satisfying an isosceles triangle relationship exists includes:
judging whether a triangle formed by the corresponding central point positions is an isosceles triangle or not according to any three central point position information;
if yes, determining the three central point location information as target central point location information, and determining that target central point location information meeting the isosceles triangle relationship exists.
Further, the preset processing mode comprises:
coding or matting.
The memory 420 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 420 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 420 may further include memory located remotely from processor 410, which may be connected to an electronic device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 430 may be used to receive an input of a power construction drawing and to generate key signal inputs related to user settings and function control of the electronic equipment. The output device 440 may include a display device such as a display screen.
Example four
The fourth embodiment of the present application further provides a storage medium containing computer-executable instructions, where the computer-executable instructions are executed by a computer processor to perform a method for cleaning a two-dimensional code, and the method includes:
under the condition of acquiring the information of the image to be cleaned, normalizing the image to be cleaned into a preset format of the image to be cleaned;
acquiring contour information of all target contours in a picture to be cleaned, wherein the target contours have at least three levels of contours;
for any target contour, determining center point position information of the target contour based on corresponding contour information;
determining whether target central point location information meeting an isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists;
and processing the area where the two-dimension code is located in the image to be cleaned according to a preset processing mode so as to clean the two-dimension code in the image to be cleaned.
In the embodiment, under the condition that the information of the image to be cleaned is acquired, the image to be cleaned is normalized into the image to be cleaned in the preset format; acquiring contour information of all target contours in a picture to be cleaned, wherein the target contours have at least three levels of contours; for any target contour, determining center point position information of the target contour based on corresponding contour information; determining whether target central point location information meeting an isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists; and processing the area where the two-dimension code is located in the image to be cleaned according to a preset processing mode so as to clean the two-dimension code in the image to be cleaned. Based on the characteristics, whether the two-dimensional code exists in the image can be judged quickly according to the characteristic that the two-dimensional code comprises three positioning points which can be connected into an isosceles triangle, and then the two-dimensional code in the image information can be cleaned quickly.
Further, under the condition that the information of the image to be cleaned is acquired, the image to be cleaned is normalized into the image to be cleaned in the preset format, and the method comprises the following steps:
under the condition of acquiring the image information to be cleaned, judging the image type of the image information to be cleaned;
and if the image type is the GIF image, acquiring a first frame of the GIF image, and converting the first frame into a preset format to obtain the image to be cleaned.
Further, before acquiring contour information of all target contours in the picture to be cleaned, the target contours having at least three levels of contours, the method further comprises:
and carrying out graying processing, binarization processing and noise processing on the picture to be cleaned in sequence.
Further, acquiring contour information of all target contours in the picture to be cleaned, wherein the target contours have at least three levels of contours, and the method comprises the following steps:
acquiring all contours in a picture to be cleaned, and screening out an initial target contour with at least three levels of contours from all the contours;
and for any initial target contour, judging whether the area of each level of contour is larger than the respective corresponding contour threshold, and if so, determining the initial target contour as the target contour.
Further, determining the center point location information of the target contour based on the corresponding contour information includes:
extracting center point position information of each level of contour in the target contour from the contour information;
and determining the center point position information of the target contour based on the center point position information of each level of contour.
Further, determining whether target center point location information satisfying an isosceles triangle relationship exists includes:
judging whether a triangle formed by the corresponding central point positions is an isosceles triangle or not according to any three central point position information;
if yes, determining the three central point location information as target central point location information, and determining that target central point location information meeting the isosceles triangle relationship exists.
Further, the preset processing mode comprises:
coding processing or matting processing.
Of course, the storage medium provided in the embodiments of the present application and containing the computer-executable instructions is not limited to the above method operations, and may also perform related operations in the method for cleaning a two-dimensional code provided in any embodiment of the present application.
From the above description of the embodiments, it is obvious for those skilled in the art that the present application can be implemented by software and necessary general hardware, and certainly can be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present application or portions contributing to the prior art may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods of the embodiments of the present application.
It should be noted that, in the embodiment of the search apparatus, each included unit and each included module are merely divided according to functional logic, but are not limited to the above division, as long as corresponding functions can be implemented; in addition, specific names of the functional units are only used for distinguishing one functional unit from another, and are not used for limiting the protection scope of the present application.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present application and the technical principles employed. Those skilled in the art will appreciate that the present application is not limited to the particular embodiments described herein, and that various obvious changes, rearrangements and substitutions will now become apparent to those skilled in the art without departing from the scope of the application. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the appended claims.

Claims (10)

1. A method for cleaning a two-dimensional code is characterized by comprising the following steps:
under the condition of acquiring the information of the image to be cleaned, normalizing the image to be cleaned into a picture to be cleaned in a preset format;
acquiring contour information of all target contours in the picture to be cleaned, wherein the target contours have at least three levels of contours;
for any one target contour, determining center point location information of the target contour based on the corresponding contour information;
determining whether target central point location information meeting an isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists;
and processing the area of the two-dimensional code in the image to be cleaned according to a preset processing mode so as to clean the two-dimensional code in the image to be cleaned.
2. The method according to claim 1, wherein, in the case of acquiring the information of the image to be cleaned, normalizing the image to be cleaned into the image to be cleaned in a preset format comprises:
under the condition of acquiring image information to be cleaned, judging the image type of the image information to be cleaned;
and if the image type is a GIF image, acquiring a first frame of the GIF image, and converting the first frame into a preset format to obtain a picture to be cleaned.
3. The method according to claim 1, wherein before the obtaining of the contour information of all target contours in the picture to be cleaned, the target contours having at least three levels of contours, the method further comprises:
and carrying out graying processing, binarization processing and noise processing on the picture to be cleaned in sequence.
4. The method according to claim 1, wherein the obtaining contour information of all target contours in the picture to be cleaned, the target contours having at least three levels of contours, comprises:
acquiring all contours in the picture to be cleaned, and screening out an initial target contour with at least three levels of contours from all the contours;
and for any initial target contour, judging whether the area of each level of contour is larger than the respective corresponding contour threshold, and if so, determining that the initial target contour is the target contour.
5. The method of claim 1, wherein said determining the midpoint location information of the target contour based on the corresponding contour information comprises:
extracting center point position information of each level of contour in the target contour from the contour information;
and determining the central point location information of the target contour based on the central point location information of each level of contour.
6. The method of claim 1, wherein the determining whether the target midpoint location information satisfying an isosceles triangle relationship exists comprises:
judging whether a triangle formed by the corresponding central point positions is an isosceles triangle or not according to any three central point position information;
if yes, determining the three central point location information as target central point location information, and determining that target central point location information meeting an isosceles triangle relationship exists.
7. The method according to claim 1, wherein the predetermined processing manner comprises:
coding or matting.
8. The utility model provides a belt cleaning device of two-dimensional code which characterized in that, the device includes:
the normalization module is used for normalizing the image to be cleaned into a picture to be cleaned in a preset format under the condition of acquiring the information of the image to be cleaned;
the acquisition module is used for acquiring contour information of all target contours in the picture to be cleaned, and the target contours have at least three levels of contours;
the central point position determining module is used for determining central point position information of any target contour based on the corresponding contour information;
the existence judging module is used for determining whether target central point location information meeting the isosceles triangle relationship exists or not, and determining that a two-dimensional code containing the target central point location information exists in the picture to be cleaned under the condition that the target central point location information exists;
and the cleaning module is used for processing the area where the two-dimensional code is located in the image to be cleaned according to a preset processing mode so as to clean the two-dimensional code in the image to be cleaned.
9. An electronic device, characterized in that the electronic device comprises:
one or more processors;
a storage device for storing one or more programs,
when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method for cleaning the two-dimensional code according to any one of claims 1 to 7.
10. A computer-readable storage medium on which a computer program is stored, the program, when executed by a processor, implementing the method for cleaning a two-dimensional code according to any one of claims 1 to 7.
CN202211109456.2A 2022-09-13 2022-09-13 Two-dimensional code cleaning method and device, electronic equipment and storage medium Pending CN115456899A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211109456.2A CN115456899A (en) 2022-09-13 2022-09-13 Two-dimensional code cleaning method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211109456.2A CN115456899A (en) 2022-09-13 2022-09-13 Two-dimensional code cleaning method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115456899A true CN115456899A (en) 2022-12-09

Family

ID=84302458

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211109456.2A Pending CN115456899A (en) 2022-09-13 2022-09-13 Two-dimensional code cleaning method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115456899A (en)

Similar Documents

Publication Publication Date Title
US10796447B2 (en) Image detection method, apparatus and system and storage medium
CN111583097A (en) Image processing method, image processing device, electronic equipment and computer readable storage medium
KR101457313B1 (en) Method, apparatus and computer program product for providing object tracking using template switching and feature adaptation
CN109753953B (en) Method and device for positioning text in image, electronic equipment and storage medium
CN107886026B (en) graphic code processing method and device
CN109116129B (en) Terminal detection method, detection device, system and storage medium
CN110414649B (en) DM code positioning method, device, terminal and storage medium
CN111242128B (en) Object detection method, device, computer readable storage medium and computer equipment
CN104239909A (en) Method and device for recognizing images
CN110766007A (en) Certificate shielding detection method, device and equipment and readable storage medium
CN111160202A (en) AR equipment-based identity verification method, AR equipment-based identity verification device, AR equipment-based identity verification equipment and storage medium
CN113496208B (en) Video scene classification method and device, storage medium and terminal
CN115131714A (en) Intelligent detection and analysis method and system for video image
CN107578011A (en) The decision method and device of key frame of video
CN111899270A (en) Card frame detection method, device and equipment and readable storage medium
CN112052702A (en) Method and device for identifying two-dimensional code
CN111080665A (en) Image frame identification method, device and equipment and computer storage medium
CN108875538B (en) Attribute detection method, device and system and storage medium
CN112633200A (en) Human face image comparison method, device, equipment and medium based on artificial intelligence
CN115456899A (en) Two-dimensional code cleaning method and device, electronic equipment and storage medium
CN110135224B (en) Method and system for extracting foreground target of surveillance video, storage medium and terminal
CN113011497B (en) Image comparison method and system
CN111753573B (en) Two-dimensional code image recognition method and device, electronic equipment and readable storage medium
CN114298257A (en) Method and device for realizing authenticity query through one-step code scanning
CN109325945B (en) Image processing method, image processing device, electronic equipment and storage medium

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