A cable inkjet character reading method and system based on image recognition

By constructing axial and circumferential mapping relationships to correct the geometric distortion of the printed characters on the cable, an accurate target unfolded image is generated, which solves the problem of character recognition difficulties caused by cable bending and nonlinear projection, and achieves high-precision OCR recognition effect.

CN121963217BActive Publication Date: 2026-07-21CHUNHUA KUNLUN YOUJIA CABLE CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CHUNHUA KUNLUN YOUJIA CABLE CO LTD
Filing Date
2026-04-02
Publication Date
2026-07-21

AI Technical Summary

Technical Problem

Existing technologies cannot accurately read inkjet-printed characters in cable character recognition, mainly because the bending of the cable causes the characters to be compressed or stretched, and the nonlinearity of the projection on the cylindrical surface causes character distortion, which traditional methods cannot effectively correct.

Method used

By constructing a dual mapping relationship in both the axial and circumferential directions, the character compression or stretching is corrected using the true arc length of the cable centerline, and the nonlinear projection is corrected by back-calculation of the brightness profile, generating a target unfolded image with minimal geometric distortion for OCR recognition.

Benefits of technology

It significantly improves the accuracy and adaptability of OCR recognition, solves the problem of character recognition under cable bending and non-ideal projection, and enhances recognition accuracy and robustness.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121963217B_ABST
    Figure CN121963217B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of image processing, in particular to a cable inkjet code character reading method and system based on image recognition. The method comprises: obtaining a surface image of a cable containing inkjet code characters; constructing a blank target unwinding image corresponding to the surface image; constructing an axial mapping relationship and a circumferential mapping relationship; based on the axial mapping relationship and the circumferential mapping relationship, filling the gray value of each original pixel position in the surface image into the corresponding pixel position in the blank target unwinding image to obtain a target image; and performing OCR identification on the target image to obtain a reading result. That is, the scheme of the present application can solve the problems of difficult inkjet code character recognition and low precision caused by cable bending and nonlinear cylinder projection in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology. More specifically, this invention relates to a method and system for reading cable inkjet characters based on image recognition. Background Technology

[0002] During the production and manufacturing process of wires and cables, it is necessary to continuously print character information such as model, specifications, and meter markings on the cable surface for quality traceability and inventory management.

[0003] Industrial optical character recognition (OCR) systems are widely used for automatically reading these inkjet codes. However, in actual production lines, cable inkjet code recognition faces two major challenges:

[0004] (a) The traditional linear straightening algorithm incorrectly equates the projected length with the actual arc length. However, the cable is curved along its axis, and its actual surface arc length is greater than its projected length on the X-axis of the image. Therefore, it is easy to cause the characters in the curved area of ​​the cable to be severely compressed, resulting in character sticking and uneven spacing.

[0005] (ii) The cable is a cylinder, and its surface projection onto the 2D image is non-linear. Due to the projection of the cable's cylindrical surface, characters are severely compressed in the image edge areas, resulting in a noticeable narrowing distortion of characters (such as "O") at the edges. The area near the center of the cable (facing the camera) is stretched, while the areas near the top and bottom edges of the cable are severely compressed.

[0006] To address the aforementioned issues, some methods attempt to use a fixed inverse cosine formula for correction, but this only applies to ideal orthogonal projections and perfect cylinders, and cannot adapt to the real perspective of production lines and cable ellipticity.

[0007] Therefore, there is an urgent need for a method that can solve the problem of inaccurate reading of inkjet characters when performing cable inkjet coding identification. Summary of the Invention

[0008] The purpose of this invention is to propose a method and system for reading inkjet-printed characters on cables based on image recognition, so as to solve the problem that the existing technology cannot accurately read inkjet-printed characters; to this end, this invention provides solutions in the following two aspects.

[0009] In a first aspect, the present invention provides a method for reading cable inkjet characters based on image recognition, comprising:

[0010] Obtain a surface image of the cable containing the inkjet-printed characters;

[0011] Construct a blank target unfolded image corresponding to the surface image;

[0012] Extract the centerline along the axial direction of the cable from the surface image, and calculate the true arc length of each abscissa on the centerline; based on the correspondence between the true arc length and the abscissa in the surface image, construct an axial mapping relationship that maps the abscissa of the unfolded target image to the abscissa of the surface image.

