Workpiece identifying and positioning method, device and equipment and storage medium

Through the implementation of workpiece recognition and positioning methods on the FPGA platform, the image processing algorithm is used to perform workpiece identification and positioning, solving the problem of large amounts of calculation of traditional template compatibility algorithms and high resource consumption, and realized efficient and real -time workpieces recognition and positioning.

CN119379628APending Publication Date: 2025-01-28FOSHAN INST OF INTELLIGENT EQUIP TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411424839.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-01-28

AI Technical Summary

Technical Problem

The traditional template matching algorithm has a large amount of calculation in workpiece recognition and positioning, poor real-time performance, and excessive resource consumption on the FPGA platform, which has high hardware costs.

Method used

Adopt the method of identification and positioning of workpiece based on the FPGA platform, write image data into DDR memory through the ARM side, the FPGA side perform logical programming and data reading, perform gray, Gaussian filtering, and SOBEL edge detection to obtain the edge features of the workpiece image image Points and match the edge feature points of the template image. Statistize the calculation results of the sliding window and multiple template images to find the most similar position and template.

Benefits of technology

Greatly reduces the processing time, improves real -time, reduces the occupation of hardware resources, improves the resource utilization rate, and is suitable for industrial application scenarios that require rapid response.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119379628A_ABST
    Figure CN119379628A_ABST
Patent Text Reader

Abstract

The invention provides a workpiece identification and positioning method and device, equipment and a storage medium. The method comprises the following steps: acquiring first image data; writing the first image data in the ARM end into a DDR memory; the FPGA end reads the first image data in the DDR memory through logic programming and an AXI bus to obtain second image data; graying the second image data to obtain third image data; performing Gaussian filtering on the third image data to obtain fourth image data; sobel edge detection is carried out on the fourth image data to obtain workpiece image edge feature points; obtaining edge feature points of the template image; matching the edge feature points of the workpiece image with the edge feature points of the template image; and calculating the calculation results of the sliding window and the plurality of template images, searching the most similar position and template, and finally observing the identified result through a display device or outputting coordinate data to the next level. According to the workpiece identification and positioning method, device and equipment and the storage medium, the real-time performance is high, and the resource utilization rate is high.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of robotics technology, and in particular to a workpiece identification and positioning method, device, equipment and storage medium. Background Art

[0002] In the field of industrial robots, workpiece identification and positioning is one of the key technologies for realizing automated production lines. With the continuous improvement of industrial automation, the accuracy and real-time requirements for workpiece identification and positioning are becoming higher and higher. At present, industrial robots mainly use visual recognition technology for workpiece identification and positioning. This technology obtains the image information of the workpiece through a camera, and uses image processing algorithms to analyze and process the image, thereby realizing the identification and positioning of the workpiece.

[0003] Template matching algorithm is a commonly used method in visual recognition technology. The template matching algorithm compares the workpiece image to be identified with the pre-stored template image to find the part that is most similar to the template image, thereby realizing the recognition and positioning of the workpiece. However, the traditional template matching algorithm needs to traverse and search the entire image, which has a large amount of calculation and poor real-time performance. Secondly, the template matching algorithm currently implemented on the PC needs to consume a lot of resources to be transplanted to the FPGA, and the hardware cost is high. Summary of the invention

[0004] The purpose of the present invention is to provide a workpiece identification and positioning method, device, equipment and storage medium to solve one or more technical problems existing in the prior art and at least provide a beneficial choice or create conditions.

[0005] To achieve the above object, the present invention adopts the following technical solutions:

[0006] In a first aspect, a workpiece identification and positioning method is provided, based on an FPGA platform, comprising:

[0007] Acquiring first image data;

[0008] Writing the first image data in the ARM end into the DDR memory;

[0009] The FPGA end reads the first image data in the DDR memory through the AXI bus by logic programming to obtain the second image data;

[0010] gray-scaling the second image data to obtain third image data;

[0011] Performing Gaussian filtering on the third image data to obtain fourth image data;

[0012] Performing Sobel edge detection on the fourth image data to obtain edge feature points of the workpiece image;

[0013] Get edge feature points of the template image;

