Sole edge detection method based on image grayscale value analysis
By using an image grayscale value analysis-based sole edge detection method, defective shoes are automatically screened and matched with left and right shoes. This solves the problems of low efficiency and high false judgment rate in existing technologies, and achieves efficient and accurate shoe detection and matching.
Patent Information
- Application Number
- CN202511128929.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-13
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2045-08-13
AI Technical Summary
Existing footwear inspection technologies rely on manual operation, which is inefficient, has a high error rate, is difficult to meet the needs of large-scale production, and is costly.
A shoe sole edge detection method based on image grayscale value analysis is adopted. Color images are acquired through a camera, converted into grayscale images, and processed for region segmentation to obtain grayscale images of shoe sole edges. The integrity of shoe sole edges is analyzed, defective shoes are automatically filtered out, and left and right shoes are matched.
It enables efficient and accurate detection of footwear defects, improves production efficiency, reduces costs, and enhances the accuracy of left-right foot matching and user comfort.
Smart Images

Figure CN120635084B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of image processing technology, specifically, it relates to a method for detecting shoe sole edges based on image grayscale value analysis. Background Technology
[0002] With the rapid development of industrial automation and intelligent technology, quality inspection and matching of footwear products has become an important part of the footwear manufacturing industry. As a major manufacturing country, my country ranks among the world's top in both footwear exports and production.
[0003] However, the testing technology for footwear products is still in its infancy in the current market, and automated testing technology is relatively scarce. In the era of big data and artificial intelligence, how to effectively utilize data for quality analysis and prediction is the current challenge.
[0004] Traditional footwear inspection and matching methods mainly rely on manual operation, which suffers from low efficiency, high error rate, and high cost, making it difficult to meet the needs of large-scale production. The large investment of human resources also greatly increases the burden on enterprises. Therefore, this invention proposes a sole edge detection method based on image grayscale value analysis. By combining image processing technology with automation technology, it can achieve efficient and accurate defect detection of footwear products, improve production efficiency, reduce costs, enhance the competitiveness of enterprises, and provide the footwear manufacturing industry with an efficient and accurate quality inspection and matching solution. Summary of the Invention
[0005] To address the shortcomings of existing technologies, this invention provides a method for detecting shoe sole edges based on image grayscale value analysis, which solves the problems of difficulty and low efficiency in detecting defective footwear products in existing technologies.
[0006] The objective of this invention can be achieved through the following technical solutions:
[0007] A method for detecting shoe sole edges based on image grayscale value analysis, comprising the following steps:
[0008] Step 1: Use several cameras to acquire color images of the shoe X to be tested in the detection area of the shoe to be tested, and fit the images to form a complete color image Q of the shoe to be tested;
[0009] The grayscale image Q of the shoe under test is obtained by Q-transformation of the color image of the shoe under test. gray ;
[0010] Step 2: Q-image of the grayscale image of the shoe to be tested gray Perform region segmentation processing to obtain the grayscale image Q of the shoe sole edge. gum And further analysis to determine;
[0011] If the shoe X to be tested is determined to be a defective shoe, then the shoe X is removed, and the grayscale image Q of the shoe X is updated. gray And perform a deletion operation on the color image Q of the shoe to be tested;
[0012] If based on the grayscale image Q of the shoe sole edge gum If the shoe X to be tested is determined to be a non-defective shoe, proceed to the next step;
[0013] Step 3: Obtain grayscale images of the sole edges of several non-defective shoes, perform left and right foot matching and filtering, match the left shoe with the best matching result with the right shoe, and output the matching result.
[0014] As a further aspect of the present invention, in step one, in addition to several cameras, the detection area of the shoe to be tested also includes a positioning device for fixing the shoe X to be tested, so as to ensure that several cameras can acquire color images of the shoe X to be tested.
[0015] As a further aspect of the present invention, the color image Q of the shoe to be tested in step one includes a color image of the front of the shoe X, a first side color image, a color image of the back of the shoe X, and a second side color image.
[0016] The image layout rules are as follows:
[0017] In the color image Q of the shoe to be tested, the color image of the front of the shoe X is connected to the first side color image of the shoe X, the first side color image of the shoe X is connected to the back color image of the shoe X, and the back color image of the shoe X is connected to the second side color image of the shoe X.
[0018] In the color image Q of the shoe under test, the edge of the sole of the shoe X is shown as a continuous image without interruption or repetition;
[0019] Convert the color image Q of the shoe under test to a grayscale image Q. gray The subsequent image layout should be the same as that described in the color image Q of the shoe to be tested.
[0020] As a further aspect of the present invention, the grayscale image Q of the shoe to be tested... gray Perform region segmentation processing to obtain the grayscale image Q of the shoe sole edge. gum The specific method is as follows:
[0021] S41. Based on the acquired grayscale image Q of the shoe to be tested gray Construct a two-dimensional coordinate system, with each pixel as a point in the two-dimensional coordinate system. For any pixel Q... i gray Calculate the gray-level variance σ within the e*e neighborhood (x, y). iWhere i is a positive integer index, not exceeding k, and k is Q. gray The total number of pixels, x and y represent the horizontal and vertical coordinates of any pixel, and e is set by the operator.
[0022] S42. Calculate the gray-level variance of k pixels to obtain k gray-level variances. Sort the k gray-level variances in descending order according to their values to obtain the gray-level variance sequence σ1,σ2,...,σ k ;
[0023] S43. Obtain the first gray-level variance σ1 from the gray-level variance sequence as the first benchmark value, and then obtain the second gray-level variance σ2. Calculate the numerical difference rate between σ2 and the first benchmark value. If the numerical difference rate does not exceed the operator's preset numerical difference rate threshold σ... 阈 Then the gray variance σ2 and the first benchmark value are classified into category P1;
[0024] S44. Continue extracting gray-level variances from the gray-level variance sequence until σ is reached. k Calculate the numerical difference rate with the first benchmark value sequentially, ensuring that it does not exceed the numerical difference rate threshold σ. 阈 The corresponding gray-level variance, if classified into category P1, will exceed the numerical difference rate threshold σ. 阈 The corresponding gray-level variance is assigned to the category P to be classified. 待 In, and treat the classification P 待 Sort in descending order according to the grayscale variance value;
[0025] S45, From the category to be classified P 待 In the process, the first grayscale variance value is obtained as the second baseline value. Steps S43-S44 are repeated to obtain category P2. For categories exceeding the numerical difference rate threshold σ, 阈 The corresponding gray-level variance is reassigned to the category P to be classified. 待 In, and treat the classification P 待 Reorder the data in descending order based on the grayscale variance values;
[0026] S46. Repeat S43-S45 until all gray-level variances have been classified, resulting in n categories, denoted as the category sequence P1, P2, ..., Pn. n , where n is a positive integer index representing the total number of categories;
[0027] Further analysis and processing of the category sequence yields a pre-selected region, which is then expanded to obtain the grayscale image Q of the shoe sole edge. gum .
[0028] As a further aspect of the present invention, the grayscale image Q of the shoe sole edge is obtained. gum Specific methods also include:
[0029] S51. Obtain the horizontal and vertical coordinates of all pixels corresponding to the gray variance in any category from the category sequence, and plot all pixels on a new two-dimensional coordinate system based on the horizontal and vertical coordinates of the pixels.
[0030] If all pixels can be fitted into a horizontal band, then obtain the mean value of the ordinate of all pixels within that horizontal band.
[0031] If a horizontal band-shaped region cannot be fitted, no processing is performed;
[0032] S52. Perform the operation described in step S51 on all categories in the category sequence to obtain several horizontal strip regions. Obtain the mean ordinate of all pixels in each horizontal strip region and sort them in descending order according to the mean ordinate. The horizontal strip region corresponding to the first mean ordinate after sorting is used as the pre-selected region.
[0033] Based on the determined pre-selected area, the operator sets an expansion value m, which expands the pre-selected area upward by m pixels from the mean of the vertical coordinates. The expanded length is used as the width of the pre-selected area, while the original length of the pre-selected area remains unchanged.
[0034] The expanded pre-selected region corresponds to the grayscale image Q of the shoe to be tested. gray The image in the image is used as the grayscale image of the shoe sole edge Q. gum .
[0035] As a further aspect of the present invention, the grayscale image Q of the shoe sole edge is obtained. gum The specific methods for further analysis and judgment are as follows:
[0036] Q, the grayscale image of the shoe sole edge gum The first pixel in the bottom left corner is used as the origin to construct a two-dimensional coordinate system with a scale of one pixel.
[0037] Obtain the grayscale image of the shoe sole edge Q gum The mean of all pixels in the image, and expressed as the grayscale image of the shoe sole edge Q. gum The width of the standard pixel column is used as the width of the standard pixel column to construct the standard pixel column;
[0038] Compare the standard pixel column with the grayscale image of the shoe sole edge Q. gum Compare each column of pixels in a two-dimensional coordinate system and record the pixel difference rate between the L columns of pixels and the standard pixel column to obtain G1, G2, ..., G L Where L represents a positive integer index, and Q represents the grayscale image of the shoe sole edge. gum Total number of columns in the middle pixel column;
[0039] The difference rates of the L pixels are sequentially compared with the pixel difference rate threshold G preset by the operator. 阈 If the pixel difference rate exceeds the pixel difference rate threshold G during comparison... 阈 Then the pixels in that column are considered abnormal pixels.
[0040] If the number of pixels does not exceed the limit, it is considered a normal pixel column and no processing is performed.
[0041] Extract the column number corresponding to all abnormal pixel columns, and determine whether the column number is continuous. If there is a continuous column number, it is determined that there is a defect in the corresponding shoe X to be tested, and the shoe X to be tested is regarded as a defective shoe.
[0042] If there is no continuous situation, the shoe X to be tested is determined to be a non-defective shoe.
[0043] As a further aspect of the present invention, the specific method for extracting the column numbers corresponding to all abnormal pixel columns and determining whether the column numbers are consecutive is as follows:
[0044] If there are r consecutive columns, then a consecutive case is considered to exist; otherwise, it is considered that no consecutive case exists. Here, r is a positive integer set by the operator.
[0045] As a further aspect of the present invention, if the shoe X to be tested is determined to be a defective shoe, then the shoe X to be tested is removed, and the grayscale image Q of the shoe X to be tested is... gray And perform a deletion operation on the color image Q of the shoe to be tested.
[0046] As a further aspect of the present invention, the specific method for obtaining grayscale images of the sole edges of several non-defective shoes for left-right foot matching and filtering is as follows:
[0047] The obtained shoes to be tested are classified into left and right shoes, resulting in a total of α left-foot shoes and α right-foot shoes;
[0048] The grayscale images of the sole edges of α left shoes are obtained, along with the number of abnormal pixel columns in each image. These images are then sorted in ascending order based on the number of abnormal pixel columns to obtain the grayscale image sequence Q corresponding to the sole edges of α left shoes. 1 gum Q 2 gum ,...,Q α gum Similarly, the grayscale image sequence Q corresponding to the sole edge of the right shoe is obtained. 1’ gum Q 2’ gum ,...,Q α’ gum ;
[0049] Using Qβ gum Corresponding to Q β’ gum The algorithm sequentially matches α left shoes with α right shoes and outputs the best matching result, where β is a positive integer index representing any one of 1-α, and α is a counting index representing the number of left and right shoes.
[0050] The beneficial effects of this invention are:
[0051] (1) This invention provides an automatic screening mechanism and method, which uses image processing technology to analyze image category sequences to obtain a pre-selected area, and expands the pre-selected area to obtain a complete and clear grayscale image of the shoe sole edge; then, based on automated analysis technology, it determines whether the shoes are defective products, quickly screens and removes them, without the need for manual inspection, saving manpower and time, and improving production efficiency;
[0052] (2) The present invention provides a grayscale image analysis and grayscale variance sequence grouping classification, which can effectively distinguish the shoe sole edge area from the background or other irrelevant areas, and further improve the accuracy of the pre-selected area division; in addition, by sorting the number of abnormal pixel columns and matching the corresponding methods, the integrity and symmetry of the shoe sole edge are considered, improving the accuracy of left and right foot matching, ensuring that users receive suitable and matching shoes, and improving the user's comfort. Attached Figure Description
[0053] The invention will now be further described with reference to the accompanying drawings.
[0054] Figure 1 This is a schematic diagram of the system described in Embodiment 1 of the present invention;
[0055] Figure 2 This is a flowchart illustrating the method described in Embodiment 2 of the present invention;
[0056] Figure 3 This is a flowchart illustrating the method described in Embodiment 3 of the present invention. Detailed Implementation
[0057] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0058] Example 1
[0059] A method for detecting shoe sole edges based on image grayscale value analysis, such as Figure 1As shown, the implementation of this method relies on a sole edge detection system, which includes:
[0060] The image acquisition module includes multiple cameras mounted in the detection area of the shoe to be tested, used to acquire color images of the shoe in real time.
[0061] The image analysis module converts the color image of the shoe under test into a grayscale image of the shoe under test, and obtains the grayscale image of the sole edge through region segmentation processing.
[0062] The image decision module analyzes the grayscale image of the shoe sole edge acquired by the image analysis module, determines whether the current shoe to be tested is a defective shoe, matches non-defective shoes, and obtains and outputs the best matching result.
[0063] The storage module is used to store the analysis results and calculation results of any step described in this method.
[0064] The central processing unit, including computing units, is used to process the calculation and analysis steps involved in this method and serves as a medium for data transmission between modules.
[0065] Example 2
[0066] A method for detecting shoe sole edges based on image grayscale value analysis, such as Figure 2 As shown, the specific steps include the following:
[0067] Step 1: This method is applicable to the production line of footwear products (for a single production line, that is, all shoes on the production line are of the same size and style, including left and right shoes). It relies on the sole edge detection system described in Example 1. When the shoe to be tested arrives at the detection area of the shoe to be tested through the production line, the positioning device installed on the detection area of the shoe to be tested first performs a positioning operation on the shoe to be tested to ensure that the several cameras installed on the detection area of the shoe to be tested can accurately obtain the color image of the shoe to be tested.
[0068] Several cameras capture color images of the same shoe under test, resulting in several color images of the shoe under test. Through image fitting technology, the several color images of the shoe under test are fitted into a complete color image of the shoe under test, which is denoted as Q.
[0069] Then, the grayscale image Q of the shoe to be tested is obtained by applying the conversion formula of human eye perception weight to the color image Q of the shoe to be tested. gray This facilitates subsequent image analysis operations.
[0070] It should be explained here that the color image Q of the shoe under test includes the color image of the front of the shoe, the first side color image, the color image of the back of the shoe, and the second side color image.
[0071] The image arrangement rules in the color image Q of the shoe under test are as follows:
[0072] In the color image Q of the shoe under test, the color image of the front of the shoe under test is connected to the color image of the first side of the shoe under test, the color image of the first side of the shoe under test is connected to the color image of the back of the shoe under test, and the color image of the back of the shoe under test is connected to the color image of the second side of the shoe under test.
[0073] Finally, the fitted color image Q of the shoe under test is obtained. In this image, the edge of the sole of the shoe under test is shown as a continuous image without interruption and repetition.
[0074] Convert the color image Q of the shoe under test to a grayscale image Q. gray Afterwards, the grayscale image Q of the shoe under test gray The image layout rules are the same as those of the color image Q of the shoe under test;
[0075] This arrangement ensures that the edge of the shoe sole and the background appear as an approximately continuous straight line in the image, meaning that the ordinate of the pixel at the intersection of the shoe sole edge and the background is within a certain range.
[0076] It should be noted that this method requires that the edge of the sole be clearly distinguished from the background. This method is not applicable to shoes without a sole or shoes with a sole edge that is similar in material to the background and not clearly distinguishable.
[0077] Step 2: Process the acquired grayscale image Q of the shoe to be tested. gray Perform region segmentation processing to segment out a grayscale image Q containing only the edge of the sole. gum Then, based on the grayscale image Q of the shoe sole edge... gum The analysis was conducted to determine whether the shoes under test were defective.
[0078] If the shoe under test is determined to be defective, it will be removed from the analysis and will not be included in subsequent processing. The grayscale image of the shoe will then be converted to Q... gray And perform a deletion operation on the color image Q of the shoe to be tested;
[0079] If based on the grayscale image Q of the shoe sole edge gum If the shoe to be tested is determined to be non-defective, proceed to the next step;
[0080] Step 3: Based on the several non-defective shoes selected in Step 2, obtain the grayscale images of the sole edges of these shoes again, perform left and right foot matching and filtering, match the left shoe with the best matching result with the right shoe, and output the matching result.
[0081] Example 3
[0082] This embodiment discloses a method for testing the grayscale image Q of the shoe under test, based on embodiment 2.gray Perform segmentation processing to obtain the grayscale image Q of the shoe sole edge. gum Methods, such as Figure 3 As shown, the details are as follows:
[0083] Based on the acquired grayscale image Q of the shoe to be tested gray In the grayscale image Q of the shoe to be tested gray Based on this, a two-dimensional coordinate system is constructed, with the grayscale image Q of the shoe to be tested as the reference. gray The bottom left boundary point is taken as the origin, and the right and top of the origin are taken as the horizontal and vertical axes of this two-dimensional coordinate system. The grayscale image Q of the shoe to be tested is... gray Each pixel in the graph is considered a point in the two-dimensional coordinate system.
[0084] For the grayscale image Q of the shoe to be tested gray Any pixel Q i gray (x, y) is used to obtain the pixel value of the pixel and the Q value of the pixel. i gray Find the pixel values of all pixels within the e*e neighborhood of (x,y), and calculate the Q value of that pixel. i gray The gray variance σ of (x,y) in the e*e neighborhood i Where i is a positive integer index, not exceeding k, and k is Q. gray The total number of pixels, x and y represent the horizontal and vertical coordinates of any pixel, and the value of e is set by the operator in combination with the shoe type of the shoe being tested and the required judgment accuracy of the production line where the shoe type is located.
[0085] Q-image of the shoe under test gray The grayscale variance of each of the k pixels is calculated, resulting in k grayscale variances. These k grayscale variances are then sorted in descending order of their numerical values, and the resulting grayscale variance sequence is denoted as σ1, σ2, ..., σ k ;
[0086] For a gray-level variance sequence, the gray-level variance σ1 at the first sorted position is obtained and used as the first benchmark value. Then, the gray-level variance σ2 at the second sorted position is obtained from the gray-level variance sequence. The numerical difference rate is used.
[0087] ;
[0088] Calculate the numerical difference rate between the grayscale variance σ2 and the first benchmark value (the grayscale variance σ1 with the first sorting position), and compare this numerical difference rate with the numerical difference rate threshold σ preset by the operator. 阈The comparison is performed, and if the calculated numerical difference rate does not exceed the numerical difference rate threshold σ... 阈 Then the gray variance σ2 and the first benchmark value are classified into the same category and denoted as category P1. The average gray variance in category P1 is the largest among all categories, and the average gray variance of subsequent categories decreases sequentially.
[0089] Continue extracting gray-level variances from the gray-level variance sequence until the last gray-level variance σ is obtained. k Then, the numerical difference rate between the obtained grayscale variance and the first benchmark value is calculated sequentially, and the values not exceeding the numerical difference rate threshold σ are compared according to the above comparison method. 阈 The corresponding gray-level variance is assigned to category P1, which contains the first baseline value, and the calculated numerical difference rate is set to the threshold σ. 阈 The corresponding gray variance is reassigned to a new category P to be classified. 待 In, and treat the classification P 待 Sort by grayscale variance values from largest to smallest;
[0090] Then from the category P to be classified 待 In the process, the first grayscale variance value is obtained as the second baseline value, and then the classification continues from the unclassified P. 待 Obtain a grayscale variance from the middle until the class P to be classified is defined. 待 The last grayscale variance in the dataset is used to calculate the numerical difference rate between the second baseline value and the second baseline value, and it is then determined whether the calculated numerical difference rate exceeds the numerical difference rate threshold σ. 阈 If it does not exceed the difference rate threshold σ 阈 The grayscale variance is then grouped into the same category as the second baseline value, denoted as category P2. For values exceeding the numerical difference rate threshold σ... 阈 The corresponding gray-level variance is reassigned to the category P to be classified. 待 In, and treat the classification P 待 Re-sort according to the grayscale variance values from largest to smallest;
[0091] Repeat the above steps until all gray-level variances have been classified, resulting in n categories, denoted as the category sequence P1, P2, ..., Pn. n , where n is a positive integer index representing the total number of categories;
[0092] It should be explained here that the larger the value of the grayscale variance, the more drastic the change in grayscale value in the area surrounding the pixel. This means that the grayscale value fluctuates more in the neighborhood of the pixel. Such large fluctuations usually correspond to changes in edges, textures or other significant features in the image. In this scheme, the method is used to find the pixel at the boundary between the sole and the background by taking advantage of the clear boundary between the sole and the background pixels.
[0093] Then, obtain the x and y coordinates of all pixels corresponding to the gray variance in any category from the category sequence, and construct a new two-dimensional coordinate system with a scale of one pixel.
[0094] Re-plot all pixels on this two-dimensional coordinate system using the x and y coordinates of the pixels, and determine whether the x and y coordinates of the corresponding pixels in this category can be fitted into a horizontal band region (the method of fitting a horizontal band region can be implemented according to existing technology, which will not be elaborated here).
[0095] If it can be fitted into a horizontal band region, then obtain the mean value of the ordinate of all pixels in the horizontal band region;
[0096] If a horizontal band-shaped region cannot be fitted, no processing is performed;
[0097] Based on the mean of the ordinates of all pixels in all the obtained horizontal strip regions, they are sorted in ascending order. The horizontal strip region corresponding to the first mean of the ordinates (the smallest mean of the ordinates) is taken as the pre-selected region. The pre-selected region represents the area of the shoe sole and the background boundary. The shoe sole is a continuous image, so it can be fitted into a horizontal strip region. The ordinate of the pixel at the shoe sole is the smallest among the pixels in the entire image. Therefore, the area of the shoe sole and the background boundary can be obtained by the above method.
[0098] For the determined pre-selected area, the operator sets an expansion value m, which is the number of pixels preset by the operator and matches the pixel width of the sole edge of the shoe to be tested, so as to ensure that the entire sole edge can be covered when expanding the pre-selected area.
[0099] The expansion value m represents expanding the preselected area by m pixels based on the average of the ordinates of all pixels in the preselected area. This expanded length (m pixels) is used as the width of the preselected area, while the original length of the preselected area remains unchanged.
[0100] The expanded pre-selected region is obtained, and the expanded pre-selected region is then extracted from the corresponding grayscale image Q of the shoe to be tested. gray The image is segmented and the resulting image is used as the grayscale image Q of the shoe sole edge. gum .
[0101] Example 4
[0102] This embodiment discloses a method for screening and matching shoes to be tested, based on embodiment 1, as follows:
[0103] The grayscale image Q of the sole edge, as determined in Example 3. gum A two-dimensional coordinate system is established using this image, with the grayscale image Q of the shoe sole edge as the reference.gum The first pixel in the lower left corner is used as the origin of this two-dimensional coordinate system. The horizontal axis directly to the left of the origin and the vertical axis directly above the origin are constructed. The scale on the horizontal and vertical axes of this two-dimensional coordinate system is the width of one pixel.
[0104] Obtain the grayscale image Q of the shoe sole edge. gum The pixel values of all pixels in the image are averaged to obtain the grayscale image Q of the shoe sole edge. gum The average pixel value is used to obtain the grayscale image Q of the shoe sole edge. gum The width, that is, the grayscale image Q at the edge of the sole. gum The distance between the coordinates on the vertical axis and the origin in a two-dimensional coordinate system is used to construct a column of pixel values for the grayscale image Q of the shoe sole edge, based on the obtained width. gum The standard pixel column of the average pixel value;
[0105] Using standard pixel columns and grayscale images of the shoe sole edge Q gum The first column of pixels with an abscissa of 1 is compared in a two-dimensional coordinate system, and the pixel difference rate between the first column of pixels and the standard pixel column is recorded and denoted as G1.
[0106] Next, compare the standard pixel column with the second column of pixels at the x-coordinate of 2, and then slide one tick forward to perform the comparison operation until the Lth column of pixels. Record the pixel difference rate between all columns of pixels and the standard pixel column, denoted as G1, G2, ..., G L Where L represents a positive integer index, indicating the grayscale image Q of the shoe sole edge. gum The total number of columns of pixels in the middle.
[0107] Obtain the pixel difference rate threshold G preset by the operator. 阈 The recorded L pixel difference rates are then compared sequentially with the pixel difference rate threshold G. 阈 During the comparison operation, if the difference rate of any pixel exceeds the preset pixel difference rate threshold G set by the operator... 阈 If the pixel difference rate is not exceeded, the entire column of pixels associated with that pixel difference rate is considered an abnormal pixel column; if any pixel difference rate does not exceed the operator's preset pixel difference rate threshold G... 阈 If the pixel difference rate is not specified, the column of pixels associated with that pixel difference rate will be treated as a normal pixel column and will not be processed.
[0108] Extracting grayscale image of shoe sole edge Q gum The algorithm identifies all abnormal pixel columns and their associated column numbers, sorting all column numbers in ascending order. If there are r consecutive abnormal pixel columns with a certain number of columns, then the current grayscale image Q of the shoe sole edge is determined. gumIf a defect exists in the corresponding shoe to be tested, the shoe is considered a defective shoe, removed from the test, and the grayscale image of the shoe is then processed. gray The color image Q of the shoe to be tested is deleted. If there is no continuous image, the shoe X to be tested is considered a non-defective shoe.
[0109] By repeating the above steps, several non-defective shoes were obtained, including left and right shoes of the same model and size, which were referred to as test shoes. Grayscale images of the sole edges of several test shoes were obtained, and grayscale images of the sole edges of several test shoes were taken from the grayscale images of the sole edges of several test shoes. Then, the test shoes were classified according to left and right shoes, and finally α left shoes and α right shoes were obtained.
[0110] Taking α left shoes as an example, obtain α grayscale images of the shoe sole edges and the number of abnormal pixel columns in each of the α grayscale images of the shoe sole edges. Then, sort the grayscale images of the shoe sole edges in order of increasing number of abnormal pixel columns to obtain Q. 1 gum Q 2 gum ,...,Q α gum Similarly, we can obtain the grayscale image Q of the sole edge of the right shoe after sorting the columns of abnormal pixels in ascending order of the number of abnormal pixels. 1’ gum Q 2’ gum ,...,Q α’ gum ;
[0111] Use Q 1 gum Corresponding to Q 1’ gum Q 2 gum Corresponding to Q 2’ gum Until Q α gum Corresponding to Q α’ gum The method involves matching α left-foot shoes with α right-foot shoes, treating them as a single pair of shoes, recording the best matching result, and outputting this result. The counting index represents the number of left and right shoes.
[0112] All data in the formulas described above are numerical calculations performed with dimensions removed. Furthermore, any content not described in detail in this specification is existing technology known to those skilled in the art.
[0113] The above description is merely an example and illustration of the present invention. Those skilled in the art can make various modifications or additions to the specific embodiments described, or use similar methods to replace them, as long as they do not deviate from the invention or exceed the scope defined in the claims, all of which should fall within the protection scope of the present invention.
[0114] It should be stated that all user data collected in this application was collected with the user's consent and authorization. Furthermore, the uses of user data are legal and compliant, and the use and processing of user data comply with the relevant laws, regulations, and standards of the relevant regions.
Claims
1. A method for detecting shoe sole edges based on image grayscale value analysis, characterized in that, This method includes the following steps: Step 1: Use several cameras to acquire color images of the shoe X to be tested in the detection area of the shoe to be tested, and fit the images to form a complete color image Q of the shoe to be tested; The grayscale image Q of the shoe under test is obtained by Q-transformation of the color image of the shoe under test. gray ; Step 2: Q-image of the grayscale image of the shoe to be tested gray Perform region segmentation processing to obtain the grayscale image Q of the shoe sole edge. gum ; Obtain the grayscale image of the shoe sole edge Q gum The specific method is as follows: S11. Based on the acquired grayscale image Q of the shoe to be tested gray Construct a two-dimensional coordinate system, with each pixel as a point in the two-dimensional coordinate system. For any pixel Q... i gray Calculate the gray-level variance σ within the e*e neighborhood (x, y). i Where i is a positive integer index, not exceeding k, and k is Q. gray The total number of pixels, x and y represent the horizontal and vertical coordinates of any pixel, and e is set by the operator. S12. Calculate the gray-level variance of k pixels to obtain k gray-level variances. Sort the k gray-level variances in descending order according to their values to obtain the gray-level variance sequence σ1,σ2,...,σ k ; S13. Obtain the first gray-level variance σ1 from the gray-level variance sequence as the first benchmark value, and then obtain the second gray-level variance σ2. Calculate the numerical difference rate between σ2 and the first benchmark value. If the numerical difference rate does not exceed the numerical difference rate threshold σ preset by the operator... 阈 Then the gray variance σ2 and the first benchmark value are classified into category P1; S14. Continue extracting gray-level variances from the gray-level variance sequence until σ is reached. k Calculate the numerical difference rate with the first benchmark value sequentially, ensuring that it does not exceed the numerical difference rate threshold σ. 阈 The corresponding gray-level variance, if classified into category P1, will exceed the numerical difference rate threshold σ. 阈 The corresponding gray-level variance is assigned to the category P to be classified. 待 In, and treat the classification P 待 Sort in descending order according to the grayscale variance value; S15, From the category to be classified P 待 In the process, the first grayscale variance value is obtained as the second baseline value. Steps S13-S14 are repeated to obtain category P2. For categories exceeding the numerical difference rate threshold σ, 阈 The corresponding gray-level variance is reassigned to the category P to be classified. 待 In, and treat the classification P 待 Reorder the data in descending order based on the grayscale variance values; S16. Repeat S13-S15 until all gray-level variances have been classified, resulting in n categories, denoted as the category sequence P1, P2, ..., Pn. n , where n is a positive integer index representing the total number of categories; Further analysis and processing of the category sequence yields a pre-selected region, which is then expanded to obtain the grayscale image Q of the shoe sole edge. gum ; Obtain the grayscale image of the shoe sole edge Q gum And further analysis to determine; If the shoe X to be tested is determined to be a defective shoe, then the shoe X is removed, and the grayscale image Q of the shoe X is updated. gray And perform a deletion operation on the color image Q of the shoe to be tested; If based on the grayscale image Q of the shoe sole edge gum If the shoe X to be tested is determined to be a non-defective shoe, proceed to the next step; Step 3: Obtain grayscale images of the sole edges of several non-defective shoes, perform left and right foot matching and filtering, match the left shoe with the best matching result with the right shoe, and output the matching result.
2. The method for detecting shoe sole edges based on image grayscale value analysis according to claim 1, characterized in that, In step one, in addition to several cameras, the detection area of the shoe to be tested also includes a positioning device for fixing the shoe X to be tested, so as to ensure that all the cameras can acquire color images of the shoe X to be tested.
3. The method for detecting shoe sole edges based on image grayscale value analysis according to claim 1, characterized in that, The color image Q of the shoe to be tested in step one includes the front color image, the first side color image, the back color image, and the second side color image of the shoe to be tested X. The image layout rules are as follows: In the color image Q of the shoe to be tested, the color image of the front of the shoe X is connected to the first side color image of the shoe X, the first side color image of the shoe X is connected to the back color image of the shoe X, and the back color image of the shoe X is connected to the second side color image of the shoe X. In the color image Q of the shoe under test, the edge of the sole of the shoe X is shown as a continuous image without interruption or repetition; Convert the color image Q of the shoe under test to a grayscale image Q. gray The subsequent image layout should be the same as that described in the color image Q of the shoe to be tested.
4. The method for detecting shoe sole edges based on image grayscale value analysis according to claim 3, characterized in that, Obtain the grayscale image of the shoe sole edge Q gum Specific methods also include: S41. Obtain the horizontal and vertical coordinates of all pixels corresponding to the gray variance in any category from the category sequence, and plot all pixels on a new two-dimensional coordinate system based on the horizontal and vertical coordinates of the pixels. If all pixels can be fitted into a horizontal band, then obtain the mean value of the ordinate of all pixels within that horizontal band. If a horizontal band-shaped region cannot be fitted, no processing is performed; S42. Perform the operation in step S41 on all categories in the category sequence to obtain several horizontal strip regions. Obtain the mean ordinate of all pixels in each horizontal strip region and sort them in descending order according to the mean ordinate. The horizontal strip region corresponding to the first mean ordinate after sorting is used as the pre-selected region. Based on the determined pre-selected area, the operator sets an expansion value m, which expands the pre-selected area upward by m pixels from the mean of the vertical coordinates. The expanded length is used as the width of the pre-selected area, while the original length of the pre-selected area remains unchanged. The expanded pre-selected region corresponds to the grayscale image Q of the shoe to be tested. gray The image in the image is used as the grayscale image of the shoe sole edge Q. gum .
5. The method for detecting shoe sole edges based on image grayscale value analysis according to claim 4, characterized in that, Obtain the grayscale image of the shoe sole edge Q gum The specific methods for further analysis and judgment are as follows: Q, the grayscale image of the shoe sole edge gum The first pixel in the bottom left corner is used as the origin to construct a two-dimensional coordinate system with a scale of one pixel. Obtain the grayscale image of the shoe sole edge Q gum The mean of all pixels in the image, and expressed as the grayscale image of the shoe sole edge Q. gum The width of the standard pixel column is used as the width of the standard pixel column to construct the standard pixel column; Compare the standard pixel column with the grayscale image of the shoe sole edge Q. gum Compare each column of pixels in a two-dimensional coordinate system and record the pixel difference rate between the L columns of pixels and the standard pixel column to obtain G1, G2, ..., G L Where L represents a positive integer index, and Q represents the grayscale image of the shoe sole edge. gum Total number of columns in the middle pixel column; The difference rates of the L pixels are sequentially compared with the pixel difference rate threshold G preset by the operator. 阈 If the pixel difference rate exceeds the pixel difference rate threshold G during comparison... 阈 Then the pixels in that column are considered abnormal pixels. If the number of pixels does not exceed the limit, it is considered a normal pixel column and no processing is performed. Extract the column number corresponding to all abnormal pixel columns, and determine whether the column number is continuous. If there is a continuous column number, it is determined that there is a defect in the corresponding shoe X to be tested, and the shoe X to be tested is regarded as a defective shoe. If there is no continuous situation, the shoe X to be tested is determined to be a non-defective shoe.
6. The method for detecting shoe sole edges based on image grayscale value analysis according to claim 5, characterized in that, The specific method for extracting the column numbers corresponding to all abnormal pixel columns and determining whether the column numbers are consecutive is as follows: If there are r consecutive columns, then a consecutive case is considered to exist; otherwise, it is considered that no consecutive case exists. Here, r is a positive integer set by the operator.
7. The method for detecting shoe sole edges based on image grayscale value analysis according to claim 6, characterized in that, If the shoe X to be tested is determined to be a defective shoe, then the shoe X is removed, and the grayscale image Q of the shoe X is updated. gray And perform a deletion operation on the color image Q of the shoe to be tested.
8. The method for detecting shoe sole edges based on image grayscale value analysis according to claim 7, characterized in that, The specific method for obtaining grayscale images of the sole edges of several non-defective shoes and performing left-right foot matching and filtering is as follows: The obtained shoes to be tested are classified into left and right shoes, resulting in a total of α left-foot shoes and α right-foot shoes; The grayscale images of the sole edges of α left shoes are obtained, along with the number of abnormal pixel columns in each image. These images are then sorted in ascending order based on the number of abnormal pixel columns to obtain the grayscale image sequence Q corresponding to the sole edges of α left shoes. 1 gum Q 2 gum ,...,Q α gum Similarly, the grayscale image sequence Q corresponding to the sole edge of the right shoe is obtained. 1’ gum Q 2’ gum ,...,Q α’ gum ; Using Q β gum Corresponding to Q β’ gum The algorithm sequentially matches α left shoes with α right shoes and outputs the best matching result, where β is a positive integer index representing any one of 1-α, and α is a counting index representing the number of left and right shoes.
Citation Information
Patent Citations
Machine vision control method and system for shoe body quality detection
CN116862850A
Sole edge detection method and device based on image gray value analysis
CN118071783A