A rust removal area identification and area accurate calculation method for a curved workpiece

By combining monocular vision images with the geometric model of cylindrical workpieces, and using the LAB color space and surface area weight matrix, the problems of strong subjectivity in manual visual assessment and projection errors of existing planar image processing methods on curved workpieces are solved. This achieves high-precision and automated rust removal area calculation, which is suitable for online inspection in industrial sites.

CN122510239APending Publication Date: 2026-08-04FUZHOU UNIV
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
FUZHOU UNIV
Filing Date
2026-05-26
Publication Date
2026-08-04

AI Technical Summary

Technical Problem

In existing technologies, manual visual assessment of the rust removal quality of metal surfaces is highly subjective and has poor repeatability. Furthermore, existing planar image processing methods have projection errors on curved workpieces, making it impossible to accurately calculate the actual rust removal area. 3D scanning technology is costly and inefficient, making it difficult to meet the high-speed, continuous inspection requirements of industrial sites.

Method used

By combining monocular vision images with the geometric model of cylindrical workpieces, a calibration model of image pixels and three-dimensional surface area is established. The LAB color space is used to identify the metal base color region, construct the surface area weight matrix, remove rust and oxide scale regions, and realize the actual rust removal area by pixel-by-pixel weighted summation.

Benefits of technology

It achieves high-precision, automated, and low-cost quantitative assessment of the rust removal area of ​​cylindrical workpieces, overcomes projection distortion errors, and improves the accuracy and stability of the detection results. It is suitable for online quality monitoring of automated rust removal production lines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122510239A_ABST
    Figure CN122510239A_ABST
Patent Text Reader

Abstract

The application provides a rust removal area identification and area accurate calculation method for a curved surface workpiece, comprising: acquiring a surface image of a cylindrical workpiece, and establishing a calibration relationship between image pixel size and actual physical size; selecting a to-be-detected area and generating a corresponding binary mask; mapping pixel coordinates in the to-be-detected area to a cylindrical parameter space; according to the cylindrical geometric relationship and the mapping relationship, calculating an area correction weight for each pixel in the to-be-detected area, the weight being used for correcting area representation errors of the pixel caused by the cylindrical curvature and imaging projection, and the correction weights of all the pixels forming a curved surface area weight matrix; converting the image to a LAB color space, identifying a metal base color area and generating a rust removal candidate area; removing rust and oxide skin areas in the rust removal candidate area, and generating a target area mask after morphological optimization; and performing pixel-by-pixel weighted summation on the target area mask and the curved surface area weight matrix to obtain an actual physical area of the rust removal area.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of surface treatment inspection and intelligent manufacturing technology, specifically relating to a method for identifying rust removal areas and accurately calculating the area of ​​curved workpieces. Background Technology

[0002] Currently, the assessment of rust removal quality on metal surfaces in the industrial sector typically employs visual comparison standards (such as Sa2.5 grade). This standard, based on the GB / T 8923 series of specifications, requires that the steel surface be free of visible grease and dirt, and that scale, rust, and paint coatings have been largely removed, with any remaining residue firmly adhered. However, this traditional method relies entirely on manual experience, inherently suffering from strong subjectivity and poor repeatability. Different inspectors may have significantly different judgments on the rust removal grade of the same surface, and even the same inspector may yield inconsistent results under different times and lighting conditions. Furthermore, manual visual inspection can only provide qualitative grade assessments and cannot accurately calculate the rust removal area, failing to meet the demands of modern industry for refined and data-driven quality control. This problem is particularly prominent in the rust removal quality assessment of curved workpieces (such as bridge railings, bridge screens, and industrial pipelines). Due to the complex geometry of curved workpieces, the distance and angle between each point on the surface and the observer are different, which can easily lead to visual errors when viewed manually. It is difficult to accurately judge the rust removal effect in different areas, and it is even more impossible to reasonably estimate the actual treatment area of ​​the curved surface.

[0003] Furthermore, with the development of digital image processing technology, many studies have attempted to apply it to the quality inspection of rust removal on metal surfaces, replacing manual visual inspection methods. However, most existing image processing methods are designed for planar targets. Their core principle is to calculate the number of pixels in the rust-removed area of ​​the image and then multiply it by a fixed pixel equivalent to obtain the actual area. This method can achieve good results in the inspection of planar workpieces, but when applied to curved workpieces, it ignores the influence of surface curvature on imaging, leading to serious projection errors. Specifically, when a camera photographs a curved workpiece, the pixels in the edge area of ​​the curved surface are compressed due to perspective projection, and the actual physical area they represent is much larger than the pixels in the center area of ​​the image. If a uniform pixel equivalent is directly used for calculation, the rust removal area at the edge of the curved surface will be severely underestimated, resulting in a large deviation in the final evaluation result. Although some studies have attempted to introduce 3D scanning technology to obtain the geometric information of the curved surface and then calculate the actual area, 3D scanning equipment is usually expensive, slow, and has high requirements for the on-site environment, making it difficult to meet the needs of high-speed, continuous online inspection in industrial sites. Therefore, it is necessary to propose a quantitative calculation method for rust removal area that is applicable to curved workpieces, low in cost, fast in detection speed, and high in accuracy. Summary of the Invention

[0004] To address the shortcomings and deficiencies of existing technologies, this invention provides a method and system for identifying and accurately calculating the area of ​​rust-removed regions on cylindrical workpieces. It aims to solve the problems of strong subjectivity in manual visual assessment, inaccurate area calculation due to projection errors on curved surfaces in existing planar image processing methods, and high cost and low efficiency of 3D scanning technology.

