A segmentation process was applied to separate the part of interest (the true image of a
banana) from the background. This process is critical in image processing and it is done to
eliminate the influence of the background pixel information on the RGB value of the banana.
The threshold value used was obtained from a histogram of the gray-scale image (Fig.2),
which is the conversion image of the original image of the banana. Morphological dilation
was performed to remove background noise, and this was followed by a mask operation to get
back the original colour of the segmented image resulting in a binary image and finally the
true image of the bananas (Fig.3). The RGB values were then extracted from the image and
converted to hue value using the following transformation: