A method for irregular parts arrangement based on normalized two-dimensional cross-correlation matrix and template matching

By using the method based on normalized two-dimensional cross-correlation matrix and template matching, the problems of high calculation costs, inaccurate material loss estimation, low layout efficiency and difficult to determine relative position in irregular parts layout are solved, and efficient and accurate part layout and resource optimization are achieved.

CN117592606BActive Publication Date: 2025-03-14NANJING TECH UNIV +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311588337.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-24
Publication Date
2025-03-14
Estimated Expiration
2043-11-24

AI Technical Summary

Technical Problem

The existing irregular parts arrangement methods have problems such as high calculation costs, inaccurate material loss estimates, low layout efficiency and difficult to determine relative locations, which are difficult to meet the needs of modern manufacturing and production.

Method used

Using a method based on normalized two-dimensional cross-correlation matrix and template matching, efficient arrangement of irregular parts is achieved through pre-processing of part images, two-dimensional cross-correlation matrix calculation and vector arrangement optimization.

Benefits of technology

It improves the arrangement efficiency of irregular parts, reduces calculation costs, accurately considers material losses, optimizes resource utilization, and meets rapidly changing production needs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117592606B_ABST
    Figure CN117592606B_ABST
Patent Text Reader

Abstract

The present invention relates to an irregular parts arrangement method based on a normalized two-dimensional mutual correlation matrix and template matching. First, a part shape diagram is obtained based on a part model, and the diagram is binarized, with black as the background and white as the target object. The image size is adjusted according to the actual size of the part; the part image is expanded in consideration of the material loss during the processing process; the reference plate is represented by a binary black image, and the part is rotated by 0°, 90°, 180°, and 270°, respectively, and four mutual correlation matrices of the rotated part and the reference image are calculated, and the matrix is ​​cropped twice, and appropriate elements are retained, and the remaining elements are formed into a vector, and are sorted in descending order based on the correlation value. The method of the present invention combines image processing, mathematical modeling, and template matching technology, and can be used in various manufacturing and production environments, improves production efficiency, reduces costs, and achieves optimal use of resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical field:

[0001] The invention relates to an irregular parts arrangement method based on a normalized two-dimensional mutual correlation matrix and template matching, and belongs to the fields of computer science and engineering. Background technology:

[0002] In modern manufacturing and production processes, parts arrangement is a key link and is essential for improving production efficiency and resource utilization. Traditional parts arrangement methods are mainly aimed at parts with regular shapes, such as rectangles or circles, and various effective algorithms and tools have been developed. However, when it comes to the arrangement of irregularly shaped parts, the problem becomes more complicated because many factors need to be considered at this time, such as the shape, size, relative position of the parts, and material loss.

[0003] At present, some existing technologies attempt to solve the problem of irregular parts arrangement through computer-aided arrangement. However, these methods often have some obvious limitations. First, they usually rely on complex algorithms and a large amount of computing resources, resulting in high computing costs and time-consuming arrangement processes. Secondly, the existing technologies are insufficient in considering material loss during part processing, so the arrangement results are often not accurately implemented in actual processing. In addition, for parts with irregular shapes, the arrangement efficiency of existing methods is low and it is difficult to meet rapidly changing production needs. Finally, determining the exact relative position between irregular parts is usually a complex task, which can easily lead to overlap between parts or waste of resources.

[0004] Therefore, it is necessary to provide an innovative method that can effectively deal with the challenges of irregular parts arrangement. This method should be able to comprehensively consider multiple factors, including the shape, size, material loss, relative position, etc. of the parts, so as to achieve efficient parts arrangement, improve production efficiency, reduce costs, and optimize resource utilization.

[0005] The traditional irregular parts arrangement method has the following main problems:

[0006] (1) High computational cost: Existing technologies rely on complex computational methods and require a large amount of computing resources, which significantly increases computational costs and limits the feasibility of practical applications.

[0007] (2) Inaccurate estimation of material loss: Existing methods usually fail to fully consider the material loss during part processing, resulting in the inability to accurately implement the layout results in actual production, wasting resources;

[0008] (3) Low layout efficiency: For parts with irregular shapes, the layout efficiency of existing technologies is relatively low, which cannot meet the rapidly changing production needs and affects production efficiency;

