# A Novel Logo Identification Technique for Logo-Based Phishing Detection in Cyber-Physical Systems
## 5 Proposed Work
The _Training Phase_ begins with extraction of the logo from the website and then it is converted to Hue, Saturation and Value (HSV) format. In the next step, the hue value centroid position and pixel ratio is calculated for each distinct hue value. Now, the nearest hue values are clustered to approximate the analysis of presence of different colors in the logo. For each hue cluster, the hue density distribution is computed by obtaining the pixel compactness with respect to the relative distance from the hue centroid. Finally, the dataset is prepared from the retrieved image features, and ML algorithms are applied on it to train the model for detecting phishing logos. In the _Detection Phase_, the logo is extracted from the provided web-page or email. The logo image is then pre-processed as provided in the training phase to obtain hue-based information from the image. Then, an ML algorithm is used to find the best match. On obtaining a best match, it is detected as a phishing logo. Hue refers only to the pure spectrum color names found on the color wheel: red, orange, yellow, green, blue and violet [33]. The hue value representation uses a range of 0-360 integer value to represent the original pigmentation of a pixel as shown in Figure 6. A single integer representation of a color empowers us to extract and use other associated features of the logo image for efficient detection. Once an image \(I\) is transformed to its equivalent hue, saturation and value (HSV) format, say \(I_{\text{hse}}\), the list of distinct hue values \(HL_{I_{\text{hse}}}\) present in the image is obtained. For each hue value \(h_{i}\) in the \(HL_{I_{\text{hse}}}\), the pixel ratio and the centroid position of all the pixels sharing the hue value \(h_{i}\) is computed. Figure 5: Flow diagram of the proposed approach. **Definition 1**. : _The **pixel ratio** of a hue value \(h\) is defined as the ratio of the number of pixels having hue value \(h\) in the image \(I_{\text{hsv}}\) and the total number of pixels in the image \(I_{\text{hsv}}\)_  
**Definition 2**. : _If \(p_{1},p_{2},\dots,p_{m}\) are the \(m\) number of pixels having same hue value \(h\) in an image \(I_{\text{hsv}}\), then the centroid of \(h\) is given by \(\left(C_{x}^{h},C_{y}^{h}\right)\), where_  
\[C_{x}^{h} = \frac{x_{p_{1}}+x_{p_{2}}+\dots+x_{p_{m}}}{m},\text{ and}\] \[C_{y}^{h} = \frac{y_{p_{1}}+y_{p_{2}}+\dots+y_{p_{m}}}{m} \tag{1}\]  
In the next step, the relative Euclidean distance of each pixel \(p_{i}\) is calculated from its hue centroid. **Definition 3**. : _The relative Euclidean distance between a pixel \(p\) and the centroid, \(C^{h}\) is defined as the ratio of the Euclidean distance between \(p\) and \(C^{h}\) and length of the side of the image that incident of the \(line(p,C^{h})\) with the smallest angle._  
It is clear from the Definition 3 that the relative distance ranges between \(0\) and \(1\). The reason behind using relative distance is that the proposed mechanism considered logos with different dimensions. The images are not transformed to the equivalent image of a given size to preserve the ratio of color and their shape in the original logo. The relative distance of a pixel from its hue centroid represents the relative position of the pixel in an image irrespective of its dimension. Therefore, our proposed mechanism has the ability to extract this unique feature from logo images of different size. Since the relative distance of any pixel from its hue centroid ranges between \(0\) and \(1\), we created approximately \(10\) groups of relative distance \(\{0.1,0.2,\dots,0.9,1.0\}\) to maintain the count number of pixels in each group. The count of pixels in each group reflects the positional distribution of the pixels for a given hue value.