Tire surface barcode correction method and device based on density segmentation

By using a density-based segmentation method, barcode feature data groups on the tire surface are obtained, segmentation boundaries are determined, and correction processing is performed. This solves the problem of insufficient barcode distortion correction accuracy in existing technologies and improves barcode recognition rate and image quality.

CN121962178AActive Publication Date: 2026-05-01ZHEJIANG UNIV OF TECH
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202610434385.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-04-03
Publication Date
2026-05-01
Estimated Expiration
2046-04-03

AI Technical Summary

Technical Problem

Existing technologies suffer from insufficient correction accuracy, poor adaptability, and difficulty in parameter adjustment when dealing with barcode distortion on tire surfaces, resulting in barcodes being unable to be correctly identified and decoded.

Method used

A density-based segmentation method is adopted to determine the location of barcode segmentation boundaries by acquiring barcode feature data groups, and to perform segmentation and correction processing on the initial barcode image, including grayscale processing, gradient calculation, edge detection, spectrum analysis and distortion factor correction.

Benefits of technology

It significantly improves barcode recognition rate, ensures uniformity and clarity of barcode images, and effectively restores the geometric shape and grayscale features of barcodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121962178A_ABST
    Figure CN121962178A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image processing, in particular to a tire surface barcode correction method and device based on density segmentation. The method comprises the steps of obtaining an initial barcode image; acquiring a bar code feature data set based on the initial bar code image, determining a bar code segmentation boundary position based on the bar code feature data set, and segmenting the initial bar code image based on the bar code segmentation boundary position to obtain a plurality of bar code area images; and performing correction processing based on the bar code area image to obtain a corrected bar code image. In this way, the uniformity of the bar code can be effectively recovered, and then the bar code recognition rate is remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

A method and apparatus for correcting tire surface barcodes based on density segmentation Technical Field

[0001] This invention relates to the field of image processing technology, and specifically to a method and apparatus for correcting tire surface barcodes based on density segmentation. Background Technology

[0002] Barcodes, as an important automatic identification technology, play a crucial role in modern industrial production and logistics management. In the tire manufacturing industry, barcode recognition technology is widely used for information collection during the tire warehousing process. Specifically, after tires are produced, they enter the warehouse via an assembly line. Industrial cameras deployed on the assembly line are responsible for capturing images of the barcodes affixed to the tire sidewalls. By decoding these images, key information such as the tire's production batch, specifications, and production date is obtained, enabling automated warehousing management and full lifecycle traceability. However, in a real factory environment, due to the cylindrical curved surface of the tire sidewall, the barcode images captured by industrial cameras suffer from severe geometric distortion. This distortion has the following characteristics: First, the degree of distortion is non-uniformly distributed across different areas of the image, with less distortion closer to the camera and more distortion farther away. Second, the angular differences between different areas of the curved surface and the light source lead to significant brightness variations and uneven grayscale levels. Third, the curvature of the cylindrical surface causes the barcode stripes to stretch or compress horizontally, resulting in perspective distortion ("nearer is larger, farther is smaller"). Finally, image curvature can also cause adjacent pixels in the barcode area to stick together, causing abnormal changes in grayscale values, which in turn produces image quality problems such as noise, blurring, ringing, and compression artifacts. The combined effect of these factors severely distorts the width ratio of the barcode stripes, ultimately preventing the barcode from being correctly identified and decoded.

[0003] Existing technologies for barcode distortion correction mainly include perspective transformation and cylindrical unfolding methods. Perspective transformation corrects barcode distortion by detecting the four corners of the barcode, but it assumes the barcode is on a plane and cannot handle nonlinear distortion caused by cylindrical surfaces. Cylindrical unfolding assumes the barcode is attached to a standard cylindrical surface and unfolds it through cylindrical coordinate transformation. However, this method requires precise estimation of the cylinder radius and camera position, is sensitive to parameters, and cannot handle non-standard cylindrical surfaces. When dealing with cylindrical barcodes in real-world industrial scenarios, these methods suffer from insufficient correction accuracy, poor adaptability, and difficulty in parameter adjustment, making it difficult to meet the demands of high-precision barcode recognition. Summary of the Invention

[0004] The purpose of this invention is to provide a method and apparatus for correcting tire surface barcodes based on density segmentation, which can effectively restore the uniformity of barcodes and thus significantly improve the barcode recognition rate.

[0005] In a first aspect of the present invention, a tire surface barcode correction method based on density segmentation is provided, comprising:

[0006] Step 100. Obtain the initial barcode image;

[0007] Step 200. Obtain barcode feature data set based on the initial barcode image, determine the barcode segmentation boundary position based on the barcode feature data set, and segment the initial barcode image based on the barcode segmentation boundary position to obtain several barcode region images;

[0008] Step 300. Perform correction processing on the barcode area image to obtain the corrected barcode image.

[0009] As a preferred embodiment of the present invention, step 200, obtaining the barcode feature data group based on the initial barcode image, specifically includes:

[0010] Step 211. Perform grayscale processing on the initial barcode image to obtain the first image, and perform Gaussian smoothing processing on the first image to obtain the second image;

[0011] Step 212. The gradient magnitude of each pixel in the second image is calculated using the first-scale Sobel operator, and the sum of the gradient magnitudes of each column of pixels is calculated to obtain the first total gradient magnitude of each column of pixels.

[0012] Step 213. The gradient magnitude of each pixel in the second image is calculated using the second-scale Sobel operator, and the sum of the gradient magnitudes of each column of pixels is calculated to obtain the second total gradient magnitude of each column of pixels.

[0013] Step 214. The gradient magnitude of each pixel in the second image is calculated using the third-scale Sobel operator, and the sum of the gradient magnitudes of each column of pixels is calculated to obtain the third total gradient magnitude of each column of pixels.