[0005] This invention creatively combines monocular vision images with known geometric models of cylindrical workpieces to construct a correction model from two-dimensional image pixels to three-dimensional surface area. Specifically, the method includes: acquiring an image of the cylindrical workpiece surface and calibrating the physical dimensions of the pixels; establishing a mapping relationship between image pixel coordinates and the cylindrical parameter space (central angle, axial length); crucially, based on this mapping relationship, calculating a unique area correction weight for each pixel in the image, where the weight is inversely proportional to the cosine of the angle between the normal direction of the corresponding pixel point and the line of sight, thereby compensating for the image edge pixel area compression effect caused by surface curvature and perspective projection; all weights constitute the surface area weight matrix; simultaneously, converting the image to the more robust LAB color space for illumination, robustly extracting rust removal candidate areas by fusing multiple sub-masks targeting different metallic lusters, and eliminating rust and oxide scale interference areas; obtaining an accurate target area mask after morphological optimization; finally, weighting and summing the target area mask and the surface area weight matrix pixel by pixel to obtain the corrected, true rust removal physical area. This invention enables high-precision, automated, and low-cost quantitative evaluation of the rust removal area of ​​cylindrical workpieces.

[0006] The specific technical solution adopted by this invention to solve its technical problem is as follows:

[0007] This invention provides a method for calculating the area of ​​the rust-removed region of a cylindrical workpiece, characterized by comprising the following steps:

[0008] Step 1: Acquire images and establish calibration relationships.

[0009] Acquire surface images of the cylindrical workpiece and establish a calibration relationship between image pixel dimensions and actual physical dimensions. During image acquisition, the preferred camera arrangement is to position the camera optical axis perpendicular to the central axis of the cylinder, with the central axis parallel to the horizontal edge of the camera's imaging plane. The calibration process uses a calibration plate of known dimensions to obtain the equivalent physical width of the horizontal pixels and the equivalent physical length of the vertical pixels, thus transforming the pixel coordinates to the actual length coordinate system. When the camera has a small pitch angle, accuracy can be ensured by applying cosine correction to the axial variables. These measures lay the foundation for the conversion from planar pixels to physical space.

[0010] Step 2: Select the area to be detected.

[0011] The region to be detected is selected in the image, and a corresponding binary mask is generated. This region typically covers the visible curved portion of the cylindrical workpiece surface, determined through interactive selection or automatically extracted edge detection algorithms. The introduction of the mask confines all subsequent calculations to the effective area, eliminating background interference and improving processing efficiency and accuracy.

[0012] Step 3: Establish the mapping from pixel coordinates to cylindrical parameter space.

[0013] The pixel coordinates within the detection area are mapped to the cylindrical parameter space to obtain the central angle and axial length variables corresponding to each pixel. For the geometric features of the cylinder, a transformation between the horizontal pixel coordinates and the central angle is established using the arcsine projection relationship: taking the horizontal center pixel coordinates of the cylindrical cross-section in the image as a reference, the ratio of the current pixel's horizontal offset distance to the cylinder radius is calculated, and the central angle is obtained through arcsine calculation; the axial length variable is obtained by directly multiplying the vertical coordinates by the equivalent of the vertical pixel's physical length. In this transformation, when the absolute value of the intermediate value used for the arcsine calculation is greater than 1, it indicates that the pixel has exceeded the visible area of ​​the cylinder and is automatically discarded to ensure the validity of subsequent calculations. This mapping step is a key technical step in restoring two-dimensional image information to three-dimensional curved surface space.

[0014] Step 4: Construct the surface area weight matrix to compensate for projection distortion.

[0015] Based on the cylindrical geometry and the mapping relationship, an area correction weight is calculated for each pixel within the detection region. This weight is specifically used to correct the area representation error caused by the cylindrical curvature and imaging projection of that pixel. The correction weights of all pixels together constitute a surface area weight matrix. The core mechanism is that a pixel in a two-dimensional image corresponds to a larger actual surface area at the cylindrical edge than at the center. By dividing the projected area of ​​each pixel on the image plane (i.e., the product of the horizontal and vertical pixel physical equivalents) by the cosine of its corresponding central angle variable, the actual surface micro-element area represented by that pixel can be obtained. The resulting weight matrix directly quantifies the spatial distribution of surface projection distortion, enabling subsequent area calculations to automatically compensate for edge compression effects.

[0016] Step 5: Identify rust removal candidate areas based on LAB color space and multi-feature mask fusion.

[0017] The image is converted to the LAB color space, which is more robust to illumination. Within this space, metallic primary color regions are identified, and rust removal candidate regions are generated. To accommodate color fluctuations caused by different illumination conditions, reflectivity, and variations in metal surface roughness, a multi-feature sub-mask logical OR fusion strategy is employed. Specifically, primary metal primary color mask conditions are set separately, along with three sets of sub-mask conditions (silver, gray, and blue-gray) for high-brightness silver-white metal, low-saturation gray metal, and bluish-gray reflective metal. Pixels satisfying any of these conditions are fused using a logical OR operation to generate complete rust removal candidate regions. This fusion mechanism effectively overcomes the problem of poor adaptability of single color thresholds in complex industrial environments.

[0018] Step 6: Remove areas with rust and oxide scale defects.

[0019] Based on the candidate rust removal areas obtained in step five, rust and oxide scale areas are removed. Using a characteristic color model including reddish-brown, yellowish-brown, yellowish-orange, rust-green, and black, rust and oxide scale masks are generated. Logical difference operations are then performed on the candidate rust removal areas to expose those parts that, although metallic in color, are actually corroded or covered, thus obtaining the initial target rust removal areas. This step ensures that the identification results strictly conform to the area evaluation criteria for rust removal quality.

[0020] Step 7: Morphological optimization processing.

[0021] The preliminary target region obtained in step six undergoes morphological optimization, including closing operations, hole filling, and removal of connected components with areas smaller than a preset threshold. Closing operations connect minor breaks caused by reflections, hole filling eliminates internal dark spots, and small connected component removal filters out isolated noise. The optimized region has smooth edges and internal continuity, forming the final target region mask, providing high-quality input for accurate area calculation.

[0022] Step 8: Calculate the actual physical area using discrete surface integrals.

[0023] The target region mask and the surface area weight matrix are then summed pixel-by-pixel in a weighted manner. Essentially, this operation involves discrete integration of the areas of all surface elements distributed within the target region on the cylindrical surface. Pixels with a value of 1 in the target region mask contribute to the summation of their corresponding weights, while pixels with a value of 0 do not contribute to the area. The final summation result represents the actual physical area of ​​the rust-removed region on the 3D curved workpiece, thus achieving a high-precision conversion from a 2D image to the actual surface area.