[0009] (4) Relative positions are difficult to determine: Determining the accurate relative positions between irregular parts is usually a complex task. Existing methods easily lead to overlap or unreasonable arrangement between parts, wasting resources and time.

[0010] The object of the present invention is to provide an innovative irregular parts arrangement method, aiming to solve the above-mentioned problems, improve production efficiency, reduce costs, and achieve optimal utilization of resources. Summary of the invention:

[0011] The present invention relates to an irregular parts arrangement method based on normalized two-dimensional cross-correlation matrix and template matching, aiming to solve the problems of computational complexity, inaccurate material loss estimation, low arrangement efficiency and difficulty in determining relative positions in existing irregular parts arrangement methods. The method combines image processing, mathematical modeling and template matching technology, can be used in various manufacturing and production environments, improves production efficiency, reduces costs, and achieves optimal use of resources.

[0012] A method for arranging irregular parts based on normalized two-dimensional cross-correlation matrix and template matching includes the steps of preprocessing part images:

[0013] S1. Obtain a part shape drawing according to the CAD model of the part;

[0014] S2, binarize it, black represents the background, white represents the target;

[0015] S3, adjusting the size of the image according to the actual size of the part;

[0016] S4. Considering the material loss during the part processing, the part image is expanded.

[0017] The steps involved in calculating the two-dimensional cross-correlation matrix are:

[0018] S5.1. Rotate the parts by 0°, 90°, 180° and 270° respectively;

[0019] S5.2, calculating the two-dimensional cross-correlation matrix between the rotated part and the reference image, and obtaining four matrices;

[0020] S5.3. Perform the first cut of the four matrix pairs to ensure that the parts do not move outside the reference plate during translation;

[0021] S5.4. Perform a second trimming of the four matrices to ensure that the parts are arranged gradually from left to right;

[0022] S5.5. Combine the remaining elements of the four matrices into a vector;

[0023] S5.6, sorting the corresponding vectors from large to small according to the cross-correlation values;

[0024] S5.7, starting from the first element of the vector, the part image is adjusted according to the specified rotation angle and translation amount;

[0025] S5.8. After each adjustment of the part image, determine whether the part overlaps with other parts. If so, try the next element. If not, complete the arrangement of the part.

[0026] S5.9. After each part is arranged, the reference image has a new part image. When arranging the next part, the cross-correlation matrix between the next part and the new reference image needs to be recalculated.

[0027] S5.10. Repeat the above process until all parts are arranged.

[0028] The present invention comprises the following key steps:

[0029] (1) Part image preprocessing

[0030] First, the shape image of the part is obtained based on the CAD model of the part. Then, the shape image is binarized, where black represents the background and white represents the target object. The image size is adjusted according to the actual size of the part, and the part image is expanded to ensure that the size of the part is consistent with the actual processing requirements, taking into account the material loss during the part processing.

[0031] (2) Calculation of two-dimensional cross-correlation matrix

[0032] The two-dimensional cross-correlation matrix calculation is a key step of the present invention. It includes the following sub-steps:

[0033] S1. Rotate the parts at four rotation angles: 0°, 90°, 180° and 270°.

[0034] S2. Calculate the two-dimensional cross-correlation matrix between each rotated part image and the reference image, thereby obtaining four correlation matrices.

[0035] S3. The four related matrices are trimmed to ensure that the parts do not exceed the range of the plate during translation while maintaining the arrangement order from left to right.

[0036] (3) Vector arrangement and optimization

[0037] Combine the remaining elements of the four correlation matrices into a vector and sort the vectors according to the size of the correlation values. Then, starting from the first element of the vector, try to arrange the part images and adjust them according to the specified rotation angle and translation amount. After each attempt, determine whether the part image overlaps with other parts. If there is no overlap, the arrangement of the part is completed. After each arrangement, a part image will be added to the reference image, and the cross-correlation matrix between the next part and the new reference image needs to be recalculated. Repeat the above process until all parts are arranged.

[0038] Compared with the prior art, the present invention has the following beneficial effects:

[0039] The main advantages of the present invention are:

[0040] (1) Efficiency: This method achieves efficient irregular parts arrangement and improves production efficiency through the normalized two-dimensional cross-correlation matrix and template matching technology.

[0041] (2) Accuracy: The material loss during part processing is taken into account, and the layout results more accurately meet the actual processing requirements.

[0042] (3) Versatility: It is suitable for various irregular parts and has a wide range of applications.