[0014] Step 215. Calculate the weighted fusion gradient magnitude of each column of pixels based on the first total gradient magnitude, the second total gradient magnitude, and the third total gradient magnitude of each column of pixels;

[0015] Step 216. Normalize all weighted fusion gradient magnitudes to obtain the first barcode feature data group.

[0016] As a preferred embodiment of the present invention, step 200, which involves obtaining the barcode feature data set based on the initial barcode image, further includes:

[0017] Step 221. Use the Sobel operator to calculate the gradient magnitude and gradient direction of each pixel in the second image, and calculate the horizontal deviation of each pixel based on the gradient direction;

[0018] Step 222. Determine whether the gradient magnitude of each pixel is greater than the gradient magnitude threshold. When the gradient magnitude of a pixel is greater than the gradient magnitude threshold, the corresponding pixel is determined as a strong edge point.

[0019] Step 223. Calculate the consistency weight of each strong edge point based on the horizontal deviation of each pixel;

[0020] Step 224. Sum the consistency weights of all strong edge points in each column of pixels to obtain the column direction consistency value of each column of pixels;

[0021] Step 225. Normalize all column direction consistency values ​​to obtain the second barcode feature data group.

[0022] As a preferred embodiment of the present invention, step 200, which involves obtaining the barcode feature data set based on the initial barcode image, further includes:

[0023] Step 231. Obtain an image patch from the second image based on a sliding window, perform a two-dimensional fast Fourier transform on the image patch to obtain the spectrum, obtain the corresponding energy spectrum based on the spectrum, sum the energy values ​​of each column of the energy spectrum to obtain the total energy value, and calculate the energy percentage within a preset frequency range based on the total energy value of each column of the energy spectrum.

[0024] Repeat step 231 to obtain the energy percentage values ​​of all image blocks in the second image;

[0025] Step 232. Interpolate all energy percentage values ​​to obtain the third barcode feature data group;

[0026] Step 233. Perform weighted data value processing on the first barcode feature data group, the second barcode feature data group, and the third barcode feature data group to obtain the barcode feature data group.

[0027] As a preferred embodiment of the present invention, step 200, determining the barcode segmentation boundary position based on the barcode feature data group, specifically includes:

[0028] Step 241. Perform Gaussian smoothing on the data points in the barcode feature data group to obtain the first data group;

[0029] Step 242. Perform first-order differentiation on the data points in the first data group to obtain the second data group, perform second-order differentiation on the data points in the first data group to obtain the third data group, and perform absolute value weighting on the second and third data groups to obtain the fourth data group.

[0030] Step 243. Perform Gaussian smoothing on the data points in the fourth data set to obtain the fifth data set;

[0031] Step 244. Determine the initial peak value based on the data points in the fifth data group. Select candidate peak values ​​that meet the conditions from all the initial peak values ​​in descending order of peak value, and the two adjacent candidate peak values ​​must be greater than the peak distance threshold.

[0032] Step 245. Determine the barcode segmentation boundary position based on candidate peak values.

[0033] As a preferred embodiment of the present invention, step 245. determining the barcode segmentation boundary position based on candidate peak values ​​specifically includes:

[0034] Step 2451. Determine the initial segmentation boundary position based on candidate peak values;

[0035] Step 2452. Perform grayscale processing on the initial barcode image to obtain the first image, and perform Gaussian smoothing processing on the first image to obtain the second image; use the Sobel operator to calculate the gradient magnitude of each pixel in the second image, and calculate the average magnitude of the gradient magnitude of each column of pixels to obtain the average magnitude of each column of pixels.

[0036] Step 2453. Within a preset column pixel range at a certain initial segmentation boundary position, search for whether there are other boundary positions whose average amplitude is less than that of the initial segmentation boundary position. If not, determine the initial segmentation boundary position as the barcode segmentation boundary position; if so, determine the other boundary position with the smallest average amplitude as the barcode segmentation boundary position.

[0037] Repeat steps 2453 until all initial segmentation boundary positions have been determined to correspond to the barcode segmentation boundary positions.

[0038] As a preferred embodiment of the present invention, step 300, which involves performing correction processing on the barcode region image to obtain a corrected barcode region image, specifically includes:

[0039] Step 311. Binarize the barcode area image to obtain a black and white image;

[0040] Step 312. Record the black and white run value for each row of pixels in the black and white image, and remove outliers from all black and white run values ​​to obtain the remaining black and white run values;

[0041] Step 313. Based on the remaining black and white run length values, the minimum width of the sliding window is used to estimate the module width of the current region in the clearest region. The ideal module width is defined as the maximum value of the module width of all regions. The horizontal distortion factor is obtained by dividing the ideal module width by the module width of the current region.

[0042] Step 314. In the binarized black and white image pixel sequence, find the longest continuous black pixel segment as the main body of the stripe and record its upper and lower boundary positions. The difference between the two is the stripe height of the column. Based on the detected stripe height sequence, calculate the difference between the maximum and minimum stripe heights and divide it by the average stripe height to obtain the vertical distortion factor.

[0043] Step 315. Calculate the stretching coefficients in the horizontal and vertical directions based on the horizontal distortion factor and the vertical distortion factor, and correct the barcode area image according to the stretching coefficients to obtain the corrected barcode area image.

[0044] In a second aspect of the present invention, a tire surface barcode correction device based on density segmentation is provided, comprising:

[0045] The initial barcode image acquisition module is configured to acquire the initial barcode image.

[0046] The barcode region image acquisition module is configured to acquire a barcode feature data set based on an initial barcode image, determine the barcode segmentation boundary position based on the barcode feature data set, and segment the initial barcode image based on the barcode segmentation boundary position to obtain several barcode region images.

[0047] The corrected barcode image acquisition module is configured to perform correction processing on the barcode area image to obtain the corrected barcode image.

[0048] In a third aspect of the present invention, a computer program product is provided, including a computer program that, when executed by a processor, implements the method provided according to the first aspect.