[0013] Remove the inkjet characters from the surface image to obtain a background image. Obtain the mean sequence of multiple grayscale value sequences along the circumference of the cable in the background image to form a main brightness profile. Construct an arc length curvature function that is negatively correlated with each mean value in the main brightness profile. Integrate the arc length curvature function along the vertical axis to obtain the cumulative arc length curvature. Based on the correspondence between the cumulative arc length curvature and the vertical coordinate in the surface image, construct a circumferential mapping relationship that maps the vertical coordinate of the unfolded target image to the vertical coordinate in the surface image.

[0014] Based on the axial and circumferential mapping relationships, the gray values ​​of each original pixel position in the surface image are filled into the corresponding pixel positions in the blank target unfolded image to obtain the target image;

[0015] The target image is subjected to OCR recognition to obtain the reading result.

[0016] The above scheme addresses image distortion by constructing a dual relationship of axial and circumferential mapping. Axial mapping, based on the true arc length of the cable centerline, accurately corrects character compression or stretching caused by cable bending, resolving the error of traditional linear straightening algorithms that equate projected length with actual length. Circumferential mapping utilizes the brightness profile of the surface image (brightness is negatively correlated with surface curvature) to inversely deduce and correct character deformation caused by the nonlinear projection of the cylinder. This dual mapping method generates a target unfolded image with minimal geometric distortion, significantly improving the accuracy of subsequent OCR recognition and adaptability to complex on-site environments (such as cable bending and non-ideal projection).

[0017] Optionally, the process of constructing the axial mapping relationship is as follows:

[0018] The width of the expanded image of the target is used to normalize all true arc lengths to obtain a set of arc lengths; the width is the maximum value among all true arc lengths.

[0019] Obtain the horizontal position in the unfolded image of the target At the first scale position in the unfolded image of the target, where, , Expand the width of the image to the target;

[0020] In the arc length set, find the arc length that is equal to the first proportional position by traversing the set, and compare the horizontal coordinate of the corresponding arc length in the original pixel position of the surface image with the horizontal position in the unfolded target image. Mapping is performed; if an arc length equal to the first proportional position cannot be found, linear interpolation is performed between two adjacent arc lengths of the first proportional position in the arc length set to obtain the interpolated arc length. The horizontal coordinate of the original pixel position of the interpolated arc length in the surface image is then compared with the horizontal position of the target unfolded image. Perform mapping.

[0021] The point-by-point mapping method based on the normalized arc length set described above ensures the accuracy and continuity of axial correction, enabling the final unfolded image to more realistically reproduce the physical size and spacing of the characters along the cable axis.

[0022] Optionally, the circumferential mapping relationship is:

[0023] The cumulative arc length curvature is normalized using the height of the unfolded image of the target to obtain the cumulative arc length set; the height is the integer value of the product of the average diameter and pi, and the average diameter is the sum of the upper and lower edges of all grayscale value sequences. The mean of the differences between the axis coordinates;

[0024] Calculate the vertical position in the unfolded image of the target The second proportional position within the height of the unfolded target image; if there exists a second proportional position that is equal to the cumulative arc length of the accumulated arc length, then the vertical position of the unfolded target image is adjusted. A one-to-one mapping is performed between the ordinate and the ordinate in the surface image; if no equal ordinate exists, the two cumulative arc lengths adjacent to each other in the cumulative arc length set at the second proportional position are obtained, and linear interpolation is performed using the two cumulative arc lengths to obtain the ordinate of the interpolated cumulative arc length in the surface image, and the ordinate is then mapped one-to-one with the vertical position of the target unfolded image.

[0025] The above solution converts optical characteristics (brightness) into precise geometric correction parameters, achieving high-precision unfolding of the cylindrical surface of the cable and effectively solving the problem of severe compression of characters near the edge.

[0026] Optionally, the arc length curvature function is calculated as follows:

[0027] ;

[0028] in, y-axis The value of the arc length curvature function, The y-axis in the mean sequence The corresponding mean, is a preset positive number, where i is the index of the original pixel position in the surface image.

[0029] Optionally, extracting the centerline of the cable along the axial direction in the surface image includes:

[0030] Edge detection is performed on the surface image to obtain an edge map;

[0031] Perform a morphological closing operation on the edge graph to connect edge breakpoints;

[0032] The two longest edges in the edge graph are designated as the top and bottom edges, respectively.

[0033] The upper and lower edges are smoothed using a B-spline fitting algorithm to obtain the upper edge curve and the lower edge curve. The average value of the ordinate on the upper and lower edge curves under each horizontal coordinate is calculated. The set of points corresponding to all average values ​​constitutes the centerline.