[0014] Matching edge feature points of the workpiece image with edge feature points of the template image;

[0015] Count the calculation results of the sliding window and multiple template images, find the most similar position and template, and finally observe the recognition results through the display device or output the coordinate data to the next level.

[0016] Optionally, when grayscale is performed, the grayscale value is calculated as follows: grayscale value=(77R+150G+29B)>>8.

[0017] Optionally, when performing Gaussian filtering, the two-dimensional Gaussian distribution function is:

[0018]

[0019] Here, σ is the intensity of the Gaussian distribution.

[0020] Optionally, when performing Sobel edge detection, the Sobel operator is first used to calculate the horizontal gradient and the vertical gradient, and then the horizontal gradient and the vertical gradient are combined, and finally the image edge pixels are determined through threshold setting processing, and the edge detection result is output.

[0021] Optionally, when performing matching, a SAD (sum of absolute differences) algorithm is used.

[0022] Optionally, the calculation formula of the SAD (Sum of Absolute Difference) algorithm is:

[0023]

[0024] Among them, D is the error, S is the workpiece image, and T represents the template image that needs to be matched, i, j are the positions of the pixels of the original image, s, t are the positions of the pixels of the sliding window, and M, N are the number of feature points.

[0025] In a second aspect, a workpiece identification and positioning device is provided, comprising:

[0026] A first module is used to obtain first image data;

[0027] The second module is used to write the first image data in the ARM end into the DDR memory;

[0028] The third module is used to drive the FPGA end to read the first image data in the DDR memory through logic programming and the AXI bus to obtain the second image data;

[0029] A fourth module is used to grayscale the second image data to obtain third image data;

[0030] A fifth module, configured to perform Gaussian filtering on the third image data to obtain fourth image data;

[0031] A sixth module is used to perform Sobel edge detection on the fourth image data to obtain edge feature points of the workpiece image;

[0032] The seventh module is used to obtain edge feature points of the template image;

[0033] An eighth module is used to match edge feature points of the workpiece image with edge feature points of the template image;

[0034] The ninth module is used to count the calculation results of the sliding window and multiple template images, find the most similar position and template, and finally observe the recognition results through the display device or output the coordinate data to the next level.

[0035] In a third aspect, a computer device is provided, comprising a storage device and a processor, wherein the storage device stores a computer program, and the processor executes the computer program to implement the workpiece identification and positioning method as described in the first aspect.

[0036] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the workpiece identification and positioning method as described in the first aspect is implemented.

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

[0038] 1. The workpiece identification and positioning method, device, equipment and storage medium provided by the present invention greatly reduce the processing time and improve the real-time performance by deploying the algorithm to the FPGA platform for acceleration. The processing time is approximately equal to the image resolution multiplied by the number of clock cycles, which is crucial for industrial application scenarios that require fast response. For example, in the industrial robot visual servo system, the advantage of high real-time performance is crucial to ensure that the robot can accurately and quickly respond to changes in the external environment and target objects. The visual servo system obtains and processes the image information of the external environment in real time, provides the robot with accurate posture feedback and motion control instructions, and can ensure that the robot can accurately identify and locate the target object in a very short time, thereby achieving high-speed and high-precision operation.

[0039] 2. The workpiece identification and positioning method, device, equipment and storage medium provided by the present invention are as follows: In an industrial robot system, hardware resources are limited, so optimizing the algorithm to reduce resource consumption is of great significance for improving the overall performance of the system and reducing costs. By optimizing the algorithm, such as simplifying feature representation, reducing the number of pixels, optimizing the sliding window cache and optimizing similarity calculation, the occupation of FPGA resources by the algorithm can be significantly reduced, thereby improving resource utilization. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0041] Figure 1 A schematic diagram of the flow of the workpiece identification and positioning method of the present invention;

[0042] Figure 2 It is a schematic diagram of the composition of the workpiece identification and positioning device of the present invention;

[0043] Figure 3 A schematic diagram of the hardware structure of the computer device of the present invention;

[0044] Figure 4 This is a schematic diagram of a 3x3 matrix window of Block Ram cache in the present invention;