[0049] In a fourth aspect of the present invention, an electronic device is provided, including one or more processors and a memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the method provided in the first aspect.

[0050] In summary, the present invention has the following beneficial effects:

[0051] The method and apparatus of this invention obtain barcode feature data groups by weighted fusion of gradient magnitude, column direction consistency value, and energy ratio value. The optimal barcode segmentation boundary position can be determined by the barcode feature data group. Segmenting the initial barcode image by the determined barcode segmentation boundary position can make the segmented barcode region image have the best segmentation effect, thereby enabling each barcode region image to be effectively recovered, and thus enabling the entire barcode image to be effectively recovered, ultimately significantly improving the barcode recognition rate.

[0052] Further or more detailed beneficial effects will be described in conjunction with specific embodiments in the detailed implementation. Attached Figure Description

[0053] Figure 1 shows a flowchart of the tire surface barcode correction method based on density segmentation according to an embodiment of the present invention;

[0054] Figure 2 shows a block diagram of a tire surface barcode correction device based on density segmentation according to an embodiment of the present invention;

[0055] Figure 3 shows a block diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation

[0056] Embodiments of the present invention will now be described in more detail with reference to the accompanying drawings. While some embodiments of the invention are shown in the drawings, it should be understood that the invention can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the invention. It should be understood that the accompanying drawings and embodiments are for illustrative purposes only and are not intended to limit the scope of protection of the invention.

[0057] In the description of embodiments of the present invention, the term "comprising" and similar terms should be understood as open-ended inclusion, i.e., "including but not limited to". The term "based on" should be understood as "at least partially based on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc., may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0058] Figure 1 shows a flowchart of a tire surface barcode correction method based on density segmentation according to an embodiment of the present invention. The method includes:

[0059] Step 100. Obtain the initial barcode image.

[0060] This step involves capturing initial barcode images affixed to the tire sidewall surface using industrial cameras positioned around the production line. The industrial cameras are fixed above or to the side of the production line and automatically trigger a capture as a tire passes by, obtaining an initial barcode image containing the barcode area. Each pixel in the initial barcode image is uniquely identified by its horizontal and vertical coordinates.

[0061] Step 200. Obtain barcode feature data set based on the initial barcode image, determine the barcode segmentation boundary position based on the barcode feature data set, and segment the initial barcode image based on the barcode segmentation boundary position to obtain several barcode region images.

[0062] In step 200 of this embodiment, obtaining the barcode feature data group based on the initial barcode image specifically includes:

[0063] Step 211. Perform grayscale processing on the initial barcode image to obtain the first image, and perform Gaussian smoothing processing on the first image to obtain the second image.

[0064] Grayscale conversion is the process of converting a color image into a grayscale image that only contains brightness information and no color information. Each pixel in a color image has three values: R, G, and B, while each pixel in a grayscale image has only one value (any value between 0 and 255).

[0065] Gaussian smoothing suppresses high-frequency noise (such as sensor noise, print spots, and uneven lighting) while preserving the main edge structure of the barcode, providing a more stable and reliable input for subsequent gradient calculations. Without Gaussian smoothing, the Sobel operator would mistakenly identify this noise as barcode edges.

[0066] Step 212. The gradient magnitude of each pixel in the second image is calculated using the first-scale Sobel operator, and the sum of the gradient magnitudes of each column of pixels is calculated to obtain the first total gradient magnitude of each column of pixels.

[0067] The first scale of the Sobel operator is 3×3. Image processing software can calculate the x-axis gradient value of each pixel in the second image using a 3×3 Sobel-x convolution kernel, and simultaneously calculate the y-axis gradient value of each pixel using a 3×3 Sobel-y convolution kernel. Once the x-axis and y-axis gradient values ​​of a pixel are known, simply summing the squares of the x-axis and y-axis gradient values ​​yields the sum of squares. Taking the square root of this sum gives the gradient magnitude of that pixel.

[0068] The first total gradient magnitude of a column of pixels (i.e., pixels with the same x value but different y values) can be obtained by summing all the gradient magnitudes of that column. Assuming the size of the second image is 1000×800, it can be understood that x=1 corresponds to a first total gradient magnitude, x=2 corresponds to a first total gradient magnitude, x=3 corresponds to a first total gradient magnitude, ..., x=1000 corresponds to a first total gradient magnitude.

[0069] Step 213. The gradient magnitude of each pixel in the second image is calculated using the second-scale Sobel operator, and the sum of the gradient magnitudes of each column of pixels is calculated to obtain the second total gradient magnitude of each column of pixels.

[0070] The second-scale Sobel operator has a scale of 5×5. Image processing software can calculate the x-axis gradient value of each pixel in the second image using a 5×5 Sobel-x convolution kernel, and simultaneously calculate the y-axis gradient value of each pixel using a 5×5 Sobel-y convolution kernel. Once the x-axis and y-axis gradient values ​​of a pixel are known, simply summing the squares of the x-axis and y-axis gradient values ​​yields the sum of squares. Taking the square root of this sum gives the gradient magnitude of that pixel.

[0071] The second total gradient magnitude of a column of pixels (i.e., pixels with the same x-value but different y-values) is obtained by summing all the gradient magnitudes of that column. Assuming the size of the second image is 1000×800, it can be understood that x=1 corresponds to one second total gradient magnitude, x=2 corresponds to one second total gradient magnitude, x=3 corresponds to one second total gradient magnitude, ..., x=1000 corresponds to one second total gradient magnitude.

[0072] Step 214. The gradient magnitude of each pixel in the second image is calculated using the third-scale Sobel operator, and the sum of the gradient magnitudes of each column of pixels is calculated to obtain the third total gradient magnitude of each column of pixels.

[0073] The third-scale Sobel operator has a scale of 7×7. Image processing software can calculate the x-axis gradient value of each pixel in the second image using a 7×7 Sobel-x convolution kernel, and simultaneously calculate the y-axis gradient value of each pixel using a 7×7 Sobel-y convolution kernel. Once the x-axis and y-axis gradient values ​​of a pixel are known, simply summing the squares of the x-axis and y-axis gradient values ​​yields the sum of squares. Taking the square root of this sum gives the gradient magnitude of that pixel.

[0074] The summation of all gradient magnitudes for a column of pixels (i.e., pixels with the same x-value but different y-values) yields the third total gradient magnitude for that column. Assuming the second image size is 1000×800, then x=1 corresponds to one third total gradient magnitude, x=2 corresponds to one third total gradient magnitude, x=3 corresponds to one third total gradient magnitude, and so on, until x=1000 corresponds to one third total gradient magnitude.

[0075] The Sobel operator at a single scale can only effectively respond to edges of a specific width. In real-world scenarios, the width of barcode modules varies greatly (due to distortion, distance, and resolution), so multi-scale fusion is needed to accommodate both large and small stripes.

[0076] Step 215. Calculate the weighted fusion gradient magnitude of each column of pixels based on the first total gradient magnitude, the second total gradient magnitude, and the third total gradient magnitude of each column of pixels.

[0077] Taking the first column of pixels as an example, assuming the weight of the first total gradient magnitude is 0.5, the weight of the second total gradient magnitude is 0.3, and the weight of the third total gradient magnitude is 0.2, then we only need to add the first total gradient magnitude multiplied by its weight, the second total gradient magnitude multiplied by its weight, and the third total gradient magnitude multiplied by its weight to obtain the weighted fused gradient magnitude of the pixels in that column.

[0078] The calculation method for column pixels is the same. Ultimately, we can obtain: x=1 corresponds to a weighted fusion gradient magnitude, x=2 corresponds to a weighted fusion gradient magnitude, x=3 corresponds to a weighted fusion gradient magnitude, ..., x=1000 corresponds to a weighted fusion gradient magnitude.

[0079] Step 216. Normalize all weighted fusion gradient magnitudes to obtain the first barcode feature data group.

[0080] Taking the first weighted fusion gradient magnitude (i.e. the weighted fusion gradient magnitude corresponding to x=1) as an example, the first normalized value can be obtained by dividing "the first weighted fusion gradient magnitude minus the smallest weighted fusion gradient magnitude" by "the largest weighted fusion gradient magnitude minus the smallest weighted fusion gradient magnitude".

[0081] The normalization process for other weighted fusion gradient magnitudes is the same. The final result is: the 1st normalized value, the 2nd normalized value, the 3rd normalized value, ..., the 1000th normalized value (i.e., the first barcode feature data group).

[0082] In step 200 of this embodiment, obtaining the barcode feature data group based on the initial barcode image further includes:

[0083] Step 221. Use the Sobel operator to calculate the gradient magnitude and gradient direction of each pixel in the second image, and calculate the horizontal deviation of each pixel based on the gradient direction.

[0084] This step can use a Sobel operator of any scale, such as a 3×3 Sobel operator. The image processing software can calculate the x-axis gradient value of each pixel in the second image using a 3×3 Sobel-x convolution kernel, and can also calculate the y-axis gradient value of each pixel in the second image using a 3×3 Sobel-y convolution kernel.

[0085] Once the x-axis gradient value and y-axis gradient value of a certain pixel are known, the sum of the squares of the x-axis gradient value and the y-axis gradient value can be obtained. Then, the square root of the sum of the squares can be used to obtain the gradient magnitude of that pixel.

[0086] The gradient direction of a pixel can be expressed by the formula The calculation yielded, where This represents the gradient value in the y-direction of that pixel. This is the gradient value in the x-direction of this pixel.

[0087] The horizontal deviation of a certain pixel can be expressed by the formula The calculation yielded, where This represents the gradient direction of that pixel. This represents the horizontal deviation of that pixel.

[0088] Step 222. Determine whether the gradient magnitude of each pixel is greater than the gradient magnitude threshold. When the gradient magnitude of a pixel is greater than the gradient magnitude threshold, the corresponding pixel is determined as a strong edge point.

[0089] The gradient magnitude threshold in this step can be obtained using the formula... The calculation yielded, where The average gradient magnitude of all pixels. The standard deviation of the gradient magnitude of all pixels. This is an empirical coefficient (e.g., it could be 2.5). This is the gradient magnitude threshold. If the gradient magnitude of a pixel is greater than the gradient magnitude threshold, then the pixel is determined to be a strong edge point.

[0090] Step 223. Calculate the consistency weight of each strong edge point based on the horizontal deviation of each pixel.

[0091] Step 221 reveals the horizontal deviation of each pixel, and step 222 reveals which pixels are strong edge points, thus revealing the horizontal deviation of each strong edge point.

[0092] Once the horizontal deviation of a strong marginal point is known, the consistency weight of that strong marginal point can be expressed by the formula... The calculation yielded, where This represents the horizontal deviation of the strong edge point. This is the consistency weight for the strong edge point.

[0093] Step 224. Sum the consistency weights of all strong edge points in each column of pixels to obtain the column direction consistency value of each column of pixels.

[0094] Taking the first column of pixels as an example, the column direction consistency value of the pixels can be obtained by summing the consistency weights of all strong edge points in the column.

[0095] The calculation method for column pixels is the same. Assuming the size of the second image is 1000×800, then we can obtain: x=1 corresponds to a column direction consistency value, x=2 corresponds to a column direction consistency value, x=3 corresponds to a column direction consistency value, ..., x=1000 corresponds to a column direction consistency value. When a column of pixels has no strong edge points, the column direction consistency value of that column of pixels is 0.

[0096] Step 225. Normalize all column direction consistency values ​​to obtain the second barcode feature data group.

