CN114565551A - Label detection method, device, equipment and computer readable storage medium - Google Patents

Label detection method, device, equipment and computer readable storage medium Download PDF

Info

Publication number
CN114565551A
CN114565551A CN202110915512.0A CN202110915512A CN114565551A CN 114565551 A CN114565551 A CN 114565551A CN 202110915512 A CN202110915512 A CN 202110915512A CN 114565551 A CN114565551 A CN 114565551A
Authority
CN
China
Prior art keywords
image
target
label
detected
target label
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
CN202110915512.0A
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.)
Chint Group R & D Center Shanghai Co ltd
Original Assignee
Chint Group R & D Center Shanghai 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 Chint Group R & D Center Shanghai Co ltd filed Critical Chint Group R & D Center Shanghai Co ltd
Priority to CN202110915512.0A priority Critical patent/CN114565551A/en
Publication of CN114565551A publication Critical patent/CN114565551A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • G06T7/0004Industrial image inspection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/22Matching criteria, e.g. proximity measures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/70Determining position or orientation of objects or cameras
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02EREDUCTION OF GREENHOUSE GAS [GHG] EMISSIONS, RELATED TO ENERGY GENERATION, TRANSMISSION OR DISTRIBUTION
    • Y02E10/00Energy generation through renewable energy sources
    • Y02E10/50Photovoltaic [PV] energy

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Artificial Intelligence (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Image Analysis (AREA)

Abstract

The application discloses a label detection method, a device, equipment and a computer readable storage medium, wherein the method comprises the following steps: preprocessing an image to be detected to obtain a vertical histogram based on pixel values; intercepting and converting the binary image according to the vertical histogram to obtain a target gray level image; performing standard square error matching processing on the target gray level image according to a matching template of the target label to obtain the actual position of the target label in the image to be detected; and judging whether the target label is correctly pasted according to the actual position of the target label in the image to be detected. Compared with the prior art, the method and the device have the advantages that the gray level histogram of the label is used as the retrieval template, and the solar cell panel to be detected is matched, so that the accuracy of the detection result is higher, the detection accuracy of the position of the label is improved, and the pasting effect of the target label is ensured.

Description

Label detection method, device, equipment and computer readable storage medium
Technical Field
The present application relates to the field of image processing technologies, and in particular, to a method, an apparatus, a device, and a computer-readable storage medium for detecting a tag.
Background
In order to distinguish each solar cell panel, a label capable of uniquely identifying the solar cell panel is attached to a fixed position of the solar cell panel, and in order to avoid the situations that the label of the solar cell panel is attached in a wrong way or the label is absent, the correctness of the label on the solar cell panel needs to be checked in the production process of the solar cell panel.
At present, the labels on the solar cell panels are generally inspected by using a gray level histogram of the labels as a retrieval template to be matched with the solar cell panels to be inspected, but the inspection method has low accuracy, can only identify whether the appearances of the labels are defective or not in most cases, and cannot accurately identify the pasting effect of the labels.
Disclosure of Invention
The application provides a label detection method, a label detection device, label detection equipment and a computer-readable storage medium, and aims to solve the problems that in the prior art, a gray level histogram of a label is used as a retrieval template to be matched with a solar cell panel to be detected, so that the accuracy of a detection result is not high, and the label pasting effect cannot be accurately identified.
In a first aspect, the present application provides a tag detection method, including:
preprocessing an image to be detected according to preset position information of a target label in the image to be detected to obtain a vertical histogram based on a pixel value; the pixel value is the pixel value of a binary image corresponding to the image to be detected;
intercepting and converting the binary image according to the vertical histogram to obtain a target gray level image; wherein, the target gray level image comprises a target label;
performing standard square error matching processing on the target gray level image according to a matching template of the target label to obtain the actual position of the target label in the image to be detected;
and judging whether the target label is correctly pasted according to the actual position of the target label in the image to be detected.
In a possible implementation manner of the present application, preprocessing an image to be detected according to preset position information of a target label in the image to be detected to obtain a vertical histogram based on a pixel value, including:
according to preset position information of a target label in an image to be detected, cutting the image to be detected to obtain a first partial image;
carrying out binarization processing on the first local image to obtain a binarized image; the binary image comprises white pixel points;
obtaining a vertical histogram based on pixel values according to the pixel values of the binary image; the horizontal coordinate of the vertical histogram is the width of the binarized image, and the vertical coordinate of the vertical histogram is the sum of pixel values of all white pixel points corresponding to each width value in the binarized image.
In one possible implementation manner of the present application, the binarized image further includes black pixel points;
the method for performing binarization processing on the first local image to obtain a binarized image comprises the following steps:
obtaining the average pixel values of all pixel points in the first partial image according to the pixel values of all pixel points in the first partial image;
if the pixel value of the pixel point in the first partial image is larger than the average pixel value, modifying the pixel value of the pixel point in the first partial image to be 255, and obtaining a white pixel point;
and if the pixel value of the pixel point in the first partial image is smaller than the average pixel value, modifying the pixel value of the pixel point in the first partial image to be 0 to obtain a black pixel point.
In a possible implementation manner of the present application, performing an intercepting conversion process on a binarized image according to a vertical histogram to obtain a target grayscale image includes:
determining an interception starting point according to the vertical histogram; wherein the interception starting point is a first abscissa point in the vertical histogram, and the first abscissa point is a first abscissa point in the vertical histogram having a non-zero ordinate value;
determining an interception end point according to a preset interception width; the intercepting end point is a second horizontal coordinate point in the vertical histogram;
based on the interception starting point and the interception end point, carrying out interception processing on the binary image to obtain a target image; wherein the target image comprises a target label;
and carrying out graying processing on the target image to obtain a target grayscale image.
In a possible implementation manner of the application, the actual position of the target label in the image to be detected comprises an upper left corner position coordinate and a lower right corner position coordinate of the target label in the image to be detected;
performing standard square error matching processing on the target gray level image according to a matching template of the target label to obtain the actual position of the target label in the image to be detected, wherein the method comprises the following steps:
traversing the target gray level image by using a matching template based on a normalized square error matching method to obtain a matching result; the matching result comprises a normalized mean square difference value corresponding to each pixel point in the target gray level image;
selecting a pixel point corresponding to the minimum normalized mean square difference value in the matching result as a reference point;
carrying out offset processing on the datum points according to the interception starting points to obtain position coordinates of the upper left corner;
and obtaining the position coordinate of the lower right corner according to the size information of the matched template and the position coordinate of the upper left corner.
In a possible implementation manner of the present application, before performing standard square error matching processing on a target gray image according to a matching template of a target label to obtain an actual position of the target label in an image to be detected, the method includes:
acquiring specific position information of a target label in an image to be detected, and acquiring a label image of the target label according to the specific position information;
and carrying out graying processing on the label image of the target label to obtain a label gray image, and taking the label gray image as a matching template of the target label.
In a possible implementation manner of the present application, determining whether the target label is correctly attached according to the actual position of the target label in the image to be detected includes:
comparing the actual position of the target label in the image to be detected with a preset position interval;
if the actual position of the target label in the image to be detected is within the position interval, determining that the target label is correctly pasted;
otherwise, determining that the target label is attached with an error.
In one possible implementation manner of the present application, after determining that the target label is applied incorrectly, the method further includes:
rotating the matching template by 180 degrees to obtain a second matching template, and performing standard square error matching processing on the target gray level image according to the second matching template to obtain a second position of the target label in the image to be detected;
and if the second position of the target label in the image to be detected is within the position interval, determining that the target label is reversely attached.
In a second aspect, the present application also provides a label detecting apparatus, including:
the preprocessing module is used for preprocessing the image to be detected according to the preset position information of the target label in the image to be detected to obtain a vertical histogram based on a pixel value; the pixel value is the pixel value of a binary image corresponding to the image to be detected;
the intercepting and converting module is used for intercepting and converting the binary image according to the vertical histogram to obtain a target gray level image; wherein, the target gray level image comprises a target label;
the matching module is used for performing standard square error matching processing on the target gray level image according to the matching template of the target label to obtain the actual position of the target label in the image to be detected;
and the judging module is used for judging whether the target label is correctly pasted according to the actual position of the target label in the image to be detected.
In one possible implementation manner of the present application, the preprocessing module is specifically configured to:
according to preset position information of a target label in an image to be detected, cutting the image to be detected to obtain a first partial image;
carrying out binarization processing on the first local image to obtain a binarized image; the binary image comprises white pixel points;
obtaining a vertical histogram based on pixel values according to the pixel values of the binary image; the horizontal coordinate of the vertical histogram is the width of the binarized image, and the vertical coordinate of the vertical histogram is the sum of pixel values of all white pixel points corresponding to each width value in the binarized image.
In a possible implementation manner of the present application, the binarized image further includes black pixel points, and the preprocessing module is further specifically configured to:
obtaining the average pixel values of all pixel points in the first partial image according to the pixel values of all pixel points in the first partial image;
if the pixel value of the pixel point in the first partial image is larger than the average pixel value, modifying the pixel value of the pixel point in the first partial image to be 255, and obtaining a white pixel point;
and if the pixel value of the pixel point in the first partial image is smaller than the average pixel value, modifying the pixel value of the pixel point in the first partial image to be 0 to obtain a black pixel point.
In one possible implementation manner of the present application, the interception conversion module is specifically configured to:
determining an interception starting point according to the vertical histogram; the intercepting starting point is a first abscissa point in the vertical histogram, and the first abscissa point is a first abscissa point with a non-zero ordinate value in the vertical histogram;
determining an interception end point according to a preset interception width; the intercepting end point is a second horizontal coordinate point in the vertical histogram;
based on the interception starting point and the interception end point, carrying out interception processing on the binary image to obtain a target image; wherein the target image comprises a target label;
and carrying out graying processing on the target image to obtain a target grayscale image.
In a possible implementation manner of the present application, the actual position of the target label in the image to be detected includes an upper left corner position coordinate and a lower right corner position coordinate of the target label in the image to be detected, and the matching module is specifically configured to:
traversing the target gray level image by using a matching template based on a normalized square error matching method to obtain a matching result; the matching result comprises a normalized mean square difference value corresponding to each pixel point in the target gray level image;
selecting a pixel point corresponding to the minimum normalized mean square difference value in the matching result as a reference point;
carrying out offset processing on the datum points according to the interception starting points to obtain position coordinates of the upper left corner;
and obtaining the position coordinate of the lower right corner according to the size information of the matched template and the position coordinate of the upper left corner.
In one possible implementation manner of the present application, the tag detection apparatus further includes:
the template acquisition module is used for acquiring specific position information of the target label in the image to be detected and acquiring a label image of the target label according to the specific position information;
and carrying out graying processing on the label image of the target label to obtain a label gray image, and taking the label gray image as a matching template of the target label.
In one possible implementation manner of the present application, the determining module is specifically configured to:
comparing the actual position of the target label in the image to be detected with a preset position interval;
if the actual position of the target label in the image to be detected is within the position interval, determining that the target label is correctly pasted;
otherwise, determining that the target label is attached with an error.
In a possible implementation manner of the present application, after determining that the target label is attached with an error, the determining module is further specifically configured to:
rotating the matching template by 180 degrees to obtain a second matching template, and performing standard square error matching processing on the target gray level image according to the second matching template to obtain a second position of the target label in the image to be detected;
and if the second position of the target label in the image to be detected is within the position interval, determining that the target label is reversely attached.
In a third aspect, the present application also provides a tag detection apparatus, which includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps in the tag detection method of the first aspect.
In a fourth aspect, the present application also provides a computer readable storage medium having a computer program stored thereon, the computer program being executed by a processor to implement the steps in the tag detection method of the first aspect.
From the above, the present application has the following advantageous effects:
1. this application carries out intercepting conversion processing to the binary image that waits to detect the image correspondence according to vertical histogram, target gray image including the target label has been obtained, then carry out standard square error matching processing to target gray image according to the matching template of target label, obtain the actual position of target label in waiting to detect the image, and then judge whether the target label pastes correctly according to this actual position, compare in prior art through the grey histogram of label as the retrieval template, with waiting to detect solar cell panel and match, the detection result accuracy after the processing is higher based on standard square error matching, the detection precision of label position has been improved, and then the effect of pasting of target label has been ensured.
2. The method comprises the steps of comparing the actual position of a target label in an image to be detected with a preset position interval to determine whether the target label is correctly pasted, if the actual position of the target label in the image to be detected is not in the position interval, rotating a matching template by 180 degrees to obtain a second matching template, then carrying out standard square error matching processing on a target gray image according to the second matching template to obtain the second position of the target label in the image to be detected, comparing the second position with the position interval, and if the second position is in the position interval, determining that the target label is inversely pasted.
Drawings
In order to more clearly illustrate the technical solutions in the present application, the drawings that are needed to be used in the description of the present application will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art that other drawings can be obtained based on these drawings without inventive effort.
FIG. 1 is a schematic diagram of a scenario of a tag detection system provided in an embodiment of the present application;
FIG. 2 is a schematic flow chart of a label detection method provided in an embodiment of the present application;
FIG. 3 is a schematic image diagram of an image to be detected in an embodiment of the present application;
FIG. 4 is a schematic diagram of an image of a matching template in an embodiment of the present application;
FIG. 5 is a schematic image of a first partial image in an embodiment of the present application;
FIG. 6 is a schematic image diagram of a binarized image according to an embodiment of the present application;
FIG. 7 is a schematic diagram of an image of a vertical histogram in an embodiment of the present application;
FIG. 8 is a schematic image of a target gray scale image in an embodiment of the present application;
FIG. 9 is a schematic diagram of an image of a matching result in an embodiment of the present application;
FIG. 10 is a schematic diagram of a partially enlarged image of the actual position of the target tag in the image to be detected in the embodiment of the present application;
FIG. 11 is a schematic representation of an image of a second matching template in an embodiment of the present application;
FIG. 12 is a schematic view of a structure of a label detecting apparatus provided in an embodiment of the present application;
fig. 13 is a schematic structural diagram of a label detecting apparatus provided in an embodiment of the present application.
Detailed Description
The technical solutions in the present application will be described clearly and completely with reference to the accompanying drawings in the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the description of the present application, it is to be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like indicate orientations or positional relationships based on those shown in the drawings, and are used merely for convenience of description and for simplicity of description, and do not indicate or imply that the referenced device or element must have a particular orientation, be constructed in a particular orientation, and be operated, and thus should not be considered as limiting the present application. Furthermore, the terms "first", "second" and "first" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more features. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
In this application, the word "exemplary" is used to mean "serving as an example, instance, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. The following description is presented to enable any person skilled in the art to make and use the application. In the following description, details are set forth for the purpose of explanation. It will be apparent to one of ordinary skill in the art that the present application may be practiced without these specific details. In other instances, well-known structures and processes are not set forth in detail in order to avoid obscuring the description of the present application with unnecessary detail. Thus, the present application is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed herein.
The present application provides a label detection method, apparatus, device and computer readable storage medium, which are described in detail below.
Referring to fig. 1, fig. 1 is a schematic view of a scene of a label detection system according to an embodiment of the present application, where the label detection system may include a server 100 and a terminal device 200 in communication connection with the server 100, where the terminal device 200 may be disposed on a solar panel production line and configured to capture a front image of a solar panel 300 with a label attached thereto to obtain an image to be detected and upload the image to the server 100, or the terminal device 200 may also be in communication connection with a shooting device 400, such as a camera, etc., disposed on the solar panel production line to obtain the front image of the solar panel 300 with the label attached thereto, captured by the shooting device, obtain the image to be detected and forward the image to the server 100, a label detection device is integrated in the server 100 and may be used to perform label detection on the image to be detected uploaded by the terminal device 200, thereby judging whether the position of the label attached to the solar cell panel 300 is correct, detecting the attaching effect of the label, and the like.
In the embodiment of the present application, the server 100 is mainly configured to pre-process an image to be detected according to preset position information of a target label in the image to be detected, so as to obtain a vertical histogram based on a pixel value; the pixel value is the pixel value of a binary image corresponding to the image to be detected; intercepting and converting the binary image according to the vertical histogram to obtain a target gray image; the target gray level image comprises a target label; performing standard square error matching processing on the target gray level image according to a matching template of the target label to obtain the actual position of the target label in the image to be detected; and judging whether the target label is correctly pasted according to the actual position of the target label in the image to be detected.
In the embodiment of the present application, the server 100 may be an independent server, or may be a server network or a server cluster composed of servers, for example, the server 100 described in the present application includes, but is not limited to, a computer, a network host, a single network server, a plurality of network server sets, or a cloud server composed of a plurality of servers. Among them, the Cloud server is constituted by a large number of computers or web servers based on Cloud Computing (Cloud Computing).
In this embodiment, the server 100 and the terminal device 200 may implement network communication through any communication manner, including but not limited to mobile communication based on the third Generation Partnership Project (3 GPP), Long Term Evolution (LTE), Worldwide Interoperability for Microwave Access (WiMAX), or computer network communication based on the TCP/IP Protocol Suite (TCP/IP), User Datagram Protocol (UDP), and the like. The terminal device 200 may interact with the server 100 through the above-described communication means.
In this embodiment, the terminal device 200 may be a general-purpose computer device or a special-purpose computer device. In a specific implementation, the terminal device 200 may be a palm top computer, a Personal Digital Assistant (PDA), a mobile phone, a tablet computer, a wireless terminal device, or other terminal devices with a shooting function, and the application does not limit the type of the terminal device 200.
Those skilled in the art can understand that the application environment shown in fig. 1 is only one application scenario adapted to the present application scheme, and does not constitute a limitation of the application scenario of the present application scheme, and that other application scenarios may further include more or fewer terminal devices 200 than those shown in fig. 1, for example, only 2 terminal devices are shown in fig. 1, and it can be understood that the tag detection system may further include more or fewer terminal devices communicatively connected to the server 100, which is not limited herein. In addition, the scheme of the application can also be used in image processing processes such as label detection and image matching in other application scenarios.
It should be noted that the scenario diagram of the tag detection system shown in fig. 1 is merely an example, and the tag detection system and the scenario described in this application are for more clearly illustrating the technical solution of this application, and do not constitute a limitation to the technical solution provided in this application, and as the tag detection system evolves and a new service scenario appears, the technical solution provided in this application is also applicable to similar technical problems, as will be known to those skilled in the art.
First, the present application provides a tag detection method, which is applied to a server, where an execution subject of the tag detection method is a tag detection apparatus, and the tag detection method includes:
preprocessing an image to be detected according to preset position information of a target label in the image to be detected to obtain a vertical histogram based on a pixel value; the pixel value is the pixel value of a binary image corresponding to the image to be detected; intercepting and converting the binary image according to the vertical histogram to obtain a target gray level image; wherein, the target gray level image comprises a target label; performing standard square error matching processing on the target gray level image according to a matching template of the target label to obtain the actual position of the target label in the image to be detected; and judging whether the target label is correctly pasted according to the actual position of the target label in the image to be detected.
As shown in fig. 2, fig. 2 is a schematic flow chart of a tag detection method provided in the embodiment of the present application. It should be noted that while a logical order is shown in the flow diagram, in some cases, the steps shown or described may be performed in an order different than presented herein. The label detection method is applied to the server and comprises the following steps:
s201, preprocessing an image to be detected according to preset position information of a target label in the image to be detected to obtain a vertical histogram based on a pixel value; and the pixel value is the pixel value of the binary image corresponding to the image to be detected.
In the application scene of this application, the image of waiting to detect can be the positive image of Solar cell panel or Solar PV modules, and it can be understood, Solar cell panel (Solar panel) is through absorbing the sunlight, directly or indirectly converts Solar radiation energy into the device of electric energy through photoelectric effect or photochemical effect, and most Solar cell panel's main material is silicon, for ordinary battery and circulated rechargeable battery, Solar cell belongs to the green product of more energy-concerving and environment-protective.
Typically, a solar panel includes a plurality of solar cells uniformly arranged in rows and columns on a back panel of the solar panel, and a label of the solar panel is usually attached to the top left corner of the solar panel and generally does not exceed the height of the first row and the first column of solar cells.
The label of the solar cell panel can be used for uniquely identifying the solar cell panel, under the common condition, the label of the solar cell panel can comprise a bar code, a sequence code and the like of the solar cell panel, relevant parameter information of the solar cell panel can be obtained by scanning the bar code on the solar cell panel, the relevant parameter information can comprise electrical property parameter information and specification parameter information, wherein the electrical property parameter information can be parameter information such as product model, short-circuit current, short-circuit voltage, open-circuit voltage, optimal working current and voltage, power deviation and the like, and the specification parameter information can be parameter information such as weight, length, width, thickness, application grade and the like.
It can be understood that the front side of the solar cell panel is shot, the obtained front side image can be the image of all solar cells including one solar cell panel, namely, the image to be detected can be the front side image of one whole solar cell panel, and because the label of the solar cell panel is pasted on a certain fixed area, before the image to be detected is detected, the image to be detected can be preprocessed according to the preset position information of the target label in the image to be detected.
For example, an image to be detected may be cut according to preset position information, an image of a preset position of a target label and surrounding pixel points thereof may be retained, and in order to facilitate subsequent image matching of the cut image, a calculation amount may be reduced, and the cut image may also exhibit a black-and-white effect image, so as to highlight a contour of a target in the image, that is, a contour of the target label, wherein the black-and-white effect image may be similar to a binarization processing performed on the image to be detected or the cut image, and the obtained binarization image may be a black-and-white effect image highlighting the contour of the target in the image; for the black-and-white effect image, namely the binary image, the condition of the pixel points in the binary image can be counted for the purpose of assisting in finding the actual position of the target label in the follow-up process, and therefore the vertical histogram of the binary image can be generated to count the condition of the pixel points in the binary image.
It can be understood that the image to be detected in the embodiment of the present application may also be an image obtained after being cut and including the preset position of the target label and the surrounding pixel points thereof, and for such a situation, the preprocessing process of the image to be detected may be reduced so as to accelerate the detection speed.
S202, intercepting and converting the binary image according to the vertical histogram to obtain a target gray level image; and the target gray level image comprises a target label.
Since the vertical histogram in S201 can be used to count the pixel situation in the binarized image, therefore, the abscissa of the vertical histogram may correspond to the width of the binarized image, and the ordinate may be used to count the pixel values of each column of pixel points in the binarized image, for a pixel point with a pixel value of 0 in the binarized image, it can be considered as not being associated with the target tag, and therefore, in order to further reduce the amount of calculation, improve the detection accuracy, the binarized image may be further cropped, for example, for each abscissa value in the vertical histogram, if the ordinate value corresponding to the abscissa value is 0, it may be discarded, since the position of the target label is an area position, the first abscissa value when the ordinate value is not 0 can be searched along the extending direction of the abscissa of the vertical histogram, and the binarized image can be cut out based on the first abscissa value.
In addition, the image to be detected obtained by shooting may be a three-channel image based on three color channels of red, green and blue (R, G and B), and the binary image obtained based on the image to be detected may also be another three-channel image based on three color channels of red, green and blue (R, G and B).
S203, performing standard square error matching processing on the target gray level image according to the matching template of the target label to obtain the actual position of the target label in the image to be detected.
It is understood that the matching template of the target label may be a template image including only the target label, and since the target gray-scale image belongs to a gray-scale image, the matching module performing the standard square error matching process with the target gray-scale image may also be a gray-scale image.
In the embodiment of the application, the target gray level image is subjected to standard square error matching processing according to the matching template of the target label, that is, the target gray level image is traversed by the matching template, the matching template is compared with an image area covered by the matching template in the target gray level image, when the traversal is completed, the best matching result is found, an area with the highest similarity to the matching template of the target label can be found according to the best matching result, and the area can be regarded as the actual position of the target label in the image to be detected.
And S204, judging whether the target label is correctly pasted according to the actual position of the target label in the image to be detected.
It can be understood that the attaching position and the attaching direction of the target label on the solar cell panel have a certain rule, the rule may describe the attaching requirement of the attaching position and the attaching direction, and the target label may be considered to be correctly attached only when the attaching position and the attaching direction specified by the attaching requirement are met, therefore, in the embodiment of the present application, the actual position detected in S203 may be compared with the attaching requirement of the target label, when the actual position meets the attaching requirement, the target label may be determined to be correctly attached, when the actual position does not meet the attaching requirement, the target label may be determined to be erroneously attached, and because there are various conditions of the attaching error, if there are possible errors of position attaching, error of direction attaching, that is, attaching or pasting, etc., on the premise of determining the target label attaching error, the error type may also be determined by the attaching requirement, thereby the effect of pasting of target label on the solar cell panel is obtained.
In the embodiment of the application, the binarization image corresponding to the image to be detected is intercepted and converted according to the vertical histogram, a target gray image comprising a target label is obtained, then the target gray image is subjected to standard square error matching processing according to a matching template of the target label, the actual position of the target label in the image to be detected is obtained, and whether the target label is correctly attached or not is judged according to the actual position.
In some embodiments of the present application, before performing standard square error matching processing on the target grayscale image according to the matching template of the target label to obtain the actual position of the target label in the image to be detected, the label detection method may further include:
acquiring specific position information of a target label in an image to be detected, and acquiring a label image of the target label according to the specific position information; and carrying out graying processing on the label image of the target label to obtain a label gray image, and taking the label gray image as a matching template of the target label.
Referring to fig. 3, fig. 3 is a schematic diagram of an image to be detected in an embodiment of the present application, where the image to be detected shown in fig. 3 is a front image of a whole solar panel, and specific position information of a target label in the image to be detected is obtained, which may be obtained by using a common image processing software ImageJ based on Java to view a picture tool, so as to obtain the specific position information of the target label in the image to be detected, since the target label may be framed by a rectangular frame, the specific position of the target label may be represented by coordinates of two vertices of a diagonal line of the rectangular frame, that is, in the embodiment, the specific position information may be coordinates of an upper left point (e.g., (130, 273) ") and coordinates of a lower right point (e.g., (201, 562)", according to the coordinates of the upper left point (130, 273) and the coordinates of the lower right point (201, 562) ", the target label may be cut or cropped from the image to be detected, it can be understood that, in the embodiment of the present application, the coordinate of the upper left point of the image to be detected is used as the origin coordinate (0, 0), the x axis increases from left to right, and the y axis increases from top to bottom.
In the embodiment of the application, the target label can be cut out or clipped from the image to be detected by using a picture cutting method in an OpenCV open source library to obtain a label image, specifically, a clipping frame can be set as box (130, 273, 201, 562), where 130 is an x-axis minimum value, 273 is a y-axis minimum value, 201 is an x-axis maximum value, and 562 is a y-axis maximum axis, and the target label can be cut out from the image to be detected based on the clipping frame box (130, 273, 201, 562) to obtain the label image.
Similarly, the image to be detected obtained by shooting may be a three-channel image based on three color channels of red, green and blue (R, G, B), and the label image obtained by capturing based on the image to be detected may also be a three-channel image based on three color channels of red, green and blue (R, G, B), and if the three-channel image is directly used for calculation, the calculation amount is three times that of the single-channel image.
As shown in fig. 5, fig. 5 is a schematic image diagram of a first partial image in an embodiment of the present application, and in some embodiments of the present application, preprocessing an image to be detected according to preset position information of a target tag in an image to be detected to obtain a vertical histogram based on pixel values, the method may further include:
according to preset position information of a target label in an image to be detected, cutting the image to be detected to obtain a first partial image; carrying out binarization processing on the first local image to obtain a binarized image; the binary image comprises white pixel points; obtaining a vertical histogram based on pixel values according to the pixel values of the binary image; the abscissa of the vertical histogram is the width of the binarized image, and the ordinate of the vertical histogram is the sum of the pixel values of all white pixel points corresponding to each width value in the binarized image.
In the embodiment of the application, the position of the set label is always at the upper left corner of the solar cell panel, and the height of the first row and the first column of the cell pieces is not more than that of the first row, as shown in fig. 3, a whole solar cell panel comprises 6 rows and 12 columns of the solar cell pieces, and assuming that the height of the image to be detected is H, the target label is located at the upper left corner of the image to be detected according to the preset position information, and the height of the first row and the first column of the cell pieces is not more than that of the first row, the image to be detected is cut, where the height of cutting can be H/6, the first local image as shown in fig. 5 can be obtained, and here, the width of the first local image is the same as that of the image to be detected.
It should be noted that, the cropping height H/6 is only an example of the embodiment of the present application, the cropping height of the first partial image may also be H/5 or H/4 or other values related to the height H of the image to be detected, and the cropping height of the first partial image may be selected according to the preset position information of the target label and the actual application scene, which is not limited herein.
Further, in order to highlight the characteristics of the target label, in this embodiment of the application, a binarization process may be performed on the first local image, specifically, the binarization process may be: obtaining the average pixel values of all pixel points in the first partial image according to the pixel values of all pixel points in the first partial image, namely summing the pixel values of all pixel points in the first partial image, and then dividing the sum of the obtained pixel values by the total number of the pixel points in the first partial image to obtain the average pixel value of all the pixel points in the first partial image; then, taking the average pixel value as a comparison threshold value, comparing the average pixel value with the pixel value of the pixel point in the first partial image, and if the pixel value of the pixel point in the first partial image is larger than the average pixel value, modifying the pixel value of the pixel point in the first partial image to be 255 to obtain a white pixel point; if the pixel value of the pixel point in the first partial image is smaller than or equal to the average pixel value, the pixel value of the pixel point in the first partial image may be modified to 0 to obtain a black pixel point, so as to obtain an image schematic diagram of the binarized image as shown in fig. 6.
As shown in fig. 7, fig. 7 is an image schematic diagram of a vertical histogram in the embodiment of the present application, based on the obtained binarized image, a vertical histogram associated with a pixel value of the binarized image may be drawn, please refer to fig. 7, an abscissa of the vertical histogram may be a width of the binarized image, and an ordinate of the vertical histogram may be a sum of pixel values of all white pixels corresponding to each width value in the binarized image, that is, the ordinate may be a sum of pixel values of white pixels on each column of pixels in the binarized image.
As shown in fig. 8, fig. 8 is an image schematic diagram of a target grayscale image in this embodiment, and in some embodiments of the present application, the performing truncation processing on the binarized image according to the vertical histogram to obtain the target grayscale image may further include:
determining an interception starting point according to the vertical histogram; wherein the interception starting point is a first abscissa point in the vertical histogram, and the first abscissa point is a first abscissa point in the vertical histogram having a non-zero ordinate value; determining an interception end point according to a preset interception width; the intercepting end point is a second horizontal coordinate point in the vertical histogram; based on the interception starting point and the interception end point, carrying out interception processing on the binary image to obtain a target image; wherein the target image comprises a target label; and carrying out graying processing on the target image to obtain a target grayscale image.
In order to further reduce the detection calculation amount and improve the detection accuracy, in the embodiment of the present application, a binary image may be further intercepted, and it can be understood that an abscissa point with an ordinate value of 0 in a vertical histogram indicates that the relevance between the column where the abscissa point is located and a target label is not high or no relevance exists, so that the abscissa point of the vertical histogram may be searched from left to right, and a first abscissa point with a nonzero ordinate value is found as an interception starting point x; from fig. 8, it can be obtained that the distance from the cut start point x to the first row of solar cells is 230, and therefore, in order to be able to surround the entire target label, the width of the solar cell is W, and the cut width is set to W80%, and therefore, the cut end point may be W80% + x, that is, the width of W80% pixels from the cut start point x is taken as the width of the target image, and if the cut start point x is 52 and the width W of the solar cell is 1000, the cut end point is 1000 × 80% +52 852, that is, the target image is obtained by cutting the binarized image according to the cut start point and the cut end point, and the width of the target image is from the first abscissa 52 to the second abscissa 852 in the binarized image; then, the color space of the binarized image may be converted by using cvtColor () function in the OpenCV open source library, for example, by performing a graying process on the binarized image by cvtColor (src, dst, CV _ BGR2GRAY), an image schematic diagram of the target grayscale image as shown in fig. 8 may be obtained.
As shown in fig. 9, fig. 9 is an image schematic diagram of a matching result in the embodiment of the present application, and in some embodiments of the present application, an actual position of a target tag in an image to be detected includes an upper left corner position coordinate and a lower right corner position coordinate of the target tag in the image to be detected; performing standard square error matching processing on the target gray level image according to the matching template of the target label to obtain the actual position of the target label in the image to be detected, and may further include:
traversing the target gray level image by using a matching template based on a normalized square error matching method to obtain a matching result; the matching result comprises a normalized mean square difference value corresponding to each pixel point in the target gray level image; selecting a pixel point corresponding to the minimum normalized mean square difference value in the matching result as a reference point; carrying out offset processing on the datum points according to the interception starting points to obtain position coordinates of the upper left corner; and obtaining the position coordinate of the lower right corner according to the size information of the matched template and the position coordinate of the upper left corner.
Specifically, the calculation formula of the normalized square error matching method is as follows:
Figure BDA0003205455200000161
the method comprises the steps of obtaining a matching template, wherein T (x ', y') represents a pixel value of the matching template at a pixel point (x ', y'), I (x + x ', y + y') represents a pixel value of a target gray image at a pixel point (x + x ', y + y'), x 'and y' represent cyclic variables, represent that pixel points of the matching template are traversed sequentially from left to right and from top to bottom, the value range of x 'is the width of the matching template, the value range of y' is the height of the matching template, x and y represent pixel point coordinates of the target gray image, the value range of x is the width of the target gray image, and the value range of y is the height of the target gray image.
According to the calculation formula of the normalized square error matching method, the matching template is used to traverse the target gray-scale image, so as to obtain an image schematic diagram of the matching result as shown in fig. 9, where the matching result may include the normalized square error value corresponding to each pixel point in the target gray-scale image; according to the formula, when the normalized square difference value is 0, the representative matching template is completely matched with the target gray level image, namely when the pixel value is 0, the matching result is optimal, and because the pixel point with the minimum normalized square difference value represents the best matching, in the embodiment of the application, the pixel point corresponding to the minimum normalized square difference value in the matching result can be selected as the reference point, the coordinate of the reference point is assumed to be (x _ min, y _ min), and the target image is obtained by intercepting on the basis of the binary image, so that the reference point (x _ min, y _ min) is subjected to offset processing by combining the intercepting starting point x, and the upper left corner position coordinate (x _ min + x, y _ min) of the target label in the image to be detected can be obtained; according to the size information of the matching template, such as the width roi _ w and the height roi _ h of the matching template, the position coordinates (x _ min + x + roi _ w, y _ min + roi _ h) of the lower right corner of the target label in the image to be detected can be obtained, and thus the actual position of the target label in the image to be detected can be obtained.
As shown in fig. 10, fig. 10 is a schematic diagram of a locally enlarged image for obtaining an actual position of a target tag in an image to be detected in the embodiment of the present application, in which the width and height of a matching template, i.e., the target tag, can be obtained according to a shape () function in an OpenCV open source library, for example, image.shape (), the number of rows, columns, and color channels of the matching template can be obtained, e.g., (289, 71, 1), i.e., the width roi _ w of the matching template is 71, the height roi _ h is 289, the coordinate of a reference point is (x _ min is 108, y _ min is 278), the intercept point x is 52, the upper left-corner position coordinate of the target tag in the image to be detected is (x _ min + x is 160, y _ min is 278), i.e., (160, 278), the lower right-corner position coordinate is (x _ min + x + roi _ w is 231, y _ min + roi _ h is 567), 567) the actual position of the target tag in the image to be detected is the black box in fig. 10.
In some embodiments of the present application, determining whether the target label is correctly attached according to the actual position of the target label in the image to be detected may further include:
comparing the actual position of the target label in the image to be detected with a preset position interval; if the actual position of the target label in the image to be detected is within the position interval, determining that the target label is correctly pasted; otherwise, determining that the target label is attached with an error.
It can be understood that, in order to standardize the pasting position of the tag in the solar cell panel, a pasting range of the tag, that is, a position interval may be preset, where the position interval may include a lower threshold and an upper threshold, in this embodiment of the present application, the position interval is used to standardize the abscissa of the position coordinate of the upper left corner of the target tag, for example, the position interval is set to [100, 180], and if the actual position of the target tag in the image to be detected is within the position interval, it is determined that the target tag is correctly pasted, that is, if the abscissa of the position coordinate of the upper left corner of the target tag is within the position interval [100, 180], it is determined that the target tag is correctly pasted; in contrast, if the abscissa value of the upper left-hand position coordinate of the target tag is not within the position interval [100, 180], the target tag is erroneously attached, such as being possibly erroneously attached or missing.
Referring to fig. 10, the actual position of the target tag in fig. 10 is the upper left corner position coordinate (160, 278), and the lower right corner position coordinate (231, 567), and since the abscissa value 160 of the upper left corner position coordinate is within the position interval [100, 180], it can be determined that the target tag is correctly attached.
In some embodiments of the present application, after determining that the target label is applied incorrectly, the label detection method may further include:
rotating the matching template by 180 degrees to obtain a second matching template, and performing standard square error matching processing on the target gray level image according to the second matching template to obtain a second position of the target label in the image to be detected; and if the second position of the target label in the image to be detected is within the position interval, determining that the target label is reversely attached.
As shown in fig. 11, fig. 11 is an image schematic diagram of a second matching template in the embodiment of the present application, when an abscissa value of a position coordinate of an upper left corner of a target tag is not within a position interval, in order to further determine an attaching effect of the target tag, such as an error type of an attaching error, the matching template may be rotated 180 ° with its own central point as a rotation origin to obtain the second matching template, it can be understood that, for the matching template shown in fig. 4, the second matching template corresponding to the matching template should be the second matching template shown in fig. 11, a sequence code is on a left side of the second matching template, a barcode is on a right side of the second matching template, after obtaining the second matching template, a standard square error matching process may be performed again on the target grayscale image shown in fig. 8 according to the second matching template to obtain a second position of the target tag in an image to be detected, the calculation process of the second position may refer to the calculation process of the actual position of the target tag in the above embodiment, and details are not described here.
It can be understood that, after obtaining the second position of the target label in the image to be detected, the second position may be compared with the position interval again, specifically, the second position may also include a second upper left corner position coordinate, if the abscissa value of the second upper left corner position coordinate is within the above position interval [100, 180], it may be determined that the target label is attached reversely, and if the abscissa value of the second upper left corner position coordinate is still not within the above position interval [100, 180], it may be determined that the target label is missing or omitted.
In the embodiment of the application, whether the target label is attached correctly is determined by comparing the actual position of the target label in the image to be detected with a preset position interval, if the actual position of the target label in the image to be detected is not within the position interval, the matching template is rotated by 180 degrees to obtain a second matching template, then standard square error matching processing is carried out on the target gray image according to the second matching template to obtain the second position of the target label in the image to be detected, the second position and the position interval are compared, and if the second position is within the position interval, the target label can be determined to be attached reversely.
It should be noted that, in the foregoing embodiment, rotating the matching template by 180 ° to obtain the second matching template is only an example of the present application, and it may be understood that, in some other application scenarios, after rotating the target grayscale image by 180 °, the standard square error matching processing may be performed on the target grayscale image and the matching template, so that the rotated object may be selected according to an actual application scenario, and is not limited herein.
In order to better implement the tag detection method in the present application, the present application further provides a tag detection apparatus, as shown in fig. 12, which is a schematic structural diagram of the tag detection apparatus provided in the embodiment of the present application, where the tag detection apparatus of the present application is applied to a server, and the tag detection apparatus 1200 includes:
the preprocessing module 1201 is configured to preprocess the image to be detected according to preset position information of the target label in the image to be detected, so as to obtain a vertical histogram based on a pixel value; the pixel value is the pixel value of a binary image corresponding to the image to be detected;
an interception and conversion module 1202, configured to perform interception and conversion processing on the binarized image according to the vertical histogram to obtain a target grayscale image; wherein, the target gray level image comprises a target label;
a matching module 1203, configured to perform standard square error matching processing on the target grayscale image according to a matching template of the target label, so as to obtain an actual position of the target label in the image to be detected;
the judging module 1204 is configured to judge whether the target label is correctly attached according to an actual position of the target label in the image to be detected.
In the embodiment of the application, the interception conversion module 1202 performs interception conversion processing on a binary image corresponding to an image to be detected according to a vertical histogram, so as to obtain a target gray-scale image including a target label, then the matching module 1203 performs standard square deviation matching processing on the target gray-scale image according to a matching template of the target label, so as to obtain an actual position of the target label in the image to be detected, and then the judgment module 1204 judges whether the target label is correctly attached according to the actual position, compared with the prior art that the gray-scale histogram of the label is used as a retrieval template, and when the target label is matched with a solar cell panel to be detected, the accuracy of a detection result after the standard square deviation matching processing is higher, and the detection accuracy of the label position is improved.
In some embodiments of the present application, the preprocessing module 1201 may be specifically configured to:
according to preset position information of a target label in an image to be detected, cutting the image to be detected to obtain a first partial image;
carrying out binarization processing on the first local image to obtain a binarized image; the binary image comprises white pixel points;
obtaining a vertical histogram based on pixel values according to the pixel values of the binary image; the horizontal coordinate of the vertical histogram is the width of the binarized image, and the vertical coordinate of the vertical histogram is the sum of pixel values of all white pixel points corresponding to each width value in the binarized image.
In some embodiments of the present application, the binarized image further includes black pixel points, and the preprocessing module 1201 may be further configured to:
obtaining the average pixel values of all pixel points in the first partial image according to the pixel values of all pixel points in the first partial image;
if the pixel value of the pixel point in the first partial image is larger than the average pixel value, modifying the pixel value of the pixel point in the first partial image to be 255, and obtaining a white pixel point;
and if the pixel value of the pixel point in the first partial image is smaller than the average pixel value, modifying the pixel value of the pixel point in the first partial image to be 0 to obtain a black pixel point.
In some embodiments of the present application, the intercept translation module 1202 may be specifically configured to:
determining an interception starting point according to the vertical histogram; wherein the interception starting point is a first abscissa point in the vertical histogram, and the first abscissa point is a first abscissa point in the vertical histogram having a non-zero ordinate value;
determining an interception end point according to a preset interception width; the intercepting end point is a second horizontal coordinate point in the vertical histogram;
based on the interception starting point and the interception end point, carrying out interception processing on the binary image to obtain a target image; wherein the target image comprises a target label;
and carrying out graying processing on the target image to obtain a target grayscale image.
In some embodiments of the present application, the actual position of the target label in the image to be detected includes an upper left corner position coordinate and a lower right corner position coordinate of the target label in the image to be detected, and the matching module 1203 may specifically be configured to:
traversing the target gray level image by using a matching template based on a normalized square error matching method to obtain a matching result; the matching result comprises a normalized mean square difference value corresponding to each pixel point in the target gray level image;
selecting a pixel point corresponding to the minimum normalized mean square difference value in the matching result as a reference point;
carrying out offset processing on the datum points according to the interception starting points to obtain position coordinates of the upper left corner;
and obtaining the position coordinate of the lower right corner according to the size information of the matched template and the position coordinate of the upper left corner.
In some embodiments of the present application, the tag detection apparatus 1200 may further include:
the template obtaining module 1205 is configured to obtain specific position information of the target tag in the image to be detected, and obtain a tag image of the target tag according to the specific position information;
and carrying out graying processing on the label image of the target label to obtain a label gray image, and taking the label gray image as a matching template of the target label.
In some embodiments of the present application, the determining module 1204 may be specifically configured to:
comparing the actual position of the target label in the image to be detected with a preset position interval;
if the actual position of the target label in the image to be detected is within the position interval, determining that the target label is correctly pasted;
otherwise, determining that the target label is attached with an error.
In some embodiments of the present application, after determining that the target tag is attached with an error, the determining module 1204 may further be specifically configured to:
rotating the matching template by 180 degrees to obtain a second matching template, and performing standard square error matching processing on the target gray level image according to the second matching template to obtain a second position of the target label in the image to be detected;
and if the second position of the target label in the image to be detected is within the position interval, determining that the target label is reversely attached.
It should be noted that, in the present application, the relevant contents of the preprocessing module 1201, the interception and transformation module 1202, the matching module 1203, the judgment module 1204, and the template obtaining module 1205 correspond to the above one to one, and it can be clearly understood by those skilled in the art that, for convenience and simplicity of description, the specific working process of the above-described label detection apparatus and the corresponding modules thereof may refer to the description of the label detection method in any embodiment corresponding to fig. 2 to fig. 11, and details are not repeated herein.
In order to better implement the label detection method of the present application, on the basis of the label detection method, the present application further provides a label detection apparatus, which integrates any one of the label detection devices provided in the present application, the label detection apparatus includes a processor 1301, a memory 1302, and a computer program stored in the memory 1302 and capable of running on the processor 1301, and the processor 1301 executes the computer program to implement the steps in the label detection method of any one of the embodiments.
As shown in fig. 13, it shows a schematic structural diagram of a label detection apparatus according to an embodiment of the present application, specifically:
the apparatus may include components such as a processor 1301 of one or more processing cores, memory 1302 of one or more computer-readable storage media, a power supply 1303, and an input unit 1304. Those skilled in the art will appreciate that the configuration of the device shown in fig. 13 is not intended to be limiting of the device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
the processor 1301 is a control center of the apparatus, connects various parts of the entire apparatus using various interfaces and lines, and performs various functions of the apparatus and processes data by running or executing software programs and/or modules stored in the memory 1302 and calling data stored in the memory 1302, thereby performing overall monitoring of the apparatus. Optionally, processor 1301 may include one or more processing cores; the Processor 1301 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like, and preferably the processor 1301 may integrate an application processor, which handles primarily the operating system, user interfaces, application programs, etc., and a modem processor, which handles primarily wireless communications. It is to be appreciated that the modem processor described above may not be integrated into processor 1301.
The memory 1302 may be used to store software programs and modules, and the processor 1301 may execute various functional applications and data processing by operating the software programs and modules stored in the memory 1302. The memory 1302 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, and the like; the storage data area may store data created according to use of the device, and the like. Further, the memory 1302 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 volatile solid state storage device. Accordingly, memory 1302 may also include a memory controller to provide processor 1301 access to memory 1302.
The device further comprises a power supply 1303 for supplying power to each component, and preferably, the power supply 1303 may be logically connected to the processor 1301 through a power management system, so that functions of managing charging, discharging, power consumption, and the like are realized through the power management system. The power supply 1303 may also include one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and any other components.
The device may further comprise an input unit 1304 and an output unit 1305, the input unit 1304 being operable to receive entered numerical or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the apparatus may further include a display unit and the like, which will not be described in detail herein. Specifically, in the present application, the processor 1301 in the device loads an executable file corresponding to a process of one or more application programs into the memory 1302 according to the following instructions, and the processor 1301 runs the application programs stored in the memory 1302, thereby implementing various functions as follows:
preprocessing an image to be detected according to preset position information of a target label in the image to be detected to obtain a vertical histogram based on a pixel value; the pixel value is the pixel value of a binary image corresponding to the image to be detected;
intercepting and converting the binary image according to the vertical histogram to obtain a target gray level image; wherein, the target gray level image comprises a target label;
performing standard square error matching processing on the target gray level image according to a matching template of the target label to obtain the actual position of the target label in the image to be detected;
and judging whether the target label is correctly pasted according to the actual position of the target label in the image to be detected.
It will be understood by those skilled in the art that all or part of the steps of the above methods may be performed by instructions or by instructions controlling associated hardware, and the instructions may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, the present application provides a computer-readable storage medium, which may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like. The computer readable storage medium has stored thereon a computer program which is executed by a processor to implement the steps of any of the label detection methods provided herein. For example, the computer program is executed by a processor to implement the steps of:
preprocessing an image to be detected according to preset position information of a target label in the image to be detected to obtain a vertical histogram based on a pixel value; the pixel value is the pixel value of a binary image corresponding to the image to be detected;
intercepting and converting the binary image according to the vertical histogram to obtain a target gray level image; wherein, the target gray level image comprises a target label;
performing standard square error matching processing on the target gray level image according to a matching template of the target label to obtain the actual position of the target label in the image to be detected;
and judging whether the target label is correctly pasted according to the actual position of the target label in the image to be detected.
Since the instructions stored in the computer-readable storage medium can execute the steps in the tag detection method in any embodiment corresponding to fig. 2 to fig. 11 of the present application, the beneficial effects that can be achieved by the tag detection method in any embodiment corresponding to fig. 2 to fig. 11 of the present application can be achieved, for details, see the foregoing description, and are not repeated herein.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and parts that are not described in detail in a certain embodiment may refer to the above detailed descriptions of other embodiments, and are not described herein again.
In a specific implementation, each unit or structure may be implemented as an independent entity, or may be combined arbitrarily to be implemented as one or several entities, and the specific implementation of each unit or structure may refer to the foregoing embodiments, which are not described herein again.
The foregoing detailed description is directed to a method, an apparatus, a device, and a computer-readable storage medium for label detection, which are provided by the present application, and specific examples are applied herein to illustrate the principles and implementations of the present application, and the foregoing description is only provided to help understand the method and core ideas of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (11)

1. A label detection method, characterized in that the label detection method comprises:
preprocessing the image to be detected according to preset position information of a target label in the image to be detected to obtain a vertical histogram based on a pixel value; the pixel value is the pixel value of a binary image corresponding to the image to be detected;
intercepting and converting the binary image according to the vertical histogram to obtain a target gray level image; wherein the target gray level image comprises the target label;
performing standard square error matching processing on the target gray level image according to the matching template of the target label to obtain the actual position of the target label in the image to be detected;
and judging whether the target label is correctly pasted according to the actual position of the target label in the image to be detected.
2. The method according to claim 1, wherein the preprocessing the image to be detected according to the preset position information of the target label in the image to be detected to obtain a vertical histogram based on pixel values comprises:
according to preset position information of the target label in the image to be detected, cutting the image to be detected to obtain a first partial image;
carrying out binarization processing on the first local image to obtain a binarized image; the binary image comprises white pixel points;
obtaining a vertical histogram based on the pixel values according to the pixel values of the binary image; the abscissa of the vertical histogram is the width of the binarized image, and the ordinate of the vertical histogram is the sum of pixel values of all white pixel points corresponding to each width value in the binarized image.
3. The method according to claim 2, wherein said binarized image further comprises black pixels;
the binarizing processing the first local image to obtain the binarized image includes:
obtaining the average pixel values of all pixel points in the first partial image according to the pixel values of all pixel points in the first partial image;
if the pixel value of the pixel point in the first partial image is larger than the average pixel value, modifying the pixel value of the pixel point in the first partial image to be 255, and obtaining the white pixel point;
and if the pixel value of the pixel point in the first partial image is smaller than the average pixel value, modifying the pixel value of the pixel point in the first partial image to be 0 to obtain the black pixel point.
4. The method according to claim 2, wherein the performing the clipping and converting process on the binarized image according to the vertical histogram to obtain a target grayscale image comprises:
determining a starting point of interception according to the vertical histogram; wherein the cut starting point is a first abscissa point in the vertical histogram, the first abscissa point being a first abscissa point in the vertical histogram having a non-zero ordinate value;
determining an interception end point according to a preset interception width; wherein the interception end point is a second abscissa point in the vertical histogram;
based on the interception starting point and the interception end point, carrying out interception processing on the binary image to obtain a target image; wherein the target image comprises the target label;
and carrying out graying processing on the target image to obtain the target grayscale image.
5. The method according to claim 4, wherein the actual position of the target label in the image to be detected comprises an upper left corner position coordinate and a lower right corner position coordinate of the target label in the image to be detected;
the standard square error matching processing is carried out on the target gray level image according to the matching template of the target label to obtain the actual position of the target label in the image to be detected, and the method comprises the following steps:
traversing the target gray level image by using the matching template based on a normalized square error matching method to obtain a matching result; the matching result comprises a normalized mean square difference value corresponding to each pixel point in the target gray level image;
selecting a pixel point corresponding to the minimum normalized mean square difference value in the matching result as a reference point;
carrying out offset processing on the reference point according to the interception starting point to obtain the position coordinate of the upper left corner;
and obtaining the position coordinate of the lower right corner according to the size information of the matched template and the position coordinate of the upper left corner.
6. The method according to claim 1, wherein the standard square error matching processing is performed on the target gray-scale image according to the matching template of the target label to obtain the actual position of the target label in the image to be detected, and the method comprises:
acquiring specific position information of the target label in the image to be detected, and acquiring a label image of the target label according to the specific position information;
and carrying out graying processing on the label image of the target label to obtain a label gray image, and taking the label gray image as a matching template of the target label.
7. The method according to any one of claims 1 to 6, wherein the determining whether the target label is correctly attached according to the actual position of the target label in the image to be detected comprises:
comparing the actual position of the target label in the image to be detected with a preset position interval;
if the actual position of the target label in the image to be detected is within the position interval, determining that the target label is correctly pasted;
otherwise, determining the target label pasting error.
8. The method of claim 7, wherein after determining the target label application error, the method further comprises:
rotating the matching template by 180 degrees to obtain a second matching template, and performing standard square error matching processing on the target gray level image according to the second matching template to obtain a second position of the target label in the image to be detected;
and if the second position of the target label in the image to be detected is within the position interval, determining that the target label is reversely attached.
9. A label sensing device, comprising:
the preprocessing module is used for preprocessing the image to be detected according to preset position information of the target label in the image to be detected to obtain a vertical histogram based on a pixel value; the pixel value is the pixel value of a binary image corresponding to the image to be detected;
the intercepting conversion module is used for intercepting and converting the binary image according to the vertical histogram to obtain a target gray level image; wherein the target gray level image comprises the target label;
the matching module is used for performing standard square error matching processing on the target gray level image according to the matching template of the target label to obtain the actual position of the target label in the image to be detected;
and the judging module is used for judging whether the target label is correctly pasted according to the actual position of the target label in the image to be detected.
10. A tag detection apparatus, characterized in that the tag detection apparatus comprises a processor, a memory and a computer program stored in the memory and executable on the processor, the processor executing the computer program to implement the steps in the tag detection method of any one of claims 1 to 8.
11. A computer-readable storage medium, having stored thereon a computer program for execution by a processor to perform the steps of the label detection method of any one of claims 1 to 8.
CN202110915512.0A 2021-08-10 2021-08-10 Label detection method, device, equipment and computer readable storage medium Pending CN114565551A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110915512.0A CN114565551A (en) 2021-08-10 2021-08-10 Label detection method, device, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110915512.0A CN114565551A (en) 2021-08-10 2021-08-10 Label detection method, device, equipment and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN114565551A true CN114565551A (en) 2022-05-31

Family

ID=81711091

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110915512.0A Pending CN114565551A (en) 2021-08-10 2021-08-10 Label detection method, device, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114565551A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117826692A (en) * 2024-03-04 2024-04-05 深圳市昊洋智能有限公司 Intelligent classroom multimedia management platform utilizing Internet of things for centralized management and control

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117826692A (en) * 2024-03-04 2024-04-05 深圳市昊洋智能有限公司 Intelligent classroom multimedia management platform utilizing Internet of things for centralized management and control
CN117826692B (en) * 2024-03-04 2024-05-24 深圳市昊洋智能有限公司 Intelligent classroom multimedia management platform utilizing Internet of things for centralized management and control

Similar Documents

Publication Publication Date Title
US20140177938A1 (en) System and Method for Identifying Defects in a Material
CN108205680B (en) Image feature extraction integrated circuit, method and terminal
CN114549393B (en) Image labeling method, device, equipment and computer storage medium
WO2022262054A1 (en) Image processing method, apparatus and device, and storage medium
EP3667903B1 (en) Photovoltaic panel recognition method, ground station, control apparatus, and unmanned aerial vehicle
CN116168351B (en) Inspection method and device for power equipment
CN110738205A (en) machine vision-based battery cell positive and negative electrode identification equipment and method
CN111767915A (en) License plate detection method, device, equipment and storage medium
CN114594114A (en) Full-automatic online nondestructive detection method for lithium battery cell
CN112325772A (en) Punching size measuring method, system, equipment and medium based on machine vision
CN114565551A (en) Label detection method, device, equipment and computer readable storage medium
CN112415014A (en) Copper foil defect detection method and medium
CN116660270A (en) Power cable detection method, device and storage medium
CN113326836B (en) License plate recognition method, license plate recognition device, server and storage medium
CN113654493A (en) Quality detection method and system for laminated soft package lithium battery
CN114581360B (en) Photovoltaic module label detection method, device, equipment and computer storage medium
CN114549392B (en) Color difference detection method, device and equipment for solar cell and computer medium
CN113538449A (en) Image correction method, device, server and storage medium
CN112700415A (en) Pen electricity shell defect rapid detection algorithm
CN111523583A (en) Method for automatically identifying and classifying equipment nameplate photos by using unmanned aerial vehicle
US11915410B2 (en) Method and apparatus for inspecting tab appearance of cell assembly, and electronic device
CN113792677B (en) Table identification method and device, computer equipment and storage medium
CN113449559B (en) Table identification method and device, computer equipment and storage medium
CN112507956B (en) Signal lamp identification method and device, electronic equipment, road side equipment and cloud control platform
CN109860742B (en) Method for identifying electrolyte leakage of communication power supply storage battery of transformer substation

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