[0045] Figure 5 It is a block diagram of the Sobel edge detection algorithm in the present invention;

[0046] Figure 6 This is the FPGA design diagram of the Sobel algorithm in the present invention;

[0047] Figure 7 This is a schematic diagram of the template matching principle in the present invention;

[0048] Figure 8 This is a schematic diagram of the BRAM efficient cache template matching window in the present invention. DETAILED DESCRIPTION

[0049] The technical solutions in the embodiments of the present invention are described clearly and completely below. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0050] In the description of the present invention, it should be understood that the terms "length", "width", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", etc., indicating the orientation or position relationship are based on the orientation or position relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0051] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features.

[0052] Combine the following Figures 1 to 8 The workpiece identification and positioning method, device, equipment and storage medium of the present invention are described.

[0053] like Figure 1 As shown, the present invention provides a workpiece identification and positioning method based on an FPGA platform, comprising the following steps:

[0054] S1, obtaining first image data;

[0055] S2, writing the first image data in the ARM end into the DDR memory;

[0056] S3, the FPGA end reads the first image data in the DDR memory through the AXI bus through logic programming to obtain the second image data;

[0057] S4, graying the second image data to obtain third image data;

[0058] S5, performing Gaussian filtering on the third image data to obtain fourth image data;

[0059] S6, performing Sobel edge detection on the fourth image data to obtain edge feature points of the workpiece image;

[0060] S7, obtaining edge feature points of the template image;

[0061] S8, matching the edge feature points of the workpiece image with the edge feature points of the template image;

[0062] S9, counting the calculation results of the sliding window and multiple template images, finding the most similar position and template, and finally observing the recognition result through the display device or outputting the coordinate data to the next level.

[0063] The FPGA vision algorithm acceleration solution mainly uses the template matching algorithm to achieve target positioning. The image data is collected by the camera and written to the DDR memory by the ARM side. The FPGA side reads the image data in the DDR memory through the AXI bus through logic programming, and then grays it. There is a decimal part when graying, and the Verilog hardware description language cannot represent decimals, so it needs to be enlarged first and then the result is reduced. Due to the pipeline structure, the 3×3 matrix implementation during Gaussian filtering requires caching the grayscale values ​​of two rows of image pixels and designing a row cache module. The implementation of Sobel edgeization mainly includes a 3×3 matrix module and a convolution summation module, and then the square root of the gradient sum is processed, and the edge feature points are obtained by comparing with the threshold. The template image also needs to undergo the same image processing process in advance to save the feature data. The matching process is mainly to replace the absolute value operation with the same or OR operation of the original image data and the template data at multiple angles, and to count the calculation results of the sliding window and multiple templates to find the most similar position and template. Finally, the recognition result is observed by the display device or the coordinate data is output to the next level.

[0064] Optionally, when grayscale is performed, the grayscale value is calculated as follows: grayscale value=(77R+150G+29B)>>8.

[0065] It is understandable that grayscale processing plays a vital role in digital image processing. It can simplify calculations, reduce information redundancy, and increase processing speed. There are many ways to implement grayscale algorithms. The simplest one is the weighted average method, which assigns different weights according to the sensitivity of the human eye to different colors. Commonly used weighted average methods are:

[0066] Gray value = 0.299R + 0.587G + 0.114B,

[0067] Since FPGA is not convenient for decimal operations, it is magnified by 256 times for calculation and then shifted right by 8 bits, that is:

[0068] Gray value = (77R+150G+29B)>>8,

[0069] The grayscale conversion of color images is a point operation, but too much combinational logic between the two levels of registers will cause timing problems, so the formula is pipelined and divided into three levels: the first level processes multiplication, the second level processes addition, and the third level processes shift.

[0070] In the field of image processing, convolution operations occupy a core position. To achieve efficient convolution processing, FPGA (field programmable gate array) as a flexible and powerful hardware platform is widely used to accelerate complex operations such as convolution. However, in FPGA design, DDR (double data rate synchronous dynamic random access memory) as an off-chip storage resource has complex read and write timing and large resource consumption. Especially when processing large-scale image data, the pressure and delay of DDR bandwidth become the key factors limiting performance improvement. In order to overcome the limitations of DDR, it is particularly important to make full use of FPGA's on-chip storage resources (such as BRAM). In convolution operations, by caching intermediate results, the number of DDR accesses can be significantly reduced, and the throughput and efficiency of data processing can be improved.