[0034] The above scheme can effectively handle edge breakpoints and noise, providing data support for subsequent calculation of the true arc length and construction of accurate axial mapping relationships.

[0035] Optionally, acquiring the background image includes:

[0036] The surface image was segmented using the Otsu thresholding method to obtain character regions;

[0037] The character region is removed to obtain a blank region, and the blank region is filled using a bicubic interpolation algorithm to obtain the background image.

[0038] Optionally, the specific process of obtaining the surface image of the cable containing the inkjet-printed characters is as follows:

[0039] The images were acquired sequentially: the left-side image with the left-side light source, the right-side image with the right-side light source, and the ambient light image when there was no light source.

[0040] The left image and the ambient light image, and the right image and the ambient light image are respectively subjected to difference operations to obtain the left difference image and the right difference image;

[0041] The left and right difference images are merged to obtain a minimum value image, where the gray value of each pixel in the minimum value image is the smaller of the gray values ​​in the left and right difference images for the corresponding position.

[0042] The minimum value image is subjected to zero-value clamping to obtain the surface image.

[0043] The above scheme greatly improves the stability and accuracy of subsequent edge detection, centerline extraction, and brightness profile analysis.

[0044] Optionally, performing OCR recognition on the unfolded image of the target further includes:

[0045] The watershed algorithm is applied to the unfolded image of the target to segment it, resulting in multiple character blocks;

[0046] Merge adjacent character blocks that meet preset conditions;

[0047] Perform OCR recognition on each merged character block.

[0048] Optionally, the preset conditions include vertical merging and horizontal merging;

[0049] The vertical merging is defined as follows: the difference between the centroids of two adjacent character blocks in the vertical direction and the difference in the horizontal direction is less than the first width threshold, and the difference between the centroids in the vertical direction is less than the second height threshold.

[0050] The horizontal merging is defined as follows: the difference between the centroids of two adjacent character blocks in the horizontal direction and the difference in the vertical direction is less than the second height threshold, and the difference in the horizontal direction is less than the second width threshold, and the total aspect ratio of the merged character blocks is within the range of [0.5, 2.0].

[0051] The first width threshold is less than the second width threshold.

[0052] In a second aspect, a cable inkjet character reading system based on image recognition includes:

[0053] processor;

[0054] The memory stores computer instructions for reading cable inkjet characters based on image recognition, which, when executed by the processor, cause the system to perform the aforementioned method for reading cable inkjet characters based on image recognition.

[0055] The beneficial effects of this invention are as follows:

[0056] The solution of the present invention can unfold the distorted character image into a regular planar image, fundamentally solving the problems of low recognition rate and poor robustness of the prior art, and greatly improving the accuracy of OCR recognition. Attached Figure Description

[0057] Figure 1 This schematically illustrates a flowchart of the steps of a cable inkjet character reading method based on image recognition in this embodiment;

[0058] Figure 2 The diagram illustrates the structural block diagram of a cable inkjet character reading system based on image recognition in this embodiment. Detailed Implementation

[0059] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.

[0060] like Figure 1As shown in this embodiment, a cable inkjet printing character reading method based on image recognition includes the following steps:

[0061] Step S1: Obtain a surface image of the cable containing the inkjet-printed characters and perform preprocessing.

[0062] In this embodiment, the specific process of obtaining the surface image of the cable containing the inkjet-printed characters is as follows:

[0063] First, in a controlled lighting environment, an industrial camera is used to sequentially capture images of the left side under left-side lighting, the right side under right-side lighting, and the ambient light image when there is no light source.

[0064] Next, difference operations are performed on the left image and the ambient light image, and the right image and the ambient light image, respectively, to obtain the left difference image and the right difference image.

[0065] Then, the left and right difference images are merged to obtain the minimum value image. That is, the smaller gray value at the same pixel position of the two difference images is taken as the gray value of the minimum value image. Zero-value clamping is performed on the minimum value image to set all negative pixels to 0 and retain non-negative gray values ​​to obtain the surface image of the cable.

[0066] Due to the complex and variable lighting conditions in industrial environments, and the fact that cable sheaths typically have smooth surfaces, single-frame images often contain both uncontrollable ambient light noise and high-intensity specular highlights. While these lighting components are part of the original optical signal, they severely distort and obscure the true diffuse reflectance of the cable background, causing subsequent physical calibration (relying on the Lambert model) to fail due to incorrect input data. Therefore, differential computation can eliminate the effects of uneven ambient lighting and highlight the surface features of the cable illuminated by directional light sources.