[0097] Taking the first column direction consistency value (i.e. the column direction consistency value corresponding to x=1) as an example, the first normalized value can be obtained by dividing "the first column direction consistency value minus the smallest column direction consistency value" by "the largest column direction consistency value minus the smallest column direction consistency value".

[0098] The normalization process for consistency values ​​in other columns is the same. The final result is: the 1st normalized value, the 2nd normalized value, the 3rd normalized value, ..., the 1000th normalized value (i.e., the second barcode feature data group).

[0099] In step 200 of this embodiment, obtaining the barcode feature data group based on the initial barcode image further includes:

[0100] Step 231. Obtain an image patch from the second image based on a sliding window, perform a two-dimensional fast Fourier transform on the image patch to obtain the spectrum, obtain the corresponding energy spectrum based on the spectrum, sum the energy values ​​of each column of the energy spectrum to obtain the total energy value, and calculate the energy percentage within a preset frequency range based on the total energy value of each column of the energy spectrum.

[0101] Assume the size of the second image is 1000×800, and the size of the sliding window is 100×400.

[0102] The first sliding window corresponds to columns 1 to 100 and rows 201 to 600 of the second image. A 100×400 image block can be extracted from the second image using the first sliding window.

[0103] A spectrum is obtained by performing a two-dimensional fast Fourier transform on an image patch. The spectrum can be understood as a complex matrix with the same size as the image patch. That is, a 100×400 image patch will result in a 100×400 complex matrix after performing a two-dimensional fast Fourier transform (each value in the complex matrix is ​​a complex number).

[0104] For each complex value in the spectrum, use the formula The corresponding energy value is calculated, where It is a complex value in the spectrum. The energy value is calculated for this complex value. After calculating all energy values, the energy spectrum can be obtained, which can be understood as a real number matrix with the same size as the image patch.

[0105] Once the energy spectrum is obtained, the energy values ​​of each column of elements in the energy spectrum can be summed to obtain the total energy value of each column. Ultimately, we can obtain: the first frequency component corresponds to one total energy value, the second frequency component corresponds to one total energy value, the third frequency component corresponds to one total energy value, and so on, up to the 100th frequency component.

[0106] Before this step, a preset frequency range will be determined in advance. This preset frequency range corresponds to the frequency range of the "barcode". After the total energy value of each column of elements is determined, we only need to first sum the total energy values ​​corresponding to the preset frequency range to obtain the first total energy value, then sum all the total energy values ​​to obtain the second total energy value, and finally divide the first total energy value by the second total energy value to obtain the energy ratio value of the image block.

[0107] Repeat step 231 to obtain the energy percentage of all image blocks in the second image.

[0108] During the second execution of step 231, the sliding window needs to be moved a specific distance (e.g., 10 pixels) along the x-direction on the second image. This second sliding window then corresponds to columns 11 to 110 and rows 201 to 600 of the second image. A 100×400 image block can be extracted from the second image using this second sliding window. Subsequent processing of the image block follows the same procedure, ultimately yielding another energy percentage value.

[0109] Then repeat step 231 until the total energy percentage is obtained.

[0110] Step 232. Interpolate all energy percentage values ​​to obtain the third barcode feature data group.

[0111] When the size of the second image is 1000×800, the energy percentage values ​​obtained in step 231 are less than 1000. Therefore, interpolation processing (e.g., using linear interpolation) is required to ensure that the number of energy percentage values ​​is 1000. Furthermore, since the energy percentage values ​​themselves are between 0 and 1, normalization processing is not necessary. This step ultimately yields 1000 energy percentage values, which constitute the third barcode feature data group.

[0112] Step 233. Perform weighted data value processing on the first barcode feature data group, the second barcode feature data group, and the third barcode feature data group to obtain the barcode feature data group.

[0113] The weight values ​​of the first barcode feature data group (e.g., 0.4), the second barcode feature data group (e.g., 0.4), and the third barcode feature data group (e.g., 0.2) are pre-set.

[0114] Taking the first data value a1 in the first barcode feature data group, the first data value b1 in the second barcode feature data group, and the first data value c1 in the third barcode feature data group as examples, the first data value in the barcode feature data group is obtained by adding the value of data value a1 multiplied by its weight value, the value of data value b1 multiplied by its weight value, and the value of data value c1 multiplied by its weight value.

[0115] The calculation method for other data values ​​is the same, and finally a barcode feature data group with 1000 data values ​​can be obtained.

[0116] In step 200 of this embodiment, determining the barcode segmentation boundary position based on the barcode feature data group specifically includes:

[0117] Step 241. Perform Gaussian smoothing on the data points in the barcode feature data group to obtain the first data group.

[0118] Gaussian smoothing can suppress noise and make edge transitions smoother.

[0119] Step 242. Perform first-order differentiation on the data points in the first data group to obtain the second data group, perform second-order differentiation on the data points in the first data group to obtain the third data group, and perform absolute value weighting on the second and third data groups to obtain the fourth data group.

[0120] Pre-set the weight values ​​for the second data group (e.g., 0.6) and the third data group (e.g., 0.4).

[0121] Taking the first data value A1 in the second data group and the first data value B1 in the third data group as examples, the first data value in the fourth data group is obtained by adding the absolute value of data value A1 multiplied by its weight value to the absolute value of data value B1 multiplied by its weight value. The calculation method for the other data values ​​in the fourth data group is the same.

[0122] Step 243. Perform Gaussian smoothing on the data points in the fourth data set to obtain the fifth data set.

[0123] Step 244. Determine the initial peak value based on the data points in the fifth data group. Select candidate peak values ​​that meet the conditions from all the initial peak values ​​in descending order of peak value, and the two adjacent candidate peak values ​​must be greater than the peak distance threshold.

[0124] After obtaining the fifth data set, namely the barcode density variation intensity, peak positions need to be detected as segmentation boundaries. First, a percentile method is used to adaptively set the detection threshold, typically taking the 75th to 85th percentile of the variation intensity sequence. This method can adapt to the variation intensity distribution of different images. To avoid detecting overly dense peaks and causing over-segmentation, a minimum distance constraint is set between peaks. Based on the above threshold and distance constraint, peak detection is performed to filter out candidate positions where the variation intensity is greater than the threshold, is a local maxima, and maintains sufficient distance from other peaks.

[0125] Step 245. Determine the barcode segmentation boundary position based on candidate peak values.

[0126] In step 245 of this embodiment, determining the barcode segmentation boundary position based on candidate peak values ​​specifically includes:

[0127] Step 2451. Determine the initial segmentation boundary position based on the candidate peak values.

[0128] Once a candidate peak is determined, we know which data point it is, and consequently, which column of pixels in the second image it belongs to. For example, if it's the 118th column of pixels, then the initial segmentation boundary would be located at the 118th column of pixels in the second image.

[0129] Step 2452. Perform grayscale processing on the initial barcode image to obtain the first image, and perform Gaussian smoothing processing on the first image to obtain the second image; use the Sobel operator to calculate the gradient magnitude of each pixel in the second image, and calculate the average magnitude of the gradient magnitude of each column of pixels to obtain the average magnitude of each column of pixels.

[0130] Step 2453. Within a preset column pixel range at a certain initial segmentation boundary position, search for whether there are other boundary positions whose average amplitude is less than that of the initial segmentation boundary position. If not, the initial segmentation boundary position is determined as the barcode segmentation boundary position; if so, the other boundary position with the smallest average amplitude is determined as the barcode segmentation boundary position.

[0131] The preset column pixel range can be from the two columns before the initial segmentation boundary position to the two columns after the initial segmentation boundary position. When an initial segmentation boundary position is located at the 118th column pixel of the second image, the preset column pixel range corresponding to this initial segmentation boundary position is from the 116th column pixel to the 120th column pixel of the second image. Assuming that the average amplitude of the pixels in the 116th, 117th, 119th, and 120th columns of the second image is greater than the average amplitude of the pixels in the 118th column of the second image, then the barcode segmentation boundary position is at the 118th column pixel of the second image (i.e., the initial barcode image). If the average amplitude of the pixels in the 117th column of the second image is smaller than the average amplitude of the pixels in the 116th, 118th, 119th, and 120th columns of the second image, then the barcode segmentation boundary position is at the 117th column pixel of the second image (i.e., the initial barcode image).

[0132] Repeat steps 2453 until all initial segmentation boundary positions are determined to correspond to the corresponding barcode segmentation boundary positions. Segmenting the initial barcode image based on the barcode segmentation boundary positions will yield several barcode region images. When there are 5 barcode segmentation boundary positions, 6 barcode region images can be obtained.

[0133] Step 300. Perform correction processing on the barcode area image to obtain the corrected barcode image.

[0134] In step 300 of this embodiment, the correction processing based on the barcode region image to obtain the corrected barcode image specifically includes:

[0135] Step 311. Binarize the barcode area image to obtain a black and white image.

[0136] Step 312. Record the black and white run value for each row of pixels in the black and white image, and remove outliers from all black and white run values ​​to obtain the remaining black and white run values.

[0137] Taking a row of pixels as an example, the pixel values ​​in that row are either 0 or 255. The black-and-white run value is the number of consecutive "0"s or consecutive "255"s. For ease of understanding, let's assume the pixel values ​​of that row are: 0, 0, 255, 255, 255, 0, 0, 0, 0, 255, 255, 255, 255, 0, 0, 255, 255, 255, 0, 0, 0. Then the recorded black-and-white run value is: 2, 3, 4, 4, 2, 4, 3.

[0138] After a set of black and white run values ​​is obtained for each row of pixels in the black and white image, outliers are first removed from all the black and white run values ​​to obtain the remaining black and white run values. Outliers can be black and white run values ​​that are greater than or less than a certain black and white run threshold.

[0139] Step 313. Based on the remaining black and white run length values, the minimum width of the sliding window is used to estimate the module width of the current region in the clearest region. The ideal module width is defined as the maximum value of the module width of all regions. The horizontal distortion factor is obtained by dividing the ideal module width by the current region module width.

[0140] First, estimate the local module width: Perform a histogram analysis on the remaining black and white run values ​​to find the most frequently occurring width. Assuming the most frequently occurring width is 1.8 pixels, then the local module width is 1.8 pixels. Next, assume the ideal module width is 2 pixels. The horizontal distortion factor equals the ideal module width divided by the local module width.

[0141] Step 314. In the binarized black and white image pixel sequence, find the longest continuous black pixel segment as the main body of the stripe and record its upper and lower boundary positions. The difference between the two is the stripe height of that column. Based on the detected stripe height sequence, calculate the difference between the maximum and minimum stripe heights and divide it by the stripe mean to obtain the vertical distortion factor. This index reflects the degree of variation of stripe height in the horizontal direction.

[0142] Step 315. Calculate the stretching coefficients in the horizontal and vertical directions based on the horizontal distortion factor and the vertical distortion factor, and correct the barcode area image according to the stretching coefficients to obtain the corrected barcode area image.