[0024] As a further preferred embodiment, the calibration relationship includes obtaining the equivalent physical width of the horizontal pixel and the equivalent physical length of the vertical pixel through calibration; the area correction weight is the product of the equivalent physical width of the horizontal pixel and the equivalent physical length of the vertical pixel corresponding to that pixel, divided by the cosine value of the central angle variable corresponding to that pixel. This weight expression intuitively shows that: the closer to the edge of the cylinder, the larger the central angle, the smaller the cosine value, and the larger the area correction weight, automatically compensating for the projection compression effect.

[0025] As another preferred embodiment, in identifying the metal base color region and generating rust removal candidate regions, the specific conditions for the main metal base color mask are: luminance component between 60 and 98, red-green component between -10 and 10, and yellow-blue component between -15 and 20; silver sub-mask meets the requirement of luminance greater than 80 and absolute values ​​of both red-green and yellow-blue components less than 8; gray sub-mask meets the requirement of luminance between 75 and 80, absolute value of red-green component less than 10, and yellow-blue component less than 5; and blue-gray sub-mask meets the requirement of luminance greater than 60, yellow-blue component less than -10, and absolute value of red-green component less than 8. These threshold settings precisely cover the various color presentations of the metal surface after rust removal, providing accurate boundaries for multi-feature fusion.

[0026] For the removal of rust and oxide scale, the characteristic color model specifically includes reddish-brown, yellowish-brown, yellowish-orange, rust-green, and black, which are commonly found in industrial environments. Corresponding defect masks are generated based on these colors, and rejection is achieved through logical difference operations. This color set originates from a summary of typical rust and oxide scale appearances, effectively filtering out major defect types.

[0027] The morphological optimization, through its closing operation, can bridge the tiny cracks in the target area caused by reflection, while the hole filling can eliminate internal spots caused by dust or slight color differences. The connected component removal with a preset threshold can cleanly eliminate discrete noise interference. The progressive processing of these three aspects significantly improves the cleanliness and practical usability of the mask.

[0028] Regarding the specific implementation of cylindrical coordinate mapping, the horizontal center pixel coordinates of the cylindrical cross-section on the image are used as a reference. The product of the difference between the current pixel's horizontal coordinate and the reference, and the equivalent of the horizontal pixel's physical width, is calculated and then divided by the cylinder radius to obtain an intermediate value. An arcsine operation is performed on this intermediate value to obtain the central angle variable. The axial length variable is the product of the current pixel's vertical coordinate and the equivalent of the vertical pixel's physical length. When the absolute value of the intermediate value exceeds 1, it indicates that the pixel's line of sight has exceeded the cylinder tangent range, corresponding to an invisible area, which is then directly discarded. This arcsine mapping model has high engineering approximation accuracy when the camera object distance is greater than a certain multiple of the cylinder diameter.

[0029] Furthermore, to ensure the accurate establishment of the measurement coordinate system, during image acquisition, the camera optical axis is perpendicular to the central axis of the cylinder, and the central axis of the cylinder is parallel to the horizontal edge of the camera's imaging plane. When a pitch angle exists due to installation or site conditions, a cosine correction of that pitch angle is applied to the axial length variable to eliminate axial compression introduced by perspective tilt. This constraint and correction ensure the linearity and accuracy of the axial mapping.

[0030] In scenarios requiring extremely high measurement accuracy, the mapping relationship can be achieved using a perspective projection model. Specifically, this involves obtaining a camera intrinsic parameter matrix containing focal length and principal point coordinates through camera calibration, and acquiring the vertical distance from the camera's optical center to the cylinder's central axis. Based on perspective projection geometry, a precise mapping is established between the pixel's horizontal coordinates and the central angle variable, and the corresponding surface area weight matrix is ​​calculated accordingly. This model can completely reproduce the real perspective imaging process, eliminating all imaging distortions caused by close-up shooting, and achieving a higher level of area measurement accuracy.

[0031] This invention also provides a system for identifying and calculating the area of ​​rust-removed regions on cylindrical workpieces. Corresponding to the aforementioned method, this system includes: an image acquisition and calibration module for acquiring surface images of the cylindrical workpiece and establishing a calibration relationship between image pixel dimensions and actual physical dimensions; a region selection module for selecting the region to be detected and generating a corresponding binary mask; a parameter mapping module for mapping the pixel coordinates within the region to be detected to a cylindrical parameter space, obtaining the central angle and axial length variables corresponding to each pixel; an area modeling module for calculating area correction weights for each pixel within the region to be detected based on the cylindrical geometric relationship and the mapping relationship, and generating a surface area weight matrix; a target recognition module for converting the image to the LAB color space to identify the metal base color region, removing rust and oxide scale regions, and generating a target region mask after morphological optimization; and an area calculation module for performing a pixel-by-pixel weighted summation of the target region mask and the surface area weight matrix to finally obtain the actual physical area of ​​the rust-removed region. Through the organic cooperation of these modules, this system transforms the aforementioned high-precision calculation method into an automated process that can be directly deployed in industrial inspection environments.

[0032] Compared to existing technologies, this invention and its preferred solution overcome projection distortion errors and achieve accurate calculation of surface area. It innovatively introduces a mapping from two-dimensional image coordinates to three-dimensional cylindrical parameter coordinates, and constructs an area correction weight for each pixel based on the differential geometric relationship of the cylinder, generating a surface area weight matrix. This matrix effectively compensates for the area compression caused by the curvature and imaging projection of the cylindrical edge, solving the problem of severely underestimated surface edge area in traditional planar image measurements, making the area calculation result highly approximate the actual physical surface area. It exhibits strong anti-interference capabilities and high robustness. Abandoning the RGB color space, which is susceptible to illumination, it adopts the LAB color space, which separates brightness and color. It extracts the metal primary color region through a multi-feature sub-mask logic or fusion strategy, which is compatible with metal color fluctuations under different illumination, reflection, and surface roughness conditions, significantly reducing the risk of a single threshold failing due to environmental changes. Furthermore, it combines rust and oxide scale characteristic color models for defect removal, greatly improving the accuracy and stability of rust removal area identification. It transforms traditional qualitative assessments relying on experience and visual inspection into objective quantitative calculations based on digital image processing, eliminating individual differences and subjectivity inherent in manual inspection and ensuring high repeatability of test results. The entire process, from image acquisition to area output, can be completed automatically, making it highly suitable for integration into online quality monitoring and evaluation systems in automated rust removal production lines, and possessing significant engineering application value. Attached Figure Description

