Image defect detection method, device, system and computer readable storage medium

By using integral image and grid sliding traversal technology of 2.5D images in battery appearance detection, the problem of low detection accuracy in manual visual inspection is solved, and accurate detection of battery appearance defects is achieved.

CN119151945BActive Publication Date: 2025-03-14HANGZHOU LINGXI ROBOT INTELLIGENT TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411658949.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-20
Publication Date
2025-03-14
Estimated Expiration
2044-11-20

AI Technical Summary

Technical Problem

In the prior art, battery appearance detection relies on manual visual inspection, which is easily affected by subjective factors, and is difficult to quantify the detection standards. When the workload is large, the detector is prone to fatigue, resulting in low detection accuracy.

Method used

By obtaining the integral image of the 2.5D image of the target object, a grid is constructed in the integral image, slidingly traverse the integral image to form a comparison area with the detection area and the adjacent grid, and calculating the difference between the maximum value of the average pixel value of each comparison area. If it is greater than the preset threshold, the detection area is determined as a defect area, and the defect type is determined based on the defect information.

Benefits of technology

It improves the accuracy of battery appearance detection, avoids the influence of subjective factors in manual visual inspection and the missed and missed detection problems caused by fatigue, and can accurately determine defects in the image.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119151945B_ABST
    Figure CN119151945B_ABST
Patent Text Reader

Abstract

The present application relates to an image defect detection method, device, system and computer-readable storage medium, wherein the image defect detection method comprises: obtaining an integral image of a 2.5D image of a target object, constructing several grids in the integral image; sliding through the integral image with any grid as a detection area, forming a comparison area with the detection area and adjacent grids distributed in a set manner, and obtaining several comparison areas by traversal; in any comparison area, obtaining the pixel average of each grid containing the detection area, and determining the maximum pixel average and the minimum pixel average; if the difference between the maximum pixel average and the minimum pixel average is greater than a preset threshold, obtaining the central pixel of the detection area, and obtaining a defect area composed of all the central pixels; obtaining defect information of the defect area, and determining the defect type according to the defect information. Through the present application, the accuracy of defect detection is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of image detection, and in particular to an image defect detection method, device, system and computer-readable storage medium. Background Art

[0002] In the production of batteries, the appearance inspection of batteries is the last checkpoint of product quality. Through the appearance inspection of batteries, defects in the batteries can be discovered in time, thereby avoiding safety problems such as short circuits and spontaneous combustion when the batteries are used. At present, the appearance inspection of batteries adopts manual visual inspection. However, the manual visual inspection method is easily affected by subjective factors, making it difficult to quantify the inspection standards. In addition, when the workload is heavy, the inspectors are prone to fatigue, which may lead to errors in battery inspection. Due to the problems of manual visual inspection, the accuracy of battery appearance inspection is low. How to improve the accuracy of battery appearance inspection has become an urgent problem to be solved. Summary of the invention

[0003] The embodiments of the present application provide an image defect detection method, device, system and computer-readable storage medium to at least solve the problem of related art: how to improve the accuracy of appearance detection of batteries.

[0004] In a first aspect, an embodiment of the present application provides an image defect detection method, characterized by comprising:

[0005] Obtain an integral image of the 2.5D image of the target object, and construct a number of grids in the integral image;

[0006] Taking any grid as the detection area, sliding through the integral image, forming a comparison area with the detection area and adjacent grids distributed in a set manner, and obtaining a number of comparison areas by traversing;

[0007] In any comparison area, obtaining the pixel average of each grid containing the detection area, and determining the maximum pixel average and the minimum pixel average;

[0008] If the difference between the maximum pixel average and the minimum pixel average is greater than a preset threshold, the center pixel of the detection area is obtained;

[0009] According to all the central pixels, the defect area and the defect information of the defect area are obtained, and the defect type is determined according to the defect information.

[0010] In one embodiment, obtaining defect information of a defect area and determining a defect type according to the defect information includes:

[0011] Obtaining a defect area and a grayscale value of the defect in the defect region, if the defect area is less than a preset area threshold and the grayscale value is less than a preset grayscale threshold, the defect is a slight defect according to the first detection requirement obtained in advance, wherein a slight defect indicates that the defect does not affect normal use of the target object;

[0012] According to the second detection requirement obtained in advance, the defect is a severe defect, and a severe defect indicates that the defect can affect the normal use of the target object.

