## 3 Materials and Methods
### Contrast Enhancement of the ROI Using the Fuzzy Stretching Technique
Furthermore, the maximum brightness value (\(I_{max}^{r}\), \(I_{max}^{g}\), \(I_{max}^{b}\)) and minimum brightness value (\(I_{min}^{r}\), \(l_{min}^{g}\), \(l_{min}^{b}\)) are applied to the triangular membership function shown in Figure 4.  
\[I_{mid}^{r}=\frac{I_{max}^{r}+I_{min}^{r}}{2},\ I_{mid}^{g}=\frac{I_{max}^{g}+I _{min}^{g}}{2}\,\ I_{mid}^{b}=\frac{I_{max}^{b}+I_{min}^{b}}{2} \tag{12}\]  
The middle brightness value (\(I_{mid}^{r}\), \(I_{mid}^{g}\), \(I_{mid}^{b}\)) at which the membership degree becomes 1 is determined by applying the maximum brightness value (\(I_{max}^{r}\), \(I_{max}^{g}\), \(I_{max}^{b}\)) and minimum brightness value (\(I_{min}^{r}\), \(I_{min}^{g}\), \(I_{min}^{b}\)) of the membership function shown in Figure 4 to Equation (12). \[ \begin{array}{l}i\textit{f}\Big{(}X^{r}_{m}\leq I^{r}_{min}\Big{)}or(X^{r}_{m} \geq I^{r}_{max})\textit{then }\mu(X^{r})=0\\ \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad if \Big{(}X^{r}_{m}>I^{r}_{mid}\Big{)}\textit{ then }\mu(X^{r})=\frac{I^{r}_{min}-X^{r}_{m}}{I^{r}_{max}-I^{r}_{min}}\\ \quad\quad\quad\quad\quad\quad\quad if\Big{(}X^{r}_{m}<I^{r}_{mid}\Big{)}\textit{ then }\mu(X^{r})=\frac{X^{r}_{min}-I^{r}_{min}}{I^{r}_{mid}-I^{r}_{min}}\\ \quad\quad\quad\quad\quad\quad\quad\quad\quad if\Big{(}X^{r}_{m}=I^{r}_{mid} \Big{)}\textit{ then }\mu(X^{r})=1\\ \quad\quad\quad\quad\quad if\Big{(}X^{g}_{m}\leq I^{g}_{min}\Big{)}\textit{ or }\big{(}X^{g}_{m}\geq I^{g}_{max}\Big{)}\textit{ then }\mu(X^{g})=0\\ \quad\quad\quad\quad\quad\quad\quad\quad\quad if\Big{(}X^{g}_{m}>I^{g}_{mid} \Big{)}\textit{ then }\mu(X^{g})=\frac{I^{g}_{max}-X^{g}_{min}}{I^{g}_{max}-I^{g}_{min}}\\ \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad if\Big{(}X^{g}_{m}<I^{g}_{mid }\Big{)}\textit{ then }\mu(X^{g})=\frac{X^{g}_{min}-I^{g}_{min}}{I^{g}_{mid}-I^{g}_{min}}\\ \quad\quad\quad\quad\quad\quad\quad\quad\quad if\Big{(}X^{g}_{m}=I^{g}_{mid} \Big{)}\textit{ then }\mu(X^{g})=1\\ \quad\quad\quad\quad if\Big{(}X^{b}_{m}\leq I^{b}_{min}\Big{)}\textit{ or }\big{(}X^{b}_{m}\geq I^{b}_{max}\Big{)}\textit{ then }\mu(X^{b})=0\\ \quad\quad\quad\quad\quad\quad\quad if\Big{(}X^{b}_{m}>I^{b}_{mid}\Big{)}\textit{ then }\mu\big{(}X^{b}\big{)}=\frac{I^{b}_{max}-X^{b}_{min}}{I^{g}_{max}-I^{b}_{min}}\\ \quad\quad\quad\quad\quad\quad\quad\quad if\Big{(}X^{b}_{m}<I^{b}_{mid}\Big{)} \textit{ then }\mu\big{(}X^{b}\big{)}=\frac{X^{b}_{m}-I^{b}_{min}}{I^{b}_{mid}-I^{b}_{min}}\\ \quad\quad\quad\quad\quad\quad\quad\quad if\Big{(}X^{b}_{m}=I^{b}_{mid}\Big{)} \textit{ then }\mu\big{(}X^{b}\big{)}=1\\ \end{array}  \tag{13}\]  
In addition, \((I^{r}_{min},I^{r}_{max})\), \((I^{g}_{min},I^{g}_{max})\), and \((I^{b}_{min},I^{b}_{max})\) to be applied to the membership function are determined using Equation (13), and the membership degree is determined using the membership function of each channel (RGB). \[ \begin{array}{l}if\Big{(}I^{r}_{min}<>0\Big{)}cut^{r}=\frac{I^{r}_{min}}{I^{ g}_{max}},\textit{ else }cut^{r}=0.5\\ if\Big{(}I^{g}_{min}<>0\Big{)}cut^{g}=\frac{I^{g}_{max}}{I^{g}_{max}},\textit{ else }cut^{g}=0.5\\ if\Big{(}I^{b}_{min}<>0\Big{)}cut^{b}=\frac{I^{g}_{min}}{I^{g}_{max}},\textit{ else }cut^{b}=0.5\\ \end{array}  \tag{14}\]  
The upper \((\beta)\) and lower \((\alpha)\) limits can be determined by applying the membership degree \(\mu(\mathrm{x})\) obtained from Equation (13) to \(cut^{r},\textit{ }cut^{g},\textit{ }\textit{ and }cut^{b}\) which were determined from Equation (14). The image is stretched by applying each upper limit \((\beta^{r},\ \beta^{g},\ \beta^{b})\) and lower limit \((\alpha^{r},\ \alpha^{g},\ \alpha^{b})\) to Equation (15). The \(X^{r},\ X^{g},\ \text{and}\ X^{b}\) values in Equation (15) represent the previous brightness values, while \(X^{r}_{new},\ X^{g}_{new},\ \text{and}\ X^{b}_{new}\) represent the new brightness values obtained after stretching.