[0143] This step details how the barcode area image is corrected using a distortion factor. For horizontal correction, the horizontal stretching coefficient is first calculated. This coefficient is calculated column-by-column based on the run-length encoding results. For each column of the area image, the width of each run's single module is calculated within a sliding window centered on that column, and the average is taken as the local module width for that column. The width of each run's single module is obtained by dividing the run length by the number of basic modules it contains. The number of basic modules is estimated by dividing the run length by the area module width and rounding. The width ratio of each column is the ideal module width divided by the local module width. The initial stretching coefficient is normalized by dividing the width ratio by the minimum width ratio within the area. Then, a stretching strength coefficient is calculated based on the horizontal distortion factor to adjust the initial stretching coefficient. A larger distortion factor results in a higher stretching strength and greater correction. The final stretching coefficient is converted into a mapping table from the original coordinates to the corrected coordinates using a cumulative mapping strategy, achieving horizontal coordinate correction of the pixels. For vertical correction, the longest continuous black pixel segment is identified as the main stripe. The difference between the upper and lower boundaries of this segment is the stripe height for that column. After obtaining the height distribution of all columns, the height variation coefficient is obtained by dividing the difference between the maximum and minimum values ​​of the height sequence by the mean. This index reflects the degree of variation in stripe height in the horizontal direction; a larger value indicates more severe vertical distortion. The vertical stretch coefficient is calculated based on the stripe height of each column. The vertical stretch coefficient is obtained by dividing the target height (maximum height within the region) by the current height of each column, and the vertical stretch intensity is calculated based on the degree of height variation. A boundary-based linear mapping method is used in the vertical direction to map the stripe region of each column from the current upper and lower boundaries to the target upper and lower boundary positions. Once each barcode region image has been corrected to obtain the corresponding corrected barcode region image, the final corrected barcode image is obtained.

[0144] Figure 2 shows a block diagram of a tire surface barcode correction device 400 based on density segmentation according to an embodiment of the present invention. The device 400 includes:

[0145] The initial barcode image acquisition module 402 is configured to acquire an initial barcode image;

[0146] The barcode region image acquisition module 404 is configured to acquire a barcode feature data group based on an initial barcode image, determine the barcode segmentation boundary position based on the barcode feature data group, and segment the initial barcode image based on the barcode segmentation boundary position to obtain several barcode region images.

[0147] The corrected barcode image acquisition module 406 is configured to perform correction processing based on the barcode area image to obtain the corrected barcode image.

[0148] Figure 3 shows a block diagram of an electronic device 500 according to some embodiments of the present invention. The device 500 includes a processor 501, which can perform various appropriate actions and processes according to computer program instructions loaded into random access memory (RAM) 503 based on computer program instructions stored in read-only memory (ROM) 502. Various programs and data required for the operation of the device 500 may also be stored in RAM 503. The processor 501, ROM 502, and RAM 503 are interconnected via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0149] The various processes and procedures described above, such as method 100, can be executed by processor 501. For example, in some embodiments, method 100 may be implemented as a software program tangibly contained in a machine-readable medium. In some embodiments, part or all of the software program may be loaded and / or installed on device 500 via ROM 502. When the software program is loaded into RAM 503 and executed by processor 501, one or more actions of method 100 described above may be performed.

[0150] The functions described above in this document can be performed at least in part by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: field programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload programmable logic devices (CPLDs), and so on.

[0151] The program code used to implement the methods of the present invention can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing device, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can be executed entirely on the machine, partially on the machine, as a standalone software package partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0152] This invention can be a method, apparatus, system, and / or program product. The program product may include a machine-readable storage medium on which machine-readable program instructions for performing various aspects of the invention are loaded. The machine-readable program instructions described herein can be downloaded from the machine-readable storage medium to various computing / processing devices, or downloaded via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network, to an external computer or external storage device. The network may include copper transmission cables, fiber optic transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. A network adapter card or network interface in each computing / processing device receives the machine-readable program instructions from the network and forwards them for storage in the machine-readable storage medium of the respective computing / processing device.

[0153] Machine program instructions used to perform the operations of this invention may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The machine-readable program instructions may be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or may be connected to an external computer (e.g., via the Internet using an Internet service provider). In some embodiments, electronic circuitry, such as programmable logic circuitry, field-programmable gate arrays (FPGAs), or programmable logic arrays (PLAs), is personalized by utilizing state information from the machine-readable program instructions. This electronic circuitry can execute the machine-readable program instructions to implement various aspects of the invention.

[0154] In the context of this invention, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. Machine-readable media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing. Furthermore, although the operations are depicted in a specific order, this should be understood as requiring that such operations be performed in the specific order shown or in sequential order, or requiring that all illustrated operations be performed to achieve the desired result. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the invention. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0155] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A method for correcting tire surface barcodes based on density segmentation, characterized in that, include: Step 100. Obtain the initial barcode image; Step 200. Obtain a barcode feature data set based on the initial barcode image, determine the barcode segmentation boundary position based on the barcode feature data set, and segment the initial barcode image based on the barcode segmentation boundary position to obtain several barcode region images; Step 300. Perform correction processing on the barcode region images to obtain a corrected barcode image.

2. The method according to claim 1, characterized in that, In step 200, obtaining the barcode feature data group based on the initial barcode image specifically includes: Step 211. Performing grayscale processing on the initial barcode image to obtain a first image, and performing Gaussian smoothing processing on the first image to obtain a second image; Step 212. Calculating the gradient magnitude of each pixel in the second image using the first-scale Sobel operator, and calculating the sum of the gradient magnitudes of each column of pixels to obtain the first total gradient magnitude of each column of pixels; Step 213. Calculating the gradient magnitude of each pixel in the second image using the second-scale Sobel operator, and calculating... Step 214. The gradient magnitude of each pixel in the second image is calculated by summing the gradient magnitudes of each column of pixels to obtain the second total gradient magnitude of each column of pixels; Step 215. The gradient magnitude of each pixel in the second image is calculated using the third-scale Sobel operator, and the gradient magnitude of each column of pixels is calculated to obtain the third total gradient magnitude of each column of pixels; Step 216. The weighted fused gradient magnitude of each column of pixels is calculated based on the first total gradient magnitude, the second total gradient magnitude, and the third total gradient magnitude of each column of pixels; Step 217. All the weighted fused gradient magnitudes are normalized to obtain the first barcode feature data group.