[0067] The method described above, which obtains the minimum value image, can effectively suppress specular reflection and retain clearer character and background information.

[0068] Step S2: Construct the axial mapping relationship.

[0069] This embodiment aims to solve the problem of character compression or stretching caused by axial bending of the cable, that is, by calculating the true arc length of the center line and establishing the horizontal coordinate in the target unfolded image ( (axis) and the horizontal coordinate in the surface image ( The axial mapping relationship between axes.

[0070] Before constructing the axial mapping relationship, it is necessary to first construct a blank target unfolded image corresponding to the surface image.

[0071] Specifically, the process of constructing the axial mapping relationship is as follows:

[0072] First, the center line along the axial direction of the cable is extracted from the surface image.

[0073] Specifically, the process of obtaining the centerline is as follows:

[0074] First, an edge detection algorithm is performed on the surface image to obtain an edge map. Then, a morphological closing operation is performed on the edge map to connect these breakpoints and form more continuous edges. Next, the two longest edges are selected from the edge map and designated as the upper and lower edges of the cable, respectively. A B-spline fitting algorithm is then used to fit the pixels on the upper and lower edges to obtain the upper and lower edge curves. Finally, the curves for each... The upper and lower edge curves on the axial coordinate system correspond to the vertical ( The average value of the (axis) coordinates, and the trajectory formed by the points corresponding to all these average values ​​is the centerline of the cable.

[0075] It should be noted that the X-axis and Y-axis mentioned above are the horizontal and vertical axes in the pixel coordinate system, that is, with the top left corner of the image as the origin, the X-axis is positive to the right and forward, and the Y-axis is positive downward.

[0076] The edge detection algorithm described above uses the Canny operator; the morphological closing operation described above uses a 3×1 linear structuring element (along the X-axis or horizontal direction), and this structuring element is used to perform the morphological closing operation (dilation followed by erosion) on the binary edge map.

[0077] The B-spline fitting algorithm described above is used to obtain smooth and accurate edge curves; since the B-spline fitting algorithm is existing technology, it will not be elaborated on here.

[0078] The edges in the image include both the physical boundaries of the cable (the upper and lower edges of the cable) and the edges of the printed characters themselves. Obviously, the precise positions of the upper and lower edges of the cable constitute the key geometric constraints required for the mapping function from the surface of the curved cable to the unfolded image on the plane. However, if the character edges are used as the reference, the entire coordinate system will be established on the content rather than the carrier, causing correction distortion. Therefore, obtaining the upper and lower edges of the cable is particularly important.

[0079] Secondly, calculate the true arc length of the horizontal coordinate at each pixel position in the center line.

[0080] Because the cable is bent on the production line, there is a non-linear geometric distortion between its actual arc length and the X-axis projection, causing the characters to be compressed and deformed in the bent area.

[0081] Differential geometry theory shows that the ratio of the true arc length of a curve to its projected length depends on the local slope; the more severe the curvature, the more severe the projected compression. To address this issue, this embodiment requires obtaining the true arc length of the cable to provide data support for the subsequent establishment of the mapping relationship.

[0082] In this embodiment, the true arc length can be obtained by calculating it using existing arc length formulas. Specifically, the specific steps for calculating the true total arc length using the arc length formula for smooth curves are as follows:

[0083] Treating the center line as a smooth curve, we can discretize and differentiate the values ​​of each pixel position on the center line to obtain the slope value at each position. Based on the slope and the arc differential formula, we can obtain the arc length function of each original pixel position. Then, by integrating the arc length function, we can obtain the true arc length corresponding to the x-coordinate of each original pixel position on the center line.

[0084] Subsequently, the maximum value among all the true arc lengths is used as the width of the target unfolded image, and an axial mapping relationship is constructed based on the true arc length.

[0085] It should be noted that the width is the length from the left to the right of the unfolded image of the target, that is, the total number of pixels.

[0086] The above axial mapping relationship is implemented in the form of a reverse mapping lookup table, in which the horizontal coordinates of the pixel positions in the unfolded image of the target are mapped one-to-one with the horizontal coordinates of the original pixel positions in the surface image.

[0087] The process of obtaining the axial mapping relationship is as follows:

[0088] Using the width, all true arc lengths are linearly normalized to obtain a range of values. The set of arc lengths;

[0089] Obtain the horizontal position in the unfolded image of the target (i.e., x-axis) At the first scale position in the unfolded image of the target, where, ; Expand the width of the image to the target;

[0090] In the arc length set, find the arc length that is equal to the first proportional position by traversing the set, and compare the horizontal coordinate of the corresponding arc length in the original pixel position of the surface image with the horizontal position in the unfolded target image. Mapping is performed; if no arc length distribution matching the first proportional position is found, linear interpolation is performed between two adjacent arc lengths of the first proportional position in the arc length set to obtain the interpolated arc length. The horizontal coordinate of the original pixel position of the interpolated arc length in the surface image is then compared with the horizontal position of the target unfolded image. Perform mapping.

[0091] The aforementioned first proportional position refers to the proportion of the horizontal position in the width direction of the unfolded target image, i.e., the first proportional position. for: ; Expand the width of the image to the target.

[0092] The first proportional position mentioned above takes into account that the horizontal coordinate (horizontal position) of the first pixel on the left is 0. Therefore, when calculating the first proportional position, one pixel needs to be removed.

[0093] The unfolded image of the target obtained through the above axial mapping relationship can reflect the true physical scale of the cable surface and eliminate character deformation caused by bending.

[0094] It should be noted that after establishing the axial mapping relationship, the horizontal positions in the unfolded image of the target can be determined.

[0095] Step S3: Construct a circumferential mapping relationship.

[0096] Specifically, the process of constructing the circumferential mapping relationship is as follows:

[0097] First, obtain the background image.

[0098] Specifically, the inkjet-printed character area on the surface image is first segmented and removed. Then, a bicubic interpolation algorithm is used to fill the removed character area to obtain the background image.

[0099] The segmentation method described above is the Otsu threshold method.

[0100] The above filling is achieved by using a bicubic interpolation algorithm; since the bicubic interpolation algorithm can utilize a wider range of surrounding pixel information to generate a smooth and natural transition, a characterless background image can be obtained in this embodiment.

[0101] Secondly, based on the background image, the main brightness profile and the height of the target unfolded image are extracted.

[0102] Specifically, the process of obtaining the main brightness profile is as follows:

[0103] along Multiple sampling positions are uniformly selected within the background image along the axial direction (i.e., the horizontal region where the cable is located). At each sampling position, along... Extract a grayscale value sequence along the axial direction to obtain multiple grayscale value sequences. Calculate the mean of all grayscale values ​​under the same Y-axis coordinate to obtain the main brightness profile and the corresponding grayscale mean sequence.

[0104] The height of the unfolded target image is:

[0105] Obtain the top and bottom edges of each grayscale value sequence. The difference between the axis coordinates is used as the average diameter. The average diameter is then multiplied by pi and rounded to obtain the height of the unfolded image of the target.

[0106] It should be noted that the grayscale value sequences in the above embodiments are of equal length; however, in actual situations, there may be multiple grayscale value sequences (one grayscale value sequence corresponds to one brightness profile) of unequal length. In this case, the center point of the grayscale value sequence of each brightness profile can be used as a reference, and all brightness profiles can be aligned according to this center point. Taking the longest brightness profile as a reference, one-dimensional linear interpolation is performed on the missing areas at both ends of the shorter brightness profiles to make the grayscale value sequences of all brightness profiles have the same length. Finally, the Y coordinates of all grayscale value sequences are linearly mapped to the range [0,1] to obtain the corresponding normalized ordinate.

[0107] Then, based on the main brightness profile, an arc length curvature function that is negatively correlated with the brightness value is constructed.

[0108] The arc length curvature function is calculated as follows:

[0109] ;

[0110] in, y-axis The value of the arc length curvature function, The y-axis in the mean sequence The corresponding mean, is a preset positive number, where i is the index of the original pixel position in the surface image.

[0111] In this embodiment, The preferred value is ; Introduction The basis is to prevent when the brightness value The calculation error of zero denominator occurs when the value is zero or close to zero, thus ensuring numerical stability.

[0112] In the above formula, when When increasing, move closer to the center of the cable (the middle of the cable's Y-axis). Decreasing indicates that the projection of that area is stretched, and the arc length represented by each pixel is shorter; conversely, when... When reducing the size, move closer to the cable edge (top or bottom edge). An increase indicates that the projection of that area is compressed, and the arc length represented by a unit pixel is longer.

[0113] It should be noted that, under the Lambertian reflection model, the lower the brightness of the region, the greater the curvature of the cable surface and the longer the actual arc length per unit projected length. Therefore, in this embodiment, an arc length curvature function that is negatively correlated with the brightness value is constructed to calculate the arc length curvature.

[0114] Finally, regarding the arc length curvature function along Integrating and normalizing along the Y-axis yields the cumulative arc length of each Y-axis coordinate, and a circumferential mapping relationship is constructed.

[0115] The above cumulative arc length function is the ordinate. The relationship between arc length and curvature is used to unfold the image of the target. Axis coordinates mapped to the original surface image Axis coordinates.

[0116] Among them, at the edge of the cable (the area with lower brightness). Larger values ​​mean that these areas require greater stretching to correct circumferential distortion; while in the center of the cable (higher brightness areas). Smaller values ​​indicate that these areas retain relatively little stretch.

[0117] The above method converts optical observation (brightness) into curvature required for geometric correction by using the inverse of brightness. This makes darker areas more elongated, that is, increasing curvature in curved areas (dark areas) to restore the true width in the unfolded image of the target.

[0118] In this embodiment, the circumferential mapping relationship is a reverse mapping table, and its specific construction process is as follows:

[0119] Create a lookup table with the same height as the unfolded image of the target;

[0120] Calculate each vertical position in the unfolded image of the target. The second proportional position within the height of the unfolded target image; if the cumulative arc length is concentrated at a point where the second proportional position is equal to the cumulative arc length, then the vertical position of the unfolded target image is determined. A one-to-one mapping is performed between the ordinate and the ordinate in the surface image; if no equal ordinate exists, the two cumulative arc lengths adjacent to each other in the cumulative arc length set at the second proportional position are obtained, and linear interpolation is performed using the two cumulative arc lengths to obtain the ordinate of the interpolated cumulative arc length in the surface image, and the ordinate is then mapped one-to-one with the vertical position of the target unfolded image.

[0121] The aforementioned second proportional position refers to the percentage of the vertical position in the height direction of the unfolded target image, i.e., the second proportional position. for: ) ; The height of the image unfolded for the target.

[0122] It should be noted that the height of the unfolded target image is actually the number of pixels in the unfolded target image along the Y-axis.

[0123] It should be noted that after establishing the circumferential mapping relationship, the vertical positions in the unfolded image of the target can be determined.

[0124] Step S4: Generate the expanded image of the target and perform character recognition.

[0125] In this embodiment, by constructing axial and circumferential mapping relationships, the pixel positions in the target unfolded image corresponding to the original pixel positions of the surface image are determined. This allows the grayscale values ​​in the surface image to be mapped to the grayscale values ​​in the target unfolded image, thereby generating a target unfolded image with corrected geometric distortion.

[0126] In this embodiment, the target unfolded image is used to identify the spray-coded characters.

[0127] Specifically, the recognition of inkjet-coded characters in the unfolded image of the target includes:

[0128] First, the watershed algorithm is applied to process the unfolded image of the target to obtain multiple character blocks.

[0129] Specifically, seed points of the target unfolded image are first obtained. Based on the seed points, a label-based watershed segmentation algorithm is performed on the target unfolded image to obtain multiple character blocks.

[0130] The process of obtaining the above seed points is as follows:

[0131] The Otsu method is used to perform threshold segmentation on the unfolded image of the target to obtain a binary image, and a distance transformation map of the binary image is obtained. The local maxima in the distance transformation map are used as seed points.

[0132] Secondly, traverse all character blocks and merge them to obtain a new merged character block.

[0133] The merging of character blocks includes:

[0134] Vertical merging: If the difference between the centroids of character block A and character block B on the X-axis is less than the first width threshold, and the difference between their centroids on the Y-axis is less than the second height threshold, and character block A is located above character block B, then the two character blocks are merged.

[0135] The first width threshold is 20% of the character width, and the second height threshold is 40% of the character width.

[0136] For example: fix characters such as i, :, j to prevent the dot and the main body from being incorrectly separated.

[0137] Horizontal merging: If the difference between the centroids of two adjacent character blocks in the horizontal direction on the Y-axis is less than the second height threshold, and the difference between their centroids on the X-axis is less than the second width threshold, and the overall aspect ratio after merging is within the range of [0.5, 2.0], then the two character blocks are merged.

[0138] The second height threshold is 25% of the character height, and the second width threshold is 60% of the character width.

[0139] For example: fix wide characters such as M and W to prevent them from being incorrectly split into multiple parts.

[0140] The above merging is to combine fragmented character segments caused by noise or segmentation algorithms and restore them to a single complete character.

[0141] Then, each new character block is identified to obtain the final reading result.

[0142] The above recognition was performed using the OCR recognition method.

[0143] Because the corrected characters have uniform spacing and standard shape, the recognition difficulty is greatly reduced. Furthermore, this embodiment also performs semantic verification on the recognized string, specifically: checking whether the recognition result conforms to a predefined model specification pattern, such as regular expression matching.

[0144] Based on the semantic verification results, filter out recognition results that do not meet expectations, and output reliable reading results after verification; if the verification fails, it can fall back to the result of the previous reliable frame or trigger the manual review process.

[0145] The present invention constructs a precise axial and circumferential mapping relationship to geometrically correct the surface image of the cable, generating a target unfolded image with small distortion and regular character shape, thereby significantly improving the accuracy of subsequent optical character recognition (OCR) and solving the problems of difficult and low accuracy of inkjet printing character recognition caused by cable bending and nonlinearity of cylindrical projection in the prior art.

[0146] This invention also provides a cable inkjet printing character reading system based on image recognition. For example... Figure 2 As shown, the system includes a processor and a memory. The memory stores computer program instructions, which, when executed by the processor, implement the above-described method for reading cable inkjet characters based on image recognition according to the present invention.

[0147] The system also includes other components well known to those skilled in the art, such as communication buses and communication interfaces, the settings and functions of which are known in the art and therefore will not be described in detail here.

[0148] In this invention, the aforementioned memory can be any tangible medium containing or storing a program that can be used or combined with an instruction execution system, apparatus, or device. For example, a computer-readable storage medium can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc., or any other medium that can be used to store desired information and can be accessed by an application, module, or both. Any such computer storage medium can be part of a device or accessible to or connected to a device. Any application or module described in this invention can be implemented by computer-readable / executable instructions stored or otherwise maintained on such a computer-readable medium.

[0149] In the description of this specification, "multiple" means at least two, such as two, three or more, etc., unless otherwise expressly and specifically defined.

[0150] While various embodiments of the invention have been shown and described in this specification, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will occur to those skilled in the art without departing from the spirit and essence of the invention.

Claims

1. A method for reading cable inkjet-printed characters based on image recognition, characterized in that, include: Obtain a surface image of the cable containing the inkjet-printed characters; Construct a blank target unfolded image corresponding to the surface image; Extract the centerline along the axial direction of the cable from the surface image, and calculate the true arc length of each abscissa on the centerline; Based on the correspondence between the actual arc length and the horizontal coordinate in the surface image, an axial mapping relationship is constructed to map the horizontal coordinate of the unfolded target image to the horizontal coordinate of the surface image. Remove the inkjet characters from the surface image to obtain a background image. Obtain the mean sequence of multiple grayscale value sequences along the circumference of the cable in the background image to form a main brightness profile. Construct an arc length curvature function that is negatively correlated with each mean value in the main brightness profile. Integrate the arc length curvature function along the vertical axis to obtain the cumulative arc length curvature. Based on the correspondence between the cumulative arc length curvature and the vertical coordinate in the surface image, construct a circumferential mapping relationship that maps the vertical coordinate of the unfolded target image to the vertical coordinate in the surface image. Based on the axial and circumferential mapping relationships, the gray values ​​of each original pixel position in the surface image are filled into the corresponding pixel positions in the blank target unfolded image to obtain the target unfolded image; The unfolded image of the target is subjected to OCR recognition to obtain the reading result.

2. The cable inkjet printing character reading method based on image recognition according to claim 1, characterized in that, The process of constructing the axial mapping relationship is as follows: The width of the expanded image of the target is used to normalize all true arc lengths to obtain a set of arc lengths; the width is the maximum value among all true arc lengths. Obtain the horizontal position in the unfolded image of the target At the first scale position in the unfolded image of the target, where, , Define the width of the unfolded image for the target; find the arc length in the arc length set that is equal to the first proportional position by traversing it, and compare the horizontal coordinate of the corresponding arc length in the original pixel position of the surface image with the horizontal position in the unfolded image of the target. Mapping is performed; if an arc length equal to the first proportional position cannot be found, linear interpolation is performed between two adjacent arc lengths of the first proportional position in the arc length set to obtain the interpolated arc length. The horizontal coordinate of the original pixel position of the interpolated arc length in the surface image is then compared with the horizontal position of the target unfolded image. Perform mapping.

3. The cable inkjet printing character reading method based on image recognition according to claim 1, characterized in that, The circumferential mapping relationship is as follows: The cumulative arc length curvature is normalized using the height of the unfolded image of the target to obtain the cumulative arc length set; the height is the integer value of the product of the average diameter and pi, and the average diameter is the sum of the upper and lower edges of all grayscale value sequences. The mean of the differences between the axis coordinates; Calculate the vertical position in the unfolded image of the target The second proportional position within the height of the unfolded target image; if there exists a second proportional position that is equal to the cumulative arc length of the accumulated arc length, then the vertical position of the unfolded target image is adjusted. A one-to-one mapping is performed between the ordinate and the ordinate in the surface image; if no equal ordinate exists, the two cumulative arc lengths adjacent to each other in the cumulative arc length set at the second proportional position are obtained, and linear interpolation is performed using the two cumulative arc lengths to obtain the ordinate of the interpolated cumulative arc length in the surface image, and the ordinate is then mapped one-to-one with the vertical position of the target unfolded image.

4. The cable inkjet printing character reading method based on image recognition according to claim 1, characterized in that, The arc length curvature function is calculated as follows: ; in, y-axis The value of the arc length curvature function, The y-axis in the mean sequence The corresponding mean, is a preset positive number, where i is the index of the original pixel position in the surface image.

5. The cable inkjet printing character reading method based on image recognition according to claim 1, characterized in that, Extracting the centerline along the axial direction of the cable from the surface image includes: Edge detection is performed on the surface image to obtain an edge map; Perform a morphological closing operation on the edge graph to connect edge breakpoints; The two longest edges in the edge graph are designated as the top and bottom edges, respectively. The upper and lower edges are smoothed using a B-spline fitting algorithm to obtain upper and lower edge curves. The average value of the ordinates on the upper and lower edge curves under each abscissa is calculated, and the set of points corresponding to all average values ​​constitutes the centerline.

6. The cable inkjet printing character reading method based on image recognition according to claim 1, characterized in that, Obtaining the background image includes: The surface image was segmented using the Otsu thresholding method to obtain character regions; The character region is removed to obtain a blank region, and the blank region is filled using a bicubic interpolation algorithm to obtain the background image.

7. The cable inkjet printing character reading method based on image recognition according to claim 1, characterized in that, The specific process for obtaining the surface image of the cable containing the inkjet-printed characters is as follows: The images were acquired sequentially: the left-side image with the left-side light source, the right-side image with the right-side light source, and the ambient light image when there was no light source. The left image and the ambient light image, and the right image and the ambient light image are respectively subjected to difference operations to obtain the left difference image and the right difference image; The left and right difference images are merged to obtain a minimum value image, where the gray value of each pixel in the minimum value image is the smaller of the gray values ​​in the left and right difference images for the corresponding position. The minimum value image is subjected to zero-value clamping to obtain the surface image.

8. The cable inkjet printing character reading method based on image recognition according to claim 1, characterized in that, The OCR recognition of the unfolded target image further includes: The watershed algorithm is applied to the unfolded image of the target to segment it, resulting in multiple character blocks; Merge adjacent character blocks that meet preset conditions; Perform OCR recognition on each merged character block.

9. A method for reading cable inkjet-printed characters based on image recognition according to claim 8, characterized in that, The preset conditions include vertical merging and horizontal merging; The vertical merging is defined as follows: the difference between the centroids of two adjacent character blocks in the vertical direction on the horizontal axis is less than a first width threshold, and the difference between the centroids in the vertical axis is less than a first height threshold. The horizontal merging is defined as follows: the difference between the centroids of two adjacent character blocks in the horizontal direction and the difference in the vertical direction is less than the second height threshold, and the difference in the horizontal direction is less than the second width threshold, and the total aspect ratio of the merged character blocks is within the range of [0.5, 2.0]. The first width threshold is less than the second width threshold.

10. A cable inkjet printing character reading system based on image recognition, characterized in that, include: processor; A memory storing computer instructions for reading cable inkjet characters based on image recognition, which, when executed by the processor, cause the system to perform a cable inkjet character reading method based on image recognition according to any one of claims 1-9.