Application Background
When loading a workpiece with a notch for the next processing step, the location of the notch needs to be automatically identified. Because the location of the external notch on the workpiece is often not uniform, the position of the workpiece needs to be corrected before loading or unloading before proceeding to the next processing step, so that the workpiece's position to be processed and its actual processing position are consistent.
The traditional processing method involves manual loading of the workpiece, followed by a robotic arm moving the workpiece to the next station for final processing. However, manual loading leads to inconsistent placement of workpiece notches and low efficiency, resulting in discrepancies between the workpiece's arrival at the processing position and its actual processing location, thus affecting processing efficiency and accuracy.
To address the aforementioned issues, Zhengdong Technology has developed an automatic workpiece notch orientation identification system. This system features high detection speed, high reliability, and high production efficiency. It has good applicability in automated production lines for automatic machine vision identification of workpiece notch locations and also has a wide range of market applications.
In the last lesson, we discussed the application case of flexible vibratory feeder in machine vision solutions. In this lesson, we will share with you how to achieve the function of automatically identifying the direction of workpiece notches.
Instructional Videos
01 Detection Principle
(I) Testing Requirements
The system detects and identifies the location of the notch in the workpiece, then displays the detected radius of the workpiece and the number of samples produced today on the interface, and finally displays the final detection result on the image.
Sample image
(II) Software Algorithm
First, the image is binarized. Then, the smallest circumcircle within the region is found, and its XY coordinates and radius are obtained. Next, a circular region is generated using the obtained XY coordinates and radius. Then, the material region is obtained using a BLOB threshold, and the difference operation is performed between the material region and the generated circular region. Finally, the gap position is displayed in red.
02 Software Implementation
1. Open ZDevelop software: Create a new project named "Gap Detection.zpj" → Create a new HMI file → Create a new main.bas file (for writing the interface response function) → Create a new global.bas file (for storing global variables) → Create a new camera.bas file (for implementing the camera acquisition function) → Add the files to the project.
2. Design the HMI main interface.
3. Associate HMI main interface control variables.
4. The main instructions used in the code implementation of this course are for binarization processing, followed by region difference operations and other related instructions.
(1) Binarization
ZV_RETHRESH(parameter 1: input image, parameter 2: mask region, parameter 3: binarized region, output parameters, parameter 4: set low threshold, parameter 5: set high threshold)
(2) Calculate the minimum bounding circle of the region ZV_RECIRCLE(parameter1: input region, input matrix, parameter2: TABLE index, output parameters, output is the circle center coordinates cx, cy, and radius respectively) (3) Generate a circle ZV_REGENCIRCLE(parameter1: generated region, output parameters, parameter2: circle center coordinates X, parameter3: circle center coordinates Y, parameter4: circle radius) (4) Perform difference operation ZV_REDIFF(parameter1: input region 1, parameter2: input region 2, parameter3: calculate the difference between region 1 and region 2, output region)
Full code and sample image download address
▼
03 Operation Demonstration
(I) Operating Procedures
To check the running effect: Download the project to the controller → Use local images → Single acquisition → Click Single run (to view the current sample test results) → Click Auto run (to view the continuous running effect) → End.
(II) Effect Demonstration
This concludes our presentation on the application example of the Zhengdong Technology Machine Vision Motion Control All-in-One Machine: Automatically Identifying the Direction of Workpiece Notches.
For more exciting content, please follow the "Zheng Motion Assistant" WeChat official account. For related development environment and example code, please contact Zheng Motion's technical sales engineer: 400-089-8936.
This article is original content from Zheng Motion Technology. We welcome everyone to reprint it for mutual learning and to jointly improve China's intelligent manufacturing level. Copyright belongs to Zheng Motion Technology. Please indicate the source if you reprint this article.