[0013] In one embodiment, the method of obtaining the average pixel value of each grid is specifically configured as follows:

[0014]

[0015] in, I ( r,c ) is the pixel value corresponding to any grid in the integral image, average ( r,c ) is the pixel average value of any grid in the integral image, and the size of the grid is ( w,h ), w is the width of the grid, h The height of the grid.

[0016] In one embodiment, obtaining an integral image of a 2.5D image of a target object includes:

[0017] determining a main body region image of the target object in the 2.5D image of the target object;

[0018] An integral image is obtained based on the subject area image.

[0019] In one embodiment, the integral image satisfies the following formula:

[0020]

[0021] in, Intergral ( r,c ) is the integral image, I ( i,j ) is the pixel value at any position in the main area image, and the size of the main area image is ( R,C ).

[0022] In one embodiment, determining a main body area image of the target object in a 2.5D image of the target object includes:

[0023] In the 2.5D image, several measurement blocks are obtained along the main edge of the target object;

[0024] Obtain edge points of the target object in each measurement block, fit all edge points, and obtain a straight line equation or a circle equation;

[0025] Based on the straight line equation or the circle equation, a subject area image about the target object is acquired.

[0026] In one embodiment, several grids are constructed in the integral image, including:

[0027] Based on the 2.5D image, a preliminary size of the defect is obtained, and a grid size is determined according to the preliminary size, wherein the grid size is larger than the size of the defect;

[0028] Based on the grid size, several grids are constructed in the integral image.

[0029] In a second aspect, an embodiment of the present application provides an image defect detection device, characterized in that it includes:

[0030] A construction module, used for obtaining an integral image of a 2.5D image of a target object and constructing a plurality of grids in the integral image;

[0031] An acquisition module is used to slide and traverse the integral image with any grid as a detection area, form a comparison area with the detection area and adjacent grids distributed in a set manner, and acquire a plurality of comparison areas by traversing;

[0032] A first determination module is used to obtain the pixel average value of each grid including the detection area in any comparison area, and determine the maximum pixel average value and the minimum pixel average value;

[0033] The second determination module obtains the center pixel of the detection area if the difference between the maximum pixel average value and the minimum pixel average value is greater than a preset threshold;

[0034] The third determination module obtains the defect area and defect information of the defect area according to all the central pixels, and determines the defect type according to the defect information.

[0035] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the image defect detection method as described in the first aspect above is implemented.

[0036] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the image defect detection method as described in the first aspect above.

[0037] The image defect detection method, device, system, and computer-readable storage medium provided by the embodiments of the present application have at least the following technical effects.

[0038] The integral image of the target object's 2.5D image is used for detection. In the comparison area, the maximum value difference of the pixel average value is obtained. When the maximum value difference is greater than the preset threshold, it can be determined that the grayscale change between the detection area and the comparison area is large in the comparison area, so that the detection area can be determined as a defect area. Through the above method, the maximum value difference of the average pixel represents the drastic degree of grayscale change. The grayscale difference between the detection area and the comparison area in the integral image is used to determine whether there is a defect in the detection area, and the defect type in the defect area is determined based on the defect information in the defect area, so that the defects in the image can be accurately determined, thereby improving the accuracy in the battery detection process.

[0039] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0041] Figure 1 is a schematic diagram of a 2.5D imaging system according to an exemplary embodiment;

[0042] Figure 2 is a flow chart of an image defect detection method according to an exemplary embodiment;

[0043] Figure 3 is a schematic diagram of a comparison area according to an exemplary embodiment;

[0044] Figure 4 is a schematic diagram showing a method of calculating a pixel average value of a grid according to an exemplary embodiment;

[0045] Figure 5 is a schematic diagram showing a detection area traversal integral image according to an exemplary embodiment;

[0046] Figure 6 is a flow chart of an image defect detection method according to another exemplary embodiment;

[0047] Figure 7 is a flow chart of an image defect detection algorithm according to an exemplary embodiment;

[0048] Figure 8 is a block diagram showing an image defect detection apparatus according to an exemplary embodiment;

[0049] Fig. 9 is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION

[0050] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present application.

[0051] Obviously, the drawings described below are only some examples or embodiments of the present application. For ordinary technicians in this field, the present application can also be applied to other similar scenarios based on these drawings without creative work. In addition, it can also be understood that although the efforts made in this development process may be complicated and lengthy, for ordinary technicians in this field related to the content disclosed in this application, some changes in design, manufacturing or production based on the technical content disclosed in this application are just conventional technical means, and should not be understood as insufficient content disclosed in this application.

