Defect detection method, system and device and computer readable storage medium
Technical Field
The present invention relates to the field of inspection equipment technologies, and in particular, to a method, a system, and an apparatus for defect inspection, and a computer-readable storage medium.
Background
Currently, under the double pressure situation of energy shortage and environmental protection, the development and utilization of renewable energy resources are receiving general attention of people. The solar cell is a photoelectric semiconductor slice which directly generates electricity by utilizing sunlight, and has the characteristics of no pollution, universality of resources, inexhaustibility and the like. Solar cells are mainly classified into crystalline silicon solar cells and thin film solar cells. At present, a thin film solar cell is generally manufactured by attaching a photosensitive material with the thickness of only a few micrometers on a cheap glass, stainless steel or plastic substrate, wherein the stainless steel substrate is high temperature resistant, has relatively matched thermal expansion coefficient, is suitable for a roll-to-roll production process, and has wide prospects In industrialization and photovoltaic application of a flexible copper indium gallium selenide (Cu (In, Ga) Se _2, CIGS) thin film solar cell.
At present, the photovoltaic flexible stainless steel substrate has the defects of scratch, aluminum spot, water stain, pollution, dent, bulge, fold, oil stain, pinhole and the like after being fed and cleaned, and the quality detection method mainly comprises the steps of irradiating by using a strong light source and identifying by human eyes. However, the existing human eye identification method may have problems of false detection, missed detection and the like, and cannot trace back, so that the stability of quality cannot be ensured, and the requirements of personnel experience and labor cost are high.
Disclosure of Invention
In order to solve the technical problems, the invention provides a defect detection method, a system and a device, and a computer readable storage medium, which can realize automatic defect detection and reduce labor cost.
In order to achieve the purpose of the invention, the technical scheme of the embodiment of the invention is realized as follows:
the embodiment of the invention provides a defect detection method, which comprises the following steps: irradiating the detected object; collecting an image of the irradiated detected object; calculating gray values of pixel points in the collected image; and determining a defect area according to the calculated gray value of the pixel point in the acquired image.
Further, the calculating the gray value of the pixel point in the collected image includes: dividing the collected image into regions; calculating the difference absolute value of the gray values of the adjacent pixel points in each region divided by the regions;
the determining the defect region according to the calculated gray value of the pixel point in the acquired image comprises: comparing the absolute value of the difference value of the gray values of the adjacent pixel points in each region with a preset first threshold; and determining the area of which the absolute value of the difference value of the gray values of the adjacent pixel points is greater than or equal to the preset first threshold value as a defect area.
Further, the method further comprises: calculating a bright defect threshold value and a dark defect threshold value according to a preset standard gray threshold value and the preset first threshold value: the bright defect threshold is equal to the preset standard gray level threshold plus the preset first threshold; the dark defect threshold is the preset standard gray level threshold-the preset first threshold;
after the area in which the absolute value of the difference between the gray values of the adjacent pixels is greater than or equal to the preset first threshold is determined as a defect area, the method further includes: comparing the gray value of the pixel point of the defect area with the bright defect threshold and the dark defect threshold; when the gray value of the pixel point of the defect area is larger than or equal to the bright defect threshold value, determining that the defect of the defect area is a bright defect; and when the gray value of the pixel point of the defect area is smaller than or equal to the dark defect threshold value, determining that the defect of the defect area is a dark defect.
Further, the calculating the gray value of the pixel point in the collected image includes: dividing the collected image into regions; calculating the average gray value of all pixel points in each region divided by the regions;
the determining the defect region according to the calculated gray value of the pixel point in the acquired image comprises: comparing the average gray value of all pixel points in each region with a preset second threshold; and determining the area of which the average gray value of all the pixel points is greater than or equal to the preset second threshold as a defect area.
Further, the calculating the gray value of the pixel point in the collected image includes: dividing the collected image into regions; calculating the average gray value of all pixel points in each region divided by the regions;
the determining the defect region according to the calculated gray value of the pixel point in the acquired image comprises: comparing the average gray value of all pixel points in each region with the average gray value of the whole detected object; and determining the area in which the difference value between the average gray value of all the pixel points and the average gray value of the whole detected object exceeds a preset third threshold value as a defect area.
Further, after determining the defect region according to the calculated gray-scale value of the pixel point in the acquired image, the method further includes: and saving the acquired image or a partial image containing the defect area in the acquired image, and recording the relative position information of each defect area on the detected object.
Further, the relative position information includes X-axis position information and Y-axis position information, wherein: the X-axis position information is determined by: starting to record information of the travel length of the detected object after the position sensor detects the detected object, and taking the travel length corresponding to the time of acquiring the image of the detected object as the X-axis position information; and the Y-axis position information is determined according to the position of the defect area in the image of the detected object.
Further, the object to be detected is irradiated from different angles by a plurality of light sources.
Further, the number of the light sources is two, and the light sources are distributed on two sides of a camera used for collecting the image of the detected object.
Further, the light source is a strip-shaped single-color Light Emitting Diode (LED).
Further, the detected object is a stainless steel strip serving as a photovoltaic flexible stainless steel substrate.
The embodiment of the invention also provides a defect detection system, which comprises a light source, an image acquisition device and an image processing device, wherein: a light source for irradiating an object to be detected; the image acquisition device is used for acquiring an irradiated image of the detected object; and the image processing device is used for calculating the gray value of the pixel point in the acquired image and determining the defect area according to the calculated gray value of the pixel point in the acquired image.
Embodiments of the present invention also provide a computer-readable storage medium, where one or more programs are stored on the computer-readable storage medium, and the one or more programs are executable by one or more processors to implement the steps of the defect detection method as follows: and calculating the gray value of the pixel point in the acquired image, and determining the defect area according to the calculated gray value of the pixel point in the acquired image.
The embodiment of the invention also provides a defect detection device, which comprises a processor and a memory; the processor is used for executing the defect detection program stored in the memory to realize the following steps of the defect detection method: and calculating the gray value of the pixel point in the acquired image, and determining the defect area according to the calculated gray value of the pixel point in the acquired image.
The technical scheme of the invention has the following beneficial effects:
according to the defect detection method, the defect detection system, the defect detection device and the computer-readable storage medium, the defect area is determined according to the gray value of the pixel point in the acquired image, so that automatic defect detection is realized, the problems of false detection, missing detection and the like caused by manual detection are avoided, the detection quality is ensured, and the labor cost is reduced.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a schematic flow chart illustrating a defect detection method according to an embodiment of the present invention;
fig. 2 is a schematic view of a configuration of a strip-shaped light source according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a defect detection system according to an embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
Example one
As shown in fig. 1, a defect detection method according to the present invention includes the steps of:
step 101: irradiating the detected object;
in this embodiment, the object to be detected is a stainless steel strip serving as a photovoltaic flexible stainless steel substrate.
In this embodiment, the object to be detected is irradiated from different angles by a plurality of light sources.
In an embodiment of the invention, the Light source is a strip-shaped single-color Light Emitting Diode (LED). By arranging the strip-shaped single-color LED, the strip-shaped detection area in the detected object image can be uniformly irradiated.
Step 102: collecting an image of the irradiated detected object;
in this embodiment, one or more Charge Coupled Devices (CCD) cameras are used to capture an image of the irradiated object to be detected.
It should be noted that the CCD camera is an industrial high-speed camera, and is the most commonly used image sensor in machine vision at present. The photoelectric conversion, charge storage, charge transfer and signal reading are integrated into a whole, and the photoelectric conversion, charge storage, charge transfer and signal reading are typical solid-state imaging devices. One or more CCD cameras can be arranged according to the collection range of a single CCD camera and are used for collecting the images of the substrate in the bright zone area, for example, if the width of the stainless steel belt is 1 meter, if the collection width of the single CCD camera is 50 centimeters, two CCD cameras are used for parallel collection; if the acquisition width of a single CCD camera is 30 cm, four CCD cameras are used for parallel acquisition. In an embodiment of the invention, the number of the light sources is two, and the light sources are distributed on two sides of the camera. Specifically, as shown in fig. 2, it is assumed that the photovoltaic flexible stainless steel substrate is a stainless steel coil with a length of 1 km and a width of 1 m, two strip-shaped monochromatic light sources are respectively arranged on two sides of the CCD camera, and the two strip-shaped monochromatic light sources irradiate to form a cross bright band along the Y-axis direction. By arranging the two strip-shaped monochromatic light sources, the interference caused by substrate vibration and external light in the detection process is reduced.
Step 103: and calculating the gray value of the pixel point in the acquired image, and determining the defect area according to the calculated gray value of the pixel point in the acquired image.
In this embodiment, the calculating the gray value of the pixel point in the acquired image includes:
dividing the collected image into regions;
calculating the difference absolute value of the gray values of the adjacent pixel points in each region divided by the regions;
the determining the defect region according to the calculated gray value of the pixel point in the acquired image comprises:
comparing the absolute value of the difference value of the gray values of the adjacent pixel points in each region with a preset first threshold;
and determining the area of which the absolute value of the difference value of the gray values of the adjacent pixel points is greater than or equal to the preset first threshold value as a defect area.
It should be noted that how to determine the defect region according to the calculated gray value of the pixel point in the acquired image is specific, the present invention is not limited to the above detection method, and other detection methods may also be used for identification. For example, the acquired image is divided into regions; judging whether the average gray value of all pixel points of each region exceeds a preset second threshold, and if the average gray value of all pixel points of a certain region exceeds the preset second threshold, determining the region as a defect region; if the difference between the average gray value of all the pixel points in a certain region and the average gray value of the whole detected object exceeds the preset third threshold, determining that the region is a defect region.
In this embodiment, the method further includes: calculating a bright defect threshold value and a dark defect threshold value according to a preset standard gray threshold value and the preset first threshold value:
the bright defect threshold is equal to the preset standard gray level threshold plus the preset first threshold;
the dark defect threshold is the preset standard gray level threshold-the preset first threshold;
after the area in which the absolute value of the difference between the gray values of the adjacent pixels is greater than or equal to the preset first threshold is determined as a defect area, the method further includes:
comparing the gray value of the pixel point of the defect area with the bright defect threshold and the dark defect threshold;
when the gray value of the pixel point of the defect area is larger than or equal to the bright defect threshold value, determining that the defect of the defect area is a bright defect;
and when the gray value of the pixel point of the defect area is smaller than or equal to the dark defect threshold value, determining that the defect of the defect area is a dark defect.
Generally, the bright defects include scratches, water stains and the like; dark defects include pinholes, wrinkles, oil stains, and the like; defects such as dents, bumps, aluminum spots, contamination, etc. are not generally determined to be bright defects or dark defects. The defect detection method can detect the bright defects and/or the dark defects, and the specific bright defects and/or the dark defects are scratch, water stain, dent, bulge and other defect types, and can detect by manually checking the stored defect area images.
In this embodiment, after determining the defect region according to the calculated gray value of the pixel point in the acquired image, the method further includes:
and saving the acquired image or a partial image containing the defect area in the acquired image, and recording the relative position information of each defect area on the detected object.
In this embodiment, the relative position information includes X-axis position information and Y-axis position information, where:
the X-axis position information is determined by: after a position sensor detects a detected object, information of the travel length of the detected object is recorded, and the travel length corresponding to the time when the image of the detected object is acquired is used as the X-axis position information;
and the Y-axis position information is determined according to the position of the defect area in the image of the detected object.
The recorded information on the travel length may be a travel time, and the travel length is obtained by multiplying the travel time by the travel speed. When a plurality of CCD cameras are set to collect in parallel, the Y-axis position information is determined according to the width area collected by each CCD camera.
Example two
As shown in fig. 3, a defect detecting system according to the present invention includes a light source 301, an image capturing device 302 and an image processing device 303, wherein:
a light source 301 for irradiating an object to be detected;
an image acquisition device 302 for acquiring an image of the irradiated object to be detected;
and the image processing device 303 is configured to calculate a gray value of a pixel point in the acquired image, and determine the defect region according to the calculated gray value of the pixel point in the acquired image.
In this embodiment, the object to be detected is a stainless steel strip serving as a photovoltaic flexible stainless steel substrate.
In this embodiment, the image capturing device 302 captures an image of the irradiated object to be detected by one or more CCD cameras.
It should be noted that, depending on the collection range of a single CCD camera, one or more CCD cameras may be provided for collecting the image of the substrate in the bright band region, for example, if the width of the stainless steel band is 1 meter, if the collection width of a single CCD camera is 50 cm, two CCD cameras are used for parallel collection; if the acquisition width of a single CCD camera is 30 cm, four CCD cameras are used for parallel acquisition.
In this embodiment, the number of the light sources 301 is plural, and the detected object is irradiated by the plural light sources 301 from different angles.
In an embodiment of the present invention, the number of the light sources 301 is two, and the light sources are distributed on two sides of the image capturing device 302.
In an embodiment of the present invention, the Light source 301 is a strip-shaped single-color Light Emitting Diode (LED). By arranging the strip-shaped single-color LED, the strip-shaped detection area in the detected object image can be uniformly irradiated.
Specifically, as shown in fig. 2, it is assumed that the photovoltaic flexible stainless steel substrate is a stainless steel coil with a length of 1 km and a width of 1 m, two strip-shaped monochromatic light sources are respectively arranged on two sides of the CCD camera, and the two strip-shaped monochromatic light sources irradiate to form a cross bright band along the Y-axis direction. By arranging the two strip-shaped monochromatic light sources, the interference caused by substrate vibration and external light in the detection process is reduced.
In this embodiment, the image processing apparatus 303 is specifically configured to:
dividing the collected image into regions;
calculating the difference absolute value of the gray values of the adjacent pixel points in each region divided by the regions;
comparing the absolute value of the difference value of the gray values of the adjacent pixel points in each region with a preset first threshold;
and determining the area of which the absolute value of the difference value of the gray values of the adjacent pixel points is greater than or equal to the preset first threshold value as a defect area.
In this embodiment, the image processing apparatus 303 is further configured to:
calculating a bright defect threshold value and a dark defect threshold value according to a preset standard gray threshold value and the preset first threshold value:
the bright defect threshold is equal to the preset standard gray level threshold plus the preset first threshold;
the dark defect threshold is the preset standard gray level threshold-the preset first threshold;
after the area where the absolute value of the difference between the gray values of the adjacent pixels is greater than or equal to the preset first threshold is determined as a defect area, the image processing apparatus 303 is further configured to:
comparing the gray value of the pixel point of the defect area with the bright defect threshold and the dark defect threshold;
when the gray value of the pixel point of the defect area is larger than or equal to the bright defect threshold value, determining that the defect of the defect area is a bright defect;
and when the gray value of the pixel point of the defect area is smaller than or equal to the dark defect threshold value, determining that the defect of the defect area is a dark defect.
Generally, the bright defects include scratches, water stains, and the like; dark defects include pinholes, wrinkles, oil stains, and the like; defects such as dents, bumps, aluminum spots, contamination, etc. are not generally determined to be bright defects or dark defects. The defect detection system can detect the bright defects and/or the dark defects, and the specific bright defects and/or the dark defects are scratch, water stain, dent, bulge and other defect types, and can detect by manually checking the stored defect area images.
It should be noted that, how the image processing device 303 determines the defect region according to the calculated gray-scale value of the pixel point in the acquired image specifically, the present invention is not limited to the above detection method, and other detection methods may also be used for identification. For example, the image processing device 303 performs region division on the acquired image; the image processing device 303 determines whether the average gray scale value of all the pixel points in each region exceeds a preset second threshold, and if the average gray scale value of all the pixel points in a certain region exceeds the preset second threshold, the image processing device 303 determines that the region is a defective region; for another example, the image processing device 303 determines whether the difference between the average gray scale value of all the pixel points in each region and the average gray scale value of the whole detected object exceeds a preset third threshold, and if the difference between the average gray scale value of all the pixel points in a certain region and the average gray scale value of the whole detected object exceeds the preset third threshold, the image processing device 303 determines that the region is a defective region.
In this embodiment, after determining the defect region according to the calculated gray-scale value of the pixel point in the acquired image, the image processing apparatus 303 is further configured to:
and storing the image of the detected object or the partial image of the detected object, which contains the defect area, and recording the relative position information of each defect area on the detected object.
In this embodiment, the relative position information includes X-axis position information and Y-axis position information, where:
the X-axis position information is determined by: after a position sensor detects a detected object, information of the travel length of the detected object is recorded, and the travel length corresponding to the time when the image of the detected object is acquired is used as the X-axis position information;
and the Y-axis position information is determined according to the position of the defect area in the image of the detected object.
The recorded information on the travel length may be a travel time, and the travel length is obtained by multiplying the travel time by the travel speed. When a plurality of CCD cameras are set to collect in parallel, the Y-axis position information is determined according to the width area collected by each CCD camera.
EXAMPLE III
Embodiments of the present invention also provide a computer-readable storage medium, where one or more programs are stored on the computer-readable storage medium, and the one or more programs are executable by one or more processors to implement the steps of the defect detection method as follows:
and calculating the gray value of the pixel point in the acquired image, and determining the defect area according to the calculated gray value of the pixel point in the acquired image.
In this embodiment, the calculating a gray value of a pixel point in the acquired image and determining the defect region according to the calculated gray value of the pixel point in the acquired image specifically include:
dividing the collected image into regions;
calculating the difference absolute value of the gray values of the adjacent pixel points in each region divided by the regions;
comparing the absolute value of the difference value of the gray values of the adjacent pixel points in each region with a preset first threshold;
and determining the area of which the absolute value of the difference value of the gray values of the adjacent pixel points is greater than or equal to the preset first threshold value as a defect area.
In this embodiment, the one or more programs are further executable by the one or more processors to implement the steps of the defect detection method as follows:
calculating a bright defect threshold value and a dark defect threshold value according to a preset standard gray threshold value and the preset first threshold value:
the bright defect threshold is equal to the preset standard gray level threshold plus the preset first threshold;
the dark defect threshold is the preset standard gray level threshold-the preset first threshold;
comparing the gray value of the pixel point of the defect area with the bright defect threshold and the dark defect threshold;
when the gray value of the pixel point of the defect area is larger than or equal to the bright defect threshold value, determining that the defect of the defect area is a bright defect;
and when the gray value of the pixel point of the defect area is smaller than or equal to the dark defect threshold value, determining that the defect of the defect area is a dark defect.
Generally, the bright defects include scratches, water stains, and the like; dark defects include pinholes, wrinkles, oil stains, and the like; defects such as dents, bumps, aluminum spots, contamination, etc. are not generally determined to be bright defects or dark defects. The defect detection method can detect the bright defects and/or the dark defects, and the specific bright defects and/or the dark defects are scratch, water stain, dent, bulge and other defect types, and can detect by manually checking the stored defect area images.
It should be noted that how the program determines the defect region according to the calculated gray value of the pixel point in the acquired image is specific, the present invention is not limited to the above detection method, and other detection methods may be used for identification. For example, the acquired image is divided into regions; judging whether the average gray value of all pixel points of each region exceeds a preset second threshold, and if the average gray value of all pixel points of a certain region exceeds the preset second threshold, determining the region as a defect region; if the difference between the average gray value of all the pixel points in a certain region and the average gray value of the whole detected object exceeds the preset third threshold, determining that the region is a defect region.
In this embodiment, after determining the defect region according to the calculated gray value of the pixel point in the acquired image, the one or more programs may be further executed by one or more processors to implement the following steps of the defect detection method:
and storing the image of the detected object or the partial image of the detected object, which contains the defect area, and recording the relative position information of each defect area on the detected object.
In this embodiment, the relative position information includes X-axis position information and Y-axis position information, where:
the X-axis position information is determined by: after a position sensor detects a detected object, information of the travel length of the detected object is recorded, and the travel length corresponding to the time when the image of the detected object is acquired is used as the X-axis position information;
and the Y-axis position information is determined according to the position of the defect area in the image of the detected object.
The recorded information on the travel length may be a travel time, and the travel length is obtained by multiplying the travel time by the travel speed. When a plurality of CCD cameras are set to collect in parallel, the Y-axis position information is determined according to the width area collected by each CCD camera.
Example four
The embodiment of the invention also provides a defect detection device, which comprises a processor and a memory, wherein the processor is used for executing the defect detection program stored in the memory so as to realize the following steps of the defect detection method:
and calculating the gray value of the pixel point in the acquired image, and determining the defect area according to the calculated gray value of the pixel point in the acquired image.
In this embodiment, the calculating a gray value of a pixel point in the acquired image and determining the defect region according to the calculated gray value of the pixel point in the acquired image specifically include:
dividing the collected image into regions;
calculating the difference absolute value of the gray values of the adjacent pixel points in each region divided by the regions;
comparing the absolute value of the difference value of the gray values of the adjacent pixel points in each region with a preset first threshold;
and determining the area of which the absolute value of the difference value of the gray values of the adjacent pixel points is greater than or equal to the preset first threshold value as a defect area.
In this embodiment, the processor is further configured to execute a defect detection program stored in the memory to implement the following steps of the defect detection method:
calculating a bright defect threshold value and a dark defect threshold value according to a preset standard gray threshold value and the preset first threshold value:
the bright defect threshold is equal to the preset standard gray level threshold plus the preset first threshold;
the dark defect threshold is the preset standard gray level threshold-the preset first threshold;
comparing the gray value of the pixel point of the defect area with the bright defect threshold and the dark defect threshold;
when the gray value of the pixel point of the defect area is larger than or equal to the bright defect threshold value, determining that the defect of the defect area is a bright defect;
and when the gray value of the pixel point of the defect area is smaller than or equal to the dark defect threshold value, determining that the defect of the defect area is a dark defect.
Generally, the bright defects include scratches, water stains, and the like; dark defects include pinholes, wrinkles, oil stains, and the like; defects such as dents, bumps, aluminum spots, contamination, etc. are not generally determined to be bright defects or dark defects. The defect detection method can detect the bright defects and/or the dark defects, and the specific bright defects and/or the dark defects are scratch, water stain, dent, bulge and other defect types, and can detect by manually checking the stored defect area images.
It should be noted that how the processor determines the defect region according to the calculated gray value of the pixel point in the acquired image specifically, the present invention is not limited to the above detection method, and other detection methods may also be used for identification. For example, the acquired image is divided into regions; judging whether the average gray value of all pixel points of each region exceeds a preset second threshold, and if the average gray value of all pixel points of a certain region exceeds the preset second threshold, determining the region as a defect region; if the difference between the average gray value of all the pixel points in a certain region and the average gray value of the whole detected object exceeds the preset third threshold, determining that the region is a defect region.
In this embodiment, after determining the defect region according to the calculated gray value of the pixel point in the acquired image, the processor is further configured to execute a defect detection program stored in the memory, so as to implement the following steps of the defect detection method:
and storing the image of the detected object or the partial image of the detected object, which contains the defect area, and recording the relative position information of each defect area on the detected object.
In this embodiment, the relative position information includes X-axis position information and Y-axis position information, where:
the X-axis position information is determined by: after a position sensor detects a detected object, information of the travel length of the detected object is recorded, and the travel length corresponding to the time when the image of the detected object is acquired is used as the X-axis position information;
and the Y-axis position information is determined according to the position of the defect area in the image of the detected object.
The recorded information on the travel length may be a travel time, and the travel length is obtained by multiplying the travel time by the travel speed. When a plurality of CCD cameras are set to collect in parallel, the Y-axis position information is determined according to the width area collected by each CCD camera.
It will be understood by those skilled in the art that all or part of the steps of the above methods may be implemented by instructing the relevant hardware through a program, and the program may be stored in a computer readable storage medium, such as a read-only memory, a magnetic or optical disk, and the like. Alternatively, all or part of the steps of the foregoing embodiments may also be implemented by using one or more integrated circuits, and accordingly, each module/unit in the foregoing embodiments may be implemented in the form of hardware, and may also be implemented in the form of a software functional module. The present invention is not limited to any specific form of combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.