High-speed rail track board edge detection algorithm insensitive to illumination intensity change

Through the sliding window detection algorithm (SWD), the sliding window is set line by line and the grayscale difference value is calculated, which solves the problem that traditional edge detection algorithm is insensitive to lighting changes, and realizes high-precision edge detection in complex environments.

CN119625002APending Publication Date: 2025-03-14SHENYANG GOLDING NC & INTELLIGENCE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311169750.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-09-12
Publication Date
2025-03-14

AI Technical Summary

Technical Problem

Traditional edge detection algorithms are insensitive to changes in light intensity and require setting thresholds, which affects positioning accuracy and is difficult to adapt to complex production environments.

Method used

A sliding window detection algorithm (SWD) is proposed. By setting the sliding window line by line, calculating the absolute distance between the left and right and half grayscale differences, gradually reducing the range of edge points, and achieving accurate positioning of the edge contour of the track plate.

Benefits of technology

This algorithm does not require threshold settings, can adapt to various lighting intensities, is highly robust and can provide accurate edge detection results in complex environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119625002A_ABST
    Figure CN119625002A_ABST
Patent Text Reader

Abstract

The invention relates to a high-speed rail track board edge detection algorithm insensitive to illumination intensity change, which is mainly used for detecting the position of a high-speed rail track board so that a robot can conveniently process the high-speed rail track board. The edge detection algorithm provided by the invention is based on a sliding window object algorithm, called an SWD algorithm for short, and mainly comprises the following steps: firstly, determining the approximate range of an edge point by using a window, then reducing the size of the window, and detecting the position of the edge point again in the obtained range, and repeating the steps, and continuously reducing the range until the edge point meeting the precision requirement is found.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention belongs to the technical field of machine vision, and in particular is a high-speed railway track plate edge detection algorithm that is insensitive to changes in light intensity. Background Art

[0002] With the advancement of science and technology, robots are widely used in all aspects of production and life, especially in some dangerous and harsh production environments, where robots play an irreplaceable role. However, if robots are to replace people to work, they must know the position of themselves and the workpiece. Only in this way can they accurately complete production actions. In order to let the robot know the position of itself and the workpiece, a visual system is installed on the robot to guide the robot to complete the corresponding actions.

[0003] Most traditional edge detection algorithms are based on gradients, such as the Sobel operator, Laplace operator, Scharr operator, and Canny operator. These methods require setting a threshold first, using the threshold to preliminarily process the image, and then using the gradient to find the edge points. Whether the threshold setting is appropriate directly affects the positioning accuracy of the workpiece; the actual production environment is very complex, with people walking around and other machines running, and the light changes greatly between day and night, sunny and rainy days. A fixed threshold cannot adapt well to such changes, and the visual system cannot work properly, and the entire production cannot proceed normally. Therefore, it is very important to design an edge detection algorithm to overcome the problems in the existing technology. Summary of the invention

[0004] The present invention proposes a novel workpiece edge detection algorithm, which can be used for workpiece positioning. This algorithm has no threshold and can adapt to production environments under various extreme lighting conditions without changing any parameters, providing the robot with accurate coordinate information and guiding the robot to complete normal production actions.

[0005] The technical solution adopted by the present invention based on the above purpose is as follows: a high-speed railway track plate edge detection algorithm that is insensitive to changes in light intensity, comprising the following steps:

[0006] S1. Image acquisition: collect the original grayscale image of the track plate to be inspected and store it row by row and column by column as matrix data;

[0007] S2. Set the sliding window size and sliding operation of each layer: set a number of sliding window row vectors w for each row of the image i , and dynamically set the start and end positions of the window sliding for each row, which is used to correspond to each row from top to bottom of the image to be processed, using the sliding window row vector w i The sliding operation is performed sequentially, and the search range is progressively stepped in layers, so as to accurately locate the position row by row;

[0008] S3, define the distance calculation and positioning within the window: when the sliding window row vector w i When sliding in the current row of the image according to the step length stride, each sliding operation performs the absolute distance calculation of the grayscale difference between the left and right halves to detect the range of the edge point. By continuously reducing the sliding window w i The size of the edge point is continuously reduced;

[0009] S4. Execute the above steps S2-S3 row by row and column by column on the original grayscale image, and obtain the row and column coordinates (x_pos and y_pos) of the positioning window and the edge feature points therein row by row to achieve accurate positioning of the edge contour of the track plate.

[0010] An industrial camera is used to collect the grayscale image of the track plate to be inspected.

[0011] The i+1th layer window w i+1 The pixel length of window_size i+1 <i-th layer window w i The pixel length of window_size i .

[0012] The i-th layer window W i The sliding starting position is: the upper window W i-1 Start sliding position + previous window W i-1 The sliding window W where the maximum distance value is detected i The first pixel position of the i-th layer window W i The sliding stop position is: the upper window W i-1 Start sliding position + previous window W i-1 The sliding window W where the maximum distance value is detected i The first pixel position of the previous window W i-1 Length in pixels.