[0043] (4) Resource optimization: Through layout optimization, available resources are utilized to the greatest extent possible and waste is reduced.

[0044] The embodiments of the present invention can be customized according to specific production and manufacturing requirements. Various parameters, such as rotation angle, cutting method, optimization algorithm, etc., can be adjusted and optimized according to actual conditions. Description of the drawings:

[0045] Figure 1 The general flow chart of the irregular parts arrangement based on the normalized two-dimensional cross-correlation matrix and template matching of the present invention;

[0046] Figure 2 This is a schematic diagram of template image preprocessing;

[0047] Figure 3 Schematic diagram of the reference image and the template image;

[0048] Figure 4 is a schematic diagram of the normalized cross-correlation matrix;

[0049] Figure 5 It is a schematic diagram of the effective range of the normalized cross-correlation matrix;

[0050] Figure 6 Schematic diagram of the cropped normalized cross-correlation matrix with transformed coordinates;

[0051] Figure 7 The complete normalized cross-correlation matrix and cropped schematic diagram of the first template image;

[0052] Figure 8 The template is rotated to different angles;

[0053] Fig. 9 It is the surface diagram of the normalized cross-correlation matrix between the blank reference image and the first template image (after being rotated at different angles);

[0054] Fig.10 right Fig. 9 The three-dimensional surface diagram of the remaining part after the matrix in is trimmed twice;

[0055] Fig.11 is a sequence containing sorted cross-correlation values, rotation angles, and element coordinates;

[0056] Fig.12 is the arrangement result of the first template image and its occupied width Lo;

[0057] Fig.13 Schematic diagram for detecting and filling holes in an image;

[0058] Fig.14 is the second template image after being rotated at different angles;

[0059] Fig.15 Based on Fig.14 The three-dimensional surface drawn by the four normalized two-dimensional cross-correlation matrices obtained;

[0060] Fig.16 Schematic diagram of the normalized cross-correlation matrix formed by cropping subsequent images and the reference image;

[0061] Fig.17 In accordance with Fig.16 The three-dimensional surface diagram of the remaining part of the cross-correlation matrix after secondary clipping is shown;

[0062] Fig.18 The figure shows the pattern arrangement results based on normalized two-dimensional cross-correlation and template matching. Specific implementation method:

[0063] The technical solution of the present invention will be described in detail below with reference to the accompanying drawings. Figure 1 The figure is the overall flow chart of the corresponding arrangement process.

[0064] (1) Part image preprocessing

[0065] In the template matching process, two basic conditions must be met: first, the template must be smaller than the reference image; second, the pixel brightness values ​​within the template 't(x,y)' should vary. In order to achieve these two basic conditions and minimize the amount of calculation, the method adopted by the present invention is to ensure that the image is at least one pixel away from the border. Figure 2 shown.

[0066] This approach is mainly designed for rectangular patterns. If the pattern is a perfect rectangle and there is no margin left on the edge of the image, the entire template image will show a uniform brightness. This situation should be strictly avoided.

[0067] (2) Normalized two-dimensional cross-correlation calculation

[0068] The calculation expression of normalized two-dimensional cross-correlation is:

[0069]

[0070] in, represents the mean of the template (part) image, and Indicates the mean brightness of the reference image pixels 's(x,y)' in the area where the template is located.

[0071] In the context of the normalized 2D cross-correlation between the template and the reference image, an initial inversion operation is first performed on the reference image. This operation is intended to enable subsequent template matching to be performed on unoccupied areas of the reference image.

[0072] Figure 3 In the example, the template image size is V t ×H t =6×5, the reference image size is V s ×H s =11×9.

[0073] During the calculation process, there is at least one pixel overlap between the template image and the reference image. Each element of the cross-correlation matrix corresponds to a specific position of the template image relative to the reference image, such as Figure 4 shown.

[0074] Figure 4 The cross-correlation matrix shown has the dimensions (V s +V t -1)×(H s +H t -1), that is, 16×13.

[0075] (3) First Cut

[0076] In the template image, a one-pixel margin is reserved on all four edges. The different overlapping positions of the template and the reference image correspond to the elements at different positions in the cross-correlation matrix, such as Figure 5 shown.