[0033] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments:

[0034] Figure 1 This is a schematic diagram of the method flow of an embodiment of the present invention;

[0035] Figure 2 This is a schematic diagram of the detection component according to an embodiment of the present invention;

[0036] Figure 3 This is a schematic diagram illustrating the rust removal area identification range in an embodiment of the present invention;

[0037] Figure 4 This is a schematic diagram of the rust removal area identification results in an embodiment of the present invention. Detailed Implementation

[0038] To make the features and advantages of the present invention more apparent and understandable, specific embodiments are described below in detail:

[0039] It should be noted that the following detailed descriptions are exemplary and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used in this specification have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.

[0040] It should be noted that the terms used herein are only for describing specific embodiments and are not intended to limit the exemplary embodiments according to the present application. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that when the terms "comprising" and / or "including" are used in this specification, they specify the presence of features, steps, operations, devices, components, and / or combinations thereof.

[0041] The present invention provides a method and system for identifying and accurately calculating the area of a rust removal area for cylindrical curved surface workpieces, aiming to solve the problems of strong subjectivity and poor repeatability in the traditional manual visual comparison of rust removal quality, and the large projection error and inability to accurately calculate the actual rust removal area caused by the existing planar image processing method ignoring the surface curvature, so as to achieve high-precision and automated quantitative evaluation of rust removal quality.

[0042] The overall implementation process of this method is as follows: First, obtain the surface image of the curved surface workpiece and establish the mapping relationship between the image pixel coordinates and the actual physical dimensions; then select the region of interest (ROI) to be detected and generate the corresponding binary mask to exclude background interference. On this basis, establish the mapping relationship between the two-dimensional image coordinates and the three-dimensional cylindrical parameter coordinates, and convert each pixel point into the angular variable θ and the axial length variable l in the surface parameter space; construct the differential area element dA = r·dθ·dl according to the cylindrical geometric relationship, and generate a surface area weight matrix with the same resolution as the original image to compensate for the projection distortion caused by the surface curvature.

[0043] In the rust removal area identification link, the image is converted from the RGB space to the LAB color space with stronger light robustness, the metal base color area is extracted based on a preset threshold, and the Sa2.5 candidate area is obtained through multi-feature mask fusion. Among them, the main preset threshold for the metal base color area is that the luminance component L ∈ [60, 98], the red-green component A ∈ [-10, 10], and the yellow-blue component B ∈ [-15, 20]; aiming at the metal base color differences under different lighting and reflection states, three sub-regions of silver, gray, and blue-gray are further divided and the feature sub-masks are constructed respectively. The silver area satisfies L > 80 and |A| < 8 and |B| < 8, the gray area satisfies 75 < L < 80 and |A| < 10 and B < 5, and the blue-gray area satisfies L > 60 and B < -10 and |A| < 8; perform a pixel-by-pixel logical OR operation on the sub-mask that meets any of the above conditions and the main base color mask, and merge them to generate the complete Sa2.5 candidate area.

[0044] Subsequently, a rust and oxide scale feature model was constructed, which includes typical rust and oxide scale characteristic colors such as reddish-brown, yellowish-brown, yellowish-orange, rust-green, and black. Rust and oxide scale areas in the candidate regions were eliminated using logistic difference operations to obtain the preliminary target rust removal areas. To eliminate the influence of reflection and noise on the target area, morphological optimization was performed on the preliminary target area. The processing flow included closing operations, hole filling, and removal of preset small-area connected components, generating the final target area mask.

[0045] Finally, the target area mask and the surface area weight matrix are multiplied point by point and summed to obtain the actual surface area of ​​the rust removal area. The specific calculation method is as follows: the pixel value 1 representing the target area in the target area mask is multiplied by the corresponding differential area element dA, and the pixel value 0 representing the non-target area is not included in the calculation. The sum of all the products is the actual surface area.

[0046] This invention also provides a system for calculating the rust removal area of ​​curved workpieces using the above-mentioned method, comprising an image acquisition and calibration module, a region selection module, a parameter mapping module, an area modeling module, a target extraction module, a morphological optimization module, and an area calculation module. Specifically, the image acquisition and calibration module acquires images of the curved workpiece surface and establishes a mapping relationship between pixel coordinates and actual physical dimensions; the region selection module selects the region of interest (ROI) to be detected and generates a corresponding binary mask; the parameter mapping module establishes a mapping relationship between two-dimensional image coordinates and three-dimensional cylindrical parameter coordinates; the area modeling module constructs differential area elements and generates a surface area weight matrix; the target extraction module extracts the metal base color region based on the LAB color space and removes rust and oxide scale regions to obtain the target rust removal area; the morphological optimization module performs morphological processing on the target rust removal area to generate the final target region mask; and the area calculation module integrates and sums the target region mask and the surface area weight matrix to obtain the actual curved surface area of ​​the rust removal area.

[0047] Compared with the prior art, the advantages of the present invention include:

[0048] First, it boasts high accuracy, completely overcoming projection distortion errors. It innovatively introduces a mapping from image coordinates to three-dimensional cylindrical parameters (θ, l), and constructs a surface area weight matrix based on dA = r·dθ·dl. This solves the problem of severely compressed edge areas caused by neglecting curvature in traditional two-dimensional planar image evaluation methods, achieving accurate calculation of the actual physical surface area.