[0052] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0053] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application refers to two or more. "And / or" describes the association relationship of associated objects, indicating that there may be three relationships, for example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the objects before and after are in an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only used to distinguish similar objects and do not represent a specific ordering of the objects.

[0054] Figure 1 is a schematic diagram of a 2.5D imaging system according to an exemplary embodiment. Figure 1 As shown, the 2.5D imaging system includes a high-speed line scan camera, a line scan light source and a controller. The high-speed line scan camera is used to obtain an image of the object to be scanned. The line scan light source is a special phase fringe change light source, which can synchronize with the high-speed line scan camera to obtain an image of the light field phase change. The controller is used to control the line scan light source and the high-speed line scan camera. The 2.5D imaging system can simulate the multi-angle and multi-lighting detection method of the human eye, and can provide a 2.5D image with rich depth and texture features. By scanning the target object with a 2.5D imaging system, several types of images can be obtained, including average images, depth profile images, shape images, gloss ratio images, specular reflection images, diffuse reflection images and phase change images.

[0055] For any object with defects, after 2.5D imaging, several types of images can be obtained. In these images, the position of the defects is the same, but the defects show different characteristics in the images. These features facilitate the detection of objects. For example, in scenes with strong reflectivity such as metal and glass, the mirror reflection image can highlight the defective part of the object. In the scene of detecting thin films and matte, the contrast of defects in the average image and diffuse reflection image is higher. In the average image, there is an obvious color change for defects such as rust, leakage, and dirt in the battery, and there is a significant color difference between the defects in the battery and the flawless battery. Therefore, for the defects caused by the battery, the average image in the 2.5D image is used for detection. The present application does not limit the use of different images for detection and processing according to the characteristics of other objects to be detected.

[0056] Based on the above situation, the embodiments of the present application provide an image defect detection method, device, system and computer-readable storage medium.

[0057] In a first aspect, an embodiment of the present application provides an image defect detection method. Figure 2 is a flow chart of an image defect detection method according to an exemplary embodiment. Figure 2 As shown, the image defect detection method includes:

[0058] Step S101: Obtain an integral image of a 2.5D image of a target object, and construct a plurality of grids in the integral image.

[0059] A 2.5D image of the target object is obtained through a 2.5D imaging system. The 2.5D image is an average image of the target object. In an actual detection environment, the 2.5D image of the target object contains a large amount of detection background, which will interfere with the detection process. Therefore, through software tools, several measurement blocks are obtained along the main edge of the target object in the 2.5D image. In each measurement block, the edge points of the target object in each measurement block are obtained. The edge points are the main edges of the target object. Each measurement block is evenly distributed according to a preset interval, and all the edge points obtained are fitted to obtain a straight line equation or a circular equation about the edge of the target object. Based on the straight line equation or the circular equation, an image of the main area of ​​the target object is obtained. Based on the main area image, an integral image is obtained according to the following formula:

[0060]

[0061] in, Intergral ( r,c ) is the integral image, I ( i,j ) is the pixel value at any position in the main area image, and the size of the main area image is ( R,C ).

[0062] In one embodiment, the target object is a cylindrical battery, and the software tool uses a caliper tool, wherein the caliper tool includes a linear caliper tool and a circular caliper tool. The linear caliper tool is used to obtain the rectangular edge of the main area of ​​the rectangular part of the cylindrical battery, and the circular caliper tool is used to obtain the circular edges of the positive and negative electrodes of the cylindrical battery. Based on the rectangular edge and circular edge of the cylindrical battery, the main area image of the target object is obtained.

[0063] Since the defect and the background present dark or bright spots with a certain contrast in the 2.5D image, the preliminary size of the defect can be obtained from the 2.5D image. Based on the preliminary size of the defect, the grid size is determined. The grid size is larger than the preliminary size of the defect to ensure that the complete defect can be detected in the grid during the subsequent defect detection process. Preferably, the grid size is selected to be twice the defect size. According to the grid size, several grids are constructed in the integral image according to the preset step size, where the preset step size is smaller than the grid size.

