A method for measuring geometric parameters of an aluminum extrusion die hole type based on machine vision
By using ring light source partitioned illumination and angular sampling technology, the problem of unstable boundary detection in the measurement of geometric parameters of aluminum extrusion die hole shape was solved, realizing high-precision and reliable calculation of hole geometric parameters, which is suitable for batch inspection of complex hole shapes.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- JIANGYIN XIEZHICHUANG PRECISION TECHNOLOGY CO LTD
- Filing Date
- 2026-04-07
- Publication Date
- 2026-07-03
Smart Images

Figure CN122329136A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision measurement technology, specifically to a machine vision-based method for measuring the geometric parameters of the die hole shape in aluminum extrusion molds. Background Technology
[0002] The geometric parameters of the die orifice in aluminum extrusion dies directly affect the metal flow state, the dimensional accuracy of the product cross-section, and the quality of die finishing. Therefore, during die manufacturing, acceptance, and rework, it is usually necessary to inspect parameters such as orifice contour, flow width, and corner radius. In existing technologies, one type of method uses manual measuring tools, projection comparison, or coordinate measuring machines to measure the orifice dimensions. While this method can achieve a certain level of accuracy, it generally suffers from low inspection efficiency, strong operational dependence, difficulty in adapting to small, irregularly shaped orifices, and inconvenience for rapid batch inspection. Another type of method uses an industrial camera to acquire images of the die orifice, and then obtains the orifice boundary through threshold segmentation, edge operator extraction, contour tracking, template comparison, or ordinary fitting methods, further calculating the area, perimeter, and local dimensional parameters. This type of machine vision method has lower implementation costs and is convenient for online or near-line applications, making it an important development direction for die inspection.
[0003] However, aluminum extrusion die orifices typically exhibit characteristics such as strong surface reflection, abrupt edge transitions, narrow local slits, and irregular orifice shapes. Existing visual measurement methods still have significant shortcomings in practical applications. Images acquired under single illumination conditions are susceptible to specular reflection, local highlights, and shadow occlusion, leading to unstable grayscale distribution at the orifice boundary and drifting edge positions. When using fixed-directional illumination or single-image grayscale gradients for boundary extraction, only the strongest local response is often obtained, failing to stably reflect the true normal changes of boundaries in different orientations. This results in missed detections, breaks, or false edges at irregular orifice corners, narrow slits, and weak boundary areas. Existing contour tracking and ordinary smoothing fitting methods are prone to distorting closed contours when boundaries are discontinuous or local responses are abnormal, thus affecting subsequent calculations of minimum flow width, local fillet radius, and overall contour dimensions. Furthermore, while some existing methods can extract orifice contours, they lack unified processing of boundary direction consistency and closed-loop constraint relationships, resulting in insufficient repeatability and stability of measurement results, making it difficult to meet the high-precision and high-consistency geometric parameter detection requirements of aluminum extrusion dies.
[0004] Therefore, this case aims to propose a machine vision-based method for measuring the geometric parameters of aluminum extrusion die orifices. It uses a ring light source for partitioned illumination to obtain a directional grayscale response, and then converts this directionality into operable boundary normals and radial sampling. Thus, without relying on a single threshold segmentation or fixed template fitting, it can stably obtain the closed orifice boundary and output indicators such as perimeter, area, minimum flow width, and corner radius. Summary of the Invention
[0005] This invention provides a machine vision-based method for measuring the geometric parameters of the die pass of aluminum extrusion, which helps to solve the problems mentioned in the background art.
[0006] This invention provides the following technical solution: a method for measuring the geometric parameters of the die pass of an aluminum extrusion mold based on machine vision, comprising:
[0007] Establish a measurement coordinate system on the orifice image plane, extract a single orifice image window, and retain the reference edge within the image window;
[0008] The ring light source is divided into azimuth zones, grayscale images are acquired sequentially, and a standardized grayscale image sequence is formed.
[0009] Calculate the azimuth harmonic response components, response amplitude, and response phase for each pixel within the image window; establish the nearest pixel mapping and response amplitude expansion for the real coordinate points; and calculate the orifice response center.
[0010] Establish an angular sampling sequence around the orifice response center, and construct the radial unit vector, tangential unit vector, and sampling ray corresponding to each angular sampling position;
[0011] For each ray sampling point, construct a response normal unit vector, calculate the directional response difference, and scan along the sampling ray to obtain the integer candidate boundary radius;
[0012] Sub-pixel correction is performed on the integer candidate boundary radii of each sampled ray to correct the range of boundary radius values, obtain the normal unit vector of the candidate boundary response, and form a sequence of angular candidate boundary radii;
[0013] Perform closed-loop consistent solution on the candidate boundary radius sequence diagonally to obtain the closed-loop boundary radius sequence and form the closed orifice boundary curve;
[0014] Establish a scale based on the correspondence between the actual length and the image length, and calculate the orifice perimeter, orifice area, minimum flow width, and corner radius.
[0015] Optionally, establishing a measurement coordinate system on the orifice image plane, capturing a single orifice image window, and retaining the reference edge within the image window specifically includes:
[0016] Establish a rectangular coordinate system on the image plane of the orifice, set the center of the image window as the origin, set the direction of increasing the image column number as the positive horizontal direction, and set the direction of decreasing the image row number as the positive vertical direction;
[0017] Represent any point within the image window using pixel x-coordinate and pixel y-coordinate;
[0018] Obtain the cutting center of the target opening, and obtain the nominal maximum lateral dimension, nominal maximum longitudinal dimension, and the width of the outer continuous metal plane to be retained of the target opening;
[0019] Set the width of the single-aperture image window to the sum of the nominal maximum horizontal size and twice the width of the outer continuous metal plane, and set the height of the single-aperture image window to the sum of the nominal maximum vertical size and twice the width of the outer continuous metal plane.
[0020] Using the cropping center as the window center, an image window containing only one target hole is cropped from the entire mold image;
[0021] Count the total number of pixels within the image window;
[0022] Retain a reference edge of known true length within the image window, and obtain the true length of the reference edge and its pixel length in the image.
[0023] Optionally, the step of performing azimuth partitioning on the ring light source, sequentially acquiring grayscale images, and forming a standardized grayscale image sequence specifically includes:
[0024] The ring light source is divided into a preset number of azimuth zones, and each azimuth zone is arranged circumferentially according to the angular intervals after the division of the whole circumference.
[0025] With the camera's line of sight remaining unchanged, each azimuth zone is illuminated sequentially, and the corresponding grayscale images are acquired to form the original image sequence.
[0026] For each original image, the sum of the original gray levels of all pixels within the image window is counted, and the sum of the original gray levels is divided by the total number of pixels within the image window to calculate the mean gray level of the current original image.
[0027] For each pixel in each original image, when the original gray level of the current pixel is greater than zero, the original gray level of the current pixel is divided by the mean gray level of the current original image to obtain the standardized gray level of the current pixel.
[0028] For each pixel in each original image, when the original gray level of the current pixel is equal to zero, the normalized gray level of the current pixel is set to zero, forming a normalized gray level image sequence.
[0029] Optionally, the step of calculating the azimuth harmonic response components, response amplitude, and response phase for each pixel within the image window, establishing the nearest pixel mapping and response amplitude expansion for the real coordinate points, and calculating the aperture response center specifically includes:
[0030] For each pixel in the image window, the standardized gray level corresponding to each azimuth partition is multiplied by the cosine value of the azimuth angle of each azimuth partition, and then accumulated over all azimuth partitions to calculate the cosine response component of the current pixel.
[0031] For each pixel in the image window, the standardized gray level corresponding to each azimuth partition is multiplied by the sine value of the azimuth angle of each azimuth partition, and then accumulated over all azimuth partitions to calculate the sinusoidal response component of the current pixel.
[0032] For each pixel in the image window, the cosine response component and the sine response component are squared and summed. Then, the square root of the sum is taken to calculate the response amplitude of the current pixel.
[0033] For each pixel in the image window, the sinusoidal and cosine response components are used as inputs to the two-parameter arctangent function to calculate the response phase of the current pixel in the corresponding quadrant.
[0034] For any real coordinate point, round the horizontal and vertical coordinates of the real coordinate point to obtain the nearest pixel mapping result;
[0035] When the most recent pixel mapping result is within the image window, the response amplitude of the corresponding pixel is read and used as the response amplitude extension value of the real coordinate point; when the most recent pixel mapping result is outside the image window, the response amplitude extension value of the real coordinate point is set to zero.
[0036] Multiply the coordinates of each pixel in the image window by the corresponding response amplitude and accumulate them, then divide them by the sum of all response amplitudes to calculate the horizontal and vertical coordinates of the orifice response center; when the sum of all response amplitudes is zero, the orifice response center is taken as the origin of the coordinate system.
[0037] Optionally, the step of establishing an angular sampling sequence around the orifice response center and constructing a radial unit vector, a tangential unit vector, and a sampling ray corresponding to each angular sampling position specifically includes:
[0038] Set the total number of angular samples to four times the total number of azimuth partitions, arrange the angular sampling positions along the circumference according to the angular intervals after dividing the circumference into integer angles, and assign a corresponding sampling angle to each angular sampling position to form an angular sampling sequence.
[0039] For each angular sampling position, construct the corresponding radial unit vector using the cosine and sine values of the sampling angle corresponding to the current angular sampling position;
[0040] For each angular sampling position, construct a tangential unit vector using the orthogonal direction of the radial unit vector corresponding to the current angular sampling position;
[0041] Starting from the center of the orifice response, samples are taken outwards along the radial unit vector corresponding to the current angular sampling position in steps of one pixel.
[0042] For each sampled horizontal and vertical coordinate, rounding is performed to obtain the corresponding integer pixel sampling point;
[0043] Collect all integer pixel sampling points corresponding to each angular sampling position in circumferential order to form sampling rays corresponding to each angular sampling position, and collect them to form a ray sampling point set.
[0044] Optionally, the step of constructing a response normal unit vector for each ray sampling point, calculating the directional response difference, and scanning along the sampling ray to obtain integer candidate boundary radii specifically includes:
[0045] For each ray sampling point located within the image window, read the response phase of the current ray sampling point, and use the cosine and sine values of the response phase of the current ray sampling point as the horizontal and vertical components, respectively, to construct the response normal unit vector of the current ray sampling point.
[0046] For each sampling ray, check each sampling point on the current sampling ray from the orifice response center outwards. When the current sampling point, the position offset by half a pixel in the positive direction of the response normal unit vector of the current sampling point, and the position offset by half a pixel in the negative direction of the response normal unit vector of the current sampling point are all within the image window, the corresponding sampling number is included in the set of valid sampling numbers of the current sampling ray.
[0047] For each sampling ray, the largest non-negative integer sampling number in the set of valid sampling numbers of the current sampling ray is selected as the largest valid sampling number of the current sampling ray;
[0048] When the set of valid sampling numbers of the current sampling ray is not empty, within the range from zero to the maximum valid sampling number of the current sampling ray, for each sampling number, read the response amplitude expansion value of the sampling point corresponding to the current sampling number by shifting half a pixel in the positive direction along the unit vector of the response normal of the current sampling number, and subtract the response amplitude expansion value of the sampling point corresponding to the current sampling number by shifting half a pixel in the negative direction along the unit vector of the response normal of the current sampling number, and calculate the orientation response difference at the current sampling number;
[0049] When the set of valid sampling numbers for the current sampling ray is empty, the maximum valid sampling number of the current sampling ray is set to zero, and the directional response difference corresponding to each sampling number of the current sampling ray is set to zero.
[0050] When the maximum effective sampling number of the current sampling ray is not less than two, the scanning starts from the sampling number and proceeds outward along the sampling ray. Within the range not exceeding the position before the maximum effective sampling number of the current sampling ray, the sampling position corresponding to the largest absolute value of the orientation response difference is selected as the integer candidate boundary radius.
[0051] When the maximum valid sampling number of the current sampled ray is less than two, the integer candidate boundary radius is set to zero.
[0052] Optionally, the sub-pixel correction of the integer candidate boundary radii for each sampled ray, the correction of the boundary radius value range, the acquisition of the candidate boundary response normal unit vector, and the formation of an angular candidate boundary radius sequence specifically include:
[0053] When the maximum effective sampling number of the current sampling ray is not less than two, the directional response difference is read at the left adjacent position of the integer candidate boundary radius of the current sampling ray, the integer candidate boundary radius of the current sampling ray, and the right adjacent position of the integer candidate boundary radius of the current sampling ray, respectively.
[0054] When the result of subtracting the right neighbor position orientation response difference from the left neighbor position orientation response difference is not zero, and the result of subtracting twice the position orientation response difference of the integer candidate boundary radius of the current sampled ray from the left neighbor position orientation response difference and adding the right neighbor position orientation response difference is not zero, the result of subtracting the right neighbor position orientation response difference from the left neighbor position orientation response difference is used as the correction numerator, and the result of subtracting twice the position orientation response difference of the integer candidate boundary radius of the current sampled ray and adding the right neighbor position orientation response difference is multiplied by two to use as the correction denominator. The correction numerator is divided by the correction denominator and added to the integer candidate boundary radius of the current sampled ray to calculate the sub-pixel boundary radius.
[0055] When the maximum effective sampling number of the current sampling ray is not less than two, and the result of subtracting twice the integer candidate boundary radius position orientation response difference of the current sampling ray from the left neighbor position orientation response difference and adding the right neighbor position orientation response difference equals zero, the subpixel boundary radius is taken as the integer candidate boundary radius of the current sampling ray.
[0056] When the maximum effective sampling number of the current sampling ray is less than two, the sub-pixel boundary radius is set to half a pixel;
[0057] When the subpixel boundary radius is less than half a pixel, the subpixel boundary radius is corrected to half a pixel; when the subpixel boundary radius is greater than the maximum effective sampling number of the current sampling ray minus the maximum value of half a pixel and half a pixel, the subpixel boundary radius is corrected to the maximum effective sampling number of the current sampling ray minus the maximum value of half a pixel and half a pixel.
[0058] When the set of valid sampling numbers of the current sampling ray is not empty, read the response normal unit vector of the ray sampling point corresponding to the integer candidate boundary radius position of the current sampling ray as the candidate boundary response normal unit vector; when the set of valid sampling numbers of the current sampling ray is empty, read the radial unit vector of the angular sampling position corresponding to the current sampling ray as the candidate boundary response normal unit vector.
[0059] All subpixel boundary radii are arranged in angular order to form a sequence of angular candidate boundary radii.
[0060] Optionally, the diagonal candidate boundary radius sequence is subjected to closed-loop consistent solution to obtain a closed-loop boundary radius sequence, forming a closed aperture boundary curve, specifically including:
[0061] Connect the first angular sampling position to the last angular sampling position, so that the angular sampling position before the first angular sampling position corresponds to the last angular sampling position, and the angular sampling position after the last angular sampling position corresponds to the first angular sampling position, thus forming the periodic boundary condition of the closed-loop boundary radius sequence to be determined.
[0062] For each angular sampling position, calculate the difference between the radius of the closed-loop boundary to be determined at the current angular sampling position and the radius of the candidate angular boundary corresponding to the current angular sampling position. Square the difference and divide it by the square of the radius of the candidate angular boundary corresponding to the current angular sampling position. Accumulate the difference over all angular sampling positions to form the radius deviation term in the closed-loop consistency function.
[0063] For each angular sampling position, calculate the difference between the radius of the closed-loop boundary to be determined at the next angular sampling position and the radius of the closed-loop boundary to be determined at the previous angular sampling position. Divide the difference by twice the angular sampling interval. Then, combine the result of dividing the difference by twice the angular sampling interval with the tangential unit vector of the current angular sampling position, and combine it with the radius of the closed-loop boundary to be determined at the current angular sampling position and the radial unit vector of the current angular sampling position to form the boundary tangential correlation vector. Then, divide the square of the projection of the boundary tangential correlation vector onto the normal unit vector of the candidate boundary response corresponding to the current angular sampling position by the normalization term formed by the square of the radius of the closed-loop boundary to be determined at the current angular sampling position and the square of the result of dividing the difference by twice the angular sampling interval. Accumulate this normalization term over all angular sampling positions to form the tangential consistency term in the closed-loop consistency function.
[0064] Add the radius deviation term and the tangential consistency term to form the closed-loop consistency function. Then, within the range where the radius of the closed-loop boundary to be determined at each angular sampling position is greater than zero and less than the maximum effective sampling number of the sampling ray corresponding to the current angular sampling position and the maximum value of the two, perform a minimum search on the closed-loop consistency function to obtain the closed-loop boundary radius sequence.
[0065] When the closed-loop consensus function has multiple local minima, first select the closed-loop boundary radius sequence with the smallest sum of closed-loop boundary radii; when the sum of closed-loop boundary radii is the same, then compare the radius components of each closed-loop boundary radius sequence at each angular sampling position in angular order, and select the closed-loop boundary radius sequence with the smaller radius component value at the angular sampling position where the first difference occurs.
[0066] The closed-loop boundary radius of each angular sampling position is calculated by extending the radial unit vector corresponding to each angular sampling position outward from the orifice response center, and the orifice boundary point is obtained.
[0067] Connect all the orifice boundary points in angular order to form a closed orifice boundary curve.
[0068] Optionally, the step of establishing a proportional scale based on the correspondence between the actual length and the image length, and calculating the orifice perimeter, orifice area, minimum flow width, and corner radius, specifically includes:
[0069] Obtain the true length of the reference edge and its pixel length in the image, and divide the true length of the reference edge by its pixel length in the image to calculate the scale.
[0070] Connect adjacent orifice boundary points in angular order, and connect the last orifice boundary point with the first orifice boundary point to form a closed orifice boundary point column and the corresponding orifice boundary polyline segment column;
[0071] The Euclidean distances between all adjacent aperture boundary points are summed piece by piece to calculate the aperture perimeter in pixel dimension. Then, the aperture perimeter in pixel dimension is multiplied by the scale to calculate the aperture perimeter in millimeter dimension.
[0072] For each pair of adjacent orifice boundary points in the closed orifice boundary point sequence, the previous orifice boundary point is taken as the current orifice boundary point, and the next orifice boundary point is taken as the next orifice boundary point. The product of the x-coordinate of the current orifice boundary point and the y-coordinate of the next orifice boundary point is calculated, and the product of the x-coordinate of the next orifice boundary point and the y-coordinate of the current orifice boundary point is subtracted. All differences are accumulated in angular order and half of the absolute value is taken to calculate the orifice area in pixel dimension. Then, the orifice area in pixel dimension is multiplied by the square of the scale to calculate the orifice area in square millimeters dimension.
[0073] For any orifice boundary point, this orifice boundary point is taken as the current orifice boundary point. First, calculate the product of the closed-loop boundary radius corresponding to the angular sampling position of the current orifice boundary point and the radial unit vector corresponding to the angular sampling position of the current orifice boundary point. Then, calculate the product of the difference between the closed-loop boundary radius corresponding to the next angular sampling position of the current orifice boundary point and the closed-loop boundary radius corresponding to the previous angular sampling position of the current orifice boundary point, divided by twice the angular sampling interval, and the product of this product and the tangential unit vector corresponding to the angular sampling position of the current orifice boundary point. Subtract the next product from the previous product to form the geometric normal vector corresponding to the current orifice boundary point. When the magnitude of the geometric normal vector is greater than zero, normalize the geometric normal vector to obtain the geometric normal unit vector. When the magnitude of the geometric normal vector is equal to zero, use the radial unit vector corresponding to the angular sampling position of the current orifice boundary point as the geometric normal unit vector.
[0074] For any orifice boundary point, this orifice boundary point is taken as the current orifice boundary point. A straight line is established along the geometric normal unit vector of the current orifice boundary point. The intersection points of the straight line and the remaining orifice boundary polyline segments except for the two adjacent orifice boundary polyline segments of the current orifice boundary point are calculated. Orifice boundary polyline segments parallel to the straight line are eliminated. The directed distances from the current orifice boundary point to each intersection point are used to form an intersection distance set. The minimum intersection distance is selected from all non-empty intersection distance sets and multiplied by the scale to calculate the minimum flow width. When all intersection distance sets are empty, the minimum flow width is set to zero.
[0075] For any orifice boundary point in the closed orifice boundary point sequence, this orifice boundary point is designated as the current orifice boundary point. The preceding orifice boundary point in the sequence is designated as the previous orifice boundary point, and the following orifice boundary point is designated as the next orifice boundary point. If the connection vectors between the current and previous orifice boundary points and between the current and next orifice boundary points are not collinear, the distances between these three distances are calculated: the distance between the current and previous orifice boundary points, the distance between the current and next orifice boundary points, and the distance between the previous and next orifice boundary points. The product of these three distances is then divided by the distances between the current and previous orifice boundary points and between the current and next orifice boundary points. The fillet radius of the current orifice boundary point is calculated by multiplying the absolute value of the cross product of the quantities. When the connection vectors between the current and previous orifice boundary points and between the current and next orifice boundary points are collinear, the fillet radius of the current orifice boundary point is set to infinity. When the fillet radius of the current orifice boundary point is a finite value, and is no greater than or equal to the fillet radius of the previous orifice boundary point, and is also no greater than the fillet radius of the next orifice boundary point, the fillet radius of the current orifice boundary point is included in the corner fillet radius set. When no fillet radius satisfies the conditions, the corner fillet radius set is set to empty. When a fillet radius satisfies the conditions, the fillet radii in the corner fillet radius set are multiplied by the scale to calculate the corner fillet radius in millimeters.
[0076] The present invention has the following beneficial effects:
[0077] 1. By establishing a measurement coordinate system on the orifice image plane, cropping a single orifice image window, and retaining the reference edge, all subsequent calculations are confined to a unified coordinate system and a controlled field of view. This avoids misjudgments caused by interference from other orifices, textures, oil stains, etc., in the entire mold image. Simultaneously, retaining the reference edge provides a natural data source for scale conversion, reducing the impact of additional calibration plates or repetitive calibration actions on the on-site cycle time. This solution combines the separation of the measurement object and the retention of scale references into a single operation, improving the repeatability of the process and reducing boundary deviations caused by cropping offsets.
[0078] 2. A ring-shaped light source is used to partition the image into azimuth zones and acquire grayscale images sequentially. These are then used to form a standardized grayscale image sequence. The illumination direction is introduced as a controllable variable into the measurement process, so that boundary information no longer depends solely on the intensity difference of a single image, but rather on the response changes under multi-directional illumination. Standardization reduces amplitude inconsistencies caused by light source brightness fluctuations, camera exposure drift, and differences in surface reflection, making the sequences comparable. This scheme can suppress false edges caused by local highlights, shadows, and textures on highly reflective metal surfaces; it achieves intensity uniformity at each azimuth image level, directly improving the stability of subsequent directional responses.
[0079] 3. Calculate the azimuth harmonic response components, response amplitude, and response phase for each pixel, and establish the nearest pixel mapping and response amplitude expansion. Then, calculate the aperture response center, transforming the multi-azimuth illumination sequence into a directional response field. This ensures a stable center reference even when boundaries are unclear or aperture shapes are irregular. The response phase provides boundary direction information, and the response amplitude provides boundary saliency information. The combination of these two provides a better distinction between true boundaries and reflective pseudo-boundaries than traditional gradient amplitude. The nearest pixel mapping and amplitude expansion enable stable response intensity readings even at sub-pixel or continuous coordinates, avoiding sampling discontinuities caused by non-integer coordinates. This scheme does not rely on binary segmentation quality and can obtain a reliable center even when there is uneven grayscale inside the aperture or local occlusion, providing a consistent benchmark for subsequent angular sampling.
[0080] 4. Establish an angular sampling sequence around the orifice response center, and construct radial unit vectors, tangential unit vectors, and sampling rays to transform boundary search from global pixel traversal to structured ray tracing with the center as the anchor point. This structured sampling ensures that each angular sampling position corresponds to a clear boundary search path, facilitating the organization of boundary points into a consistent closed-loop sequence, laying the data structure foundation for subsequent consistent closed-loop solutions. This scheme naturally avoids tracking failures caused by contour breaks and reduces the probability of background edge interference entering the main contour; it does not presuppose that the orifice is circular or a regular curve, and is still applicable to complex orifice shapes, boundaries with notches, or multi-segment curves. In real-world applications, orifices often have local gaps or burrs; ray sampling allows for candidate boundary evidence in every direction, making the overall contour easier to complete and more controllable.
[0081] 5. Construct a response normal unit vector at the ray sampling point, calculate the directional response difference, and obtain integer candidate boundary radii by scanning along the ray. Use the normal direction obtained from the response phase to define the boundary criterion, transforming boundary detection from a simple intensity threshold to a comparative measurement with consistent direction. The directional response difference extracts the boundary position by utilizing the response difference on both sides of the normal, making it less sensitive to uneven illumination and overall grayscale drift, and also suppressing non-boundary intensity fluctuations caused by texture. This scheme locks the comparison direction to the normal direction, reducing false detections caused by tangential textures and machining marks; it does not require a constant grayscale difference inside and outside the hole, making it more suitable for metal reflective conditions.
[0082] 6. Subpixel correction is performed on integer candidate boundary radii, and the value range is corrected. Simultaneously, the normal unit vector of the candidate boundary response is obtained, forming an angular candidate boundary radius sequence. Integer-level scanning is first used to ensure reliable boundary landing points, followed by subpixel-level correction within the candidate neighborhood to improve accuracy. Range correction suppresses anomalous jumps. This avoids getting bogged down in local noise when directly performing subpixel optimization and achieves finer boundary radius resolution without introducing complex fitting models. The correction in this scheme is based on the local morphology of the directional response difference, more closely reflecting the true trend of boundary response changes. Limiting the correction to the candidate neighborhood reduces detail loss caused by excessive smoothing. In reality, burrs and gaps exist at the edge of the aperture, and integer candidates may exhibit local offsets. Range correction and serialization organization can reduce the damage of outliers to the overall boundary, improving measurement repeatability and stability.
[0083] 7. A closed-loop consistent solution is performed on the candidate boundary radius sequence in each diagonal direction to obtain a closed-loop boundary radius sequence and form a closed orifice boundary curve. A closed-loop periodic constraint and consistency criterion are introduced, and the candidate results for each diagonal direction are comprehensively evaluated within the same closed-loop framework, thereby automatically eliminating discontinuities caused by local noise, missing edges, or false detections. This scheme uses closure as a hard constraint during the solution phase, ensuring that the final boundary is naturally closed and consistent in sequence; it preserves the physical meaning of each diagonal direction, avoiding systematic biases caused by model mismatch. In real-world applications, local occlusion or reflection at the orifice may render certain candidate directions unreliable. The closed-loop consistent solution can bring these directions back to a reasonable range through neighborhood consistency and overall closure, improving the measurability and consistency of results for complex orifice types.
[0084] 8. Establish a proportional scale and calculate the orifice perimeter, orifice area, minimum flow width, and corner radius. Use the closed orifice boundary curve as a unified geometric carrier to output multiple key quality indicators at once, and complete the millimeter-scale conversion based on the same scale to avoid contradictions caused by using different measurement benchmarks for different indicators. In particular, the minimum flow width and corner radius are the most sensitive and difficult indicators to extract stably in complex orifice types. This solution is calculated based on the structured relationship between the boundary normal and the boundary point series, which is more stable and repeatable than traditional manual measurement or local intercept methods. This solution can directly address real needs such as extrusion flow rate, stress concentration, and life assessment; it suppresses abnormal corner points through adjacent point relationships and set screening, reducing false small rounded corners caused by burrs and broken lines. Attached Figure Description
[0085] Figure 1 This is a schematic diagram of the process of the present invention.
[0086] Figure 2 This is a schematic diagram of the image coordinate system and single-aperture cropping window of the present invention.
[0087] Figure 3 This is a schematic diagram of the ring light source partitioning acquisition and grayscale standardization process of the present invention.
[0088] Figure 4 This is a schematic diagram of the process for calculating the directional response and determining the orifice response center in this invention. Detailed Implementation
[0089] 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.
[0090] Example, refer to Figure 1 A machine vision-based method for measuring the geometric parameters of aluminum extrusion die pass, comprising:
[0091] Establish a measurement coordinate system on the orifice image plane, extract a single orifice image window, and retain the reference edge within the image window;
[0092] The ring light source is divided into azimuth zones, grayscale images are acquired sequentially, and a standardized grayscale image sequence is formed.
[0093] Calculate the azimuth harmonic response components, response amplitude, and response phase for each pixel within the image window; establish the nearest pixel mapping and response amplitude expansion for the real coordinate points; and calculate the orifice response center.
[0094] Establish an angular sampling sequence around the orifice response center, and construct the radial unit vector, tangential unit vector, and sampling ray corresponding to each angular sampling position;
[0095] For each ray sampling point, construct a response normal unit vector, calculate the directional response difference, and scan along the sampling ray to obtain the integer candidate boundary radius;
[0096] Sub-pixel correction is performed on the integer candidate boundary radii of each sampled ray to correct the range of boundary radius values, obtain the normal unit vector of the candidate boundary response, and form a sequence of angular candidate boundary radii;
[0097] Perform closed-loop consistent solution on the candidate boundary radius sequence diagonally to obtain the closed-loop boundary radius sequence and form the closed orifice boundary curve;
[0098] Establish a scale based on the correspondence between the actual length and the image length, and calculate the orifice perimeter, orifice area, minimum flow width, and corner radius.
[0099] By establishing a measurement coordinate system on the orifice image plane and capturing a single orifice image window while preserving the reference edge, and combining multiple grayscale acquisitions and standardization processing of the ring light source azimuth partition, pixel-level directional response information is further calculated to obtain the orifice response center. Subsequently, angular sampling sequences, radial and tangential directions, and sampling rays are constructed around this response center. Then, response normals are constructed on the rays, and directional response differences are calculated to obtain integer candidate boundary radii. Sub-pixel correction is then performed on the candidate boundary radii to form an angular candidate boundary radius sequence. Finally, a closed-loop consistent solution is used to form a closed orifice boundary curve and establish a proportional scale to output the perimeter, area, minimum flow width, and corner radius. This solves the problems of false edges, edge breaks, non-closed contours, and inconsistent scales that are easily encountered in traditional single-image threshold segmentation or single-step edge detection on highly reflective metal surfaces. The directional response brought by multi-directional illumination improves the stability of boundary evidence; structured ray sampling with the response center as the anchor point reduces interference from background texture and adjacent apertures; sub-pixel correction and closed-loop consistency constraints jointly suppress boundary jumps caused by local noise and gaps, making the output geometry more repeatable and consistent, which is convenient for quality inspection and process control.
[0100] Reference Figure 2 The step of establishing a measurement coordinate system on the orifice image plane, capturing a single orifice image window, and retaining the reference edge within the image window specifically includes:
[0101] Establish a rectangular coordinate system on the image plane of the orifice, set the center of the image window as the origin, set the direction of increasing the image column number as the positive horizontal direction, and set the direction of decreasing the image row number as the positive vertical direction;
[0102] Represent any point within the image window using pixel x-coordinate and pixel y-coordinate;
[0103] Obtain the cutting center of the target opening, and obtain the nominal maximum lateral dimension, nominal maximum longitudinal dimension, and the width of the outer continuous metal plane to be retained of the target opening;
[0104] Set the width of the single-aperture image window to the sum of the nominal maximum horizontal size and twice the width of the outer continuous metal plane, and set the height of the single-aperture image window to the sum of the nominal maximum vertical size and twice the width of the outer continuous metal plane.
[0105] Using the cropping center as the window center, an image window containing only one target hole is cropped from the entire mold image;
[0106] Count the total number of pixels within the image window;
[0107] Retain a reference edge of known true length within the image window, and obtain the true length of the reference edge and its pixel length in the image.
[0108] Establish a rectangular coordinate system on the image plane of the orifice. Among them, point Center the image window; The positive axis direction is the direction in which the image column number increases; The positive axis direction is the direction in which the image row number decreases;
[0109] Let the coordinates of any pixel point be... ;
[0110] For the entire mold image Perform local region cropping:
[0111] First, obtain the cutting center of the target aperture. Then, based on the nominal maximum lateral dimension of the target aperture... Nominal maximum longitudinal dimension and the outer continuous metal plane retains the edge width Construct the width of the single-aperture image window and height and in accordance with Extract an image window containing only one target orifice from the entire mold image. ;
[0112] Get the total number of pixels within the image window, denoted as ;
[0113] A reference edge of known true length is retained within the image window; the true length is denoted as . The corresponding image length is denoted as ;in, The actual length of the reference edge; This represents the pixel length of the same reference edge in the image.
[0114] Reference Figure 3 The step of performing azimuth partitioning on the ring light source, sequentially acquiring grayscale images, and forming a standardized grayscale image sequence specifically includes:
[0115] The ring light source is divided into a preset number of azimuth zones, and each azimuth zone is arranged circumferentially according to the angular intervals after the division of the whole circumference.
[0116] With the camera's line of sight remaining unchanged, each azimuth zone is illuminated sequentially, and the corresponding grayscale images are acquired to form the original image sequence.
[0117] For each original image, the sum of the original gray levels of all pixels within the image window is counted, and the sum of the original gray levels is divided by the total number of pixels within the image window to calculate the mean gray level of the current original image.
[0118] For each pixel in each original image, when the original gray level of the current pixel is greater than zero, the original gray level of the current pixel is divided by the mean gray level of the current original image to obtain the standardized gray level of the current pixel.
[0119] For each pixel in each original image, when the original gray level of the current pixel is equal to zero, the normalized gray level of the current pixel is set to zero, forming a normalized gray level image sequence.
[0120] The ring light source is divided into The nth directional partition, then the nth The azimuth angles of each azimuth zone are: , ;in, The total number of azimuth zones after the ring light source is divided; Discrete number index for azimuth partitions; For the first The angular positions corresponding to each directional lighting zone;
[0121] Each directional zone is illuminated sequentially, and grayscale images are acquired while keeping the camera's line of sight constant, resulting in the original image sequence: , ;in, For the first When each directional zone is lit, the pixel The corresponding original grayscale value;
[0122] Perform mean normalization on each original image to obtain a standardized grayscale image: ;in, For the first Each orientation image at pixel points The standardized grayscale value at the location; For image window An integer pixel within; For the first Each orientation image at pixel points The original grayscale value at that location.
[0123] Reference Figure 4 The calculation of the azimuth harmonic response components, response amplitude, and response phase for each pixel within the image window, the establishment of the nearest pixel mapping and response amplitude expansion for the real coordinate points, and the calculation of the aperture response center specifically include:
[0124] For each pixel in the image window, the standardized gray level corresponding to each azimuth partition is multiplied by the cosine value of the azimuth angle of each azimuth partition, and then accumulated over all azimuth partitions to calculate the cosine response component of the current pixel.
[0125] For each pixel in the image window, the standardized gray level corresponding to each azimuth partition is multiplied by the sine value of the azimuth angle of each azimuth partition, and then accumulated over all azimuth partitions to calculate the sinusoidal response component of the current pixel.
[0126] For each pixel in the image window, the cosine response component and the sine response component are squared and summed. Then, the square root of the sum is taken to calculate the response amplitude of the current pixel.
[0127] For each pixel in the image window, the sinusoidal and cosine response components are used as inputs to the two-parameter arctangent function to calculate the response phase of the current pixel in the corresponding quadrant.
[0128] For any real coordinate point, round the horizontal and vertical coordinates of the real coordinate point to obtain the nearest pixel mapping result;
[0129] When the most recent pixel mapping result is within the image window, the response amplitude of the corresponding pixel is read and used as the response amplitude extension value of the real coordinate point; when the most recent pixel mapping result is outside the image window, the response amplitude extension value of the real coordinate point is set to zero.
[0130] Multiply the coordinates of each pixel in the image window by the corresponding response amplitude and accumulate them, then divide them by the sum of all response amplitudes to calculate the horizontal and vertical coordinates of the orifice response center; when the sum of all response amplitudes is zero, the orifice response center is taken as the origin of the coordinate system.
[0131] For image window Each pixel The first-order azimuth harmonic response vector is calculated as follows: ;in, For pixels The first-order azimuth harmonic response vector; For pixels The cosine response component; For pixels The sinusoidal response components; For the first Azimuth The cosine value; No. Azimuth The sine value;
[0132] The response amplitude and response phase are calculated based on the harmonic response vector, specifically as follows: , ;in, For pixels The response amplitude; For pixels The response phase; It is a two-parameter arctangent function, with the input being the longitudinal and lateral components, and the output angle located in the correct quadrant;
[0133] For any real coordinate point Construct the nearest pixel mapping function and the response magnitude expansion function, specifically as follows: , ;in, real coordinate point The nearest pixel mapping result; This is a rounding function; real coordinate point The amplitude expansion value of the response;
[0134] The response center is constructed as follows: ;in, It serves as the orifice response center.
[0135] The step of establishing an angular sampling sequence around the orifice response center, and constructing the radial unit vector, tangential unit vector, and sampling ray corresponding to each angular sampling position, specifically includes:
[0136] Set the total number of angular samples to four times the total number of azimuth partitions, arrange the angular sampling positions along the circumference according to the angular intervals after dividing the circumference into integer angles, and assign a corresponding sampling angle to each angular sampling position to form an angular sampling sequence.
[0137] For each angular sampling position, construct the corresponding radial unit vector using the cosine and sine values of the sampling angle corresponding to the current angular sampling position;
[0138] For each angular sampling position, construct a tangential unit vector using the orthogonal direction of the radial unit vector corresponding to the current angular sampling position;
[0139] Starting from the center of the orifice response, samples are taken outwards along the radial unit vector corresponding to the current angular sampling position in steps of one pixel.
[0140] For each sampled horizontal and vertical coordinate, rounding is performed to obtain the corresponding integer pixel sampling point;
[0141] Collect all integer pixel sampling points corresponding to each angular sampling position in circumferential order to form sampling rays corresponding to each angular sampling position, and collect them to form a ray sampling point set.
[0142] Take the number of samples in the corner And establish the angular sampling sequence as follows: , ;in, This represents the total number of samples taken in the angular direction. For the first The sampling angles in the sampling direction; For angular sampling index;
[0143] For each sampling angle The radial and tangential unit vectors are constructed as follows: , ;in, For the first A radial unit vector in the angular sampling direction; To and Orthogonal tangential unit vectors;
[0144] From the response center Along direction By incrementally sampling unit by unit, the sampling points on the ray are obtained as follows: ;in, For the first The first sampling ray Integer pixel sampling points; The sampling sequence number; In response to the center The x-axis component; In response to the center The ordinate component.
[0145] The process of constructing a response normal unit vector for each ray sampling point, calculating the directional response difference, and obtaining integer candidate boundary radii by scanning along the sampling ray specifically includes:
[0146] For each ray sampling point located within the image window, read the response phase of the current ray sampling point, and use the cosine and sine values of the response phase of the current ray sampling point as the horizontal and vertical components, respectively, to construct the response normal unit vector of the current ray sampling point.
[0147] For each sampling ray, check each sampling point on the current sampling ray from the orifice response center outwards. When the current sampling point, the position offset by half a pixel in the positive direction of the response normal unit vector of the current sampling point, and the position offset by half a pixel in the negative direction of the response normal unit vector of the current sampling point are all within the image window, the corresponding sampling number is included in the set of valid sampling numbers of the current sampling ray.
[0148] For each sampling ray, the largest non-negative integer sampling number in the set of valid sampling numbers of the current sampling ray is selected as the largest valid sampling number of the current sampling ray;
[0149] When the set of valid sampling numbers of the current sampling ray is not empty, within the range from zero to the maximum valid sampling number of the current sampling ray, for each sampling number, read the response amplitude expansion value of the sampling point corresponding to the current sampling number by shifting half a pixel in the positive direction along the unit vector of the response normal of the current sampling number, and subtract the response amplitude expansion value of the sampling point corresponding to the current sampling number by shifting half a pixel in the negative direction along the unit vector of the response normal of the current sampling number, and calculate the orientation response difference at the current sampling number;
[0150] When the set of valid sampling numbers for the current sampling ray is empty, the maximum valid sampling number of the current sampling ray is set to zero, and the directional response difference corresponding to each sampling number of the current sampling ray is set to zero.
[0151] When the maximum effective sampling number of the current sampling ray is not less than two, the scanning starts from the sampling number and proceeds outward along the sampling ray. Within the range not exceeding the position before the maximum effective sampling number of the current sampling ray, the sampling position corresponding to the largest absolute value of the orientation response difference is selected as the integer candidate boundary radius.
[0152] When the maximum valid sampling number of the current sampled ray is less than two, the integer candidate boundary radius is set to zero.
[0153] For each satisfied sampling points The response normal unit vector is constructed from the response phase, specifically as follows: ;in, For the first The sampling rays The normal unit vector of the response at each sampling point; Sampling points The response phase;
[0154] For the first A sampling ray is selected, satisfying: , and The largest non-negative integer sample number is denoted as ;in, For the first The maximum valid sampling sequence number of the sampling rays;
[0155] When there exists a non-negative integer sampling sequence number that meets the condition, in the interval The internally constructed directional response difference function is as follows: ;in, For the first The sampling rays in the first The difference in directional response at each sampling number; The extended response amplitude at the positive half-pixel offset point; The extended response magnitude at the inverse half-pixel offset point;
[0156] When no non-negative integer sampling number meets the condition, take And take ;
[0157] when At that time, along the first A sampling ray from The scanning proceeds outwards in an incremental fashion, and the position where the absolute orientation response difference reaches its maximum is taken as the candidate boundary radius. Specifically: ;in, For the first Integer candidate boundary radius of each sampled ray;
[0158] when At that time, take .
[0159] The sub-pixel correction is performed on the integer candidate boundary radii of each sampled ray to correct the range of boundary radius values, obtain the candidate boundary response normal unit vector, and form an angular candidate boundary radius sequence, specifically including:
[0160] When the maximum effective sampling number of the current sampling ray is not less than two, the directional response difference is read at the left adjacent position of the integer candidate boundary radius of the current sampling ray, the integer candidate boundary radius of the current sampling ray, and the right adjacent position of the integer candidate boundary radius of the current sampling ray, respectively.
[0161] When the result of subtracting the right neighbor position orientation response difference from the left neighbor position orientation response difference is not zero, and the result of subtracting twice the position orientation response difference of the integer candidate boundary radius of the current sampled ray from the left neighbor position orientation response difference and adding the right neighbor position orientation response difference is not zero, the result of subtracting the right neighbor position orientation response difference from the left neighbor position orientation response difference is used as the correction numerator, and the result of subtracting twice the position orientation response difference of the integer candidate boundary radius of the current sampled ray and adding the right neighbor position orientation response difference is multiplied by two to use as the correction denominator. The correction numerator is divided by the correction denominator and added to the integer candidate boundary radius of the current sampled ray to calculate the sub-pixel boundary radius.
[0162] When the maximum effective sampling number of the current sampling ray is not less than two, and the result of subtracting twice the integer candidate boundary radius position orientation response difference of the current sampling ray from the left neighbor position orientation response difference and adding the right neighbor position orientation response difference equals zero, the subpixel boundary radius is taken as the integer candidate boundary radius of the current sampling ray.
[0163] When the maximum effective sampling number of the current sampling ray is less than two, the sub-pixel boundary radius is set to half a pixel;
[0164] When the subpixel boundary radius is less than half a pixel, the subpixel boundary radius is corrected to half a pixel; when the subpixel boundary radius is greater than the maximum effective sampling number of the current sampling ray minus the maximum value of half a pixel and half a pixel, the subpixel boundary radius is corrected to the maximum effective sampling number of the current sampling ray minus the maximum value of half a pixel and half a pixel.
[0165] When the set of valid sampling numbers of the current sampling ray is not empty, read the response normal unit vector of the ray sampling point corresponding to the integer candidate boundary radius position of the current sampling ray as the candidate boundary response normal unit vector; when the set of valid sampling numbers of the current sampling ray is empty, read the radial unit vector of the angular sampling position corresponding to the current sampling ray as the candidate boundary response normal unit vector.
[0166] All subpixel boundary radii are arranged in angular order to form a sequence of angular candidate boundary radii.
[0167] when At that time, within the radius , , The directional response difference is taken at three locations, and the sub-pixel radius is calculated using the vertex of a quadratic parabola, specifically as follows:
[0168] S601, when and season: ;in, For the first The subpixel boundary radius of the sampling ray; The difference in orientation response at the left neighbor position of the integer candidate boundary radius; The difference in orientation response at integer candidate boundary radius locations; The difference in orientation response at the right neighbor position of the integer candidate boundary radius;
[0169] S602, when and season: ;
[0170] when At that time, take ;
[0171] when and Less than At that time, take ;
[0172] when and Greater than At that time, take: ;
[0173] Candidate boundary response normal is taken as: ;in, For the first The response normal unit vector of each candidate boundary point; For the first The sampling ray at the integer candidate boundary radius The response normal unit vector at that location;
[0174] All In angular order Arrange them to form a sequence of angular candidate boundary radii.
[0175] The diagonal candidate boundary radius sequence is subjected to closed-loop consistent solution to obtain a closed-loop boundary radius sequence, which forms a closed orifice boundary curve, specifically including:
[0176] Connect the first angular sampling position to the last angular sampling position, so that the angular sampling position before the first angular sampling position corresponds to the last angular sampling position, and the angular sampling position after the last angular sampling position corresponds to the first angular sampling position, thus forming the periodic boundary condition of the closed-loop boundary radius sequence to be determined.
[0177] For each angular sampling position, calculate the difference between the radius of the closed-loop boundary to be determined at the current angular sampling position and the radius of the candidate angular boundary corresponding to the current angular sampling position. Square the difference and divide it by the square of the radius of the candidate angular boundary corresponding to the current angular sampling position. Accumulate the difference over all angular sampling positions to form the radius deviation term in the closed-loop consistency function.
[0178] For each angular sampling position, calculate the difference between the radius of the closed-loop boundary to be determined at the next angular sampling position and the radius of the closed-loop boundary to be determined at the previous angular sampling position. Divide the difference by twice the angular sampling interval. Then, combine the result of dividing the difference by twice the angular sampling interval with the tangential unit vector of the current angular sampling position, and combine it with the radius of the closed-loop boundary to be determined at the current angular sampling position and the radial unit vector of the current angular sampling position to form the boundary tangential correlation vector. Then, divide the square of the projection of the boundary tangential correlation vector onto the normal unit vector of the candidate boundary response corresponding to the current angular sampling position by the normalization term formed by the square of the radius of the closed-loop boundary to be determined at the current angular sampling position and the square of the result of dividing the difference by twice the angular sampling interval. Accumulate this normalization term over all angular sampling positions to form the tangential consistency term in the closed-loop consistency function.
[0179] Add the radius deviation term and the tangential consistency term to form the closed-loop consistency function. Then, within the range where the radius of the closed-loop boundary to be determined at each angular sampling position is greater than zero and less than the maximum effective sampling number of the sampling ray corresponding to the current angular sampling position and the maximum value of the two, perform a minimum search on the closed-loop consistency function to obtain the closed-loop boundary radius sequence.
[0180] When the closed-loop consensus function has multiple local minima, first select the closed-loop boundary radius sequence with the smallest sum of closed-loop boundary radii; when the sum of closed-loop boundary radii is the same, then compare the radius components of each closed-loop boundary radius sequence at each angular sampling position in angular order, and select the closed-loop boundary radius sequence with the smaller radius component value at the angular sampling position where the first difference occurs.
[0181] The closed-loop boundary radius of each angular sampling position is calculated by extending the radial unit vector corresponding to each angular sampling position outward from the orifice response center, and the orifice boundary point is obtained.
[0182] Connect all the orifice boundary points in angular order to form a closed orifice boundary curve.
[0183] Periodicity condition: , ;in, The sequence of closed-loop boundary radii is to be determined. For the first The radius of the closed-loop boundary at each angular sampling position;
[0184] Construct the closed-loop consistent function as follows: ;in, It is a closed-loop consistent function; and The dot product represents the projection of the boundary tangential correlation vector onto the response normal direction;
[0185] Set the closed-loop boundary radius sequence as a closed-loop consistent function In the feasible region The minimum point on the surface is specifically: ;
[0186] When the minimum point is not unique, first take the one that makes the minimum point unique. The smallest local minimum; when If they are still the same, take the order. The smallest local point in lexicographical order;
[0187] The lexicographically smallest order is used for comparison first. If they are the same, then compare them. And so on, selecting the sequence that first appears with the smaller component;
[0188] The orifice boundary points are calculated based on the closed-loop boundary radius sequence, specifically as follows: , ;in, For the first One orifice boundary point;
[0189] Connect all boundary points in angular order. Forming a closed orifice boundary curve ;in, This is the boundary curve of a closed orifice.
[0190] The process of establishing a proportional scale based on the correspondence between the actual length and the image length, and calculating the orifice perimeter, orifice area, minimum flow width, and corner radius, specifically includes:
[0191] Obtain the true length of the reference edge and its pixel length in the image, and divide the true length of the reference edge by its pixel length in the image to calculate the scale.
[0192] Connect adjacent orifice boundary points in angular order, and connect the last orifice boundary point with the first orifice boundary point to form a closed orifice boundary point column and the corresponding orifice boundary polyline segment column;
[0193] The Euclidean distances between all adjacent aperture boundary points are summed piece by piece to calculate the aperture perimeter in pixel dimension. Then, the aperture perimeter in pixel dimension is multiplied by the scale to calculate the aperture perimeter in millimeter dimension.
[0194] For each pair of adjacent orifice boundary points in the closed orifice boundary point sequence, the previous orifice boundary point is taken as the current orifice boundary point, and the next orifice boundary point is taken as the next orifice boundary point. The product of the x-coordinate of the current orifice boundary point and the y-coordinate of the next orifice boundary point is calculated, and the product of the x-coordinate of the next orifice boundary point and the y-coordinate of the current orifice boundary point is subtracted. All differences are accumulated in angular order and half of the absolute value is taken to calculate the orifice area in pixel dimension. Then, the orifice area in pixel dimension is multiplied by the square of the scale to calculate the orifice area in square millimeters dimension.
[0195] For any orifice boundary point, this orifice boundary point is taken as the current orifice boundary point. First, calculate the product of the closed-loop boundary radius corresponding to the angular sampling position of the current orifice boundary point and the radial unit vector corresponding to the angular sampling position of the current orifice boundary point. Then, calculate the product of the difference between the closed-loop boundary radius corresponding to the next angular sampling position of the current orifice boundary point and the closed-loop boundary radius corresponding to the previous angular sampling position of the current orifice boundary point, divided by twice the angular sampling interval, and the product of this product and the tangential unit vector corresponding to the angular sampling position of the current orifice boundary point. Subtract the next product from the previous product to form the geometric normal vector corresponding to the current orifice boundary point. When the magnitude of the geometric normal vector is greater than zero, normalize the geometric normal vector to obtain the geometric normal unit vector. When the magnitude of the geometric normal vector is equal to zero, use the radial unit vector corresponding to the angular sampling position of the current orifice boundary point as the geometric normal unit vector.
[0196] For any orifice boundary point, this orifice boundary point is taken as the current orifice boundary point. A straight line is established along the geometric normal unit vector of the current orifice boundary point. The intersection points of the straight line and the remaining orifice boundary polyline segments except for the two adjacent orifice boundary polyline segments of the current orifice boundary point are calculated. Orifice boundary polyline segments parallel to the straight line are eliminated. The directed distances from the current orifice boundary point to each intersection point are used to form an intersection distance set. The minimum intersection distance is selected from all non-empty intersection distance sets and multiplied by the scale to calculate the minimum flow width. When all intersection distance sets are empty, the minimum flow width is set to zero.
[0197] For any orifice boundary point in the closed orifice boundary point sequence, this orifice boundary point is designated as the current orifice boundary point. The preceding orifice boundary point in the sequence is designated as the previous orifice boundary point, and the following orifice boundary point is designated as the next orifice boundary point. If the connection vectors between the current and previous orifice boundary points and between the current and next orifice boundary points are not collinear, the distances between these three distances are calculated: the distance between the current and previous orifice boundary points, the distance between the current and next orifice boundary points, and the distance between the previous and next orifice boundary points. The product of these three distances is then divided by the distances between the current and previous orifice boundary points and between the current and next orifice boundary points. The fillet radius of the current orifice boundary point is calculated by multiplying the absolute value of the cross product of the quantities. When the connection vectors between the current and previous orifice boundary points and between the current and next orifice boundary points are collinear, the fillet radius of the current orifice boundary point is set to infinity. When the fillet radius of the current orifice boundary point is a finite value, and is no greater than or equal to the fillet radius of the previous orifice boundary point, and is also no greater than the fillet radius of the next orifice boundary point, the fillet radius of the current orifice boundary point is included in the corner fillet radius set. When no fillet radius satisfies the conditions, the corner fillet radius set is set to empty. When a fillet radius satisfies the conditions, the fillet radii in the corner fillet radius set are multiplied by the scale to calculate the corner fillet radius in millimeters.
[0198] Based on the actual length With image length The calculation scale is ;
[0199] Using closed boundary point array Calculate the circumference of the orifice. With orifice area Specifically: , ;in, For two adjacent boundary points and The Euclidean distance between them; , ;in, Boundary point The x-coordinate; Boundary point The ordinate;
[0200] Adjacent boundary points and Connect to form boundary polyline segments and take ;in, For boundary points and The first connection formed A boundary polyline segment; The number is the segment number, and the value range is... ;
[0201] For any boundary point First, calculate the geometric normal unit vector, specifically: ;in, For the first Geometric normal unit vectors at each boundary point;
[0202] Then along the geometric normal line Calculate the intersection set, specifically: ;in, This is the directed distance parameter along the geometrically normal line; For the first The set of intersection distances corresponding to each boundary point; For modulo operation;
[0203] Set minimum overcurrent width for: ;
[0204] When all When empty, take ;
[0205] For any boundary point The corner radius is:
[0206] S801, when season: ;in, For the first The fillet radius values corresponding to each boundary point;
[0207] S802, when season: ;
[0208] All satisfied , and of This constitutes the set of corner radius;
[0209] When there are no conditions that meet the requirements When the corner radius is empty, the set of corner radius is taken as an empty set.
[0210] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.
[0211] The above description is only a preferred embodiment of the present invention. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the technical principles of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A method for measuring the geometric parameters of the die pass of an aluminum extrusion mold based on machine vision, characterized in that, include: Establish a measurement coordinate system on the orifice image plane, extract a single orifice image window, and retain the reference edge within the image window; The ring light source is divided into azimuth zones, grayscale images are acquired sequentially, and a standardized grayscale image sequence is formed. Calculate the azimuth harmonic response components, response amplitude, and response phase for each pixel within the image window; establish the nearest pixel mapping and response amplitude expansion for the real coordinate points; and calculate the orifice response center. Establish an angular sampling sequence around the orifice response center, and construct the radial unit vector, tangential unit vector, and sampling ray corresponding to each angular sampling position; For each ray sampling point, construct a response normal unit vector, calculate the directional response difference, and scan along the sampling ray to obtain the integer candidate boundary radius; Sub-pixel correction is performed on the integer candidate boundary radii of each sampled ray to correct the range of boundary radius values, obtain the normal unit vector of the candidate boundary response, and form a sequence of angular candidate boundary radii; Perform closed-loop consistent solution on the candidate boundary radius sequence diagonally to obtain the closed-loop boundary radius sequence and form the closed orifice boundary curve; Establish a scale based on the correspondence between the actual length and the image length, and calculate the orifice perimeter, orifice area, minimum flow width, and corner radius.
2. The method for measuring the geometric parameters of aluminum extrusion die profiles based on machine vision according to claim 1, characterized in that, The step of establishing a measurement coordinate system on the orifice image plane, capturing a single orifice image window, and retaining the reference edge within the image window specifically includes: Establish a rectangular coordinate system on the image plane of the orifice, set the center of the image window as the origin, set the direction of increasing the image column number as the positive horizontal direction, and set the direction of decreasing the image row number as the positive vertical direction; Represent any point within the image window using pixel x-coordinate and pixel y-coordinate; Obtain the cutting center of the target opening, and obtain the nominal maximum lateral dimension, nominal maximum longitudinal dimension, and the width of the outer continuous metal plane to be retained of the target opening; Set the width of the single-aperture image window to the sum of the nominal maximum horizontal size and twice the width of the outer continuous metal plane, and set the height of the single-aperture image window to the sum of the nominal maximum vertical size and twice the width of the outer continuous metal plane. Using the cropping center as the window center, an image window containing only one target hole is cropped from the entire mold image; Count the total number of pixels within the image window; Retain a reference edge of known true length within the image window, and obtain the true length of the reference edge and its pixel length in the image.
3. The method for measuring the geometric parameters of aluminum extrusion die orifice based on machine vision according to claim 2, characterized in that, The process of performing azimuth partitioning on the ring light source, sequentially acquiring grayscale images, and forming a standardized grayscale image sequence specifically includes: The ring light source is divided into a preset number of azimuth zones, and each azimuth zone is arranged circumferentially according to the angular intervals after the division of the whole circumference. With the camera's line of sight remaining unchanged, each azimuth zone is illuminated sequentially, and the corresponding grayscale images are acquired to form the original image sequence. For each original image, the sum of the original gray levels of all pixels within the image window is counted, and the sum of the original gray levels is divided by the total number of pixels within the image window to calculate the mean gray level of the current original image. For each pixel in each original image, when the original gray level of the current pixel is greater than zero, the original gray level of the current pixel is divided by the mean gray level of the current original image to obtain the standardized gray level of the current pixel. For each pixel in each original image, when the original gray level of the current pixel is equal to zero, the normalized gray level of the current pixel is set to zero, forming a normalized gray level image sequence.
4. The method for measuring the geometric parameters of aluminum extrusion die orifice based on machine vision according to claim 3, characterized in that, The process of calculating the azimuth harmonic response components, response amplitude, and response phase for each pixel within the image window, establishing the nearest pixel mapping and response amplitude expansion for the real coordinate points, and calculating the aperture response center specifically includes: For each pixel in the image window, the standardized gray level corresponding to each azimuth partition is multiplied by the cosine value of the azimuth angle of each azimuth partition, and then accumulated over all azimuth partitions to calculate the cosine response component of the current pixel. For each pixel in the image window, the standardized gray level corresponding to each azimuth partition is multiplied by the sine value of the azimuth angle of each azimuth partition, and then accumulated over all azimuth partitions to calculate the sinusoidal response component of the current pixel. For each pixel in the image window, the cosine response component and the sine response component are squared and summed. Then, the square root of the sum is taken to calculate the response amplitude of the current pixel. For each pixel in the image window, the sinusoidal and cosine response components are used as inputs to the two-parameter arctangent function to calculate the response phase of the current pixel in the corresponding quadrant. For any real coordinate point, round the horizontal and vertical coordinates of the real coordinate point to obtain the nearest pixel mapping result; When the most recent pixel mapping result is within the image window, the response amplitude of the corresponding pixel is read and used as the response amplitude extension value of the real coordinate point; when the most recent pixel mapping result is outside the image window, the response amplitude extension value of the real coordinate point is set to zero. Multiply the coordinates of each pixel in the image window by the corresponding response amplitude and accumulate them, then divide them by the sum of all response amplitudes to calculate the horizontal and vertical coordinates of the orifice response center; when the sum of all response amplitudes is zero, the orifice response center is taken as the origin of the coordinate system.
5. The method for measuring the geometric parameters of aluminum extrusion die orifice based on machine vision according to claim 4, characterized in that, The step of establishing an angular sampling sequence around the orifice response center, and constructing the radial unit vector, tangential unit vector, and sampling ray corresponding to each angular sampling position, specifically includes: Set the total number of angular samples to four times the total number of azimuth partitions, arrange the angular sampling positions along the circumference according to the angular intervals after dividing the circumference into integer angles, and assign a corresponding sampling angle to each angular sampling position to form an angular sampling sequence. For each angular sampling position, construct the corresponding radial unit vector using the cosine and sine values of the sampling angle corresponding to the current angular sampling position; For each angular sampling position, construct a tangential unit vector using the orthogonal direction of the radial unit vector corresponding to the current angular sampling position; Starting from the center of the orifice response, samples are taken outwards along the radial unit vector corresponding to the current angular sampling position in steps of one pixel. For each sampled horizontal and vertical coordinate, rounding is performed to obtain the corresponding integer pixel sampling point; Collect all integer pixel sampling points corresponding to each angular sampling position in circumferential order to form sampling rays corresponding to each angular sampling position, and collect them to form a ray sampling point set.
6. The method for measuring the geometric parameters of aluminum extrusion die orifice based on machine vision according to claim 5, characterized in that, The process of constructing a response normal unit vector for each ray sampling point, calculating the directional response difference, and scanning along the sampling ray to obtain integer candidate boundary radii specifically includes: For each ray sampling point located within the image window, read the response phase of the current ray sampling point, and use the cosine and sine values of the response phase of the current ray sampling point as the horizontal and vertical components, respectively, to construct the response normal unit vector of the current ray sampling point. For each sampling ray, check each sampling point on the current sampling ray from the orifice response center outwards. When the current sampling point, the position offset by half a pixel in the positive direction of the response normal unit vector of the current sampling point, and the position offset by half a pixel in the negative direction of the response normal unit vector of the current sampling point are all within the image window, the corresponding sampling number is included in the set of valid sampling numbers of the current sampling ray. For each sampling ray, the largest non-negative integer sampling number in the set of valid sampling numbers of the current sampling ray is selected as the largest valid sampling number of the current sampling ray; When the set of valid sampling numbers of the current sampling ray is not empty, within the range from zero to the maximum valid sampling number of the current sampling ray, for each sampling number, read the response amplitude expansion value of the sampling point corresponding to the current sampling number by shifting half a pixel in the positive direction along the unit vector of the response normal of the current sampling number, and subtract the response amplitude expansion value of the sampling point corresponding to the current sampling number by shifting half a pixel in the negative direction along the unit vector of the response normal of the current sampling number, and calculate the orientation response difference at the current sampling number; When the set of valid sampling numbers for the current sampling ray is empty, the maximum valid sampling number of the current sampling ray is set to zero, and the directional response difference corresponding to each sampling number of the current sampling ray is set to zero. When the maximum effective sampling number of the current sampling ray is not less than two, the scanning starts from the sampling number and proceeds outward along the sampling ray. Within the range not exceeding the position before the maximum effective sampling number of the current sampling ray, the sampling position corresponding to the largest absolute value of the orientation response difference is selected as the integer candidate boundary radius. When the maximum valid sampling number of the current sampled ray is less than two, the integer candidate boundary radius is set to zero.
7. The method for measuring the geometric parameters of aluminum extrusion die orifice based on machine vision according to claim 6, characterized in that, The sub-pixel correction is performed on the integer candidate boundary radii of each sampled ray to correct the range of boundary radius values, obtain the candidate boundary response normal unit vector, and form an angular candidate boundary radius sequence, specifically including: When the maximum effective sampling number of the current sampling ray is not less than two, the directional response difference is read at the left adjacent position of the integer candidate boundary radius of the current sampling ray, the integer candidate boundary radius of the current sampling ray, and the right adjacent position of the integer candidate boundary radius of the current sampling ray, respectively. When the result of subtracting the right neighbor position orientation response difference from the left neighbor position orientation response difference is not zero, and the result of subtracting twice the position orientation response difference of the integer candidate boundary radius of the current sampled ray from the left neighbor position orientation response difference and adding the right neighbor position orientation response difference is not zero, the result of subtracting the right neighbor position orientation response difference from the left neighbor position orientation response difference is used as the correction numerator, and the result of subtracting twice the position orientation response difference of the integer candidate boundary radius of the current sampled ray and adding the right neighbor position orientation response difference is multiplied by two to use as the correction denominator. The correction numerator is divided by the correction denominator and added to the integer candidate boundary radius of the current sampled ray to calculate the sub-pixel boundary radius. When the maximum effective sampling number of the current sampling ray is not less than two, and the result of subtracting twice the integer candidate boundary radius position orientation response difference of the current sampling ray from the left neighbor position orientation response difference and adding the right neighbor position orientation response difference equals zero, the subpixel boundary radius is taken as the integer candidate boundary radius of the current sampling ray. When the maximum effective sampling number of the current sampling ray is less than two, the sub-pixel boundary radius is set to half a pixel; When the subpixel boundary radius is less than half a pixel, the subpixel boundary radius is corrected to half a pixel; when the subpixel boundary radius is greater than the maximum effective sampling number of the current sampling ray minus the maximum value of half a pixel and half a pixel, the subpixel boundary radius is corrected to the maximum effective sampling number of the current sampling ray minus the maximum value of half a pixel and half a pixel. When the set of valid sampling numbers of the current sampling ray is not empty, read the response normal unit vector of the ray sampling point corresponding to the integer candidate boundary radius position of the current sampling ray as the candidate boundary response normal unit vector; when the set of valid sampling numbers of the current sampling ray is empty, read the radial unit vector of the angular sampling position corresponding to the current sampling ray as the candidate boundary response normal unit vector. All subpixel boundary radii are arranged in angular order to form a sequence of angular candidate boundary radii.
8. The method for measuring the geometric parameters of aluminum extrusion die profiles based on machine vision according to claim 7, characterized in that, The diagonal candidate boundary radius sequence is subjected to closed-loop consistent solution to obtain a closed-loop boundary radius sequence, which forms a closed orifice boundary curve, specifically including: Connect the first angular sampling position to the last angular sampling position, so that the angular sampling position before the first angular sampling position corresponds to the last angular sampling position, and the angular sampling position after the last angular sampling position corresponds to the first angular sampling position, thus forming the periodic boundary condition of the closed-loop boundary radius sequence to be determined. For each angular sampling position, calculate the difference between the radius of the closed-loop boundary to be determined at the current angular sampling position and the radius of the candidate angular boundary corresponding to the current angular sampling position. Square the difference and divide it by the square of the radius of the candidate angular boundary corresponding to the current angular sampling position. Accumulate the difference over all angular sampling positions to form the radius deviation term in the closed-loop consistency function. For each angular sampling position, calculate the difference between the radius of the closed-loop boundary to be determined at the next angular sampling position and the radius of the closed-loop boundary to be determined at the previous angular sampling position. Divide the difference by twice the angular sampling interval. Then, combine the result of dividing the difference by twice the angular sampling interval with the tangential unit vector of the current angular sampling position, and combine it with the radius of the closed-loop boundary to be determined at the current angular sampling position and the radial unit vector of the current angular sampling position to form the boundary tangential correlation vector. Then, divide the square of the projection of the boundary tangential correlation vector onto the normal unit vector of the candidate boundary response corresponding to the current angular sampling position by the normalization term formed by the square of the radius of the closed-loop boundary to be determined at the current angular sampling position and the square of the result of dividing the difference by twice the angular sampling interval. Accumulate this normalization term over all angular sampling positions to form the tangential consistency term in the closed-loop consistency function. Add the radius deviation term and the tangential consistency term to form the closed-loop consistency function. Then, within the range where the radius of the closed-loop boundary to be determined at each angular sampling position is greater than zero and less than the maximum effective sampling number of the sampling ray corresponding to the current angular sampling position and the maximum value of the two, perform a minimum search on the closed-loop consistency function to obtain the closed-loop boundary radius sequence. When the closed-loop consensus function has multiple local minima, first select the closed-loop boundary radius sequence with the smallest sum of closed-loop boundary radii; when the sum of closed-loop boundary radii is the same, then compare the radius components of each closed-loop boundary radius sequence at each angular sampling position in angular order, and select the closed-loop boundary radius sequence with the smaller radius component value at the angular sampling position where the first difference occurs. The closed-loop boundary radius of each angular sampling position is calculated by extending the radial unit vector corresponding to each angular sampling position outward from the orifice response center, and the orifice boundary point is obtained. Connect all the orifice boundary points in angular order to form a closed orifice boundary curve.
9. The method for measuring the geometric parameters of aluminum extrusion die orifice based on machine vision according to claim 8, characterized in that, The process of establishing a proportional scale based on the correspondence between the actual length and the image length, and calculating the orifice perimeter, orifice area, minimum flow width, and corner radius, specifically includes: Obtain the true length of the reference edge and its pixel length in the image, and divide the true length of the reference edge by its pixel length in the image to calculate the scale. Connect adjacent orifice boundary points in angular order, and connect the last orifice boundary point with the first orifice boundary point to form a closed orifice boundary point column and the corresponding orifice boundary polyline segment column; The Euclidean distances between all adjacent aperture boundary points are summed piece by piece to calculate the aperture perimeter in pixel dimension. Then, the aperture perimeter in pixel dimension is multiplied by the scale to calculate the aperture perimeter in millimeter dimension. For each pair of adjacent orifice boundary points in the closed orifice boundary point sequence, the previous orifice boundary point is taken as the current orifice boundary point, and the next orifice boundary point is taken as the next orifice boundary point. The product of the x-coordinate of the current orifice boundary point and the y-coordinate of the next orifice boundary point is calculated, and the product of the x-coordinate of the next orifice boundary point and the y-coordinate of the current orifice boundary point is subtracted. All differences are accumulated in angular order and half of the absolute value is taken to calculate the orifice area in pixel dimension. Then, the orifice area in pixel dimension is multiplied by the square of the scale to calculate the orifice area in square millimeters dimension. For any orifice boundary point, this orifice boundary point is taken as the current orifice boundary point. First, calculate the product of the closed-loop boundary radius corresponding to the angular sampling position of the current orifice boundary point and the radial unit vector corresponding to the angular sampling position of the current orifice boundary point. Then, calculate the product of the difference between the closed-loop boundary radius corresponding to the next angular sampling position of the current orifice boundary point and the closed-loop boundary radius corresponding to the previous angular sampling position of the current orifice boundary point, divided by twice the angular sampling interval, and the product of this product and the tangential unit vector corresponding to the angular sampling position of the current orifice boundary point. Subtract the next product from the previous product to form the geometric normal vector corresponding to the current orifice boundary point. When the magnitude of the geometric normal vector is greater than zero, normalize the geometric normal vector to obtain the geometric normal unit vector. When the magnitude of the geometric normal vector is equal to zero, use the radial unit vector corresponding to the angular sampling position of the current orifice boundary point as the geometric normal unit vector. For any orifice boundary point, this orifice boundary point is taken as the current orifice boundary point. A straight line is established along the geometric normal unit vector of the current orifice boundary point. The intersection points of the straight line and the remaining orifice boundary polyline segments except for the two adjacent orifice boundary polyline segments of the current orifice boundary point are calculated. Orifice boundary polyline segments parallel to the straight line are eliminated. The directed distances from the current orifice boundary point to each intersection point are used to form an intersection distance set. The minimum intersection distance is selected from all non-empty intersection distance sets and multiplied by the scale to calculate the minimum flow width. When all intersection distance sets are empty, the minimum flow width is set to zero. For any orifice boundary point in the closed orifice boundary point sequence, this orifice boundary point is designated as the current orifice boundary point. The preceding orifice boundary point in the sequence is designated as the previous orifice boundary point, and the following orifice boundary point is designated as the next orifice boundary point. If the connection vectors between the current and previous orifice boundary points and between the current and next orifice boundary points are not collinear, the distances between these three distances are calculated: the distance between the current and previous orifice boundary points, the distance between the current and next orifice boundary points, and the distance between the previous and next orifice boundary points. The product of these three distances is then divided by the distances between the current and previous orifice boundary points and between the current and next orifice boundary points. The fillet radius of the current orifice boundary point is calculated by multiplying the absolute value of the cross product of the quantities. When the connection vectors between the current and previous orifice boundary points and between the current and next orifice boundary points are collinear, the fillet radius of the current orifice boundary point is set to infinity. When the fillet radius of the current orifice boundary point is a finite value, and is no greater than or equal to the fillet radius of the previous orifice boundary point, and is also no greater than the fillet radius of the next orifice boundary point, the fillet radius of the current orifice boundary point is included in the corner fillet radius set. When no fillet radius satisfies the conditions, the corner fillet radius set is set to empty. When a fillet radius satisfies the conditions, the fillet radii in the corner fillet radius set are multiplied by the scale to calculate the corner fillet radius in millimeters.