# Photogrammetric Measurement and Analysis of the Shape Profile of Pneumatic Artificial Muscles
## 2 Test Methods
### Image Analysis
#### 2.2.2 Boundary Detection  
Automated identification of objects within an image boils down to the practice of segmentation through boundary detection. Common methods of boundary detection include edge detection and thresholding. Edge detection methods identify boundaries of objects by locating the sharp changes in color or light intensity that are characteristic of object boundaries [17]. It is often performed using gradient-based methods such as Canny edge detection [19]. Thresholding techniques, on the other hand, segment an image by grouping image pixels by comparing their color value to a set threshold value. Since thresholding locates areas of an image and not edges, finding boundaries through thresholding requires an additional step of using a method of locating and tracing object boundaries. Edge detection methods are effective at detecting edges with sharp contrast, but can have difficulty with random specular reflections, or with soft edges that have small color gradients [17]. Identification of the edge of the PAM braid using edge detection methods proved to be difficult due to the soft edges of the PAM's bulbous shape, and random spikes in brightness due to specular reflections off the surface of the Kevlar braid. However, the ruler used for calibration, with its flat surface and high-contrast hatch markings, was found to be an ideal candidate for edge-detection methods, as detailed in the Test Methods-Image Analysis section. Thresholding techniques, when combined with a boundary tracing algorithm, can serve as a more robust method of boundary detection for identification of the PAM's braid. Setting a color threshold can be performed manually through subjective analysis, but automated methods of thresholding have been developed that can identify a suitable threshold in a consistent and time-efficient manner. Automated methods of thresholding are typically based on color histogram analysis. The histogram defines the distribution of the number of instances of each color value in an image. Setting a threshold divides the histogram into two classes (i.e., groups) with all pixels below the color value threshold grouped into one class, and all pixels above the color value belonging to a second class. An image is commonly transformed into a class-membership based binary image to provide a visual representation of the threshold segmentation, and to serve as an input in many boundary tracing algorithms. [PERSON]'s method is a common method of histogram-based thresholding that is used in this research [17; 20; 21]. This method's algorithm recursively searches for a threshold value that can divide the histogram into classes that have a maximum inter-class variance. The algorithm is detailed as follows. Let us consider a certain color value (e.g., H, S, or V) to set a threshold on. Each pixel of an image is represented by \(L\) color value levels of the histogram (e.g., 0\(-\)100% for S or V), and within the histogram, the height of each color value bar represents the fraction of the total number of pixels at each respective color value level. For a given threshold, the pixels are separated into two classes (\(i=1,2\)). \(w_{i}\) is equal to the probability of a pixel being in class \(i\), and \(\mu_{i}\) and \(\mu_{T}\) are the mean value of each class and the total, respectively. [PERSON]'s method then finds the optimal threshold value by maximizing the inter-class variance, \(\sigma_{b}\), using the following Equation [20; 21]:  
\[\sigma_{b}^{2}=w_{1}(\mu_{1}-\mu_{T})^{2}+w_{2}(\mu_{2}-\mu_{T})^{2} \tag{6}\]  
[PERSON]'s method is utilized for image segmentation, with Figures 9b and 10b providing illustrations of the relative brightness and hue histograms, respectively, with thresholds placed using [PERSON]'s method. With an area of interest identified through threshold segmentation, the boundary of the area must then be traced with a contiguous line. A simple method of boundary tracing used in this research is the Moore-Neighbor algorithm [22; 23].