[0064] By obtaining the edge points of the target object through software tools and fitting based on the edge points, the main area of ​​the target object can be accurately obtained, thereby avoiding background interference. On the other hand, the integral image is obtained based on the main area image of the target object, and the integral image can provide a basis for subsequently improving the speed of calculating the pixel average.

[0065] Step S102: Slide and traverse the integral image with any grid as the detection area, form a comparison area with the detection area and adjacent grids distributed in a set manner, and obtain a plurality of comparison areas through traversal.

[0066] Figure 3 is a schematic diagram of a comparison area according to an exemplary embodiment. Figure 3 As shown, any grid is used as the detection area 200, and the central pixel 100 of the detection area 200 is used as a reference to construct a comparison area 400 with the detection area as the initial grid. The comparison area 400 includes a detection area 200 and several comparison areas 300, that is, in the comparison area 400, except for the detection area 200, the remaining grids are all comparison areas 300. Among them, the number of comparison areas is not specifically limited and is set according to the actual application scenario requirements. In the integral image, the detection area 200 is slid through the integral image, and several comparison areas are obtained according to the above method.

[0067] The comparison area is delineated based on the detection area and the comparison area, and the integral image can be used to quickly calculate the rectangular area of ​​the image, which provides a prerequisite for the subsequent rapid calculation of the pixel averages of the detection area and the comparison area in any comparison area.

[0068] Step S103: in any comparison area, obtain the pixel average value of each grid including the detection area, and determine the maximum pixel average value and the minimum pixel average value.

[0069] Figure 4 is a schematic diagram showing a method of calculating the pixel average value of a grid according to an exemplary embodiment. Figure 4 As shown, in any comparison area, the average pixel value of each grid in the detection area is obtained. The method of obtaining the average pixel value of each grid is specifically configured as follows:

[0070]

[0071] in, I ( r,c ) is the pixel value corresponding to any grid in the integral image, average ( r,c ) is the pixel average value of any grid in the integral image, and the size of the grid is ( w,h ), w is the width of the grid, h The height of the grid.

[0072] By the above method, in any comparison area, the pixel average value of each grid is obtained. Based on the pixel average values ​​of all grids, the maximum pixel average value and the minimum pixel average value are obtained.

[0073] By using the integral image, the method of obtaining the average pixel value in the grid reduces a lot of calculation time compared to the method of traversing all pixel values ​​in the comparison area and then averaging them, and can obtain the average pixel value of the grid more quickly.

[0074] Step S104: If the difference between the maximum pixel average value and the minimum pixel average value is greater than a preset threshold, the center pixel of the detection area is obtained.

[0075] For any comparison area, based on the obtained maximum pixel average and minimum pixel average, the difference between the maximum pixel average and the minimum pixel average is obtained. The difference between the maximum pixel average and the minimum pixel average represents the severity of the grayscale change in the current comparison area. Among them, the difference between the maximum pixel average and the minimum pixel average satisfies the following formula:

[0076]

[0077] A d ( r,c ) is the difference between the maximum pixel average and the minimum pixel average, A max ( r,c) is the maximum pixel average, A min ( r,c ) is the minimum pixel average.

[0078] In each comparison area, the difference between the maximum and minimum values ​​of several pixel average values ​​is obtained. There is a clear difference between the defective area and the defect-free area. Therefore, if there is a defect in the comparison area, the difference between its maximum value is different from the difference between the maximum and minimum pixel average values ​​of the defect-free area in the comparison area. For the above reasons, the difference between the maximum pixel average and the minimum pixel average is compared with the preset threshold. If the difference is greater than the preset threshold, it means that there is a defect in the comparison area corresponding to this difference. For the comparison area where the difference is greater than the preset threshold, the central pixel of the detection area in the comparison area is marked as a defective pixel. The defective pixel is used to construct the subsequent defective area.

[0079] Step S105 : acquiring a defect area and defect information of the defect area according to all the central pixels, and determining a defect type according to the defect information.

[0080] Since the detection area will slide through the integral image, after the detection area traverses the integral image, several central pixels, i.e. defective pixels, are obtained. Based on all defective pixels, a defective area composed of defective pixels is obtained. It should be noted that, in the grayscale camera, the image obtained will have some defects that cannot be distinguished from the background area. Therefore, by using a color camera, color information can be added to the defect image to better distinguish the defect from the background area.

