Automobile body welding defect recognition method and system based on machine vision
Patent Information
- Application Number
- CN202611033789.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-13
- Publication Date
- 2026-10-23
AI Technical Summary
[0003]在现有技术中,在对汽车车身焊接瑕疵进行瑕疵检测时,往往是通过对焊接部位的表面进行检视,例如在公开号为CN120782759A的申请文件中,公开了基于图像处理的焊接瑕疵智能定位检测系统,该方法对根据自适应标准差对焊接图像进行去噪,将去噪后的焊接图像进行图像增强,获得待检测图像;对待检测图像进行焊接瑕疵的检测;该方法没有对焊缝内部进行检查,可能会出现焊缝内有气泡但未出现在焊缝表面导致检测不全面的问题
[0014]本发明的有益效果:本发明首先通过对待检测区域进行射线探照获取待检测区域的射线探照图,设置为待检测图,对标准焊接区域进行射线探照获取标准焊接区域的射线探照图,设置为标准图;通过使用射线探照,保证获取到的检测数据具有全面性;
Smart Images

Figure CN122966541A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of defect detection technology, specifically to a machine vision-based method and system for identifying welding defects in automotive bodies. Background Technology
[0002] In automobile body manufacturing, welding is a core process in the production of the body-in-white. Its quality directly affects the structural strength and safety of the vehicle body, making it the most critical connection process. The quality of body welding directly determines the structural strength, crash safety, and fatigue life of the entire vehicle. Any welding defect can become a stress concentration point, inducing early failure under alternating loads. Therefore, ensuring the quality of body welding is a crucial step in automobile manufacturing, which urgently necessitates online detection and accurate evaluation of welding quality.
[0003] In existing technologies, when detecting welding defects in automobile bodies, the surface of the welded area is often inspected. For example, in application CN120782759A, an intelligent positioning and detection system for welding defects based on image processing is disclosed. This method denoises the welding image according to adaptive standard deviation, enhances the denoised welding image to obtain the image to be detected, and then detects welding defects in the image to be detected. However, this method does not inspect the inside of the weld, which may result in incomplete detection because air bubbles inside the weld may not appear on the weld surface. Summary of the Invention
[0004] This invention aims to at least partially solve one of the technical problems in the prior art. By using X-ray inspection to obtain an image to be inspected, and then dividing the image into sections, the defect areas of the image to be inspected are determined by comparing the pixel values of different regions. This solves the problem in the prior art that the inspection of welding defects in automobile bodies lacks inspection of the inside of the weld, resulting in incomplete inspection.
[0005] To achieve the above objectives, in a first aspect, this application provides a machine vision-based method for identifying welding defects in automotive bodies, comprising the following steps: Radiographic testing is performed on the area to be inspected to obtain a radiographic image of the area to be inspected, which is then set as the image to be inspected. Radiographic testing is performed on the standard welding area to obtain a radiographic image of the standard welding area, which is then set as the standard image. The image to be detected and the standard image are divided into blocks to obtain multiple target blocks; Differences are extracted from the target blocks of the standard welding area to obtain the standard differences; differences are extracted from the target blocks of the image to be inspected to obtain the differences to be inspected. Based on the standard differences, the differences to be detected are eliminated to obtain the defective areas; The defective areas are marked on the image to be inspected to obtain the welding defect image.
[0006] Furthermore, the step of dividing the image to be detected and the standard image into blocks to obtain multiple target blocks includes the following sub-steps: Using the first distance as an interval, draw multiple equally spaced boundary lines starting from the left edges of the image to be detected and the standard image, resulting in multiple blocks with a width of the first distance and a height equal to that of the image to be detected and the standard image, which are then set as image blocks; For any image block, obtain the average pixel value of all pixels in the image block and set it as the first pixel value; obtain the minimum pixel value of all pixels in the image block and set it as the second pixel value. Get the first and second pixel values of all image blocks, set the mode of the first pixel value to the first mode, and set the mode of the second pixel value to the second mode; For any image block, if the first pixel value is equal to the first mode, then the image block is set as a solder plate block. When the first pixel value of an image block is not equal to the first mode and the second pixel value is equal to the second mode, the image block is set as a boundary block; When the first pixel value of the image block is not equal to the first mode and the second pixel value is not equal to the second mode, the image block is set as a welding block; The boundary blocks and welding blocks are collectively referred to as the target blocks.
[0007] Further, the step of extracting differences from the target blocks of the standard welding area to obtain standard differences, and extracting differences from the target blocks of the image to be inspected to obtain the differences to be inspected, includes the following sub-steps: Obtain the boundary block from the target block, remove the welded block from the boundary block, and obtain the valid boundary block; Obtain the welding blocks and valid blocks of all standard welding areas, set them as standard blocks, perform symmetry analysis on the standard blocks, and obtain the standard symmetry ratio; Obtain all welded blocks and valid blocks in the area to be inspected, set them as blocks to be inspected, perform symmetry analysis on the blocks to be inspected, and obtain the symmetry ratio of the blocks to be inspected. Obtain the average pixel value of the standard block to get the standard average value; obtain the average pixel value of the block to be detected to get the detection average value. The standard symmetry ratio and the standard average value are collectively referred to as the standard difference, and the symmetry ratio to be detected and the average value to be detected are collectively referred to as the difference to be detected.
[0008] Furthermore, the step of obtaining the boundary block from the target block, removing the soldering block from the boundary block, and obtaining the valid boundary block includes the following sub-steps: Get the pixel values of the pixels in the boundary block, mark all pixels in the boundary block whose pixel values are equal to the second mode as solder plate areas, and mark all pixels in the boundary block whose pixel values are not equal to the second mode as non-solder plate areas. Obtain the boundary line between the welded plate area and the non-welded area, and set it as the dividing line; When there is one and only one dividing line in the boundary block, the non-soldering board area is set as a valid block; When there are multiple dividing lines in the boundary area, the area to be detected is marked as a defective area.
[0009] Furthermore, the symmetry analysis includes: for any valid block, dividing each row of pixels in the valid block, setting the left half of the pixels as the left half of the pixels, and setting the right half of the pixels as the right half of the pixels. Get all the left half pixels to get the left half block, and get all the right half pixels to get the right half block; Substitute the pixel values of the pixels in the left half of the block into the pixel standard deviation formula to obtain the pixel standard deviation of the left half of the block. Substitute the pixel values of the pixels in the right half of the block into the pixel standard deviation formula to obtain the pixel standard deviation of the right half of the block. The formula for the pixel standard deviation is: Where S is the pixel standard deviation, n is the number of pixels in the block, p0 is the average pixel value of the pixels in the block, and pn is the pixel value of the nth pixel. Set the ratio of the pixel standard deviation of the left half block to the pixel standard deviation of the right half block to a symmetrical ratio.
[0010] Furthermore, the step of eliminating differences based on standard differences to obtain defective regions includes the following sub-steps: Obtain a first number of standard differences, establish a symmetrical ratio interval and a standard mean interval, wherein the minimum value of the symmetrical ratio interval is the minimum value of the standard symmetrical ratio among the first number of standard differences, and the maximum value of the symmetrical ratio interval is the maximum value of the standard symmetrical ratio among the first number of standard differences; wherein the minimum value of the standard mean interval is the minimum value of the standard mean among the first number of standard differences, and the maximum value of the standard mean interval is the maximum value of the standard mean among the first number of standard differences. Determine whether the symmetry ratio to be detected is within the symmetry ratio range; When the symmetry ratio to be detected is not within the symmetry ratio range, the area to be detected is marked as a defective area; when the symmetry ratio to be detected is within the symmetry ratio range, it is determined whether the average value to be detected is within the standard average range. When the average value of the area to be tested is not within the standard average range, the area to be tested is marked as a defective area; when the average value of the area to be tested is within the standard average range, the area to be tested is marked as a defect-free area.
[0011] Secondly, the present invention also provides a machine vision-based automotive body welding defect recognition system. The system includes an image acquisition module, a block extraction module, a feature extraction module, and a defect marking module. The image acquisition module is used to perform X-ray inspection on the area to be inspected to obtain a X-ray inspection image of the area to be inspected, which is set as the inspection image. The system also performs X-ray inspection on a standard welding area to obtain a X-ray inspection image of the standard welding area, which is set as the standard image. The block extraction module is used to divide the image to be detected and the standard image into blocks to obtain multiple target blocks; The feature extraction module is used to extract differences from target blocks in the standard welding area to obtain standard differences; and to extract differences from target blocks in the image to be detected to obtain differences to be detected. The defect marking module eliminates differences based on standard differences to obtain defect areas, and marks the defect areas in the image to be inspected to obtain a welding defect image.
[0012] Thirdly, this application provides an electronic device including a processor and a memory, the memory storing computer-readable instructions, which, when executed by the processor, perform the steps of the method described above.
[0013] Fourthly, this application provides a storage medium having a computer program stored thereon, which, when executed by a processor, performs the steps of the method described above.
[0014] The beneficial effects of this invention are as follows: First, the invention obtains a radiographic image of the area to be inspected by radiographic testing, which is set as the inspection image. Then, a radiographic image of the standard welding area is obtained by radiographic testing, which is set as the standard image. By using radiographic testing, the comprehensiveness of the obtained inspection data is ensured. The present invention also obtains multiple target blocks by dividing the image to be detected and the standard image into blocks; by dividing the image to be detected and the standard image into blocks, different detections are performed on different blocks to improve the accuracy of detection. Attached Figure Description
[0015] Figure 1 This is a flowchart illustrating the steps of the method of the present invention; Figure 2 This is a schematic diagram of the block division of the present invention; Figure 3 This is a schematic diagram of the system of the present invention; Figure 4 This is a schematic diagram of the electronic device of the present invention. Detailed Implementation
[0016] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0017] Example 1, please refer to Figure 1 As shown, this application provides a machine vision-based method for identifying welding defects in automotive bodies, including the following steps: S1: Radiographic testing is performed on the area to be inspected to obtain a radiographic image of the area to be inspected, which is set as the image to be inspected. Radiographic testing is performed on the standard welding area to obtain a radiographic image of the standard welding area, which is set as the standard image. In the specific implementation process, multiple areas to be inspected are obtained by dividing the entire weld seam. Each area to be inspected contains only one section of weld seam to avoid misjudgment due to too many weld seams in the same area. S2: Divide the image to be detected and the standard image into blocks to obtain multiple target blocks; Please see Figure 2 As shown, step S2 includes the following sub-steps: S201: Using the first distance as the interval, draw multiple equally spaced boundary lines starting from the left edges of the image to be inspected and the standard image, to obtain multiple blocks with a width of the first distance and a height equal to the width of the image to be inspected and the standard image, and set them as image blocks; In specific implementation, the first distance is the minimum spacing between two welding plates. For example, if the minimum spacing between two welding plates in one welding process is 2mm, then the first distance is 2mm; S202: For any image block, obtain the average value of all pixels in the image block and set it as the first pixel value; obtain the minimum value of all pixels in the image block and set it as the second pixel value. S203: Obtain the first pixel value and the second pixel value of all image blocks, set the mode of the first pixel value to the first mode, and set the mode of the second pixel value to the second mode; S204: For any image block, when the first pixel value of the image block is equal to the first mode, the image block is set as the welding plate block; In the specific implementation process, since the density of the welding material and the welding plate are different, and the density of the welding plate is much higher than that of the welding material, after X-ray inspection, the pixel value of the welding plate area is significantly smaller than that of the welding area, and the area of the welding plate is much larger than that of the welding area. Therefore, the first mode is the average pixel value of the welding plate, and the second mode is the pixel value of the welding plate. When the first pixel value of an image block is not equal to the first mode and the second pixel value is equal to the second mode, the image block is set as a boundary block. In the specific implementation, since the first mode is the average pixel value of the welding plate and the second mode is the pixel value of the welding plate, when a region has the pixel value of the welding plate but the average pixel value of the region is not the average pixel value of the welding plate, the region is the boundary between the welding plate and the weld. When the first pixel value of the image block is not equal to the first mode and the second pixel value is not equal to the second mode, the image block is set as a welding block; The boundary block and the welded block are collectively referred to as the target block.
[0018] S3: Extract differences from the target blocks of the standard welding area to obtain the standard differences; extract differences from the target blocks of the image to be inspected to obtain the differences to be inspected; Step S3 includes the following sub-steps: S301: Obtain the boundary block from the target block, remove the welded plate block from the boundary block, and obtain the valid boundary block; Step S301 includes the following sub-steps: Step S30101: Obtain the pixel values of the pixels in the boundary block, mark all pixels in the boundary block whose pixel values are equal to the second mode as soldering plate areas, and mark all pixels in the boundary block whose pixel values are not equal to the second mode as non-soldering plate areas. Step S30102: Obtain the boundary line between the soldering plate area and the non-soldering area, and set it as the dividing line; Step S30103: When there is one and only one dividing line in the boundary block, set the non-soldering board area as a valid block; When there are multiple dividing lines in the boundary area, the area to be inspected is marked as a defect area. In the actual implementation process, when the weld edge is regular, there is only one boundary line. When the weld edge is irregular or the weld edge has undercut, multiple boundary lines will appear.
[0019] S302: Obtain the welding blocks and valid blocks of all standard welding areas, set them as standard blocks, perform symmetry analysis on the standard blocks, and obtain the standard symmetry ratio; S303: Obtain all welding blocks and valid blocks in the area to be inspected, set them as blocks to be inspected, perform symmetry analysis on the blocks to be inspected, and obtain the symmetry ratio of the blocks to be inspected; the symmetry analysis includes: for any valid block, divide each row of pixels in the valid block, set the left half of the pixels as the left half of the pixels, and set the right half of the pixels as the right half of the pixels. In the specific implementation process, when there is an odd number of pixels in the same row, the middle pixel is recorded as both the left half of the pixels and the right half of the pixels. Get all the left half pixels to get the left half block, and get all the right half pixels to get the right half block; Substitute the pixel values of the pixels in the left half of the block into the pixel standard deviation formula to obtain the pixel standard deviation of the left half of the block. Substitute the pixel values of the pixels in the right half of the block into the pixel standard deviation formula to obtain the pixel standard deviation of the right half of the block. The formula for pixel standard deviation is: Where S is the pixel standard deviation, n is the number of pixels in the block, p0 is the average pixel value of the pixels in the block, and pn is the pixel value of the nth pixel; in specific implementation, for example, if 10 pixels are obtained, with pixel values of 201, 200, 209, 212, 210, 198, 204, 196, 208 and 204 respectively, then the calculated pixel standard deviation is 26.6; The ratio of the pixel standard deviation of the left half block to the pixel standard deviation of the right half block is set as the symmetry ratio. In the specific implementation process, for example, if the pixel standard deviation of the left half block is 26.6 and the pixel standard deviation of the right half block is 26, then the symmetry ratio is calculated to be 1.02. S304: Obtain the average pixel value of the standard block to obtain the standard average value; obtain the average pixel value of the block to be detected to obtain the detection average value. S305: The standard symmetry ratio and the standard mean are collectively referred to as the standard difference, and the symmetry ratio to be detected and the mean to be detected are collectively referred to as the difference to be detected.
[0020] S4: Based on the standard difference, the difference to be detected is eliminated to obtain the defect area; Step S4 includes the following sub-steps: S401: Obtain the first number of standard differences, establish a symmetrical ratio interval and a standard mean interval. The minimum value of the symmetrical ratio interval is the minimum value of the standard symmetrical ratios in the first number of standard differences, and the maximum value of the symmetrical ratio interval is the maximum value of the standard symmetrical ratios in the first number of standard differences. The minimum value of the standard mean interval is the minimum value of the standard mean in the first number of standard differences, and the maximum value of the standard mean interval is the maximum value of the standard mean in the first number of standard differences. S402: Determine whether the symmetry ratio to be detected is within the symmetry ratio range; When the symmetry ratio to be detected is not within the symmetry ratio range, the area to be detected is marked as a defective area; when the symmetry ratio to be detected is within the symmetry ratio range, it is determined whether the average value to be detected is within the standard average range. When the average value of the area to be tested is not within the standard average range, the area to be tested is marked as a defective area; when the average value of the area to be tested is within the standard average range, the area to be tested is marked as a defect-free area.
[0021] S5: Mark the defective areas on the image to be inspected to obtain the welding defect image.
[0022] Example 2, please refer to Figure 3 As shown, this application also provides a machine vision-based automotive body welding defect recognition system, including an image acquisition module, a block extraction module, a feature extraction module, and a defect marking module. The image acquisition module is used to perform X-ray inspection on the area to be inspected to obtain the X-ray inspection image of the area to be inspected, and set it as the inspection image. The module also performs X-ray inspection on the standard welding area to obtain the X-ray inspection image of the standard welding area, and sets it as the standard image. The block extraction module is used to divide the image to be detected and the standard image into blocks, resulting in multiple target blocks. The block extraction module is configured with a block extraction strategy, which includes drawing multiple equally spaced boundary lines with a first distance as the interval and starting from the left edge of the image to be detected and the standard image, resulting in multiple blocks with a width equal to the first distance and a height equal to the width of the image to be detected and the standard image, which are then set as image blocks. For any image block, the average pixel value of all pixels in that image block is obtained and set as the first pixel value; the minimum pixel value of all pixels in that image block is obtained and set as the second pixel value; the first pixel value and the second pixel value of all image blocks are obtained, and the mode of the first pixel value is set as the first mode, and the mode of the second pixel value is set as the second mode. For any image block, if the first pixel value is equal to the first mode, then the image block is set as a solder plate block. When the first pixel value of an image block is not equal to the first mode and the second pixel value is equal to the second mode, the image block is set as a boundary block; when the first pixel value of an image block is not equal to the first mode and the second pixel value is not equal to the second mode, the image block is set as a weld block; boundary blocks and weld blocks are collectively referred to as target blocks; The feature extraction module is used to extract differences from the target blocks of the standard welding area to obtain standard differences; and to extract differences from the target blocks of the image to be detected to obtain the differences to be detected. The feature extraction module is configured with a feature extraction strategy, which includes: obtaining the pixel values of the pixels in the boundary blocks, marking all pixels in the boundary blocks with pixel values equal to the second mode as welding plate areas, and marking all pixels in the boundary blocks with pixel values not equal to the second mode as non-welding plate areas. Obtain the boundary line between the welded plate area and the non-welded area, and set it as the dividing line; When there is one and only one dividing line in the boundary block, the non-soldering board area is set as a valid block; When there are multiple dividing lines in the boundary area, the area to be detected is marked as a defective area; Obtain the welding blocks and valid blocks of all standard welding areas, set them as standard blocks, and perform symmetry analysis on the standard blocks to obtain the standard symmetry ratio; obtain the welding blocks and valid blocks of all areas to be inspected, set them as areas to be inspected, and perform symmetry analysis on the areas to be inspected to obtain the symmetry ratio of the areas to be inspected. Symmetry analysis includes: for any valid block, dividing each row of pixels in the valid block, setting the left half of the pixels as the left half of the pixels, and setting the right half of the pixels as the right half of the pixels. Get all the left half pixels to get the left half block, and get all the right half pixels to get the right half block; Substitute the pixel values of the pixels in the left half of the block into the pixel standard deviation formula to obtain the pixel standard deviation of the left half of the block. Substitute the pixel values of the pixels in the right half of the block into the pixel standard deviation formula to obtain the pixel standard deviation of the right half of the block. The formula for pixel standard deviation is: Where S is the pixel standard deviation, n is the number of pixels in the block, p0 is the average pixel value of the pixels in the block, and pn is the pixel value of the nth pixel. Set the ratio of the pixel standard deviation of the left half block to the pixel standard deviation of the right half block as a symmetrical ratio. Obtain the average pixel value of the standard block to get the standard average value; obtain the average pixel value of the block to be detected to get the detection average value. The standard symmetry ratio and the standard mean are collectively referred to as the standard difference, while the symmetry ratio to be detected and the mean to be detected are collectively referred to as the difference to be detected.
[0023] The defect marking module performs difference elimination based on standard differences to identify defective areas. These defective areas are then marked on the image to be inspected, resulting in a welding defect image. The defect marking module is configured with defect marking strategies, including: Obtain a first number of standard differences, establish symmetrical ratio intervals and standard mean intervals. The minimum value of the symmetrical ratio interval is the minimum value of the standard symmetrical ratios in the first number of standard differences, and the maximum value of the symmetrical ratio interval is the maximum value of the standard symmetrical ratios in the first number of standard differences. Similarly, the minimum value of the standard mean interval is the minimum value of the standard mean in the first number of standard differences, and the maximum value of the standard mean interval is the maximum value of the standard mean in the first number of standard differences. Determine whether the symmetry ratio to be detected is within the symmetry ratio range; When the symmetry ratio to be detected is not within the symmetry ratio range, the area to be detected is marked as a defective area; when the symmetry ratio to be detected is within the symmetry ratio range, it is determined whether the average value to be detected is within the standard average range. When the average value of the area to be tested is not within the standard average range, the area to be tested is marked as a defective area; when the average value of the area to be tested is within the standard average range, the area to be tested is marked as a defect-free area.
[0024] Example 3, please refer to Figure 4 As shown, Figure 4 A schematic diagram of an electronic device is provided, which may include a processor, a communication interface, a memory, and a communication bus. The processor, communication interface, and memory communicate with each other via the communication bus. The memory stores computer-readable instructions, and the processor can call these instructions. When the processor executes a computer-readable instruction, it performs steps such as those in a machine vision-based automotive body welding defect recognition method to achieve the following functions: X-ray imaging is applied to the area to be inspected to obtain a X-ray image of the area to be inspected, which is set as the inspection image; X-ray imaging is applied to a standard welding area to obtain a X-ray image of the standard welding area, which is set as the standard image; the inspection image and the standard image are divided into blocks to obtain multiple target blocks; differences are extracted from the target blocks of the standard welding area to obtain standard differences; differences are extracted from the target blocks of the inspection image to obtain the inspection differences; based on the standard differences, the inspection differences are excluded to obtain defect areas; and the defect areas are marked on the inspection image to obtain a welding defect image.
[0025] Furthermore, when the logical instructions in the aforementioned memory can be implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0026] Example 4: This application also provides a computer program product, which includes a computer program stored on a computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the machine vision-based automotive body welding defect recognition method provided by the above methods. The method includes: performing X-ray probing on the area to be detected to obtain a X-ray probing image of the area to be detected, setting it as the image to be detected; performing X-ray probing on a standard welding area to obtain a X-ray probing image of the standard welding area, setting it as a standard image; dividing the image to be detected and the standard image into blocks to obtain multiple target blocks; extracting differences from the target blocks of the standard welding area to obtain standard differences; extracting differences from the target blocks of the image to be detected to obtain differences to be detected; excluding differences from differences to be detected based on standard differences to obtain defect areas; and marking the defect areas in the image to be detected to obtain a welding defect image.
[0027] Example 5: This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, it performs the steps of the above-described machine vision-based automotive body welding defect recognition method to achieve the following functions: X-ray imaging is applied to the area to be inspected to obtain a X-ray image of the area to be inspected, which is set as the image to be inspected; X-ray imaging is applied to a standard welding area to obtain a X-ray image of the standard welding area, which is set as a standard image; the image to be inspected and the standard image are divided into blocks to obtain multiple target blocks; differences are extracted from the target blocks of the standard welding area to obtain standard differences; differences are extracted from the target blocks of the image to be inspected to obtain differences to be inspected; differences are excluded based on the standard differences to obtain defect areas; and the defect areas are marked on the image to be inspected to obtain a welding defect image.
[0028] Based on the above description of the embodiments, the embodiments of the present invention can be provided as methods, systems, or computer program products. Based on this understanding, the above technical solutions, in essence or in terms of their contribution to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or certain parts of the embodiments.
[0029] In the embodiments provided in this application, it should be understood that the disclosed system or method can be implemented in other ways. The embodiments described above are merely illustrative. For example, the division of modules or units is only a logical functional division, and there may be other division methods in actual implementation. Furthermore, multiple modules or units may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the coupling or direct coupling or communication connection shown or discussed may be through some communication interfaces. The indirect coupling or communication connection between systems, modules, and units may be electrical, mechanical, or other forms.
[0030] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.
Claims
1. A machine vision-based method for identifying welding defects in automobile bodies, characterized in that, Includes the following steps: Radiographic testing is performed on the area to be inspected to obtain a radiographic image of the area to be inspected, which is then set as the image to be inspected. Radiographic testing is performed on the standard welding area to obtain a radiographic image of the standard welding area, which is then set as the standard image. The image to be detected and the standard image are divided into blocks to obtain multiple target blocks; Differences are extracted from the target blocks of the standard welding area to obtain the standard differences; differences are extracted from the target blocks of the image to be inspected to obtain the differences to be inspected. Based on the standard differences, the differences to be detected are eliminated to obtain the defective areas; The defective areas are marked on the image to be inspected to obtain the welding defect image.
2. The method for identifying welding defects in automobile bodies based on machine vision according to claim 1, characterized in that, The step of dividing the image to be detected and the standard image into blocks to obtain multiple target blocks includes the following sub-steps: Using the first distance as an interval, draw multiple equally spaced boundary lines starting from the left edges of the image to be detected and the standard image, resulting in multiple blocks with a width of the first distance and a height equal to that of the image to be detected and the standard image, which are then set as image blocks; For any image block, obtain the average pixel value of all pixels in the image block and set it as the first pixel value; obtain the minimum pixel value of all pixels in the image block and set it as the second pixel value. Get the first and second pixel values of all image blocks, set the mode of the first pixel value to the first mode, and set the mode of the second pixel value to the second mode; For any image block, if the first pixel value is equal to the first mode, then the image block is set as a solder plate block. When the first pixel value of an image block is not equal to the first mode and the second pixel value is equal to the second mode, the image block is set as a boundary block; When the first pixel value of the image block is not equal to the first mode and the second pixel value is not equal to the second mode, the image block is set as a welding block; The boundary blocks and welding blocks are collectively referred to as the target blocks.
3. The method for identifying welding defects in automobile bodies based on machine vision according to claim 2, characterized in that, The process of extracting differences from target blocks in the standard welding area to obtain standard differences, and extracting differences from target blocks in the image to be inspected to obtain differences to be inspected, includes the following sub-steps: Obtain the boundary block from the target block, remove the welded block from the boundary block, and obtain the valid boundary block; Obtain the welding blocks and valid blocks of all standard welding areas, set them as standard blocks, perform symmetry analysis on the standard blocks, and obtain the standard symmetry ratio; Obtain all welded blocks and valid blocks in the area to be inspected, set them as blocks to be inspected, perform symmetry analysis on the blocks to be inspected, and obtain the symmetry ratio of the blocks to be inspected. Obtain the average pixel value of the standard block to get the standard average value; obtain the average pixel value of the block to be detected to get the detection average value. The standard symmetry ratio and the standard average value are collectively referred to as the standard difference, and the symmetry ratio to be detected and the average value to be detected are collectively referred to as the difference to be detected.
4. The method for identifying welding defects in automobile bodies based on machine vision according to claim 3, characterized in that, The step of obtaining the boundary block from the target block, removing the soldering block from the boundary block, and obtaining the valid boundary block includes the following sub-steps: Get the pixel values of the pixels in the boundary block, mark all pixels in the boundary block whose pixel values are equal to the second mode as solder plate areas, and mark all pixels in the boundary block whose pixel values are not equal to the second mode as non-solder plate areas. Obtain the boundary line between the welded plate area and the non-welded area, and set it as the dividing line; When there is one and only one dividing line in the boundary block, the non-soldering board area is set as a valid block; When there are multiple dividing lines in the boundary area, the area to be detected is marked as a defective area.
5. The machine vision-based method for identifying welding defects in automobile bodies according to claim 4, characterized in that, The symmetry analysis includes: for any valid block, dividing each row of pixels in the valid block, setting the left half of the pixels as the left half of the pixels, and setting the right half of the pixels as the right half of the pixels. Get all the left half pixels to get the left half block, and get all the right half pixels to get the right half block; Substitute the pixel values of the pixels in the left half of the block into the pixel standard deviation formula to obtain the pixel standard deviation of the left half of the block. Substitute the pixel values of the pixels in the right half of the block into the pixel standard deviation formula to obtain the pixel standard deviation of the right half of the block. The formula for the pixel standard deviation is: Where S is the pixel standard deviation, n is the number of pixels in the block, p0 is the average pixel value of the pixels in the block, and pn is the pixel value of the nth pixel. Set the ratio of the pixel standard deviation of the left half block to the pixel standard deviation of the right half block to a symmetrical ratio.
6. The machine vision-based method for identifying welding defects in automobile bodies according to claim 5, characterized in that, The process of eliminating differences based on standard differences to obtain defective regions includes the following sub-steps: Obtain a first number of standard differences, establish a symmetrical ratio interval and a standard mean interval, wherein the minimum value of the symmetrical ratio interval is the minimum value of the standard symmetrical ratio among the first number of standard differences, and the maximum value of the symmetrical ratio interval is the maximum value of the standard symmetrical ratio among the first number of standard differences; wherein the minimum value of the standard mean interval is the minimum value of the standard mean among the first number of standard differences, and the maximum value of the standard mean interval is the maximum value of the standard mean among the first number of standard differences. Determine whether the symmetry ratio to be detected is within the symmetry ratio range; When the symmetry ratio to be detected is not within the symmetry ratio range, the area to be detected is marked as a defective area; when the symmetry ratio to be detected is within the symmetry ratio range, it is determined whether the average value to be detected is within the standard average range. When the average value of the area to be tested is not within the standard average range, the area to be tested is marked as a defective area; when the average value of the area to be tested is within the standard average range, the area to be tested is marked as a defect-free area.
7. A machine vision-based automotive body welding defect recognition system, used to implement the machine vision-based automotive body welding defect recognition method according to any one of claims 1-6, characterized in that, The system includes an image acquisition module, a block extraction module, a feature extraction module, and a defect marking module. The image acquisition module is used to perform X-ray inspection on the area to be inspected to obtain a X-ray inspection image of the area to be inspected, which is set as the inspection image. The system also performs X-ray inspection on a standard welding area to obtain a X-ray inspection image of the standard welding area, which is set as the standard image. The block extraction module is used to divide the image to be detected and the standard image into blocks to obtain multiple target blocks; The feature extraction module is used to extract differences from target blocks in the standard welding area to obtain standard differences; and to extract differences from target blocks in the image to be detected to obtain differences to be detected. The defect marking module eliminates differences based on standard differences to obtain defect areas, and marks the defect areas in the image to be inspected to obtain a welding defect image.
8. An electronic device, characterized in that, It includes a processor and a memory, the memory storing computer-readable instructions that, when executed by the processor, perform the steps of the method as described in any one of claims 1-7.
9. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it performs the steps of the method as described in any one of claims 1-7.
Citation Information
Patent Citations
Intelligent welding defect positioning and detecting system based on image processing
CN120782759A