# Thermogram Breast Cancer Detection: A Comparative Study of Two Machine Learning Techniques
## 4 The Proposed Method
### Image Preprocessing Stage
#### 4.1.1 Noise Reduction  
The noise reduction process is achieve using a homomorphic filtering technique. This technique is applied to (1) remove multiplicative noise and (2) to improve the appearance intensity range illumination. As demonstrated in Algorithm 1, the homomorphic filtering firstly applies linear techniques to map the input image to a different domain and then mapping back the output to the original image domain. Also, it involves morphological operations to delete any noise and smooth the image's edges [22]. The results of applying this technique and morphological operations are shown in Figure 4.  
```
1: Read original thermal image, img
2: The image \(img(v,w)\) is first converted into logarithm domain using the following equation: \[ln(img(v,w))=ln(j(v,w))+ln(f(v,w))\]
3: The output image is filtered by high-pass filter using Fast Fourier Transformation (FFT) using the following equation \[F(y,z)=F(ln(l(v,w)))+F(ln(f(v,w)))\] where reflectance (f) and illumination (l) components. 4: The output image is filtered again using transfer function of frequency domain filter using the following equation: \[H(y,z)=(f_{H}-f_{L})[1-exp(p(B/B_{0}^{2})]\] where \(r_{H}>1\) and \(r_{L}<1\) are the regulation parameter to change high frequency and low frequency respectively, \(D\) is balance parameter and \(D_{0}\) is harmonic coefficient. 5: Inverse FFT is applied on the output of frequency domain filter as given in this equation: \[\hat{H}(v,w)=invF(H(y,z))\]
6: Exponential is applied to the output of inverse FFT using this equation: \[G(v,w)=exp(\hat{H}(v,w))\]

**Algorithm 1** A homomorphic filtering technique

Figure 4: homomorphic filtering result on thermographic images: (**a**) input image (normal) (**b**) input image (benign) (**c**) input image (malignant) (**d**) homomorphic filtering on normal image (**e**) homomorphic filtering on benign image (**f**) homomorphic filtering on malignant image. #### 4.1.2 Image Enhancement

The enhancement process was achieved using Algorithm 2 which is designed based on the ideas in [22]. ```
1: Read thermal image, G(v,w)
2: Tophat transform is applied to \(G(v,w)\) to separate the objects. Let toph1 is the output where the size and shape of the structuring element are selected based on the size and shape of the masses. 3: Dilation operator is to gradually enlarge the regions boundaries of foreground pixels to smooth the borders of the tophat transformed image. Let toph2 is the output
4: Bot-hat transform is used to smooth the objects in the image [22]. Let toph3 is the output
5: This image is combined using Image arithmetic addition and subtraction as shown in Figure 5. \[Enhanced=(G(v,w)+toph2)-(toph3)\]
6: Adaptive histogram equalization (AHE) technique is then used to improve the contrast of images produced in Step 5. ```

**Algorithm 2** The enhancement process

AHE executed in Step 5 computes several histograms of an image. Each of them corresponding to a distinct section of the image, and it then uses these histograms to redistribute the lightness values of the image. Thus, it enhances the edges' definitions for each region of an image. The results of this algorithm are summarized in Figure 6.

### Segmentation Stage

The segmentation stage consists of three main steps which are based on the ideas in [22]: applying K-means clustering to extract the ROI, followed by binary morphology to remove small hybrids details and finally applying morphological gradient to remove the constant intensity areas and enhance edges. We summarize these stages as follows:

\[ln(img(v,w))=ln(j(v,w))+ln(f(v,w))\]0 Top-hat Transform Technique: (**a**) homomorphic filtering on normal image (**b**) white top-hat on normal image (**c**) black top-hat on normal image (**d**) homomorphic filtering on benign image (**e**) white top-hat on benign image (**f**) black top-hat on benign image (**g**) homomorphic filtering on malignant image (**h**) white top-hat on malignant image (**i**) black top-hat on malignant image.