[0081] According to the difference between the maximum pixel average and the minimum pixel average being greater than the preset threshold, the central pixel of the detection area in the comparison area is taken as the defective pixel, and there may be non-defective pixels in the detection area, so the central pixel of the detection area is selected as the defective pixel. The defective area includes non-defective pixels, which will cause errors in the defective area finally obtained. Figure 5 is a schematic diagram showing a detection area traversal integral image according to an exemplary embodiment, such as Figure 5 As shown, the problem is solved by setting the step distance between the detection area and the comparison area, and the preset step size is set to 1 to 2 pixels, so that the error is maintained at 1 to 2 pixels. In the defect area, the 1 to 2 pixel error will not affect the complete defect.

[0082] By comparing the maximum value difference of the pixel average value with the preset threshold, it is preliminarily determined whether there is a defect in the comparison area. If the maximum value difference is greater than the preset threshold, the defect area is further determined according to the central pixel of the detection area. The defect area is determined by two steps, so that the defect area only includes the defect but not the background content, thereby improving the accuracy of determining the defect area.

[0083] The information obtained in the defect area includes the pixel area size of the area and the position of the center point of the area. And the area information, location information and grayscale information of the defect are determined in the defect area. Since there are different types of defects, different types of defects will have different effects on the use and preservation of the target object. Therefore, it is necessary to judge whether the defect is a mild defect or a severe defect for the target object under different detection standards according to the type of defect, and whether the defect can be retained. Taking battery defects as an example, there are many types of battery defects, including dirt defects, scratch defects, leakage defects, dent defects and rust defects. There are different detection standards for different types of defects. Therefore, different detection requirements need to be set according to the type of defect. Among them, the detection requirements include the first detection requirements and the second detection requirements.

[0084] The defect area and the grayscale value of the defect in the defect area are obtained. If the defect area is smaller than the preset area threshold and the grayscale value is smaller than the preset grayscale threshold, according to the first detection requirement obtained in advance, the defect in the defect area is a mild defect, wherein a mild defect indicates that the defect does not affect the normal use of the target object. The first detection requirement is for defects such as stolen goods defects and scratch defects. Such defects only affect the appearance of the battery, but will not affect the use of the battery. Therefore, the first detection requirement is relatively loose and can accommodate defects with smaller areas and smaller color differences, which do not affect the use and storage of the battery.

[0085] If the defect area is smaller than the preset area threshold and the grayscale value is smaller than the preset grayscale threshold, according to the pre-acquired second detection requirement, the defect in the defect area is a severe defect, and a severe defect indicates that the defect can affect the normal use of the target object. The second detection requirement is for defects such as leakage defects, dent defects and rust defects, which will significantly affect the use and storage of the battery. Therefore, the second detection requirement is more stringent, and even small defects cannot exist.

[0086] It should be noted that the preset area threshold and the preset grayscale threshold are obtained by processing in batches based on a large amount of actual data. In addition, the results of each batch are compared with the results determined by the staff, and the data inconsistent with the results determined by the staff are used as the basis to adjust the area threshold and grayscale threshold. For example, if the number of missed detections is large, then a stricter threshold is set. If the number of false detections is large, then adjust the threshold and set the preset threshold to be more relaxed. After multiple adjustments, the detection error is maintained within the set range, thereby ensuring the requirements of the detection process.

[0087] Figure 6 is a flow chart of an image defect detection method according to another exemplary embodiment. Figure 6As shown, a 2.5D image is obtained from a 2.5D imaging system, and the image is preprocessed to obtain an integral image. A defect detection algorithm is used to detect defects in the integral image, and a threshold condition is used to determine whether it is a defect. If it is a defect, the detection information is output. For the defect detection algorithm, the specific steps include: Figure 7 is a flow chart of an image defect detection algorithm according to an exemplary embodiment. Figure 7 As shown, according to the obtained 2.5D image, the integral image is calculated, and then the integral image is traversed according to the detection area to obtain multiple comparison areas. The pixel average is quickly calculated in the comparison area using the integral image, and the maximum pixel average and the minimum pixel average are calculated. Based on the maximum pixel average and the minimum pixel average, the difference between the maximum values ​​of the pixel averages in multiple comparison areas is calculated. If the difference between the maximum values ​​of the pixel averages is greater than the set threshold, it is determined that there is a defect in the comparison area, and the relevant information of the defect is output.

