X-ray negative film defect 3D highlighting enhancement method based on dynamic compensation and point convolution
Through the method of dynamic compensation and point convolution, defect detection of X-ray films is solved, and the problems of high computational complexity, insufficient adaptability and insufficient defect enhancement in the prior art are solved, and effective enhancement of image features and improvement of detection effects are achieved.
Patent Information
- Application Number
- CN202411576112.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-03-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When detecting defects on X-ray films in the prior art, the calculation complexity is high, the adaptability is insufficient and the defect enhancement is not outstanding, resulting in poor detection results.
The method of dynamic compensation and point convolution is adopted, and the area point multiplication and convolution is performed by setting the convolution kernel, the accumulation process is performed to enhance image characteristics, and the image contrast is adjusted through grayscale offset compensation, and the boundary discrimination and removal process is finally performed to ensure the clear image boundary.
Effectively highlight defect characteristics in the image, improve the clarity and nature of the image, enhance the depth and contrast of the image, and improve the accuracy and reliability of the detection.
Smart Images

Figure CN119648600A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of image processing, and in particular relates to a 3D highlighting and display enhancement method for X-ray film defects using dynamic compensation and point convolution. Background Art
[0002] X-ray films are used for non-destructive testing, especially in welding inspection, where various defects such as pores, slag inclusions, lack of penetration, lack of fusion, cracks, etc. are generated. Detecting these defects is an important process. The existing method for detecting defects on X-ray films is to use a three-dimensional (3D) engraving method, which can help identify and locate defects.
[0003] The document with the publication number "CN116797761A" discloses "A method and system for generating 3D relief". The document with the publication number "CN110517333B" discloses "A method for modeling a dynamic shallow relief model", which distinguishes the background area from the target area by binarizing the input image. The document with the publication number "CN111428368B" discloses "A method for automatic layout of shallow relief based on random optimization algorithm", which provides a method for generating shallow three-dimensional (3D) engraving based on superimposed images. The above engraving method has the following shortcomings: 1. High computational complexity. 2. Depends on the selection of parameters and lacks adaptability. 3. Defect enhancement is not prominent. The existing methods can enhance the details and edge features of the image to a certain extent, but there are problems such as over-enhancement, sensitivity to noise, and edge effects, which limit its effect and reliability in practical applications.
[0004] The document "CN115953370A" discloses "Part Defect Detection Method Based on Point Cloud", which uses a part defect detection method based on point cloud to obtain three-dimensional point cloud data information of the object to be tested; and preprocess the obtained three-dimensional point cloud data information of the object to be tested to remove discrete point clouds from the three-dimensional point cloud data information; calculate the distance value from the point cloud to the template grid, and set a reasonable distance threshold according to the distance value. When a certain distance threshold is exceeded, it is defined as a difference area. Due to the large difference between point cloud images and X-ray images, the original X-ray detection image has the disadvantages of narrow grayscale range, low contrast, and high noise, resulting in unclear defect edges and submerged defect features. Therefore, the point cloud preprocessing method is not applicable to X-ray film defect images. Summary of the invention
[0005] The present invention provides a dynamic compensation and point convolution X-ray film defect 3D highlighting enhancement method to solve the problems of high calculation complexity, insufficient adaptability and non-prominent defect enhancement in the prior art.
[0006] To achieve the above object, the technical solution of the present invention is: a method for 3D highlighting and enhancing X-ray film defects by dynamic compensation and point convolution, comprising the following steps:
[0007] Step 1: Setting the convolution size of the weld seam of industrial radiographic film;
[0008] Step 2: Regional point multiplication convolution processing accumulation: set the convolution kernel, apply it to the local area of each pixel of the image, perform regional point multiplication convolution processing, and accumulate the regional point multiplication convolution processing;
[0009] Step 3: Grayscale offset compensation, adjusting the grayscale value range of the image;
[0010] Step 4: Boundary identification and elimination: perform boundary identification on the negative image, determine the boundary area in the image, and eliminate the invalid area.
[0011] Furthermore, the convolution kernel matrix of the above step 1 is:
[0012]
[0013] Furthermore, in the above step 2, the formula for the regional point multiplication convolution process is:
[0014]
[0015] Among them, f represents the input image, K represents the convolution kernel, ij represents the pixel index in the image, and hw represents the width and height of the image.
[0016] Furthermore, in the above step 2, the formula for the cumulative area point multiplication convolution process is:
[0017]
[0018] Where N is the number of local regions, represents the xth local area.
[0019] Furthermore, in the above step 3, the calculation process of the grayscale offset compensation is:
[0020] First, calculate the average gray value G Meav , the formula is as follows:
[0021]
[0022] Secondly, calculate the difference between each pixel and the grayscale average of the image, the formula is as follows:
[0023]
[0024] Introducing grayscale histogram Taking the number of image statistics as weight, the calculation formula of weighted average deviation is as follows:
[0025]
[0026] in, is the weight coefficient for the number of pixels of each gray value, M*N represents all pixels of the image, x i Indicates the grayscale value of the corresponding coordinate, and the grayscale offset compensation offset is set to:
[0027]
[0028] Among them, w i is the weight of the ith pixel.
[0029] Furthermore, in the above step 3, the grayscale range adjustment formula of the image is as follows:
[0030] f out (x,y)=h(x,y)+offest (8)
[0031] Among them, f out (x, y) represents the final pixel value after grayscale offset compensation, h(x, y) represents the pixel value after regional point multiplication convolution processing, and offest is a constant representing the amount of grayscale offset.
[0032] Furthermore, the formula used for elimination in the above step 4 is:
[0033]
[0034] [f1,f2] is the effective grayscale range of the image.
[0035] Compared with the prior art, the present invention has the following beneficial effects:
[0036] (1) The present invention can purposefully emphasize the visual perception of the weld area of the image, enrich the information content of the image, and make the processed image clearer and more natural. Step 2 uses regional dot convolution to highlight features such as edges and textures in the image, making the image clearer and more three-dimensional; the cumulative processing can superimpose the feature information of different regions together, thereby enhancing the depth of the image. Step 3 creatively uses the grayscale weighted average difference as the offset. This offset calculation method can adaptively adjust the contrast of the image according to the overall grayscale distribution of the image. Grayscale offset compensation calculates the grayscale average of the image and adjusts the grayscale value of the pixel according to the difference between each pixel in the image and the average value to improve the contrast and visual effect of the image.
[0037] (2) The present invention uses boundary discrimination and elimination processing technology to identify edge information in the image, and performs special processing on the pixels at the edge to retain the edge details of the image. During the image processing process, the main body and background of the image can be distinguished more accurately, and the image contour can be kept clear. Therefore, the present invention can effectively highlight the defect information in the X-ray film, help evaluate defects and reduce the missed detection rate, thereby improving the accuracy and reliability of X-ray film detection and making defect analysis easier. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a block diagram for implementing the present invention;
[0039] Figure 2 To input industrial radiographic images;
[0040] Figure 3 To deal with the effects of existing reconciliation methods;
[0041] Figure 4 Processing effect for existing eight-way method;
[0042] Figure 5 The defect 3D highlighting enhancement effect of the point convolution designed for the present invention; DETAILED DESCRIPTION
[0043] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0044] See also Figure 1 , the basic idea of the method of the present invention is:
[0045] The convolution kernel size is set, and the film image is processed by regional point multiplication convolution through the convolution kernel. The results are accumulated to enhance the image features, followed by grayscale offset compensation to highlight the defects in the film. Finally, boundary discrimination and elimination are performed to ensure that the boundaries of the enhanced image are clear and complete.
[0046] The present invention provides a method for 3D highlighting and enhancing X-ray film defects by dynamic compensation and point convolution, which specifically comprises the following steps:
[0047] Step 1: Set the convolution size of the industrial X-ray film weld:
[0048] Through the characteristics of industrial X-ray film, the size of the convolution kernel is set, and the size of the filter is adjusted to control the intensity of the three-dimensional (3D) engraving effect. It is used to apply the three-dimensional (3D) engraving effect on the image, and the effect of the three-dimensional (3D) engraving is determined by setting the value in the matrix. The specific steps are as follows:
[0049] 1.1: Input industrial X-ray film images of any size.
[0050] Figure 2 is the input industrial X-ray film image.
[0051] 1.2: Solve the proportional quantization value of each pixel to obtain the quantization matrix. The convolution kernel matrix is defined as:
[0052]
[0053] The convolution kernel in this embodiment is a 2×2 matrix.
[0054] Step 2: Regional point multiplication convolution processing accumulation:
[0055] The set 2×2 convolution kernel is applied to the local area of each pixel in the image, and the regional point multiplication convolution is performed and accumulated. That is, each element is multiplied by the pixel value at the corresponding position in the image, and then the results are added.
[0056] like Figure 3 and Figure 4 As shown in the figure, the ray images processed by the existing methods cannot be directly viewed and it is difficult for the naked eye to distinguish effective information. Therefore, it is necessary to perform point multiplication and accumulation processing on the local area.
[0057] The main steps are as follows:
[0058] 2.1: Regional point multiplication convolution processing:
[0059]
[0060] Among them, f represents the input image, K represents the convolution kernel, ij represents the pixel index in the image, and hw represents the width and height of the image.
[0061] 2.2: Accumulated area point multiplication convolution processing
[0062]
[0063] Where N is the number of local regions, represents the xth local area.
[0064] Step 3: Design grayscale offset compensation to adjust the grayscale value range of the image:
[0065] The present invention uses the statistical grayscale histogram as a weighted value and introduces the grayscale mean square error as grayscale offset compensation. The specific steps are as follows:
[0066] 3.1: Calculation of offset compensation
[0067] First, calculate the average gray value G Meav , in order to obtain a measure of the gray level of the image, so as to process and analyze the image. The specific formula is as follows:
[0068]
[0069] Secondly, the difference between each pixel and the grayscale average value of the image is calculated to measure the discreteness of the grayscale level. The uniformity of the grayscale value distribution and the grayscale characteristics are judged by the grayscale average difference. The main calculation formula is as follows:
[0070]
[0071] Based on the measurement of image grayscale distribution, the grayscale histogram is introduced As the weight coefficient of the number of pixels of each gray value, the calculation formula of the weighted average deviation is designed with the number of image statistics as the weight:
[0072]
[0073] Among them, M*N represents all pixels of the image, x i Indicates the grayscale value of the corresponding coordinate. Finally, the grayscale offset compensation amount offset is set to:
[0074]
[0075] Among them, w i is the weight of the ith pixel
[0076] 3.2: Grayscale offset compensation, adjust the grayscale value range of the image
[0077] Grayscale offset is a compensation value that indicates the amount by which the grayscale value of each pixel in the image needs to be adjusted. Grayscale offset compensation calculates the difference between each pixel and the grayscale average value and applies the difference as an offset to the image, thereby achieving grayscale adjustment of the image. The specific formula is as follows:
[0078] f out (x,y)=h(x,y)+offest (8)
[0079] Among them, f out (x,y) represents the final pixel value after grayscale offset compensation. h(x,y) represents the pixel value after regional point multiplication convolution. offest is a constant representing the amount of grayscale offset.
[0080] Step 4: Boundary discrimination and elimination processing to eliminate invalid areas
[0081] The film image is identified by boundary recognition, the boundary area in the image is determined, and the invalid area is eliminated to ensure that the boundary area of the image produces a good three-dimensional (3D) engraving effect and prevent discontinuous or unnatural boundary effects.
[0082] Since the processing result of step three may cause the pixel value to exceed the grayscale range [0,255], the new pixel value needs to be restricted.
[0083] Use f out (x, y) represents the original image, and F(x, y) represents the image after discrimination processing. Suppose the input image f out The grayscale range of (x,y) is [r1,r2]. Considering that the grayscale information of three-dimensional (3D) engraving images is mostly invalid information such as noise, it is more beneficial to the visual effect to remove a small amount of grayscale values at both ends. The grayscale with a number of pixels less than 0.13% and 99.87% of the maximum pixel is considered invalid grayscale. According to this threshold, after removing the invalid information at both ends, the effective grayscale range of the image is [f1,f2]. The transformation formula is:
[0084]
[0085] Where G[f out (x, y)] is the output image after offset compensation. After removing invalid information, the gray level distribution is in the range of [f1, f2], 0≤f1<f2≤255.
[0086] This embodiment is an explanation of the specific implementation of the present invention, rather than a limitation of the present invention. Those skilled in the relevant technical field can also make corresponding equivalent technical solutions without departing from the scope of the present invention, so all equivalent technical solutions should be included in the patent protection scope of the present invention.
Claims
1. A method for 3D highlighting and enhancing X-ray film defects by dynamic compensation and point convolution, characterized in that: The steps include: Step 1: Setting the convolution size of the weld seam of industrial radiographic film; Step 2: Regional point multiplication convolution processing accumulation: set the convolution kernel, apply it to the local area of each pixel of the image, perform regional point multiplication convolution processing, and accumulate the regional point multiplication convolution processing; Step 3: Grayscale offset compensation, adjusting the grayscale value range of the image; Step 4: Boundary identification and elimination: perform boundary identification on the film image, determine the boundary area in the image, and eliminate the invalid area.
2. The method for 3D highlighting and enhancing X-ray film defects by dynamic compensation and point convolution according to claim 1, characterized in that: The convolution kernel matrix of step 1 is:
3. The method for 3D highlighting and enhancing X-ray film defects by dynamic compensation and point convolution according to claim 2, characterized in that: In the step 2, the formula for the regional point multiplication convolution process is: Among them, f represents the input image, K represents the convolution kernel, ij represents the pixel index in the image, and hw represents the width and height of the image.
4. The method for 3D highlighting and enhancing X-ray film defects by dynamic compensation and point convolution according to claim 3, characterized in that: In step 2, the formula for the cumulative area point multiplication convolution process is: Where N is the number of local regions, represents the xth local region.
5. The method for 3D highlighting and enhancing X-ray film defects by dynamic compensation and point convolution according to claim 1 or 4, characterized in that: In step 3, the calculation process of the grayscale offset compensation is: First, calculate the average gray value G Meav , the formula is as follows: Secondly, calculate the difference between each pixel and the grayscale average of the image, the formula is as follows: Introducing grayscale histogram Taking the number of image statistics as weight, the calculation formula of weighted average deviation is as follows: in, is the weight coefficient for the number of pixels of each gray value, M*N represents all pixels of the image, x i Indicates the grayscale value of the corresponding coordinate, and the grayscale offset compensation offset is set to: Among them, w i is the weight of the ith pixel.
6. The method for 3D highlighting and enhancing X-ray film defects by dynamic compensation and point convolution according to claim 5, characterized in that: In step 3, the grayscale range adjustment formula of the image is as follows: f out (x,y)=h(x,y)+offest(8) Among them, f out (x, y) represents the final pixel value after grayscale offset compensation, h(x, y) represents the pixel value after regional point multiplication convolution processing, and offest is a constant representing the amount of grayscale offset.
7. The method for 3D highlighting and enhancing X-ray film defects by dynamic compensation and point convolution according to claim 6, characterized in that: The formula used for elimination in step 4 is: [f1,f2] is the effective grayscale range of the image.
Citation Information
Patent Citations
Dynamic bas-relief modeling method
CN110517333B
Part defect detection method and device based on point cloud and readable storage medium
CN115953370A
Instant noodle surface foreign matter detection method and system based on deep learning
CN115661058A
Method for improving radiographic inspection negative film definition based on image enhancement
CN117218035A
Image processing method, cell defect detection method, device and equipment
CN117853319A