# Photogrammetric Measurement and Analysis of the Shape Profile of Pneumatic Artificial Muscles
## 2 Test Methods
### Image Analysis
#### 2.2.1 Color Model  
Segmentation of an image is the process of grouping the pixels of an image based on their color values. With color contrast between objects in an image, an image can be segmented and reduced to isolate pixels in an area of interest. With image segmentation based on the color component values of each pixel, an important first step is the decision of what color model to use.  
A color model is the mathematical representation of a color as a tuple of numbers. The RGB color model is commonly used to define pixel color in photographic images, but is often problematic for use in image analysis. The RGB color space is not a perceptual color space which makes it difficult to perceive how changes in color components (R, G, and B) will alter the hue and brightness of the color. This makes it difficult and imprecise to define a range of R, G, or B based on color, hue, or brightness, that would enable a desired segmentation of an image [13]. Another difficulty that arises for image segmentation when using the RGB color model results because normalized RGB component values are not invariant with changes in lighting or shading [14]. This makes the RGB component values vary unpredictably with fluctuations in brightness across an object's surface from shadows, specular reflections, or changes in illumination due to motion of an object.  
A color model that is more suitable than RGB for use in image analysis is the hue, saturation, and value (HSV) color space. The HSV color space provides a more intuitive method of defining colors that is beneficial for performing image segmentation [14; 15; 16]. As illustrated in Figure 4 [13], the HSV color space can be represented as a cylindrical space with _hue_, _saturation_, and _value_ represented along respective coordinate axes.  
Hue is defined as a \(0-360\) degree value that correlates to an angular position within the cylinder, and represents a color's position within the color spectrum. Hue is helpful in segmenting an image based on color in a way that is invariant to changes in lighting conditions. _Saturation_, represented as a \(0-100\%\) value along the radius of the cylindrical space, defines the vivitness of a color's hue. Desaturation of a color occurs with added white light. Value, which is represented as a \(0-100\%\) value along the height of the cylindrical space, defines the perceived brightness of a hue. Sometimes described as _relative brightness_, value can be used to describe a color in varying lighting conditions. Therefore, segmentation using the value color component can be used to segment objects within an image based on their relative brightness [17]. Although photographic image data is often defined using the RGB color space, it can be converted to the HSV color space by using the following equations [18]:  
\[M = max(R,G,B) \tag{1}\] \[m = min(R,G,B) \tag{2}\]  
\[H = 60^{\circ}*\begin{cases}undefined&\text{if }M=m\\ \frac{G-B}{M-m}mod6&\text{if }M=R\\ \frac{B-R}{M-m}+2&\text{if }M=G\\ \frac{R-G}{M-m}+4&\text{if }M=B\end{cases} \tag{3}\] \[S = \begin{cases}0&\text{if, }M=0\\ \frac{M-m}{M}&\text{, otherwise}\end{cases}\] (4) \[V = M \tag{5}\]  
An image can be segmented based on the hue, saturation, or value component of each pixel. The invariance of hue to lighting conditions makes it a good candidate for color-based image segmentation. Care must be taken, however, to avoid use of hue segmentation in  
Figure 4: Cylindrical HSV color space.  
areas where pixel colors are near the hue singularity condition. Hue singularity occurs with colors that have saturation and value levels near zero (i.e., grayscale colors). In this color region, imperceptible changes in color can produce large fluctuations in hue. Attempts at hue segmentation near the singularity condition will result in arbitrary and inaccurate segmentation [14]. Those regions are better suited for segmenting based on saturation or value. For this research, pixel colors are defined in the HSV color space to segment each image based on relative brightness (i.e., value) and hue.