[0088] Different detection requirements are divided according to the type of defects, and different types of defects can be accurately handled. According to the processing results of different types of defects, it can be determined whether the defect has an impact on the target object. If it does cause an impact, it is determined that the defect cannot be retained. If it does not cause an impact, it is determined that the defect can be retained, thereby improving the accuracy of detecting defects in the target object.

[0089] In summary, the image defect detection method provided by the embodiment of the present application obtains the detection area, contrast area and comparison area by constructing a grid in the integral image, and uses the integral image to quickly obtain the pixel averages of the detection area and the comparison area, determines the defect area according to the difference between the maximum values ​​of the pixel averages in the comparison area, and determines the type of defect according to the defect information in the defect area. Through the above method, the detected defects can be classified and processed, and for different types of defects, it is determined whether the defect has an impact on the use and storage of the target object based on the defect information. Different detection standards are defined according to different types of defects, and a large number of defects in the image can be accurately determined, and the defects can be qualitatively and quantitatively analyzed, avoiding the problems of missed detection and false detection caused by inconsistent detection standards and fatigue in manual visual inspection, thereby improving the accuracy of detecting target objects.

[0090] In a second aspect, an embodiment of the present application provides an image defect detection device. Figure 8 FIG. 1 is a block diagram showing an image defect detection apparatus according to an exemplary embodiment. Figure 8 As shown, the image defect detection device comprises:

[0091] A construction module, used for acquiring an integral image of a 2.5D image of a target object, and constructing a plurality of grids in the integral image;

[0092] An acquisition module is used to slide and traverse the integral image with any grid as a detection area, form a comparison area with the detection area and adjacent grids distributed in a set manner, and acquire a plurality of comparison areas by traversing;

[0093] A first determination module is used to obtain the pixel average value of each grid including the detection area in any comparison area, and determine the maximum pixel average value and the minimum pixel average value;

[0094] The second determination module obtains the central pixel of the detection area and obtains the defect area composed of all the central pixels if the difference between the maximum pixel average value and the minimum pixel average value is greater than a preset threshold value;

[0095] The third determination module obtains defect information of the defect area and determines the defect type according to the defect information.

[0096] In summary, the image defect detection device provided by the present application uses the integral image of the 2.5D image of the target object for detection, and obtains the maximum value difference of the pixel average value in the comparison area. When the maximum value difference is greater than the preset threshold, it can be determined that the grayscale change between the detection area and the comparison area is large in the comparison area, so that the detection area can be determined as a defective area. Through the above method, the maximum value difference of the average pixel characterizes the severity of the grayscale change. The grayscale difference between the detection area and the comparison area in the integral image is used to determine whether there is a defect in the detection area, and the defect type in the defect area is determined based on the defect information in the defect area, so that the defects in the image can be accurately determined, thereby improving the accuracy in the battery detection process.

[0097] In one embodiment, the third determination module includes: a first determination unit and a second determination unit.

[0098] The first determination unit is used to obtain the defect area and the gray value of the defect in the defect area. If the defect area is smaller than a preset area threshold and the gray value is smaller than a preset gray threshold, according to the first detection requirement obtained in advance, the defect is a slight defect, wherein the slight defect indicates that the defect does not affect the normal use of the target object.

[0099] The second determining unit is used to determine, based on a pre-acquired second detection requirement, that the defect is a severe defect, and the severe defect indicates that the defect can affect normal use of the target object.

[0100] In one embodiment, the second determination module includes: a calculation unit.

[0101] The computing unit is configured as:

[0102]

[0103] in,I ( r,c ) is the pixel value corresponding to any grid in the integral image, average ( r,c ) is the pixel average value of any of the grids in the integral image, and the size of the grid is ( w,h ), w is the width of the grid, h The height of the grid.

[0104] In one embodiment, the construction module includes: a third determining unit and an acquiring unit.

[0105] A third determining unit, configured to determine a main body area image of the target object in the 2.5D image of the target object;

[0106] An acquisition unit is used to acquire the integral image according to the main body area image.

[0107] In one embodiment, the acquisition unit in the construction module is specifically configured as follows:

[0108]

[0109] in, Intergral ( r,c ) is the integral image, I ( i,j ) is the pixel value at any position in the main area image, and the size of the main area image is ( R,C ).

[0110] In one embodiment, the third determining unit in the construction module includes: a first obtaining subunit, a second obtaining subunit, and a third obtaining subunit.

[0111] A first acquisition subunit is used to acquire a plurality of measurement blocks along the main body edge of the target object in the 2.5D image;