[0071] Taking 3×3 convolution as an example, we use Block Ram to cache images to implement convolution. To implement 3x3 convolution, we need to cache two lines of image data on the FPGA. The current input image data is the third line, and together with the first two lines of data read from BRAM, it forms a 3x3 convolution window, as shown in the figure. Figure 4 The upward diagonal arrow in the middle indicates that the current input data is written into the lower row of Ram while being shifted into the register array. At the same time, the data read out of the lower row of Ram is written into the upper row of Ram, forming a convolution window that slides to the right and upward. In each clock cycle, these 9 data points will be multiplied by the corresponding convolution kernel parameters respectively, and the convolution result of the central pixel will be accumulated.

[0072] This BRAM-based caching strategy has the following advantages: first, it reduces the number of DDR accesses, reducing the pressure and latency of DDR bandwidth; second, by caching intermediate results, it enables continuous data processing and pipeline operations, improving system throughput and efficiency; finally, it makes full use of the on-chip storage resources of the FPGA, reducing resource consumption and the logic complexity of the code.

[0073] Furthermore, in the field of image processing, the images collected in reality are often inevitably contaminated by noise. The distribution of these noises in the image usually presents characteristics that are significantly different from the original image content, that is, they are not evenly distributed, but scattered in the image in an abrupt and irregular manner. In order to effectively remove these noises while maintaining the original details of the image, researchers have proposed a variety of filtering algorithms, among which the Gaussian filtering algorithm has attracted much attention due to its unique processing mechanism and excellent performance.

[0074] Optionally, when performing Gaussian filtering, the two-dimensional Gaussian distribution function is:

[0075]

[0076] Where σ is the strength of the Gaussian distribution. The larger the σ value, the more dispersed the data is; conversely, the data is more concentrated toward the center.

[0077] FPGA mainly uses a 3×3 window for Gaussian filtering. The 3×3 window generated by the sliding window can be obtained by performing sliding window processing on the image through the convolution window module mentioned above. The Gaussian kernel used is usually [1,2,1], [2,8,2], [1,2,1]. Except for 1, all other kernels are multiples of 2. Therefore, shift operations are usually used instead of multiplication operations in FPGA implementation.

[0078] Optionally, when performing Sobel edge detection, the Sobel operator is first used to calculate the horizontal gradient and the vertical gradient, and then the horizontal gradient and the vertical gradient are combined, and finally the image edge pixels are determined through threshold setting processing, and the edge detection result is output.

[0079] Specifically, Figure 5 As shown in FIG. 1 , the Sobel edge detection algorithm is implemented by convolving two directional templates with the image in a small neighborhood in the image plane, one for detecting the horizontal edge template and the other for detecting the vertical edge template.

[0080] When performing Sobel edge detection on an image, first use the Sobel operator to calculate the horizontal and vertical gradients, then combine the two gradients, and finally determine the edge pixels of the image through threshold setting processing and output the edge detection results. Assume a 3×3 image area as shown in the following table. Assume that P1, P2, P3, P4, P5, P6, P7, P8, and P9 are the grayscale values ​​of the pixels, P5 is unknown, and the others are known.

[0081]

[0082] The vertical gradient operator and horizontal gradient operator of the Sobel operator are shown in the following table.

[0083]

[0084] Sobel vertical and horizontal gradient operators are used Figure 4 By calculating the gradient of the image area, we can get the vertical (x direction) gradient and horizontal (y direction) gradient components of the pixel point P5:

[0085] G X =(P7+2·P8+P9)-(P1+2·P2+P3)

[0086] G y =(P3+2·P6+P9)-(P1+2·P4+P7).

[0087] The gradient calculation of point P5 requires the vertical gradient and the horizontal gradient. Substituting these two quantities into the formula, we can get the gradient of point P5:

[0088]

[0089] When the gradient amplitude is greater than or equal to the threshold value T, the value of the point is 1, and when it is less than the threshold value T, the value of the point is 0. Combined with the convolution window matrix generator mentioned above, the Sobel algorithm FPGA design is as follows: Figure 6 shown.

[0090] Furthermore, the premise of using template matching algorithm for visual target positioning or real-time tracking is that the characteristics of the target are known, and the area most similar to the target characteristics is found on the original image. The principle of template matching is as follows: Figure 7 shown.

[0091] In the field of image processing, the original image and the template image are considered as two-dimensional matrices. The working principle of the template matching algorithm is to place the template image T on the original image, starting from the upper left corner, and follow the scanning path from left to right and from top to bottom, and slide step by step. This sliding process is accurate to the movement of one column of pixels in each clock cycle, ensuring full coverage and detailed comparison of the original image. During the sliding process, the algorithm calculates the correlation between the template image and the corresponding area currently covered on the original image. This correlation calculation is achieved through a specific mathematical function that can quantify the degree of similarity between the template and the covered area. Each slide of the template will obtain a matching value based on this calculation, and these matching values ​​constitute the key data for evaluating similarity. Different template matching algorithms use different function evaluation criteria. These criteria are determined according to the actual application scenarios and requirements, and can reflect the pros and cons of different matching results.

[0092] Optionally, when performing matching, a SAD (sum of absolute differences) algorithm is used.

[0093] Optionally, the calculation formula of the SAD (Sum of Absolute Difference) algorithm is:

[0094]

[0095] Among them, D is the error, S is the workpiece image, and T represents the template image that needs to be matched, i, j are the positions of the pixels of the original image, s, t are the positions of the pixels of the sliding window, and M, N are the number of feature points.

[0096] In this formula, in the template matching algorithm, we define S as the original image to be searched, that is, the workpiece image, and T represents the template image to be matched. The core principle is that the algorithm will extract the edge eigenvalues ​​of the corresponding two-dimensional matrix windows in the original image and the template image respectively, and perform difference operations on these eigenvalues, that is, calculate the absolute values ​​between them. Subsequently, the algorithm accumulates these absolute values ​​to obtain a comprehensive evaluation index. This evaluation index directly reflects the degree of similarity between the template image and a certain area in the original image to be searched. Obviously, the smaller the value of this evaluation index, it means that the template image has a higher degree of similarity with a certain area in the image to be searched. In this case, we can be sure that the target object has been successfully matched, that is, the specific area of ​​interest has been found.

[0097] Furthermore, in order to reduce the number of pixels, the absolute error and algorithm are improved. Since the calculation of all pixel values ​​in the window is very large and consumes a lot of resources, the coordinates of the template edge points can be recorded and only the edge point similarity can be calculated.

[0098] Furthermore, the sliding window cache is optimized. The template matching algorithm is essentially a large convolution operation. However, if the matching operation is performed completely according to the previous matrix generation circuit, a large amount of BRAM resources will be consumed. Because BRAM exists in the form of blocks, if one is used, the remaining ones will be wasted. Therefore, a high-utilization BRAM cache is proposed, such as Figure 8 As shown, the bit width of BRAM (Block RAM) is used as the number of rows of the cache window, and the bit depth is used as the number of cache columns. Compared with the previous instantiation of multiple BRAMs to cache multiple rows of pixels, the bit width is used here to replace multiple BRAMs, and the first row of data stored in the first RAM is read to the second row of data stored in the second RAM, which is converted into reading the first bit of the same RAM to the second bit, making full use of RAM resources, realizing efficient storage of eigenvalues, and significantly saving LUT (Look-Up Table) resources.

[0099] In addition, it is also necessary to optimize the SAD absolute value difference and calculation. Here, because the pixel values ​​have been replaced by 0 and 1 after edge processing, the absolute value difference and operation here can be changed to the same OR operation, that is, the same pixel is 1, and the different pixels are 0, and then the results are added. There are only 4 cases in the same OR operation, so these 4 cases can be made into a lookup table, and the matching calculation is realized by searching the lookup table. The larger the result, the more similarities there are, which proves that they are more similar.