[0049] Secondly, it has strong anti-interference capabilities and high recognition accuracy. Abandoning the traditional RGB color space, it adopts the LAB color space, which is more in line with human visual perception and has stronger robustness to lighting. By accurately locking the threshold of the metal primary color and establishing a multi-feature mask to remove rust and oxide scale, it can accurately peel out rust removal areas that reach the Sa2.5 level.

[0050] Third, it boasts a high degree of automation and strong objective consistency. By transforming subjective "visual comparison" into objective "algorithm calculation," it eliminates individual differences inherent in manual inspection. This makes it highly suitable for online quality monitoring and evaluation systems in automated rust removal production lines for cylindrical curved workpieces such as railings and pipes, and it has extremely high engineering application value.

[0051] The present invention will now be described in further detail with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.

[0052] Taking the Sa2.5 level rust removal inspection of industrial circular pipes (curved workpieces) as an example, the specific implementation process of the method for identifying rust removal areas and accurately calculating the area of ​​curved workpieces provided by this invention is as follows:

[0053] Step S1: Acquire the image and establish a physical mapping

[0054] An industrial camera is used to acquire surface images perpendicular to the central axis of the pipe. The dimensions are calibrated using a camera calibration board (such as a checkerboard), and the pixel equivalent of the image (i.e., the actual physical length represented by a single pixel) is calculated to establish a preliminary mapping relationship between the two-dimensional image pixel coordinate system (u, v) and the actual physical dimensions.

[0055] Furthermore, dimensional calibration was performed using a checkerboard calibration plate. The calibration plate was placed coplanar with the pipe surface, images of the calibration plate were acquired, checkerboard corner points were detected, and the average pixel equivalent S of the image was calculated. w and S h When using a perspective projection model, there is no need to calculate the global pixel equivalent; coordinate mapping can be performed directly using the camera intrinsic and extrinsic parameter matrices.

[0056] Step S2: Select the Region of Interest (ROI) to be detected

[0057] To eliminate background interference, the main area of ​​the pipeline is extracted through interactive methods or edge detection algorithms to generate the Region of Interest (ROI) to be detected, and a corresponding binary mask is generated, where the pixel value within the ROI is 1 and the value outside the ROI is 0.

[0058] Specifically, the edge detection algorithm in this embodiment preferably employs a combination of Canny edge detection and Hough transform. First, the image is preprocessed by grayscale conversion and Gaussian blurring. Then, the Canny operator is used to extract edges, and the Hough transform is used to detect the two parallel edges of the pipe, thereby accurately segmenting the main pipe region. For cases of discontinuous edges, morphological closing operations can be used to connect broken edges, and then contour extraction is used to obtain the complete pipe region. The interactive method is suitable for special cases with extremely irregular edges; the operator can use the mouse to draw a polygon to select the area to be detected.

[0059] Step S3: Coordinate Mapping

[0060] Because the pipe is cylindrical, when an industrial camera shoots perpendicular to the pipe's central axis, the pixels at the image edges are affected by curvature and sinusoidal projection, resulting in an actual surface area larger than that at the image center. The outer diameter radius of the pipe is known to be r.

[0061] Preferably, the pipe radius r can be obtained in two ways: one is by directly inputting it into the system as a known parameter, which is suitable for standard pipe workpieces; the other is by obtaining it through image measurement. Specifically, a circular calibration object of known diameter is attached to the pipe surface, and after image acquisition, the pixel diameter of the calibration object is calculated, combined with the pixel equivalent S. w The actual radius r of the pipe can then be calculated. Preferably, the second method can eliminate the influence of pipe manufacturing tolerances on the measurement results.

[0062] First, calculate the physical equivalent of the image pixels. Let the actual total physical length corresponding to the image height be... Number of pixels The equivalent axial physical length of a single pixel Similarly, obtain the equivalent horizontal pixel physical width.

[0063] Establish a specific mapping formula from two-dimensional image coordinates (u, v) to three-dimensional cylindrical parametric coordinates (θ, l):

[0064] 1. Transformation of axial length variable l: Taking the horizontal center line of the image as the reference, the axial length corresponding to the vertical coordinate v of the image is...

[0065] Furthermore, to ensure the accuracy of axial mapping, the central axis of the pipe should be strictly parallel to the horizontal edge of the camera's imaging plane during image acquisition. This can be achieved by attaching markers at both ends of the pipe and adjusting the camera's orientation so that the vertical coordinates of the two markers are identical. When a small pitch angle α exists (typically less than 3°), the axial length can be corrected using the following formula:

[0066]

[0067] The pitch angle α can be calculated from the vertical coordinate difference between the marked points at both ends of the pipe.

[0068] 2. Transformation of the angle variable θ: Let u be the horizontal center pixel coordinate of the projection of the cylindrical section onto the image. c Due to the sinusoidal projection relationship, the horizontal pixel u is physically projected from the center. According to the principle of sinusoidal projection The conversion formula between horizontal pixels and central angle θ can be obtained using inverse trigonometric functions:

[0069]

[0070] Furthermore, when calculating angle θ, if the following occurs... In this case, the pixel is located in an invisible area of ​​the pipeline. When generating the surface area weight matrix, the weight of such pixels will be set to zero or skipped in the calculation, and they will not participate in subsequent area calculations. In practical applications, this condition can be used to automatically verify the validity of ROI selection.

[0071] Step S4: Constructing the precise calculation of the differential area element and weight matrix

