CN-122024252-A - Workpiece metal surface character recognition method based on image segmentation
Abstract
The invention provides a workpiece metal surface character recognition method based on image segmentation, which relates to the technical field of image processing, and the method is used for decoupling a single-frame gray level image into intrinsic reflectivity distribution and illumination component distribution through total variation regularization decomposition; constructing an illumination confidence field based on gradient statistical characteristics of illumination components, generating light-topology mixed seed data by combining morphological corrosion characteristics and skeleton connectivity characteristics, performing controlled geodesic morphological reconstruction and dynamic truncation by taking intrinsic reflectivity as a mask and mixed seeds as marks to generate a character enhancement structure, and finally, outputting a recognition result by combining surface quality evaluation. Through the deep coupling of physical optics and geometric topology, the problems of character fracture and background texture noise interference of the strong reflective metal surface are effectively solved, and the recognition robustness under complex working conditions is improved.
Inventors
- CHU JIANYU
- WU XINLIAN
- GUO NING
Assignees
- 济南东科科技有限公司
Dates
- Publication Date
- 20260512
- Application Date
- 20260202
Claims (10)
- 1. The workpiece metal surface character recognition method based on image segmentation is characterized by comprising the following specific steps of: s1, acquiring single-frame gray image data representing optical characteristics of the surface of a workpiece; S2, performing total variation regularization decomposition operation on the single-frame gray image data to separate and generate intrinsic reflectivity distribution data representing inherent properties of materials and illumination component distribution data representing ambient illumination and specular reflection intensity; S3, calculating and generating an illumination confidence field map based on the local gradient statistical characteristics of the illumination component distribution data, and using the illumination confidence field map as a space weighting factor to perform weighted fusion on morphological corrosion characteristics and skeleton connectivity characteristics derived from the intrinsic reflectivity distribution data so as to generate light-topology mixed seed data; S4, performing geodesic morphological reconstruction operation by taking the intrinsic reflectivity distribution data as a morphological mask and the light-topology mixed seed data as a morphological mark so as to generate character enhancement structure data which represents filtered background texture noise and repair reflection fracture defects; S5, binarization and pattern matching processing are carried out on the character enhancement structure data, and final character recognition result data are output.
- 2. The method for recognizing characters on a metal surface of a workpiece based on image segmentation according to claim 1, wherein in step S1, single-frame gray-scale image data representing optical characteristics of the surface of the workpiece is obtained, comprising: And receiving an original two-dimensional array signal from an image sensor, and performing linear demosaicing and gray mapping processing on the original two-dimensional array signal to generate single-frame gray image data with linear luminosity response characteristics, wherein each pixel value of the single-frame gray image data is proportional to the physical radiation brightness of the surface of the workpiece at the position.
- 3. The method for recognizing characters on a metal surface of a workpiece based on image segmentation according to claim 2, wherein in step S2, performing a total variation regularization decomposition operation comprises: And iteratively solving the energy functional model through an alternate direction multiplier method, and calculating two components enabling the energy functional model to reach the minimum value, wherein the two components are respectively defined as the intrinsic reflectivity distribution data and the illumination component distribution data.
- 4. The method for recognizing characters on a metal surface of a workpiece based on image segmentation according to claim 3, wherein in step S2, an energy functional model comprising a data fidelity term, a reflectivity total variation sparse term and an illumination smoothing term is constructed, further comprising: a local texture activity analysis step of executing local variance statistics operation on the single-frame gray image data to generate a texture activity distribution map representing the local detail abundance of the image; A regularization weight dynamic mapping step is executed, wherein an independent self-adaptive regularization weight coefficient is generated for each pixel position in an image through a preset inverse proportion mapping function based on the texture activity distribution diagram; And performing weighted energy functional construction, namely applying the self-adaptive regularization weight coefficient to the reflectivity total variation sparse term pixel by pixel through multiplication operation, so as to enhance the smoothness constraint in a flat area and reduce the smoothness constraint in a texture rich area.
- 5. The method for recognizing characters on a metal surface of a workpiece based on image segmentation according to claim 4, wherein in step S3, a piece of light-topology mixed seed data is generated, comprising the following sub-steps: Calculating a gradient amplitude field of the illumination component distribution data, and converting the gradient amplitude field into the illumination confidence field map with the value ranging from 0 to 1 through a negative exponential mapping function, wherein the larger the gradient amplitude is, the lower the corresponding confidence value is; Step 3.2, morphological corrosion operation is carried out on the intrinsic reflectivity distribution data to generate basic corrosion characteristic data; sub-step 3.3, performing topology skeleton extraction operation on the intrinsic reflectivity distribution data to generate skeleton connectivity characteristic data; And 3.4, for each pixel position in the image, taking the numerical value of the illumination confidence level field map as a first weight, taking the complement of the numerical value of the illumination confidence level field map as a second weight, and carrying out linear weighted summation on the basic corrosion characteristic data and the skeleton connectivity characteristic data to generate the light-topology mixed seed data.
- 6. The method for recognizing characters on a metal surface of a workpiece based on image segmentation according to claim 5, wherein in the substep 3.1 of the step S3, an illumination confidence field map is calculated and generated, which specifically comprises: A step of constructing a structure tensor, which is to construct a semi-positive structure tensor matrix based on the horizontal gradient and the vertical gradient in the neighborhood of each pixel position of the illumination component distribution data; Performing coherence index calculation, namely performing eigenvalue decomposition on the structure tensor matrix to obtain a main eigenvalue and a secondary eigenvalue, and calculating the square of the difference between the main eigenvalue and the secondary eigenvalue to generate a local structure coherence index; And executing the confidence coefficient mapping step, namely acquiring a preset illumination confidence coefficient attenuation coefficient parameter, calculating the product of the local structural coherence index and the illumination confidence coefficient attenuation coefficient parameter, and executing negative exponent operation on the product so as to generate the illumination confidence field mapping diagram.
- 7. The method for recognizing characters on a metal surface of a workpiece based on image segmentation according to claim 6, wherein in step S3, morphological corrosion features derived from the intrinsic reflectivity distribution data and skeleton connectivity features are weighted and fused, specifically comprising: Configuring a disc-shaped structural element with a radius of a preset pixel value, and performing morphological corrosion on the intrinsic reflectivity distribution data by using the disc-shaped structural element to generate basic corrosion characteristic data; Extracting a single-pixel width central line of the intrinsic reflectivity distribution data to generate skeleton connectivity characteristic data; and for each pixel position, taking the numerical value of the illumination confidence field map as a first weight, and taking the difference value of the numerical value of the illumination confidence field map and 1 as a second weight, performing linear weighted summation on the basic corrosion characteristic data and the skeleton connectivity characteristic data to generate the light-topology mixed seed data.
- 8. The method for recognizing characters on a metal surface of a workpiece based on image segmentation according to claim 7, wherein in step S4, a geodesic morphological reconstruction operation is performed, which is based on a morphological reconstruction algorithm, and the light-topology mixed seed data is driven to perform iterative conditional expansion under the numerical height constraint defined by the intrinsic reflectivity distribution data until pixel values of all connected areas are not changed any more, so that an image structure which is spatially connected with the light-topology mixed seed data is reserved, and meanwhile, unconnected texture noise is suppressed; in step S4, performing the iterative conditional expansion specifically includes: acquiring a preset reconstruction stability threshold and a preset stabilization period number; Entering an iteration loop, and in each iteration, performing expansion operation on the light-topology mixed seed data and performing numerical truncation by utilizing the intrinsic reflectivity distribution data to generate updated light-topology mixed seed data; calculating the total pixel change amount between the updated light-topology mixed seed data and the light-topology mixed seed data before updating; Establishing a stability counter, if the total pixel change amount is smaller than the reconstruction stability threshold, increasing the value of the stability counter, otherwise, resetting the stability counter; the iterative loop is terminated only when the value of the stability counter reaches the number of stability cycles.
- 9. The method for recognizing metal surface words of a workpiece based on image segmentation according to claim 8, wherein before outputting final character recognition result data in step S5, further comprising performing surface quality evaluation and system self-diagnosis procedures: Calculating differential image data between the intrinsic reflectivity distribution data and the character enhancement structure data; Generating a surface quality evaluation index representing the degree of physical defects of the surface of the workpiece based on the local variance statistic of the differential image data; and meanwhile, calculating a global average illumination value of the illumination confidence field map, and generating a state alarm signal indicating abnormal ambient illumination or sensor shielding when the global average illumination value is lower than a preset safety threshold.
- 10. The method for recognizing characters on a metal surface of a workpiece based on image segmentation according to claim 9, wherein in step S5, a surface quality evaluation index representing the degree of physical defects on the surface of the workpiece is generated, specifically comprising: Calculating differential image data between the intrinsic reflectivity distribution data and the character enhancement structure data; dividing the differential image data into a plurality of local windows, constructing a gray level co-occurrence matrix aiming at each local window, and carrying out normalization processing to obtain a probability matrix; Calculating the product of the element value and the natural logarithm of the element value for each non-zero element in the probability matrix, and summing the negative values of all the products to generate a local texture disorder index; Calculating peak values or overrun ratios of local texture disorder indexes of all local windows as the surface quality evaluation indexes; In step S5, a status alarm signal indicating that the ambient light is abnormal or the sensor is blocked is generated, specifically including: Acquiring a preset illumination warning trigger threshold and an illumination restoration reset threshold, wherein the value of the illumination restoration reset threshold is larger than that of the illumination warning trigger threshold; calculating a global average illumination value of the illumination confidence field map, and reading a currently recorded alarm state identifier; If the alarm state identifier indicates a non-alarm state and the global average illumination value is lower than the illumination warning trigger threshold, generating the state alarm signal and updating the alarm state identifier into an alarm state; If the alarm state identifier indicates an alarm state and the global average illumination value is higher than the illumination restoration reset threshold, the state alarm signal is released, and the alarm state identifier is updated to be in a non-alarm state; And if the global average illumination value is between the illumination warning trigger threshold and the illumination recovery reset threshold, maintaining the current state of the alarm state identifier and the state alarm signal unchanged.
Description
Workpiece metal surface character recognition method based on image segmentation Technical Field The invention relates to the technical field of image processing, in particular to a workpiece metal surface character recognition method based on image segmentation. Background With the rapid development of computer vision and intelligent chip interaction technology, a non-contact recognition technology based on image analysis has been widely applied to the fields of precision manufacturing, medical instrument tracing, high-end industrial control and the like. In these scenes, the accurate reading of characters on the surface of an object by an image recognition analysis technology is a key link for realizing full life cycle data interaction and tracing. However, unlike conventional OCR scenes with paper or diffuse reflective surfaces, character recognition of high-finish material surfaces such as metal, ceramic, etc. is faced with very harsh optical environment and texture disturbance challenges. In the prior art, the character recognition of the surface of a metal workpiece has a significant technical bottleneck. The high frequency texture produced by the wire drawing, sand blasting or grinding process inherent to the metal surface is highly overlapped with the dot-needle or laser etched character strokes on the frequency domain characteristics, which makes it difficult for the traditional edge detection algorithm based on gradient operators to distinguish background noise from character signals. The complex and varied lighting environment of the industrial site can create strong specular reflection (high light) or shadow areas on highly reflective surfaces, causing visual breakage of character topologies on the imaging sensor. Although a recognition method based on deep learning and Retinex enhancement is proposed in the patent document with publication number CN117275010a, and is processed by filtering and template matching, such a physical model-based enhancement method often has a "noise amplification effect" in which background texture noise is erroneously enhanced while uneven illumination is removed, whereas a conventional morphological segmentation method can suppress texture, but when a character stroke is broken due to strong reflection, due to lack of an effective connectivity seed, correct morphological reconstruction cannot be completed, resulting in fluctuation of recognition rate under extreme working conditions. In view of the above challenges, the present invention proposes an adaptive image analysis strategy for "optical-topological coupling". Unlike the data driven mode of a single dependent deep neural network or the image enhancement mode of a single dependent physical model, the invention constructs an 'illumination confidence weighted geodesic seed generator'. The method decouples the image into material intrinsic properties and illumination components through total variation regularization decomposition, and converts gradient statistical properties of the illumination components into a spatial confidence field, so as to dynamically guide seed generation of morphological reconstruction. The method realizes the transition from global consistency processing to local self-adaptive weighting, aims at utilizing physical layer information to heal the characters broken by reflection, and utilizes topology layer information to inhibit high-frequency background noise. Disclosure of Invention The invention aims to provide a workpiece metal surface character recognition method based on image segmentation, so as to solve the problems in the background technology. In order to achieve the above purpose, the present invention provides the following technical solutions: a workpiece metal surface character recognition method based on image segmentation specifically comprises the following steps: s1, acquiring single-frame gray image data representing optical characteristics of the surface of a workpiece; S2, performing total variation regularization decomposition operation on the single-frame gray image data to separate and generate intrinsic reflectivity distribution data representing inherent properties of materials and illumination component distribution data representing ambient illumination and specular reflection intensity; S3, calculating and generating an illumination confidence field map based on the local gradient statistical characteristics of the illumination component distribution data, and using the illumination confidence field map as a space weighting factor to perform weighted fusion on morphological corrosion characteristics and skeleton connectivity characteristics derived from the intrinsic reflectivity distribution data so as to generate light-topology mixed seed data; S4, performing geodesic morphological reconstruction operation by taking the intrinsic reflectivity distribution data as a morphological mask and the light-topology mixed seed data as a morphological mark so as to gen