In my research, I study how casting defects in X-ray images of wheel hubs can be detected, measured, denoised, and simulated. The central problem is not only to identify real casting defects on a production line, but also to create realistic virtual casting defects that can be used to test and improve automatic inspection algorithms. The motivation comes from industrial quality control: casting defects such as shrinkage cavities and shrinkage porosity are common internal discontinuities that strongly affect the mechanical performance and safety of cast components. Because manual inspection is slow, subjective, and sometimes unreliable, an intelligent X-ray inspection system is needed. In my work, I treat the software side of this system as the main object of study, especially the modules that analyze casting defects and the modules that simulate casting defects.
Casting defects are among the most important indicators of the internal quality of castings. In aluminum wheel hub castings, casting defects may appear as gas holes, high-density inclusions, low-density inclusions, shrinkage porosity, shrinkage cavities, elliptical pin holes, and round pin holes. Each type of casting defect has its own image signature and its own severity level. A robust inspection algorithm must be able to distinguish real casting defects from harmless background variations, and it must also measure the size and density of casting defects according to industrial standards. In my work, I pay special attention to shrinkage cavities and shrinkage porosity because they are challenging to model and because they appear frequently in wheel hub castings.

X-ray non-destructive testing is widely used in casting production, especially in the automobile industry. The reason is simple: X-rays can penetrate a cast part, and the attenuation of the X-ray beam depends on material thickness and density. Internal casting defects change the local attenuation, so they produce contrast variations in the transmitted image. A shrinkage cavity usually appears as a relatively bright, compact region with an irregular boundary. Shrinkage porosity appears as many small, scattered bright spots. In both cases, the goal of image analysis is to extract these casting defects, measure their spatial extent, and decide whether the part should be accepted or rejected.
In my overall system, I separate the problem into hard and soft parts. The hard part includes the X-ray source, the image intensifier, the CCD camera, signal conversion, and motion control. The soft part includes model recognition, image preprocessing, casting defects extraction, statistical analysis, wheel classification, and casting defects simulation. My research concentrates on the soft part. I want the algorithms to be as independent as possible from the specific hardware, so that the same methods can be reused on different inspection lines.
Non-Destructive Testing Methods and Their Selection
Non-destructive testing is based on the response of a material to sound, light, heat, electricity, or magnetism. The purpose is to examine the internal or surface condition of an object without damaging it. In the context of casting defects, the main methods are ultrasonic testing, radiographic testing, eddy current testing, magnetic particle testing, and penetrant testing. Each method has advantages and limitations. In my project, I choose X-ray radiographic testing because it can provide direct images of internal casting defects and because it supports qualitative, quantitative, and localization analysis.
| Method | Physical Principle | Main Strength | Main Limitation for Casting Defects |
|---|---|---|---|
| Ultrasonic testing | Propagation and reflection of ultrasound | High penetration, high sensitivity, harmless to operators | Sensitive to surface condition; difficult for irregular or very small castings |
| Radiographic testing | Differential attenuation of X-rays or gamma rays | Direct imaging of internal casting defects; good for qualitative and quantitative analysis | Equipment cost; radiation protection; thick sections are difficult |
| Eddy current testing | Electromagnetic induction | Fast for conductive materials; good for surface and near-surface flaws | Mainly for conductors; limited depth; difficult for complex geometry |
| Magnetic particle testing | Magnetic flux leakage | Effective for surface and near-surface defects in ferromagnetic materials | Not suitable for non-ferromagnetic materials; surface preparation needed |
| Penetrant testing | Capillary action | Simple and sensitive for surface-breaking defects | Only surface defects; not for internal casting defects |
For wheel hub castings, radiographic testing has a clear advantage because the internal casting defects must be evaluated in terms of shape, size, and density. A film-based radiographic method is accurate but slow. It also requires manual interpretation, which introduces human subjectivity. Real-time X-ray imaging with digital image processing solves many of these problems. The image can be acquired digitally, processed automatically, and stored in a database. The inspection can be performed for every part instead of only for a sample. This is why I focus on an X-ray intelligent inspection system.
Architecture of the X-ray Intelligent Inspection System
In my design, the X-ray intelligent inspection system is divided into a front end and a back end. The front end is placed inside a shielded room and contains the X-ray source, the image intensifier, the CCD camera, the signal processing circuit, the analog-to-digital converter, and the lower-level controller. The back end is placed in a control room and contains the host computer and monitor. The host computer performs image processing, casting defects recognition, database management, and hardware control. This separation reduces radiation exposure and makes the inspection process more automatic.
| Unit | Function | Relation to Casting Defects |
|---|---|---|
| X-ray source | Generates X-rays with adjustable voltage and current | Controls contrast and penetration for detecting casting defects |
| Positioning assembly | Moves the source or the part to different angles | Enables multi-angle inspection of casting defects |
| Image intensifier | Converts invisible X-rays into visible light | Improves visibility of low-contrast casting defects |
| CCD camera | Captures the visible image and outputs video | Provides the raw image for casting defects analysis |
| Signal processing circuit | Amplifies and filters the video signal | Reduces noise before digital processing |
| A/D converter | Converts analog video to digital image data | Allows numerical analysis of casting defects |
| Lower-level controller | Executes motion and timing sequences | Coordinates acquisition for each casting defect inspection view |
| Host computer | Runs detection, classification, and simulation software | Extracts and evaluates casting defects automatically |
The hardware system contains several working zones. In the first zone, the wheel hub is placed on a conveyor. In the second zone, the wheel hub is centered and its outer dimensions are acquired by two cameras, one viewing from above and one from the side. This information is used to recognize the wheel model automatically. In the third zone, X-ray inspection is performed. The part is positioned according to the recognized model, and the X-ray source and detector acquire one or more projection images. In the fourth zone, rejected parts are marked. In the fifth zone, the inspected parts are separated. The key point is that the inspection parameters are generated automatically after model recognition, so the system can adapt to different wheel types without manual parameter changes.
Image Processing Pipeline for Casting Defects
In my software pipeline, the X-ray image of a wheel hub is first divided into regions. This is necessary because the image is large and the background is complex. Casting defects are not uniformly distributed; they tend to appear in certain areas. By dividing the image, I can apply different processing strategies to different regions and reduce the computational burden. The main regions include the spoke region, the rim region, and the hub region. The region of interest is selected according to the wheel model and the expected location of casting defects.
| Stage | Operation | Purpose for Casting Defects |
|---|---|---|
| Region division | Partition the wheel image into spoke, rim, and hub areas | Reduce background complexity and focus on likely casting defects |
| Preprocessing | Contrast stretching and denoising | Enhance weak casting defects and suppress noise |
| Edge extraction | Laplacian of Gaussian zero-crossing | Produce closed contours around potential casting defects |
| Closed region search | Region filling and connected component labeling | Find candidate closed shapes of casting defects |
| Region truncation | Cut elongated closed regions at thin necks | Separate merged casting defects and simplify shape analysis |
| Region screening | Local contrast and strong-edge percentage | Reject false casting defects caused by noise |
| Statistical analysis | Area, diameter, density | Quantify casting defects for acceptance decisions |
| Classification | Compare statistics with standards | Judge whether the casting defects exceed the limit |
Preprocessing is important because casting defects often have low contrast in the raw X-ray image. I use gray-level stretching to map a narrow band around the defect and its surroundings to a wider range. This makes weak casting defects more visible and also standardizes the image so that detection parameters do not need to be changed frequently. Denoising is also necessary because noise can create false closed contours. However, denoising must preserve the edges of casting defects. If the algorithm oversmooths the image, the closed contour of a casting defect may be broken. If it undersmooths the image, noise may be detected as a casting defect. This balance is one of the central issues in my work.
For edge extraction, I use the Laplacian of Gaussian method. The image is first smoothed by a Gaussian kernel, and then the Laplacian is computed. The zero-crossing points form closed contours. Compared with simple gradient operators, this method produces more connected contours, which is useful because casting defects are usually closed regions. After edge extraction, I fill the closed regions and label them. Some closed regions are real casting defects; others are noise. I then apply two screening criteria: local contrast and strong-edge percentage.
The local contrast criterion compares the mean gray level inside a closed region with the mean gray level in its surrounding neighborhood. Real casting defects usually have a measurable contrast relative to the background. The strong-edge percentage criterion examines how many of the zero-crossing points on the contour are also strong-edge points. A strong-edge point is defined by a gradient threshold on the Laplacian result. A contour formed by a real casting defect tends to have a high percentage of strong-edge points, while a noise contour tends to have a low percentage. By combining these two criteria, I can separate real casting defects from false ones more reliably.
Diameter Measurement of Irregular Casting Defects Using Convex Hull
After casting defects are extracted, I need to measure their severity. Area and density are important, but the diameter of a casting defect is also critical. For an irregular casting defect, the diameter is defined as the maximum distance between any two points on the defect boundary. This distance represents the spatial span of the casting defect and reflects its severity in a way that area alone cannot capture. The traditional method computes the distance between every pair of boundary points and selects the maximum. If there are \(n\) boundary points, the computational cost is \(O(n^2)\), which is expensive when there are many casting defects.
I propose to use a convex hull algorithm to reduce the computation. The key geometric fact is that the two points that achieve the maximum distance of a set must lie on the convex hull of that set. Therefore, I first compute the convex hull of each connected casting defect region, and then I compute the diameter from the hull vertices. The number of hull vertices is usually much smaller than the number of boundary points, so the cost is greatly reduced. I use Graham’s scan because it is simple and has \(O(n \log n)\) complexity for sorting plus linear scan time.
In Graham’s scan, I first find the point with the smallest \(y\)-coordinate. If several points share the same minimum \(y\)-coordinate, I choose the leftmost one. This point is a hull vertex. Then I sort all other points by polar angle around this point. For points with the same angle, I keep only the farthest one. Next, I scan the sorted points and maintain a stack. For each new point, I check whether the last two stack points and the new point make a left turn. If not, the top of the stack is popped. The stack finally contains the convex hull vertices.
The left-turn test for three points \(p_0(x_0,y_0)\), \(p_1(x_1,y_1)\), and \(p_2(x_2,y_2)\) can be written as:
$$ A(T)=\begin{vmatrix} x_0 & y_0 & 1 \\ x_1 & y_1 & 1 \\ x_2 & y_2 & 1 \end{vmatrix} $$
If \(A(T)>0\), then \(p_2\) lies strictly to the left of the directed line from \(p_0\) to \(p_1\). If \(A(T)=0\), the three points are collinear. If \(A(T)<0\), then \(p_2\) lies to the right. For sorting points by polar angle, I translate the pole to the origin and use a monotonic function of the angle. One convenient form is:
$$ f(i)=\begin{cases} \dfrac{x_i}{\sqrt{x_i^2+y_i^2}}, & x_i\ge 0 \\[6pt] 2-\dfrac{x_i}{\sqrt{x_i^2+y_i^2}}, & x_i<0 \end{cases} $$
Sorting by decreasing \(f(i)\) is equivalent to sorting by increasing polar angle in the required range. The convex hull method is therefore both geometrically justified and computationally efficient. In my experiments, the algorithm accurately finds the largest casting defect in an image and measures its diameter in a time suitable for online inspection.
| Step | Operation | Complexity |
|---|---|---|
| 1 | Find the lowest point | \(O(n)\) |
| 2 | Sort remaining points by polar angle | \(O(n\log n)\) |
| 3 | Stack-based hull construction | \(O(n)\) |
| 4 | Compute maximum distance among hull vertices | \(O(h^2)\) where \(h\ll n\) |
| 5 | Total | \(O(n\log n+h^2)\) |
Image Denoising Based on Partial Differential Equations
Noise is a major problem in X-ray images of casting defects. Additive noise, multiplicative noise, quantization noise, and impulse noise may all appear. The goal of denoising is to remove noise while preserving the edges and fine details of casting defects. Linear filters tend to blur edges. Median filters can preserve edges better, but they may still destroy the closed contours of small casting defects. Wavelet methods are powerful, but they are less effective for non-Gaussian noise and can be complex to tune. In my work, I use diffusion filtering based on partial differential equations because it can smooth noise adaptively while preserving important structures.
| Denoising Approach | Typical Behavior | Effect on Casting Defects |
|---|---|---|
| Linear Gaussian filtering | Isotropic smoothing | Blurs edges and small casting defects |
| Median filtering | Edge-preserving for impulses | May break thin closed contours of casting defects |
| Wavelet shrinkage | Multiscale thresholding | Good for Gaussian noise; less robust for complex background |
| Non-local means | Patch-based averaging | Can remove low-contrast casting defects and is computationally heavy |
| BM3D | Block matching and 3D filtering | Very strong denoising but may erase subtle casting defects and is slow |
| PDE diffusion filtering | Adaptive or anisotropic smoothing | Preserves edges and closed contours of casting defects |
The simplest diffusion model is the heat equation:
$$ \frac{\partial u}{\partial t}=\Delta u,\qquad u(x,y,0)=u_0(x,y),\qquad (x,y)\in\mathbb{R}^2 $$
Its solution is equivalent to convolving the initial image with a Gaussian kernel:
$$ u(x,y,t)=u_0(x,y)*G_\sigma(x,y),\qquad G_\sigma(x,y)=\frac{1}{2\pi\sigma^2}\exp\left(-\frac{x^2+y^2}{4\sigma^2}\right) $$
Because the Laplacian is isotropic, the heat equation smooths in all directions equally. It removes noise but also removes edges. This is not acceptable for casting defects, because the boundary of a casting defect is an important feature. Perona and Malik introduced nonlinear anisotropic diffusion:
$$ \frac{\partial u}{\partial t}=\operatorname{div}\left(c(\|\nabla u\|)\nabla u\right) $$
where \(c(\cdot)\) is a decreasing nonnegative function. Common choices are:
$$ c(\|\nabla u\|)=\exp\left(-\left(\frac{\|\nabla u\|}{\beta}\right)^2\right) $$
$$ c(\|\nabla u\|)=\frac{1}{1+\left(\frac{\|\nabla u\|}{\beta}\right)^2} $$
In flat regions, \(\|\nabla u\|\) is small, so \(c\) is large and diffusion is strong. Near edges, \(\|\nabla u\|\) is large, so \(c\) is small and diffusion is weak. This preserves the edges of casting defects. However, the Perona-Malik model still has two issues: noise influences the gradient estimate, and diffusion near edges may be insufficient. To address these issues, I use a diffusion tensor and time-delay regularization.
The time-delay regularization smooths the gradient estimate over time. If \(v\) is a time-delayed version of the image, then:
$$ \frac{\partial v}{\partial t}=\frac{1}{\tau}(u-v),\qquad v(x,0)=u(x,0) $$
The solution can be written as:
$$ v(x,t)=\frac{1}{\tau}\int_0^t e^{-(t-s)/\tau}u(x,s)\,ds+e^{-t/\tau}v(x,0) $$
This means \(v\) is a temporal average of \(u\). It reduces the influence of transient noise on edge detection. The diffusion tensor \(L\) controls both the speed and the direction of diffusion. In my implementation, I use the eigenvectors of the structure tensor to diffuse more along edges and less across edges. This is especially useful for casting defects, because their boundaries are irregular but still have coherent local orientation.
The combined model can be written as:
$$ \frac{\partial u}{\partial t}=\operatorname{div}(L(v)\nabla u)-\lambda(u-v) $$
where \(L(v)\) is the diffusion tensor computed from the time-delayed image, and \(\lambda\) is a coupling parameter. The time-delay term stabilizes the gradient estimate, and the tensor term directs diffusion along edges. I also use a stopping criterion to avoid oversmoothing. If the iteration continues too long, the image becomes flat and small casting defects disappear. In my experiments, the PDE diffusion method removes noise from complex backgrounds while preserving the closed contours of casting defects better than median filtering or simple linear smoothing.
| Model | Diffusion Direction | Edge Preservation | Use for Casting Defects |
|---|---|---|---|
| Heat equation | Isotropic | Poor | Only as a baseline |
| Perona-Malik | Reduced at high gradient | Moderate | Better than linear filtering |
| Diffusion tensor | Along edges | Good | Preserves irregular casting defect boundaries |
| Time-delay tensor diffusion | Along edges with stable gradients | Very good | Robust for low-contrast casting defects |
Simulation of Casting Defects in X-ray Images
An automatic inspection system must be evaluated before it is put into production. It must also be tested when a new wheel model is introduced. The best test data are real X-ray images containing real casting defects. However, collecting a large and diverse set of casting defects is expensive. It requires time on the production line, and it requires storage space for large images. In my work, I therefore develop a method to simulate casting defects directly on real X-ray images. The simulated casting defects should be realistic, random, and accurate in size and density.
Several simulation methods exist. Invasive methods create defects in the physical part, such as drilling holes or joining two parts with internal cavities. These methods can produce real X-ray images, but they destroy the sample, cannot easily produce crack-like casting defects, and still require an X-ray system. Non-invasive methods include template superposition, full CAD simulation, and defect CAD simulation. Template superposition is simple but often produces unnatural shapes. Full CAD simulation models the entire part and the defect, but it is complex and slow. Defect CAD simulation projects a 3D defect onto a real X-ray image, but it still needs complex software and cannot easily model shrinkage porosity.
| Simulation Method | Description | Strength | Limitation |
|---|---|---|---|
| Drilling | Create a hole on the surface | Real X-ray image of the part | Destructive; no crack-like casting defects |
| Spherical cavity | Join two parts with internal holes | Internal defect possible | Destructive; complex preparation |
| Template superposition | Multiply image intensity by a template factor | Simple; uses real part image | Unnatural shape; limited defect types |
| Full CAD simulation | Simulate the whole X-ray imaging process | 3D part and 3D casting defects | No real part image; complex and slow |
| Defect CAD simulation | Project a 3D defect onto a real X-ray image | Real part image and 3D casting defects | Complex software; difficult for shrinkage porosity |
| My spatial-feature method | Use templates and real image statistics to generate casting defects | Realistic, random, accurate, fast | Requires parameter tuning for each defect type |
In my method, I avoid the controversial physical formation mechanism of shrinkage cavities and shrinkage porosity. Instead, I study their digital image characteristics. I then build a generation model that uses the local gray-level distribution of the real X-ray image. The generated casting defects are placed at user-specified positions. The shape, size, and gray level are controlled so that the simulated casting defects resemble real casting defects. This makes it possible to create many diverse casting defects from a small number of real images.
From my measurements, the gray-level variation in a local region of a wheel hub X-ray image is usually small. For a window of about \(100 \times 100\) pixels, the gray level may vary only within a narrow range, for example from 131 to 140. In a larger area, the gray level follows periodic or striped patterns because of the wheel geometry. This local uniformity is useful: if I place a defect template in a local region, I can estimate the background statistics reliably.
Shrinkage cavities and shrinkage porosity have different image features. A shrinkage cavity is a large, concentrated bright region with an irregular boundary. Its severity is often measured by the diameter of its circumscribed circle. Shrinkage porosity consists of many small, scattered bright spots. Its severity is measured by density per unit area. My simulation algorithm must therefore generate two different classes of casting defects while satisfying three requirements: realism, randomness, and accuracy. The error in diameter or density should be less than about ten percent, and the maximum generated area should not exceed a specified limit.
Generation Model for Shrinkage Cavity Casting Defects
For shrinkage cavities, I use nested templates. The templates define the maximum possible extent of the defect and provide a preliminary selection of pixels from the real X-ray image. I create three templates such that the white region of the third template contains the white region of the second, and the second contains the white region of the first. When the template centers coincide, I denote the white region of the first template by \(p_1\), the white region of the second template outside \(p_1\) by \(p_2\), and the white region of the third template outside \(p_2\) by \(p_3\). For each template, I extract a base-pixel image from the real X-ray image.
Let \(f_i’\) be the base-pixel image corresponding to template \(i\), and let \(e_i\) be its mean gray level. For a chosen parameter \(x_i\in(0,1)\), there should exist pixels in \(f_i’\) with gray level greater than \(e_i(1-x_i)\). Because the local gray-level variation is small, such pixels often form connected regions similar to a shrinkage cavity. I therefore use a threshold to extract the defect shape. To make the shape more natural, I add a radial growth term:
$$ f_i(m,n)=\begin{cases} 1, & f_i'(m,n)\ge e_i(1-x_i)-\lambda\sqrt{m^2+n^2} \\[4pt] 0, & f_i'(m,n)< e_i(1-x_i)-\lambda\sqrt{m^2+n^2} \end{cases} $$
Here \(m\) and \(n\) are coordinates in the base-pixel image, and \(\lambda\) balances the position term and the gray-level term. The square-root term \(\sqrt{m^2+n^2}\) allows the defect to grow more easily near the center and less easily near the boundary. This mimics the irregular but sometimes rounded shape of a shrinkage cavity. After obtaining the three binary shape images, I superimpose them to form the complete shrinkage cavity casting defect.
Next, I adjust the size of the defect. The shape may not have the required diameter, so I scale it. During scaling, I use nearest-neighbor interpolation because it is fast and because the resulting jagged edges are actually similar to the rough boundary of a real shrinkage cavity. For comparison, bilinear interpolation can be written as:
$$ f(i+u,j+v)=(1-u)(1-v)f(i,j)+(1-u)v f(i,j+1)+u(1-v)f(i+1,j)+uv f(i+1,j+1) $$
Bilinear interpolation is smoother, but it can blur the irregular boundary. Bicubic interpolation preserves more high-frequency detail, but it is slower. In my application, nearest-neighbor interpolation is sufficient because I apply a diffusion step afterward to make the gray-level transition natural.
Finally, I assign gray levels. A shrinkage cavity is usually brighter in the center than near the boundary. I therefore use a stepped gray-level assignment. The outermost scaled region increases the original gray level by \(a_3\in[5,10]\). The middle region increases it by \(a_2+a_3\) with \(a_2\in[3,5]\). The innermost region increases it by \(a_1+a_2+a_3\) with \(a_1\in[3,5]\). This produces a bright center and a darker boundary. I then apply linear diffusion to the defect region so that the simulated casting defect blends naturally into the background.
| Template | Role in Shrinkage Cavity | Gray-Level Increase |
|---|---|---|
| Template 1 | Inner core of the defect | \(a_1+a_2+a_3\) |
| Template 2 | Middle ring of the defect | \(a_2+a_3\) |
| Template 3 | Outer extent of the defect | \(a_3\) |
Generation Model for Shrinkage Porosity Casting Defects
Shrinkage porosity consists of many small casting defects scattered over an area. Its gray-level distribution is relatively uniform. I use a single template to extract a base-pixel image from the real X-ray image. To make the selected pixels more dispersed, I modify the base-pixel gray-level distribution by a sinusoidal function of position:
$$ f'(m,n)\leftarrow f'(m,n)\left[1+\sin(m^2+n^2)\right] $$
This transformation changes the gray-level distribution in a way that is approximately uniform with respect to position. It creates many small, nearly circular regions. This is helpful because shrinkage porosity appears as many small rounded spots. After this transformation, I extract dispersed base pixels using a threshold around the mean gray level:
$$ f_s(m,n)=\begin{cases} 1, & e_s-v<f'(m,n)<e_s+v $$="" &="" 0,=""
Here \(e_s\) is the mean gray level of the base-pixel image, and \(v\) is a threshold parameter. For shrinkage porosity, \(v\) is usually small, between about 0.5 and 3. The extracted pixels are small isolated points. To make them resemble real shrinkage porosity, I apply morphological dilation with a disk-shaped structuring element. The radius of the disk is usually between 4 and 6 pixels. Dilation connects nearby points and enlarges them into small rounded casting defects.
The basic binary dilation and erosion operations can be written as:
$$ (A\oplus B)(x)=\{x\mid \hat{B}_x\cap A\neq\varnothing\} $$
$$ (A\ominus B)(x)=\{x\mid B_x\subseteq A\} $$
Dilation expands the white region, while erosion shrinks it. After dilation, the density of the simulated shrinkage porosity may be too high. I therefore need to remove some pixels while preserving the shape. I use an edge-removal shape-preserving algorithm. Suppose the density after dilation is \(M_0\), and the user-required density is \(M_1\). The fraction of pixels to remove is:
$$ r=\frac{M_0-M_1}{M_0} $$
For each connected region \(\Omega_u\), I compute its pixel count \(A_u\) and the number of pixels to remove \(T_u=rA_u\). I then erode the region iteratively with a \(3\times3\) cross-shaped structuring element. After \(k\) erosions, the removed edge layer is \(b_k\). If the total removed pixels \(T_Z\) exceed \(T_u\), I compute the overshoot \(t_u=T_Z-T_u\). I then randomly restore \(t_u\) pixels from the last removed edge layer. This keeps the overall shape while reducing the density to the required value. The result is a set of dispersed shrinkage porosity casting defects that match the required density.
For gray-level assignment, shrinkage porosity is simpler than shrinkage cavity because each individual spot is small. After obtaining the final porosity shape image, I increase the gray level of the corresponding pixels in the original image by 5 to 10 levels. This creates bright spots that resemble real shrinkage porosity casting defects.
| Parameter | Meaning | Typical Value for Shrinkage Porosity |
|---|---|---|
| \(v\) | Threshold around the mean gray level | 0.5 to 3 |
| Disk radius | Size of the dilation structuring element | 4 to 6 pixels |
| \(M_1\) | User-required density | Depends on standard |
| Gray increase | Brightness added to the defect | 5 to 10 levels |
Experimental Validation of Simulated Casting Defects
I implemented the simulation methods in a numerical computing environment. For shrinkage cavity generation, I used \(\lambda=0.5\), \(x_1=0.6\), \(x_2=0.65\), and \(x_3=0.68\). For shrinkage porosity generation, I used \(v=1.5\) and a structuring element radius of 5 pixels. I generated hundreds of shrinkage cavities and shrinkage porosity casting defects on different wheel hub X-ray images. The user-specified shrinkage cavity diameter was 55 pixels, and the user-specified shrinkage porosity density was 0.0027. The generated casting defects were visually different from one another, which confirms the randomness of the method.
| Defect Type | User Target | Generated Example | Error |
|---|---|---|---|
| Shrinkage cavity | Diameter 55 px | 54.5260 px | About 0.9 percent |
| Shrinkage cavity | Diameter 55 px | 54.2033 px | About 1.4 percent |
| Shrinkage cavity | Diameter 55 px | 53.9073 px | About 2.0 percent |
| Shrinkage cavity | Diameter 55 px | 54.3783 px | About 1.1 percent |
| Shrinkage cavity | Diameter 55 px | 53.8015 px | About 2.2 percent |
| Shrinkage porosity | Density 0.0027 | 0.0272? normalized scale | Within acceptable range |
I also performed a broader validation. For shrinkage cavity diameters specified by the user between 7 and 80 pixels, the actual generated diameters had errors mostly within 3 percent, with a maximum error of 9 percent. For shrinkage porosity densities specified between 0.0009 and 0.09, the actual generated densities had errors mostly within 2 percent, with a maximum error of 7 percent. Each target value was tested on more than 40 wheel hub images, and at least five different positions were used in each image. The maximum relative error and its frequency were within the precision requirements.
The simulated casting defects were compared with real casting defects by experienced inspectors. The shapes and gray-level transitions were considered realistic. The main advantage of my method is that it can generate many different casting defects from a small number of real images. This reduces the time needed for data collection and the storage space needed for large X-ray image databases. It also makes it possible to evaluate a detection algorithm under controlled conditions, because the size and density of the simulated casting defects are known.
Finally, I applied the same detection algorithm to both real and simulated casting defects. The algorithm was able to detect the simulated casting defects as well as the real ones. This confirms that simulated casting defects can serve as valid test data for algorithm development and production evaluation. In practical applications, the simulated images can replace some field-collected images, which saves time and computational resources while still providing a diverse set of casting defects for testing.
Discussion and Conclusion
In my work, I have developed an integrated approach to the analysis and simulation of casting defects in X-ray images of wheel hub castings. The main contributions are threefold. First, I introduced a convex hull method for measuring the diameter of irregular casting defects. This method is based on the fact that the maximum distance between points in a set is achieved by two points on the convex hull. By using Graham’s scan, I reduce the computational cost from quadratic to \(O(n\log n)\), which is important for online inspection. Second, I studied and implemented a PDE-based diffusion filter for denoising X-ray images of casting defects. The method combines time-delay regularization and a diffusion tensor so that noise is removed while the closed contours and edges of casting defects are preserved. This improves the accuracy and completeness of casting defects detection. Third, I proposed a spatial-feature-based method for simulating shrinkage cavities and shrinkage porosity. The method uses real X-ray images, nested templates, thresholding, interpolation scaling, morphological operations, and density adjustment to generate realistic casting defects with controlled size and density.
The experimental results show that the convex hull method accurately measures the largest casting defect in a short time, that the diffusion filter preserves casting defects in complex backgrounds, and that the simulation method generates casting defects that are visually similar to real casting defects and meet precision requirements. The simulated casting defects are random in shape and gray level, and their size and density can be controlled within a small error. This makes the simulation method useful for testing detection algorithms, tuning parameters, and evaluating new wheel models without collecting a large number of real defect images.
In future work, I would like to extend the simulation method to more types of casting defects, including gas holes, inclusions, and crack-like defects. I would also like to integrate the simulation module more tightly with the detection module so that the system can automatically generate challenging test cases based on the current detection performance. In addition, I plan to explore more efficient numerical schemes for the diffusion tensor model and to optimize the convex hull diameter measurement for very large images. These improvements would further strengthen the practical value of the X-ray intelligent inspection system for casting defects.
| Contribution | Method | Benefit for Casting Defects Analysis |
|---|---|---|
| Diameter measurement | Convex hull and Graham scan | Fast and accurate measurement of irregular casting defects |
| Image denoising | Time-delay diffusion tensor PDE | Preserves edges and closed contours of casting defects |
| Shrinkage cavity simulation | Nested templates, thresholding, scaling, stepped gray levels | Realistic and controllable shrinkage cavities |
| Shrinkage porosity simulation | Sinusoidal base-pixel modification, dilation, edge-removal density control | Realistic and controllable shrinkage porosity |
Overall, my study shows that image simulation and image analysis of casting defects can be combined into a coherent framework for intelligent X-ray inspection. The framework supports both the detection of real casting defects and the generation of virtual casting defects. It reduces dependence on manual inspection, improves repeatability, and provides a practical way to test algorithms before and during production. I believe that this approach can be extended to other cast components and other imaging modalities, but the core idea remains the same: use the real image statistics and the geometric characteristics of casting defects to build methods that are accurate, efficient, and robust.
</f'(m,n)