[0013] The running speed of the SWD algorithm can be changed by changing the stride of each sliding of the sliding window.

[0014] The absolute distance of the left and right half grayscale difference is calculated as:

[0015] The sliding window row vector w i Divide into two areas, left and right, and calculate the absolute value of the difference between the grayscale accumulation values ​​in the left and right areas

[0016] Among them, P j is the gray value of the j-th pixel in the window.

[0017] The range where the detected edge points are located is represented by the sliding window row vector w i Calculate a series of continuous distance values, and take the window with the maximum distance value as the current sliding window row vector w i The range of detected edge points.

[0018] The coordinate position of the edge feature point in the positioning window is the center position of the last layer of windows.

[0019] The present invention has the following beneficial effects and advantages:

[0020] 1. The classic gradient-based edge detection algorithm needs to set one or more thresholds, and then use the threshold to process the original image (such as binarization). Whether the threshold setting is appropriate has a great impact on the effect of edge detection. The SWD algorithm we proposed has no threshold, so there is no need to go to great lengths to set the threshold, which greatly facilitates program debugging.

[0021] 2. The SWD algorithm is insensitive to changes in light intensity and can adapt to production environments under various light intensities without modifying any parameters.

[0022] 3. The SWD algorithm is highly robust to noise pollution such as Gaussian noise, salt and pepper noise, Poisson noise, etc. during the image generation and transmission process, as well as interference such as oil and water stains on the surface of the workpiece. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 Run the flow chart for the SWD algorithm.

[0024] Figure 2 The figure shows a schematic diagram of the operation process of the SWD algorithm for processing a row of pixels.

[0025] Figure 3 Shown is the original track plate grayscale image.

[0026] Figure 4 Shown is the track slab edge image processed according to the present method. DETAILED DESCRIPTION

[0027] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation method of the present invention is described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the invention, so the present invention is not limited by the specific implementation disclosed below.

[0028] like Figure 1 The figure shows the operation flow chart of the SWD algorithm. The specific steps are as follows.

[0029] The edge detection algorithm proposed in this paper is based on a sliding window. We call it slide window detection algorithm, or SWD algorithm for short. The main idea of ​​this algorithm is to first use a window to determine the approximate range of edge points, then reduce the size of the window, and detect the position of edge points again within the obtained range. Repeat this process and continuously reduce the range until edge points that meet the accuracy requirements are found. The detailed detection process of the SWD algorithm is as follows:

[0030] (1) Read the grayscale image to be detected and store the pixel grayscale values ​​in order into a matrix.

[0031] (2) Extract the i-th row of pixels to be detected from the image matrix to be detected. To better illustrate the SWD algorithm, we assume that there are row_pix=4900 pixels in a row and store the pixels in an array.

[0032] (3) We set the size of the first layer sliding window w1 to window_1_size=300, the starting position start_1 of the sliding window w1 is set to 0, that is, sliding starts from the 0th pixel of the i-th row, and the end position end_1 of the sliding is set to row_pix, that is, during the first layer detection, the sliding window slides between the 0th and last pixels of the i-th row of the image for detection.

[0033] (4) Place window w1 at the position of pixels from 0 to 299 in the i-th row, divide window w1 into two in the middle, add the grayscale values ​​of the first 150 pixels (that is, the grayscale values ​​of pixels from 0 to 149 in this row) and record it as left_total, and add the grayscale values ​​of the last 150 pixels (that is, the grayscale values ​​of pixels from 150 to 299 in the i-th row) and record it as right_total.

[0034] (5) Subtract left_total from right_total and find the absolute value of the difference, which is recorded as distance_value.

[0035] (6) Store distance_value into the array record.

[0036] Go back to step (4) and slide the window to the position between the 0th + stride and the 299th + stride pixels in the i-th row. Here we set stride to 1, which means the window slides one pixel at a time. Repeat steps (4), (5), and (6) until the window w1 slides to the end_1 position. All the distance_values ​​that the window has slid over in the i-th row of the image are stored in the array record in chronological order.

[0037] Find the maximum value in the array record, whose index in the array is recorded as n (the index is the pixel position).

[0038] Going back to step (3), we set the size of the second-layer sliding window w2 to window_2_size = 200 (smaller than the previous layer window), and the starting position start_2 of the sliding window w2 is set to n+start_1, that is, sliding starts from the n+start_1th pixel in the i-th row (n+start_1 is the starting column pixel position of the first-layer positioning window), and the end position end_2 of the sliding is set to n+start_1+window_1_size, that is, in the second-layer detection, the sliding window slides and detects between the n+start_1th and n+start_1+window1_sizeth pixels in the i-th row of the image. Repeat the following detection operations (4)(5)(6)(7)(8) until the end of the last layer fn (5 layers are used in this article, fn = 5), find the index n of the maximum value in the array record, (n + start_fn + window_fn_size / 2) is recorded as pos_temp, then pos_temp can be regarded as the position of the edge point in the i-th row of the image, and the point (i, pos_temp) is an edge point of the image.