[0077] The placement process must ensure that the pattern is completely within the reference image. Figure 5 The gray elements around the template pattern indicate that a part of the template pattern exceeds the boundary of the reference image, which should be avoided. In order to enhance the search efficiency, it is necessary to exclude these gray elements around the template pattern. The present invention refers to this step as the first clipping of the cross-correlation matrix.

[0078] (4) Coordinate transformation

[0079] In the cross-correlation matrix, each element is uniquely identified by its coordinate value, which is determined by its precise position within the matrix. Figure 6 As shown in the figure, the element in the upper left corner corresponds to the position where the pattern is aligned with the upper left corner of the reference image (including a one-pixel margin). Conversely, the element in the second row and second column indicates that the entire template image is precisely aligned with the upper left corner of the reference image (excluding a one-pixel margin), and no part exceeds. The coordinates of the element in the second row and second column are marked as (0,0), and the coordinates of the element in the first row and first column are marked as (-1,-1), as shown in the figure. Figure 6 shown.

[0080] Based on the transformed coordinates, the template image can be accurately translated.

[0081] (5) Second Cutting

[0082] In order to systematically rank the patterns from left to right, the cross-correlation matrix needs to be pruned twice to preserve its leftmost part. This step is crucial for the progressive ranking process.

[0083] The complete cross-correlation matrix, i.e. the original pattern without any trimming, is Figure 7 Visualization of the image in (a). The brightness levels in the image correspond to the values ​​of the matrix elements.

[0084] The remaining area after the first and second cropping is as follows Figure 7 (b) The width of the remaining area after the second cropping is defined as:

[0085] W c2 =1.5·L max (2)

[0086] Among them, L max Defined as L h and L v The larger value betweenh represents the horizontal size of the pattern, and L v Indicates the vertical size of the pattern.

[0087] (6) Cross-correlation value sorting

[0088] Ideally, the template image should be able to rotate freely within the reference image. For computational efficiency considerations, the present invention limits it to four discrete angles: 0°, 90°, 180°, and 270°. Figure 8 shown.

[0089] There are four normalized cross-correlation matrices between each rotated template image and the reference image, which are displayed in the form of 3D graphs, where different heights correspond to different cross-correlation element values ​​and are represented by different colors, such as Fig. 9 shown.

[0090] For each matrix, the first cropping is performed to remove the edge elements, and the second cropping is performed to retain the left part of the matrix. The cropped matrix is ​​displayed in the form of a three-dimensional (3D) graph, as shown in Fig.10 , where the corresponding height represents the value of the matrix element.

[0091] Subsequently, the remaining elements extracted from the four cross-correlation matrices are combined and sorted in descending order. Finally, a sequence is generated, which consists of the elements extracted from the four cross-correlation matrices. Each element in the sequence includes information about three key aspects: cross-correlation value, rotation angle, and coordinates corresponding to the element in the cross-correlation value matrix. Then, this sequence is sorted in descending order according to the cross-correlation value, such as Fig.11 shown.

[0092] (7) Arrange the first pattern

[0093] according to Fig.11 The template placement process considers the first element in the sequence and then proceeds in sequence. The exact position and orientation of the pattern is determined by the rotation angle and coordinates contained in each element. The resulting image is called I T , including the arranged template image superimposed on the reference image I0.

[0094] After trying one element in the sequence, the overlap detection process mentioned earlier is performed. If an overlap is detected, the template will continue to try the next element in the sequence until a suitable placement is found. However, for the initial placement of the first pattern, overlap detection is not necessary. Fig.12 The result of placing the first pattern is shown in Figure 2, which occupies a width (L o ) is defined as the distance measured from the leftmost edge of the image to the rightmost edge of the pattern.

[0095] (8) Arrangement of subsequent patterns

[0096] To minimize potential interference in subsequent patterning due to inappropriate holes, any voids that are smaller than the template itself should be filled. Fig.13 In the template arrangement shown in (a), a hole is found in the upper left corner of the image, surrounded by the edge of the reference image and the template pattern. Since the size of the blank is smaller than the current template, it is filled, as shown in Fig.13 (b) is shown. The hole size is determined based on pixel count. If the blank contains fewer pixels than the pattern part in the template, it is considered to meet the requirements and is filled. On the contrary, if the size of the blank exceeds the template, it remains unchanged because the template may have a chance to be arranged in it. Subsequently, in order to arrange the next pattern, the binary reference image should be inverted, as shown in Fig.13 (c) as shown.