[0112] A second acquisition subunit is used to acquire edge points about the target object in each of the measurement blocks, and to fit all the edge points to obtain a straight line equation or a circle equation;

[0113] The third acquisition subunit is used to acquire a main area image of the target object based on the straight line equation or the circle equation.

[0114] In one embodiment, the construction module includes: a first determining subunit and a construction subunit.

[0115] A first determining subunit is used to obtain a preliminary size of the defect based on the 2.5D image, and determine a grid size according to the preliminary size, wherein the grid size is larger than the size of the defect;

[0116] A construction subunit is used to construct a plurality of the grids in the integral image based on the grid size.

[0117] In summary, the detection area, contrast area and comparison area are obtained by constructing a grid in the integral image, and the pixel averages of the detection area and the comparison area are quickly obtained by using the integral image. The defect area is determined according to the difference between the maximum values ​​of the pixel averages in the comparison area, and the type of defect is determined according to the defect information in the defect area. Through the above method, the detected defects can be classified and processed. For different types of defects, it is determined whether the defect has an impact on the use and storage of the target object based on the defect information. Different detection standards are defined according to different types of defects, and a large number of defects in the image can be accurately determined. The defects can be qualitatively and quantitatively analyzed, avoiding the problems of missed detection and wrong detection caused by inconsistent detection standards and fatigue in manual visual inspection, thereby improving the accuracy of detecting target objects.

[0118] It should be noted that the image defect detection device provided in this embodiment is used to implement the above-mentioned implementation mode, and the descriptions that have been made will not be repeated. As used above, the terms "module", "unit", "subunit", etc. can implement a combination of software and / or hardware for a predetermined function. Although the device described in the above embodiment is preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.

[0119] In a third aspect, an embodiment of the present application provides an electronic device, Fig. 9 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment. Fig. 9 As shown, the electronic device may include a processor 81 and a memory 82 storing computer program instructions.

[0120] Specifically, the processor 81 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.

[0121] Among them, the memory 82 may include a large-capacity memory for data or instructions. By way of example and not limitation, the memory 82 may include a hard disk drive (HDD), a floppy disk drive, a solid-state drive (SSD), a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive, or a combination of two or more of these. Where appropriate, the memory 82 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 82 may be inside or outside the data processing device. In a specific embodiment, the memory 82 is a non-volatile memory. In a specific embodiment, the memory 82 includes a read-only memory (ROM) and a random access memory (RAM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically alterable ROM (EAROM) or a flash memory (FLASH), or a combination of two or more of these. Under appropriate circumstances, the RAM can be a static random access memory (SRAM) or a dynamic random access memory (DRAM), wherein the DRAM can be a fast page mode dynamic random access memory (FPMDRAM), an extended data output dynamic random access memory (EDODRAM), a synchronous dynamic random access memory (SDRAM), etc.

[0122] The memory 82 may be used to store or cache various data files required for processing and / or communication, as well as possible computer program instructions executed by the processor 81 .

[0123] The processor 81 implements any one of the image defect detection methods in the above embodiments by reading and executing computer program instructions stored in the memory 82 .

[0124] In one embodiment, the image defect detection device may further include a communication interface 83 and a bus 80. Fig. 9 As shown, the processor 81, the memory 82, and the communication interface 83 are connected via a bus 80 and communicate with each other.

[0125] The communication interface 83 is used to implement communication between the modules, devices, units and / or equipment in the embodiment of the present application. The communication port 83 can also implement data communication with other components such as: external devices, image / data acquisition equipment, databases, external storage, and image / data processing workstations.

[0126] The bus 80 includes hardware, software or both, and couples the components of the image defect detection device to each other. The bus 80 includes but is not limited to at least one of the following: a data bus, an address bus, a control bus, an expansion bus, and a local bus. By way of example and not limitation, bus 80 may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an InfiniBand interconnect, a Low Pin Count (LPC) bus, a memory bus, a Micro Channel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses or a combination of two or more of these. Where appropriate, bus 80 may include one or more buses. Although embodiments of the present application describe and illustrate a particular bus, the present application contemplates any suitable bus or interconnect.

[0127] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a program stored thereon, and when the program is executed by a processor, the image defect detection method provided in the first aspect is implemented.

[0128] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.

[0129] In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps of the image defect detection method provided in the first aspect.

[0130] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on a user device, partially on a user device, as an independent software package, partially on a user device and partially on a remote device, or entirely on a remote device.

[0131] The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0132] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.