[0072] In three-dimensional cylindrical coordinates, the formula for the smallest differential surface area element is ( For discrete digital images, numerical calculation of the differential area of ​​a single pixel is performed:

[0073] 1. Axial infinitesimal element dl of discrete pixels: Since there is no curvature distortion along the axis, the axial infinitesimal element corresponding to a single pixel is the pixel height equivalent, i.e.

[0074] 2. The angular infinitesimal element dθ of a discrete pixel: Based on the derivative of the mapping formula with respect to x, the width of a single pixel... The rate of change of angle caused

[0075] 3. Complete formula for calculating the differential area dA of a single pixel: Substituting dl and dθ into the area element formula, we obtain the actual surface area corresponding to a single pixel with coordinates (u, v):

[0076]

[0077] In the formula Let be the basic projected area of ​​a single pixel on a two-dimensional plane. Because θ increases and cosθ decreases at the edge of the cylinder, the calculated area dA of the infinitesimal element increases. By substituting each pixel within the ROI region into this formula, a "surface area weight matrix" of the same size as the original image resolution can be generated. This matrix compensates for the area compression distortion caused by curvature at the image edges.

[0078] Preferably, when the shooting distance is relatively short and the orthographic projection assumption does not hold, a more accurate perspective projection model can be used. When a perspective projection model is required for high-precision measurement, the camera intrinsic parameter matrix K, including the focal length, is first obtained through camera calibration. and principal point coordinates Let D be the perpendicular distance from the camera's optical center to the central axis of the cylinder (obtained through joint calibration by photographing the cylindrical workpiece and the calibration plate together), and r be the radius of the cylinder. Then the mapping relationship between the horizontal pixel coordinate u of the image and the central angle θ is:

[0079]

[0080] The corresponding single-pixel angle element is:

[0081]

[0082] At this point, the actual surface area corresponding to a single pixel is:

[0083]

[0084] in, For a single pixel width, This is the axial pixel equivalent. This perspective projection model can completely eliminate perspective distortion caused by close-up photography, further improving the accuracy of area calculation.

[0085] Steps S5-S6: Rust removal area identification and rejection based on LAB color space

[0086] The image is converted from the RGB color space to the LAB color space. Since the true Sa2.5 level metallic base color will exhibit local tonal differences under different lighting and materials, this invention proposes a multi-feature mask fusion mechanism.

[0087] This step creates multiple sub-masks for different metal base colors, and then merges them using a logical OR operation to form a unified Sa2.5 candidate region mask.

[0088] Specifically, it includes:

[0089] (1) Main metal base color mask:

[0090] Maskbase=(L∈[60,98])∩(A∈[-10,10])∩(B∈[-15,20]) is used to identify typical near-white metal regions.

[0091] (2) Silver sub-mask:

[0092] Masksilver = (L > 80) ∩ (|A| < 8) ∩ (|B| < 8) is used to identify the highlighted silver - white metal area.

[0093] Gray sub - mask:

[0094] Maskgray = (75 < L < 80) ∩ (|A| < 10) ∩ (B < 5) is used to identify the low - saturation gray metal area.

[0095] (4)Blue - gray sub - mask:

[0096] Maskbluegray = (L > 60) ∩ (B < - 10) ∩ (|A| < 8) is used to identify the metal area with a slight blue - gray reflection feature.

[0097] The final candidate area adopts the following logical fusion method:

[0098] Maskcandidate = Maskbase ∪ Masksilver ∪ Maskgray ∪ Maskbluegray

[0099] Therefore, the multi - feature mask fusion of the present invention essentially corresponds to:

[0100] The logical OR fusion of multiple metal - based color sub - masks. This fusion method can be compatible with color fluctuations under different lighting conditions, different reflection states, and different metal surface roughness conditions, and improve the recognition stability of the Sa2.5 rust - removal area. After obtaining the candidate area, further construct the rust mask and scale mask, and perform defect elimination through logical difference operation:

[0101] Maskfinal = Maskcandidate−(Maskrust ∪ Maskscale)

[0102] Where: Maskrust is the rust area mask; Maskscale is the scale area mask; Maskfinal is the final target rust - removal area. This model includes the characteristic colors of typical rusts and scales such as reddish - brown, yellowish - brown, yellow - orange, rust - green, and black.

[0103] It should be understood that the above LAB color thresholds are reference values measured for carbon steel No. 20 under the standard D65 lighting condition. In actual applications, appropriate floating adjustments can be made near the above - mentioned reference values according to different on - site lighting conditions and workpiece materials to obtain the best recognition effect.

[0104] S7: Morphological optimization

[0105] Due to reflections or noise, tiny black spots or edge burrs may exist inside the target area. The broken metal areas are connected using the closing operation (dilation followed by erosion) in mathematical morphology, and the small black spots in the area are filled using a hole-filling algorithm. Isolated noise spots with an area smaller than a set pixel threshold (such as 50 pixels) are removed, and finally a binarized target area mask is output.

[0106] Step S8: Calculate the exact area integral

[0107] The target region mask obtained in step S7 (containing only 0s and 1s) is multiplied element-wise with the surface area weight matrix constructed in step S4 (containing the actual physical area of ​​each pixel). Finally, the multiplied matrix is ​​summed globally (i.e., the discretized surface integral ΣdA). The summation result is the actual three-dimensional physical surface area in the pipeline image that meets the Sa2.5 rust removal standard.

[0108] The target area mask obtained in step S7 is multiplied pixel by pixel with the surface area weight matrix constructed in step S4, and the true three-dimensional surface area of ​​the target rust removal area is calculated by discrete integration.

[0109] in:

[0110]

[0111] When the pixel belongs to the Sa2.5 target area:

[0112] Mask(u,v)=1

[0113] otherwise:

[0114] Mask(u,v)=0

[0115] For a pixel with coordinates (u, v) in the image, the area of ​​its corresponding surface element is:

[0116]

[0117] Wherein: S w : Equivalent horizontal physical width of a single pixel; S h : Vertical physical length equivalent of a single pixel; θ(u): Central angle of the cylinder corresponding to pixel u.

[0118] Based on the mapping relationship in step S3:

[0119]

[0120] Therefore, the actual surface area corresponding to each pixel can be dynamically compensated for as the curvature of the cylinder edge changes. Finally, the true surface area of ​​the entire target region is calculated using discrete integrals:

[0121]

[0122] Where: Areal: the actual surface area of ​​the Sa2.5 compliant region obtained by final calculation; ∑∑: the two-dimensional cumulative integral of all pixels in the ROI region; dA(u,v): the surface area weight corresponding to a single pixel.

[0123] The above integration process essentially corresponds to a surface integral on a cylindrical surface:

[0124]

[0125] Furthermore, after obtaining the actual physical area of ​​the rust-removed area, it can be compared with the planar projected area calculated based on the number of mask pixels and pixel equivalent of the target area. If the ratio of the two exceeds the preset reasonable range, an abnormal warning message will be output to quickly detect the deviation of the calculation results caused by calibration errors, abnormal image acquisition, etc.

[0126] like Figure 2 As shown, the detection component used in this embodiment is a section of cylindrical industrial pipe made of No. 20 carbon steel, with an outer diameter of 15cm and a radius of curvature of 7.5cm. Some areas of the pipe surface have been derusted, revealing the natural metallic color, while the un-rusted areas are covered with reddish-brown rust and black oxide scale. During image acquisition, the industrial camera is positioned perpendicular to the central axis of the pipe to ensure that the pipe's axis is parallel to the horizontal edge of the camera's imaging plane.

[0127] like Figure 3 As shown, the rust removal area identification range of this invention is the visible arc surface area of ​​the pipe surface. Due to the geometric characteristics of a cylindrical surface, the camera can only capture the semi-cylindrical surface of the pipe facing the camera, and the central angle range corresponding to this semi-cylindrical surface is [-90°, 90°]. In actual inspection, the ROI to be inspected should be completely contained within this visible arc surface range to ensure that all pixels involved in the calculation can be identified by θ=arcsin((uu c )×S w The / r) formula enables effective coordinate transformation.

[0128] like Figure 4 As shown in the figure, in the rust removal area identification results of this embodiment, the pink area represents the rust removal area that meets the Sa2.5 standard, and the black area represents the non-compliant area, including residual rust, scale, and the background area around the pipe edge. The area that meets the Sa2.5 standard, calculated using the method of this invention, is marked as 137.23 cm² below the image. 2 This result accurately reflects the actual rust-removed curved surface area of ​​the pipe, effectively overcoming the projection error of the traditional two-dimensional plane calculation method.

[0129] The complete demonstration of the above steps of the present invention is as follows: Figure 1 As shown, step S1 involves acquiring an image of the curved workpiece surface and establishing a physical mapping relationship. In this embodiment, a No. 20 carbon steel round pipe with a diameter of 15cm is used as the test specimen. Its three-part arc surface is cut for detection, and a pixel coordinate (u,v) system for the image is established. Step S2 involves selecting the Region of Interest (ROI) to be detected. The main area of ​​the pipe is selected interactively, and a corresponding binary mask for the ROI is generated. Pixel values ​​within the ROI area are 1, and values ​​outside the area are 0. Step S3 involves establishing a mapping relationship between image coordinates and cylindrical parameter coordinates. Pixels in the two-dimensional image are converted into angle variables θ and axial length variables l in the three-dimensional cylindrical parameter space, achieving coordinate transformation from a planar image to a curved space. Step S4 involves constructing a differential area element and generating a surface area weight matrix. The actual surface area corresponding to each pixel is calculated based on the cylindrical geometric relationship, generating a weight matrix with the same resolution as the original image, used to compensate for projection distortion caused by surface curvature. Step S5 involves extracting Sa2.5 candidate regions based on the LAB color space. The original image is converted from RGB to LAB color space, and the L, A, and B channels are extracted. Multiple masks are then used for fusion to obtain Sa2.5 candidate regions for the metallic base color. Step S6 involves removing rust and oxide scale areas. Feature models are constructed for typical defect colors such as reddish-brown, yellowish-brown, light yellowish-brown, light yellow rust, rust green, and black rust and oxide scale. These unqualified areas are removed from the candidate regions to obtain the initial target rust removal area. Step S7 involves morphological optimization. This is achieved by sequentially connecting broken metal areas using closing operations, filling small black spots within hole areas, and removing small isolated noise points to obtain an optimized target region mask. Step S8 involves precise area integration calculation. The optimized target region mask is multiplied point-by-point by the surface area weight matrix, and all product results are summed to obtain the actual surface area of ​​the Sa2.5 compliant area. In this embodiment, the calculated result is 137.23 cm². 2 .

[0130] It should be understood that the sinusoidal projection mapping relationship used in this embodiment is an engineering approximation based on an orthogonal projection model. When the camera distance is greater than 5 times the pipe diameter, the projection error of this model is less than 1%, which can meet the accuracy requirements of most industrial rust removal inspections. When the shooting distance is close or the measurement accuracy requirements are extremely high, a perspective projection model can be used for more accurate coordinate mapping.

[0131] This invention transforms the area integration of a continuous curved surface into a numerical integration problem that can be calculated under digital image conditions through the discrete pixel integration method, thereby realizing high-precision automated measurement of the rust removal area of ​​complex cylindrical workpieces.

[0132] This invention effectively solves the problem of difficulty in quantifying the rust removal area of ​​curved surfaces by introducing surface parameter mapping and infinitesimal integration methods, providing a high-precision and automated technical means for surface treatment quality inspection.

[0133] This approach, combining orthogonal projection model with single-plane calibration, strikes a balance between accuracy and complexity. When the camera object distance is much larger than the pipe diameter, perspective distortion is very small, and the assumption of global pixel equivalent approximately holds. In this case, the calculation error of this method is within an acceptable range, and it is fast and easy to implement. For applications requiring high precision, the aforementioned perspective projection model can be used. Although this model has higher computational complexity, it is theoretically more rigorous and can eliminate all projection distortion.

[0134] Based on the same inventive concept, this invention also provides a computer device, comprising: one or more processors, and a memory for storing one or more computer programs; the programs include program instructions, and the processor executes the program instructions stored in the memory. The processor may be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. It is the computing and control core of the terminal, used to implement one or more instructions, specifically for loading and executing one or more instructions stored in a computer storage medium to implement the above-described method.

[0135] It should be further explained that, based on the same inventive concept, the present invention also provides a computer storage medium storing a computer program, which, when executed by a processor, performs the above-described method. This storage medium can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.

[0136] It should be noted that, unless otherwise defined, the technical or scientific terms used in this invention should have the ordinary meaning understood by one of ordinary skill in the art to which this invention pertains. The terms "first," "second," and similar terms used in this invention do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed following the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are used only to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0137] The above description is merely a preferred embodiment of the present invention and is not intended to limit the invention in any other way. Any person skilled in the art may make changes or modifications to the above-disclosed technical content to create equivalent embodiments. However, any simple modifications, equivalent changes, and modifications made to the above embodiments based on the technical essence of the present invention without departing from the scope of the present invention shall still fall within the protection scope of the present invention.