[0039] Return to step (2), execute i=i+1, and search for the edge points of the next row until all edge points of all sample rows are found, and store their x and y coordinates in order into the arrays x_pos and y_pos, respectively.

[0040] like Figure 2 The figure shows the operation process of the SWD algorithm processing a row of pixels. The two vertical lines a represent the range of edge points detected by the first layer window, the two vertical lines b represent the range of edge points detected by the second layer window, and the two vertical lines c represent the edge points detected by the third layer window. The two vertical lines d show the range of edge points detected by the fourth layer window, and the two vertical lines e show the range of edge points detected by the fifth layer window. The central dot is the boundary point detected by our algorithm.

[0041] like Figure 3 The figure shows the original grayscale image of the track plate. The purpose of the present invention is to extract the edge contour of the track plate. Figure 4 The figure shows the track plate edge image processed by the method. In the figure, the dots are edge points detected by the SWD algorithm, and the two straight lines are fitted edge lines. It can be seen that the method of the present invention can detect edge points very well.

[0042] The above description is only a preferred embodiment of the present invention and does not limit the present invention in any way. Any simple modification, change and equivalent structural change made to the above embodiment based on the technical essence of the present invention still falls within the protection scope of the technical solution of the present invention.

Claims

1. A high-speed rail track slab edge detection algorithm that is insensitive to changes in light intensity, characterized in that: The following steps are involved: S1. Image acquisition: collect the original grayscale image of the track plate to be inspected and store it row by row and column by column as matrix data; S2. Set the sliding window size and sliding operation of each layer: set a number of sliding window row vectors w for each row of the image i , and dynamically set the start and end positions of the window sliding for each row, which is used to correspond to each row from top to bottom of the image to be processed, using the sliding window row vector w i The sliding operation is performed sequentially, and the search range is progressively stepped in layers, so as to accurately locate the position row by row; S3, define the distance calculation and positioning within the window: when the sliding window row vector w i When sliding in the current row of the image according to the step length stride, each sliding operation performs the absolute distance calculation of the grayscale difference between the left and right halves to detect the range of the edge point. By continuously reducing the sliding window w i The size of the edge point is continuously reduced; S4. Execute the above steps S2-S3 row by row and column by column on the original grayscale image, and obtain the row and column coordinates (x_pos and y_pos) of the positioning window and the edge feature points therein row by row to achieve accurate positioning of the edge contour of the track plate.

2. According to claim 1, a high-speed rail track slab edge detection algorithm that is insensitive to changes in light intensity is characterized in that: An industrial camera is used to capture the grayscale image of the track plate to be inspected.

3. The high-speed rail track slab edge detection algorithm that is insensitive to changes in light intensity according to claim 1, characterized in that: The i+1th layer window w i+1 The pixel length of window_size i+1 <i-th layer window w i The pixel length of window_size i .

4. The high-speed rail track slab edge detection algorithm that is insensitive to changes in light intensity according to claim 1, characterized in that: The i-th window W i The sliding starting position is: the upper window W i-1 Start sliding position + previous window W i-1 The sliding window W where the maximum distance value is detected i The first pixel position of The i-th window W i The sliding stop position is: the upper window W i-1 Start sliding position + previous window W i-1 The sliding window W where the maximum distance value is detected i The first pixel position of the previous window W i-1 Length in pixels.

5. The high-speed rail track slab edge detection algorithm that is insensitive to changes in light intensity according to claim 1, characterized in that: The running speed of the SWD algorithm can be changed by changing the stride of each sliding of the sliding window.

6. The high-speed rail track slab edge detection algorithm that is insensitive to changes in light intensity according to claim 1, characterized in that: The absolute distance of the left and right half grayscale difference is calculated as: The sliding window row vector w i Divide it into two areas, left and right, and calculate the absolute value of the difference between the grayscale accumulation values ​​in the left and right areas: Among them, P j is the gray value of the j-th pixel in the window.

7. The high-speed rail track slab edge detection algorithm that is insensitive to changes in light intensity according to claim 1, characterized in that: The range where the detected edge points are located is represented by the sliding window row vector w i Calculate a series of continuous distance values, and take the window with the maximum distance value as the current sliding window row vector w i The range of detected edge points.

8. The high-speed rail track slab edge detection algorithm that is insensitive to changes in light intensity according to claim 1, characterized in that: The coordinate position of the edge feature point in the positioning window is the center position of the last layer of windows.