Claims

1. An image defect detection method, characterized in that: include: A main body region image of the target object is determined in the 2.5D image of the target object, an integral image of the 2.5D image of the target object is acquired according to the main body region image, and a plurality of grids are constructed in the integral image, wherein the integral image satisfies the following formula: in, Intergral ( r,c ) is the integral image, I ( i,j ) is the pixel value at any position in the main area image, and the size of the main area image is ( R,C ); Taking any of the grids as a detection area, slidingly traversing the integral image, taking the detection area and adjacent grids distributed in a set manner to form a comparison area, and obtaining a plurality of the comparison areas through the traversal; In any of the comparison areas, the pixel average value of each grid including the detection area is obtained, and the maximum pixel average value and the minimum pixel average value are determined, wherein the pixel average value of each grid including the detection area is specifically configured as follows: in, I ( r,c ) is the pixel value corresponding to any grid in the integral image, average ( r,c ) is the pixel average value of any of the grids in the integral image, and the size of the grid is ( w,h ), w is the width of the grid, h is the height of the grid; If the difference between the maximum pixel average value and the minimum pixel average value is greater than a preset threshold, obtaining the central pixel of the detection area; A defect area and defect information of the defect area are acquired according to all the central pixels, and a defect type is determined according to the defect information.

2. The image defect detection method according to claim 1, characterized in that: The acquiring defect information of the defect area and determining the defect type according to the defect information includes: Acquire a defect area and a gray value of the defect in the defect region, and if the defect area is smaller than a preset area threshold and the gray value is smaller than a preset gray threshold, the defect is a slight defect according to the first detection requirement acquired in advance, wherein the slight defect indicates that the defect does not affect normal use of the target object; According to the pre-acquired second detection requirement, the defect is a severe defect, and the severe defect indicates that the defect can affect the normal use of the target object.

3. The image defect detection method according to claim 1, characterized in that: Determining a main body area image of the target object in the 2.5D image of the target object includes: In the 2.5D image, acquiring a plurality of measurement blocks along the main edge of the target object; Obtain edge points about the target object in each of the measurement blocks, and fit all of the edge points to obtain a straight line equation or a circle equation; Based on the straight line equation or the circle equation, a main body area image of the target object is acquired.

4. The image defect detection method according to claim 1, characterized in that: The step of constructing a plurality of grids in the integral image comprises: Based on the 2.5D image, obtaining a preliminary size of the defect, and determining a grid size according to the preliminary size, wherein the grid size is larger than a size of the defect; Based on the grid size, a plurality of the grids are constructed in the integral image.

5. An image defect detection device, characterized in that: include: A construction module is used to determine a main body area image of the target object in the 2.5D image of the target object, obtain an integral image of the 2.5D image of the target object according to the main body area image, and construct a plurality of grids in the integral image, wherein the integral image satisfies the following formula: in, Intergral ( r,c ) is the integral image, I ( i,j ) is the pixel value at any position in the main area image, and the size of the main area image is ( R,C ); An acquisition module, configured to slide and traverse the integral image with any of the grids as a detection area, form a comparison area with the detection area and adjacent grids distributed in a set manner, and acquire a plurality of the comparison areas through the traversal; The first determination module is used to obtain the pixel average value of each grid including the detection area in any of the comparison areas, and determine the maximum pixel average value and the minimum pixel average value, wherein the specific configuration of obtaining the pixel average value of each grid including the detection area is: in, I ( r,c ) is the pixel value corresponding to any grid in the integral image, average ( r,c ) is the pixel average value of any of the grids in the integral image, and the size of the grid is ( w,h ), w is the width of the grid, h is the height of the grid; A second determination module, configured to obtain a central pixel of the detection area if a difference between the maximum pixel average value and the minimum pixel average value is greater than a preset threshold; The third determination module is used to obtain a defect area and defect information of the defect area according to all the central pixels, and determine the defect type according to the defect information.

6. An electronic device, characterized in that: The invention comprises a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the image defect detection method according to any one of claims 1 to 4 when executing the computer program.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the image defect detection method according to any one of claims 1 to 4 is implemented.

Citation Information

Patent Citations

  • Method and device for detecting defects

    CN108230321A

  • Workpiece defect detection method and system and computer readable storage medium

    CN112669460A