[0138] This invention is not limited to the preferred embodiment described above. Anyone inspired by this invention can derive other various forms of methods for identifying rust removal areas and accurately calculating the area of ​​curved workpieces. All equivalent variations and modifications made within the scope of the claims of this invention shall fall within the scope of this invention.

Claims

1. A rust removal area identification and area accurate calculation method for a curved workpiece, characterized in that, It includes the following steps: Obtain the surface image of the cylindrical workpiece and establish the calibration relationship between the image pixel size and the actual physical size; Select the area to be detected and generate the corresponding binary mask; Map the pixel coordinates in the area to be detected to the cylindrical parameter space to obtain the central angle variable and the axial length variable corresponding to each pixel; According to the cylindrical geometric relationship and the mapping relationship, calculate the area correction weight for each pixel in the area to be detected. The weight is used to correct the area representation error of the pixel caused by the cylindrical curvature and imaging projection. The correction weights of all pixels form the surface area weight matrix; Convert the image to the LAB color space, identify the metal base color area and generate the rust removal candidate area; Eliminate the rust and scale areas in the rust removal candidate area, and generate the target area mask after morphological optimization; Perform pixel-by-pixel weighted summation of the target area mask and the surface area weight matrix to obtain the actual physical area of the rust removal area.

2. The method for identifying and calculating the area of the rust removal region on the curved workpiece according to claim 1, characterized in that: The establishment of the calibration relationship between the image pixel size and the actual physical size includes obtaining the horizontal pixel physical width equivalent and the vertical pixel physical length equivalent through calibration; the area correction weight is the product of the horizontal pixel physical width equivalent and the vertical pixel physical length equivalent corresponding to the pixel, divided by the cosine value of the central angle variable corresponding to the pixel.