3. The method according to claim 2, characterized in that, In step 200, obtaining the barcode feature data group based on the initial barcode image further includes: step 221. Calculating the gradient magnitude and gradient direction of each pixel in the second image using the Sobel operator, and calculating the horizontal deviation of each pixel based on the gradient direction; step 222. Determining whether the gradient magnitude of each pixel is greater than a gradient magnitude threshold. When the gradient magnitude of a pixel is greater than the gradient magnitude threshold, the corresponding pixel is identified as a strong edge point; step 223. Calculating the consistency weight of each strong edge point based on the horizontal deviation of each pixel; step 224. Summing the consistency weights of all strong edge points in each column of pixels to obtain the column direction consistency value of each column of pixels; step 225. Normalizing all the column direction consistency values ​​to obtain the second barcode feature data group.

4. The method according to claim 3, characterized in that, In step 200, obtaining the barcode feature data group based on the initial barcode image further includes: step 231. Obtaining an image block from the second image based on a sliding window, performing a two-dimensional fast Fourier transform on the image block to obtain a spectrum, obtaining the corresponding energy spectrum based on the spectrum, summing the energy values ​​of each column element in the energy spectrum to obtain a total energy value, and calculating the energy percentage value within a preset frequency range based on the total energy value of each column element; repeating step 231 to obtain the energy percentage values ​​of all image blocks on the second image; step 232. Performing interpolation processing on all the energy percentage values ​​to obtain a third barcode feature data group; step 233. Performing data value weighting processing on the first barcode feature data group, the second barcode feature data group, and the third barcode feature data group to obtain a barcode feature data group.

5. The method according to claim 1, characterized in that, In step 200, determining the barcode segmentation boundary position based on the barcode feature data group specifically includes: Step 241. Performing Gaussian smoothing on the data points in the barcode feature data group to obtain a first data group; Step 242. Performing first-order derivative processing on the data points in the first data group to obtain a second data group, performing second-order derivative processing on the data points in the first data group to obtain a third data group, and performing absolute value weighting processing on the second and third data groups to obtain a fourth data group; Step 243. Performing Gaussian smoothing on the data points in the fourth data group to obtain a fifth data group; Step 244. Determining initial peak values ​​based on the data points in the fifth data group, and obtaining candidate peak values ​​that meet the conditions from all the initial peak values ​​in descending order of peak value, wherein two adjacent candidate peak values ​​must be greater than the peak distance threshold; Step 245. Determining the barcode segmentation boundary position based on the candidate peak values.

6. The method according to claim 5, characterized in that, Step 245. Determining the barcode segmentation boundary position based on the candidate peak values ​​specifically includes: Step 2451. Determining the initial segmentation boundary position based on the candidate peak values; Step 2452. Performing grayscale processing on the initial barcode image to obtain a first image, and performing Gaussian smoothing processing on the first image to obtain a second image; calculating the gradient magnitude of each pixel in the second image using the Sobel operator, and averaging the gradient magnitudes of each column of pixels to obtain the average magnitude of each column of pixels; Step 2453. Searching within a preset column of pixels at a certain initial segmentation boundary position for whether there are other boundary positions with an average magnitude less than the average magnitude of the initial segmentation boundary position. If not, the initial segmentation boundary position is determined as the barcode segmentation boundary position; if so, the other boundary position with the smallest average magnitude is determined as the barcode segmentation boundary position; repeating step 2453 until all initial segmentation boundary positions have been determined to have corresponding barcode segmentation boundary positions.

7. The method according to claim 1, characterized in that, In step 300, the correction processing based on the barcode region image to obtain the corrected barcode region image specifically includes: Step 311. Binarizing the barcode region image to obtain a black and white image; Step 312. Recording the black and white run length values ​​for each row of pixels in the black and white image, and removing outliers from all the black and white run length values ​​to obtain the remaining black and white run length values; Step 313. Based on the remaining black and white run length values, estimating the module width of the current region in the clearest region using the sliding window minimum width method, where the ideal module width is defined as the maximum value of the module widths of all regions, and then... Step 314. Divide the width by the current region module width to obtain the horizontal distortion factor; Step 315. Find the longest continuous black pixel segment in the pixel sequence of the binarized black and white image as the main body of the stripe and record its upper and lower boundary positions. The difference between the two is the stripe height of the column; Based on the detected stripe height sequence, calculate the difference between the maximum and minimum stripe heights and divide it by the average stripe height to obtain the vertical distortion factor; Step 316. Calculate the stretching coefficients in the horizontal and vertical directions based on the horizontal distortion factor and the vertical distortion factor, and correct the barcode region image according to the stretching coefficients to obtain the corrected barcode region image.

8. A tire surface barcode correction device based on density segmentation, characterized in that, include: The initial barcode image acquisition module is configured to acquire the initial barcode image. The barcode region image acquisition module is configured to acquire a barcode feature data set based on the initial barcode image, determine the barcode segmentation boundary position based on the barcode feature data set, and segment the initial barcode image based on the barcode segmentation boundary position to obtain several barcode region images; the corrected barcode image acquisition module is configured to perform correction processing on the barcode region images to obtain a corrected barcode image.

9. A computer program product, characterized in that, Includes a computer program, which, when executed by a processor, implements the steps of the method according to any one of claims 1-7.

10. An electronic device, characterized in that, It includes one or more processors and memory associated with the one or more processors, the memory being used to store program instructions that, when read and executed by the one or more processors, perform the steps of the method according to any one of claims 1-7.

Citation Information

Patent Citations

  • Image correction method and device, server and storage medium

    CN113538449A

  • Method and system for identifying handwritten content of test paper

    CN118053162A

  • Bar code identification method, terminal and system

    CN118428382A

  • Dynamic change monitoring method and system based on multi-temporal river channel image

    CN120356105A

  • Mechanical part contour extraction method and system based on edge detection

    CN121259030A