# A Methodology for the Mechanical Design of Pneumatic Joints Using Artificial Neural Networks
## 3 Dataset Construction and Regression Algorithms
### Bend Dataset  
After calibration, a test campaign was carried out to build the Bend dataset. In each test, hereinafter called trial, there was a unique combination of the geometric and functional parameters of the external reinforcement. The twenty-seven external reinforcements were tested at seven different pressure levels for 189 tests and repeated three times, for an overall amount of 567 trials. In each of them, the average of the six bending angles of the open sectors, identified for the same parameter combination, was calculated. In the trials, the pressure was set with a precision regulator (SMC IR1220-N01-A, maximum pressure of 4.0 bar, SMC Corporation, Tokyo, Japan) and measured with a pressure manometer (maximum pressure 2.5 bar, sensitivity 0.05 bar). The images were imported and processed in MATLAB R2023b. The parameters from the calibration results were used in the image analysis. The _undistorted_[50] and _imlocalbrighten_ filters [51] can be used before identifying the bending angles of each test. The first filter rectifies errors induced by lens distortion; thus, the algorithm maps the coordinates of the undistorted output image to the input camera image using distortion coefficients. The second filter improves image contrast: a contrast adjustment realigns the image intensity values to the full display range of the data  
Figure 3: Camera calibration results: (**a**) the adopted checkerboard in one of the positions used for the camera calibration; (**b**) real-world 3D reconstruction with the camera positioned at the point (0,0,0); (**c**) mean errors of the fifteen images used in the calibration with the maximum error shown by the red solid line and the mean error the orange dotted line.  
type. Thus, with an image with good contrast, which has more pronounced differences between black and white, it is easier to identify points of interest in image analysis.  
Figure 4a shows the raw image acquired for reinforcement 6 at a pressure P of 1.2 bar, while Figure 4b,c show the same image with distortion correction and contrast enhancement, respectively. To better understand the influence of the filters, histograms of grayscale pixel intensities are shown in Figure 4d-f for each image. The differences that occurred by the application of the first filter are not appreciable to the naked eye. With histograms, it is possible to understand how the filter acts on the intensity of some pixels, correcting the distortion of the lenses. Furthermore, the minimal changes made during this correction justify the good results of the calibration. The second filter, on the other hand, marks contrast, especially in the darker areas of the image, as is evident from the reduction in the number of pixels in the low-intensity areas.  
Finally, from the undistorted ImagePoints coordinates (in pixels) and calibration parameters, the _image2 world2d_ function was used to return the WorldPoints coordinates (X and Y in mm) by rigid transformation. Following this process, the dataset was available, and for each quaternion of values of P, L, R, and \(\Theta\), there was given output bending angle of the open sector, \(\alpha\). In total, 189 combinations of four inputs were associated with the corresponding output bending angle.