3. The method for identifying and accurately calculating the area of the rust removal area for a curved workpiece according to claim 1, wherein: The identification of the metal base color area and the generation of the rust removal candidate area specifically include: Set the main metal base color mask condition as the brightness component L ∈ [60, 98], the A component ∈ [-10, 10], and the B component ∈ [-15, 20]; Construct a silver sub-mask that satisfies L > 80 and |A| < 8 and |B| < 8; Construct a gray sub-mask that satisfies 75 < L < 80 and |A| < 10 and B < 5; Construct a blue-gray sub-mask that satisfies L > 60 and B < -10 and |A| < 8; Fuse the pixel areas that meet the main metal base color mask condition or any of the sub-mask conditions through logical OR operation to generate the rust removal candidate area.

4. The method for identifying and calculating the area of the rust removal region on the curved workpiece according to claim 1, characterized in that: The elimination of the rust and scale areas in the rust removal candidate area specifically includes: generating the rust area mask and the scale area mask according to the characteristic color model including red-brown, yellow-brown, yellow-orange, rust-green and black, and performing a logical difference operation on the rust removal candidate area to eliminate the corresponding areas.

5. The method for identifying and calculating the area of rust removal region on a curved workpiece according to claim 1, characterized in that: The morphological optimization sequentially includes closing operation, hole filling, and removal of small area connected domains.

6. The method for identifying and accurately calculating the area of the rust removal area for a curved workpiece according to claim 2, wherein: The mapping of the pixel coordinates in the area to be detected to the cylindrical parameter space specifically includes: Based on the horizontal horizontal center pixel coordinate of the cylindrical cross-section in the image, take the ratio of the difference between the horizontal coordinate of the current pixel and the center pixel coordinate multiplied by the horizontal pixel physical width equivalent to the cylindrical radius as the intermediate value, and perform an arcsine operation on the intermediate value to obtain the central angle variable; Take the product of the vertical coordinate of the current pixel and the vertical pixel physical length equivalent as the axial length variable; When the absolute value of the intermediate value is greater than 1, the pixel is determined to be located in the invisible area of ​​the cylindrical workpiece and is removed. During image acquisition, the camera's optical axis is perpendicular to the central axis of the cylinder, and the central axis of the cylinder is parallel to the horizontal edge of the camera's imaging plane.

7. The method for identifying and calculating the area of rust removal region on a curved workpiece according to claim 1, characterized in that: After obtaining the actual physical area of ​​the rust removal area, a verification step is further included: the actual physical area is compared with the planar projected area calculated based on the number of mask pixels and pixel equivalent of the target area. If the ratio of the two exceeds a preset reasonable range, an abnormal warning message is output.

8. The method for identifying and calculating the area of the rust removal region on a curved workpiece according to claim 3, characterized in that: The color component thresholds in the main metal base color mask conditions and each sub-mask condition allow for floating adjustments around the reference value based on the actual lighting environment or workpiece material.

9. A computer-readable storage medium having stored thereon a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 8.

10. A system for identifying and calculating the area of ​​rust-removed regions on cylindrical workpieces, characterized in that, include: The image acquisition and calibration module is used to acquire surface images of cylindrical workpieces and establish a calibration relationship between image pixel size and actual physical size; The region selection module is used to select the region to be detected and generate the corresponding binary mask; The parameter mapping module is used to map the pixel coordinates within the detection area to the cylindrical parameter space, and obtain the central angle variable and axial length variable corresponding to each pixel; The area modeling module is used to calculate the area correction weight for each pixel in the region to be detected and generate a surface area weight matrix based on the cylindrical geometric relationship and the mapping relationship. The target recognition module is used to convert the image to the LAB color space to identify the metal base color area, remove the rust and oxide scale areas, and generate a target area mask after morphological optimization; The area calculation module is used to perform a pixel-by-pixel weighted summation of the target area mask and the surface area weight matrix to obtain the actual physical area of ​​the rust removal area.