[0100] If resources permit, template features at multiple angles can be pre-trained and saved as a data set to identify the angle and position information of the target.

[0101] The workpiece identification and positioning method provided in this embodiment can optimize the data bit width, use 01 to represent non-edge points and edge points, and reduce the data bit width. In addition, the SAD (sum of absolute differences) matching calculation is optimized by using the same or OR lookup table, and the FPGA resources are further optimized from the calculation method. For large targets, high resolution, and the problem that the matching window is difficult to cache, the use of shift RAM is reduced by efficiently utilizing the memory resources of BRAM, and the use of LUT resources is reduced.

[0102] Second, as Figure 2 As shown, a workpiece identification and positioning device is provided, comprising:

[0103] The first module 100 is used to obtain first image data;

[0104] The second module 200 is used to write the first image data in the ARM end into the DDR memory;

[0105] The third module 300 is used to drive the FPGA end to read the first image data in the DDR memory through logic programming and the AXI bus to obtain the second image data;

[0106] The fourth module 400 is used to grayscale the second image data to obtain third image data;

[0107] A fifth module 500 is configured to perform Gaussian filtering on the third image data to obtain fourth image data;

[0108] The sixth module 600 is used to perform Sobel edge detection on the fourth image data to obtain edge feature points of the workpiece image;

[0109] The seventh module 700 is used to obtain edge feature points of the template image;

[0110] An eighth module 800 is used to match edge feature points of the workpiece image with edge feature points of the template image;

[0111] The ninth module 900 is used to count the calculation results of the sliding window and multiple template images, find the most similar position and template, and finally observe the recognition results through the display device or output the coordinate data to the next level.

[0112] The contents of the above method embodiments are all applicable to the present system embodiments. The functions implemented by the present system embodiments are the same as those of the above method embodiments, and the beneficial effects achieved are the same as those of the above method embodiments, which will not be repeated here.

[0113] This embodiment also provides a computer-readable storage medium, on which a computer program 1010 is stored. When the computer program 10 is executed by the processor 20, the above-mentioned workpiece identification and positioning method is implemented. The computer-readable storage medium includes, but is not limited to, any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory, read-only memory 30), RAM (Random Access Memory, random memory 30), EPROM (Erasable Programmable Read-Only Memory, erasable programmable read-only memory 30), EEPROM (Electrically Erasable Programmable Read-Only Memory, electrically erasable programmable read-only memory 30), flash memory, magnetic card or optical card. In other words, the storage device includes any medium that stores or transmits information in a readable form by a device (such as a computer, a mobile phone, etc.), which can be a read-only memory 30, a disk or an optical disk, etc.

[0114] also, Figure 3 is a schematic diagram of the hardware structure of a computer device provided in an embodiment of the present invention, wherein the computer device includes a processor 20, a storage 30, an input unit, a display unit and other devices. Those skilled in the art can understand that Figure 3 The device structure device shown does not constitute a limitation on all devices, and may include more or fewer components than shown, or combine certain components. The storage 30 can be used to store the computer program 10 and various functional modules, and the processor 20 runs the computer program 10 stored in the storage 30, thereby executing various functional applications and data processing of the device. The storage 30 can be an internal storage 30 or an external storage 30, or include an internal storage 30 and an external storage 30. The internal storage 30 may include a read-only storage 30 (ROM), a programmable ROM (PROM), an electrically programmable ROM (EPROM), an electrically erasable programmable ROM (EEPROM), a flash memory 30 or a random access memory 30. The external storage 30 may include a hard disk, a floppy disk, a U disk, a magnetic tape, etc. The storage 30 disclosed in the embodiment of the present invention includes but is not limited to the above-mentioned types of storage 30. The storage 30 disclosed in the embodiment of the present invention is only an example and not a limitation.

[0115] This embodiment further provides a computer device, including a storage device 30 and a processor 20, wherein the storage device 30 stores a computer program 10, and the processor 20 executes the computer program 10 to implement the above-mentioned workpiece identification and positioning method.

[0116] The workpiece identification and positioning method, device, equipment and storage medium provided by the present invention greatly reduce the processing time and improve the real-time performance by deploying the algorithm to the FPGA platform for acceleration. The processing time is approximately equal to the image resolution multiplied by the number of clock cycles, which is crucial for industrial application scenarios that require fast response. For example, in the industrial robot visual servo system, the advantage of high real-time performance is crucial to ensure that the robot can accurately and quickly respond to changes in the external environment and target objects. The visual servo system obtains and processes the image information of the external environment in real time, provides the robot with accurate posture feedback and motion control instructions, and can ensure that the robot can accurately identify and locate the target object in a very short time, thereby achieving high-speed and high-precision operation.

[0117] The workpiece identification and positioning method, device, equipment and storage medium provided by the present invention are as follows: In an industrial robot system, hardware resources are limited, so optimizing the algorithm to reduce resource consumption is of great significance for improving the overall performance of the system and reducing costs. By optimizing the algorithm, such as simplifying feature representation, reducing the number of pixels, optimizing the sliding window cache and optimizing similarity calculation, the occupation of FPGA resources by the algorithm can be significantly reduced, thereby improving resource utilization.

[0118] The above descriptions are merely embodiments of the present invention and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

Claims

1. A workpiece identification and positioning method, characterized in that: Based on FPGA platform, including: Acquiring first image data; Writing the first image data in the ARM end into the DDR memory; The FPGA end reads the first image data in the DDR memory through the AXI bus by logic programming to obtain the second image data; gray-scaling the second image data to obtain third image data; Performing Gaussian filtering on the third image data to obtain fourth image data; Performing Sobel edge detection on the fourth image data to obtain edge feature points of the workpiece image; Get edge feature points of the template image; Matching edge feature points of the workpiece image with edge feature points of the template image; Count the calculation results of the sliding window and multiple template images, find the most similar position and template, and finally observe the recognition results through the display device or output the coordinate data to the next level.

2. The workpiece identification and positioning method according to claim 1, characterized in that: When grayscale is performed, the grayscale value calculation formula is: grayscale value = (77R+150G+29B)>>8.

3. The workpiece identification and positioning method according to claim 1, characterized in that: When Gaussian filtering is performed, the two-dimensional Gaussian distribution function is: Here, σ is the intensity of the Gaussian distribution.

4. The workpiece identification and positioning method according to claim 1, characterized in that: When performing Sobel edge detection, the Sobel operator is first used to calculate the horizontal and vertical gradients, and then the horizontal and vertical gradients are combined. Finally, the image edge pixels are determined through threshold setting processing and the edge detection results are output.

5. The workpiece identification and positioning method according to claim 1, characterized in that: When performing matching, the SAD (Sum of Absolute Difference) algorithm is used.

6. The workpiece identification and positioning method according to claim 5, characterized in that: The calculation formula of the SAD (Sum of Absolute Difference) algorithm is: Among them, D is the error, S is the workpiece image, and T represents the template image that needs to be matched, i, j are the positions of the pixels of the original image, s, t are the positions of the pixels of the sliding window, and M, N are the number of feature points.

7. A workpiece identification and positioning device, characterized in that: include: A first module is used to obtain first image data; The second module is used to write the first image data in the ARM end into the DDR memory; The third module is used to drive the FPGA end to read the first image data in the DDR memory through logic programming and the AXI bus to obtain the second image data; A fourth module is used to grayscale the second image data to obtain third image data; A fifth module, configured to perform Gaussian filtering on the third image data to obtain fourth image data; A sixth module is used to perform Sobel edge detection on the fourth image data to obtain edge feature points of the workpiece image; The seventh module is used to obtain edge feature points of the template image; An eighth module is used to match edge feature points of the workpiece image with edge feature points of the template image; The ninth module is used to count the calculation results of the sliding window and multiple template images, find the most similar position and template, and finally observe the recognition results through the display device or output the coordinate data to the next level.

8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: The processor executes the computer program to implement the workpiece identification and positioning method according to any one of claims 1 to 6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the workpiece identification and positioning method according to any one of claims 1 to 6 is implemented.