# Fully Automated Dispensing System Based on Machine Vision
## 3 Vision Dispensing Camera Calibration and Path Planning
### Image Acquisition Recognition and Positioning Accuracy Experiment  
The dispensing object is small, and manual dispensing and traditional dispensing cannot very well guarantee accuracy; to improve the dispensing accuracy, machine vision is used for image acquisition processing. For this purpose, the image acquisition experiment is done on the physical dispensing platform, where the PCB board is placed in the code tray for image acquisition, and the upper computer is compiled to display the number of the dispensing PCB board in the code tray in real time. Among them, image acquisition, image processing, image template matching, and other operations can be completed in the human-computer interaction interface of the upper computer, and the XY pixel coordinates and angle values of the center point of the dispensing area can be displayed in the data display area. The image acquisition is the pre-work for the subsequent image processing and matching. The following experiments are conducted to match and locate the templates from the image acquisition, then the matching rate data and the positioning accuracy error are obtained. 1. Localization information extraction experiment  
The experiment selected 120 RJDNEL-type PCB boards, divided into five groups for the positioning information extraction test; the recognition results are shown in Table 5. Analyzing the extraction test results, it can be concluded that 600 PCB boards correctly extracted 599 pieces, matching the correct rate above 99%. After repeated analysis of the test, one of the unsuccessful matches is due to the presence of edge-breaking missing PCB boards, not a defect in the extraction algorithm. \begin{table}
\begin{tabular}{c c c} \hline \hline \multirow{2}{*}{**Group**} & **Conventional Dispensing Path** & **Optimized Dispensing Path** \\  & **Length \(\overline{L_{1}}\) (mm)** & **Length \(\overline{L_{2}}\) (mm)** \\ \hline
1 & 1654.9 & 940.1 \\
2 & 1713.4 & 959.8 \\
3 & 1707.4 & 949.2 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Simulated annealing algorithm for path length extraction. \begin{table}
\begin{tabular}{c c c c c} \hline \hline \multirow{2}{*}{**Experiment Serial Number**} & \multirow{2}{*}{
\begin{tabular}{c} **Total Number** \\ **of PCB Boards/** \\ **Block** \\ \end{tabular} } & \multicolumn{2}{c}{**Number of**} & & \\  & **of PCB Boards/** & **Correct** & **Withdrawal** & **Correct** \\  & **Block** & **Extractions/** & **Time/ms** & **Extraction Rate** \\ \hline
1 & 120 & 120 & 815 & 100\% \\
2 & 120 & 120 & 820 & 100\% \\
3 & 120 & 120 & 765 & 100\% \\
4 & 120 & 119 & 910 & 99.2\% \\
5 & 120 & 120 & 620 & 100\% \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Positioning information extraction rate. Image recognition coordinate position accuracy error analysis. In image acquisition, if the positioning coordinate points identified from each image differ greatly, this will lead to inaccurate dispensing in the subsequent actual dispensing process, which requires repeated identification and positioning test analysis for a certain position. When doing the repeatability test, the standard deviation of the set of measured values represents the accuracy of the measured values [26]. This experimental theory uses the standard deviation as a quantitative criterion for the accuracy of repeatedly extracting the positioning coordinate points, and the experimental steps are as follows:  
* The experiment randomly selects two PCBs into groups A and B. * On the PCB board in group A, the collected image is pre-processed by grayscaling, filtering, binarization, etc., and then the edge extraction and refinement of the PCB board dispensing area are carried out. Finally, the coordinates of the center point of the dispensing area are repeatedly collected and extracted 10 times based on the minimum outer rectangle algorithm. The extracted coordinates are read out as (\(X_{1}\), \(Y_{1}\)). * Repeat the experimental steps in group B to obtain (\(X_{2}\), \(Y_{2}\)).