[0097] For the subsequent patterns, four different cross-correlation matrices are generated based on the inverted reference image. Each matrix corresponds to a different rotation angle, such as Fig.14 shown.

[0098] The surface plots of the four calculated cross-correlation matrices are shown in Fig.15 In order to enhance the search efficiency, the correlation matrix should be initially pruned to eliminate the inappropriate elements around it. In order to arrange the subsequent patterns from left to right in an orderly manner, the correlation matrix should also be pruned a second time, such as Fig.16 Shown by the green dashed line.

[0099] The remaining matrix width must satisfy two conditions. First, it should be large enough to completely accommodate the corresponding pattern. This requirement can be met by setting the following conditions:

[0100] L r1 =1.5·L p-max (3)

[0101] Among them, L r1 represents the width of the corresponding area of ​​the reference image after the second cropping of the cross-correlation matrix, and L p-max Indicates the larger value between the horizontal and vertical dimensions of the pattern. In addition, ensure that the placement of the corresponding pattern remains within the occupied width (L o ) is also crucial, such as Fig.12 This requirement can be met by the following conditions:

[0102] L r2 =L o -L p-max (4)

[0103] Among them, L r2 Indicates the position limit that the pattern should not exceed, such as Fig.16 shown.

[0104] Finally, L r The value of is determined as follows:

[0105] L r =max(L r1 ,L r2 )=max(1.5·L p-max ,L1-L p-max ) (5)

[0106] If most of the remaining area after two rounds of matrix cropping cannot fit the pattern because the density of the previously arranged patterns is very high, you need to adjust L r The update expression is:

[0107] L r =max(1.5·L p-max ,L1-L p-max )+L p-max (6)

[0108] The 3D image of the cross-correlation matrix after two rounds of cropping is as follows Fig.17 As shown. By using elements from four different matrices, a sequence can be generated. In this sequence, the cross-correlation values ​​are arranged in descending order. Therefore, the placement position of the second pattern can be determined based on the search results, such as Fig.18 (a). The pattern arrangement process will continue until all patterns are effectively positioned, as shown in Fig.18 (b) as shown.

[0109] according to Fig.18 From the observation in (b), it can be clearly seen that the orderly arrangement of all patterns follows the direction from left to right. This strategic layout follows the principles of orderly progression and compact configuration, both of which play a key role in the effective use of available film materials. The intentional placement of patterns starting from the leftmost side and moving to the right ensures the effective use of spatial dimensions and ultimately optimizes the use of materials.

[0110] This approach fully reflects the careful consideration of resource conservation and provides a coherent method for pattern placement. This carefully calculated method ensures that the placement of each pattern not only contributes to the overall design, but also maximizes the use of materials, which emphasizes an environmentally friendly and resource-efficient pattern layout strategy.

Claims

1. An irregular parts arrangement method based on normalized two-dimensional cross-correlation matrix and template matching, characterized in that: The steps of preprocessing the part image are as follows: S1. Obtain a part shape drawing according to the CAD model of the part; S2, binarize it, black represents the background, white represents the target; S3, adjusting the size of the image according to the actual size of the part; S4, taking into account the material loss during the part processing process, the part image is expanded; S5.

1. Rotate the parts by 0°, 90°, 180° and 270° respectively; S5.2, calculating the two-dimensional cross-correlation matrix between the rotated part and the reference image, and obtaining four matrices; S5.

3. Perform the first cut of the four matrix pairs to ensure that the parts do not move outside the reference plate during translation; S5.

4. Perform a second trimming of the four matrices to ensure that the parts are arranged gradually from left to right; S5.

5. Combine the remaining elements of the four matrices into a vector; S5.6, sorting the corresponding vectors from large to small according to the cross-correlation values; S5.7, starting from the first element of the vector, the part image is adjusted according to the specified rotation angle and translation amount; S5.

8. After each adjustment of the part image, determine whether the part overlaps with other parts. If so, try the next element. If not, complete the arrangement of the part. S5.

9. After each part is arranged, the reference image has a new part image. When arranging the next part, the cross-correlation matrix between the next part and the new reference image needs to be recalculated. S5.

10. Repeat the above process until all parts are arranged.

Citation Information

Patent Citations

  • Three-dimensional model identification method based on feature simplification and neural network

    CN113963118A

  • Project progress management system based on BIM and application

    CN115587399A