Image Processing
Image Processing initiates by capturing images. The amount of information contained in the image depends on the quality of images acquired. Therefore, input images to the systems are ensured to be of appropriate standards. The visual detection of fruits implies digital image or digital video processing by intelligent robotic or computer vision systems.
In any field image processing deals with two basic principles that require color and shape. The proposed system includes digital image collection by the pi camera and clicking fruit areas. With some image processing techniques this system extracts some features from an image as described below:
Image Preprocessing Methods
Preprocessing techniques can improve the performance of image processing methods like Image transformation, Segmentation, Feature extraction, and object detection. Image collection is a highly important fundamental step for pre-processing and quality control because further processes need input data.
The collection of images is performed by an optical sensor which is always a video camera that provides a still image. Quality of image is linked with local illumination because it directly affects the visibility and patterns of the image.
Types of Color Spaces
Color is very instinctive and useful. The applications of color spaces in image processing aim to help the process of distinguishing color between distinctive objects with image processing algorithms.
Researchers work and randomly select color spaces for image processing applications. Researchers select appropriate color spaces for the specific application. The most frequently used color spaces are RGB, HSI, Lab, YCbCr, etc.
Color Space Models and their applications
The input image is shown below
RGB (Red, Green, Blue)
The RGB model is called additive the most common color space used in image processing. It consists of three plain channels, R belongs to Red, G belongs to Green and B belongs to Blue which is put together in different ways to generate a wide vector of colors. RGB color space is frequently used in digital images.
However, the high interconnection between these color channels is due to non-linearity, tool support, and mixing of luminance points makes this color channel not a very good choice for digital image processing.
Figure 1. 1 Representation of RGB Color Space
Python code for RGB color space is shown below:
import cv2image = cv2.imread('bg1.jpg')rgb_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)r, g, b = cv2.split(rgb_image)cv2.imwrite('R.jpg',r)
cv2.imwrite('G.jpg',g)
cv2.imwrite('B.jpg',b)
It is also computationally complex. Thus need for other color spaces which can be more ideal in image processing.
HSV/HSI (Hue Saturation Value/ Intensity)
HSV color space is a non-linear intensity component of the RGB color space. There is a difference in the luminance points of the color information that makes it usable in digital image processing. However, because of its non-linearity, it is broadly used in the subject of color vision applications.
HSV color space is consists of three color channels, Hue, Saturation, and Value. H and S represent the color and Value is representing by luminance. It is well-liked in color classification or segmentation because of the precise bias between luminance and color.
Figure 1.2 Representation of HSV Color Space
import cv2image = cv2.imread('bg1.jpg')rgb_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
hsv_image = cv2.cvtColor(rgb_image, cv2.COLOR_RGB2HSV)h, s, v = cv2.split(hsv_image)cv2.imwrite('H.jpg',h)
cv2.imwrite('S.jpg',s)
cv2.imwrite('V.jpg',v)
LAB (Lightness Color Channel)
This color channel consists of three channels, the Lightness channel belongs to L, two-color channels belong to A and B. The range of the L channel starts from 0 and goes to 100, corresponding to a different color from the black/white ratio.
The range of the A channel starts from −128 and goes to +127 which gives the red/green ratio. The range of the B channel is from −128 to +127 which gives the yellow/blue ratio. Fig. 1.3 represents LAB color-space.
Figure 1.3 Representation of LAB Color Space
import cv2image = cv2.imread('bg1.jpg')rgb_image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
lab_image = cv2.cvtColor(rgb_mean, cv2.COLOR_RGB2Lab)L, a, b = cv2.split(lab_image)cv2.imwrite('L.jpg',L)
cv2.imwrite('b_star.jpg',b)
cv2.imwrite('a_star.jpg',a)