Ayurvedic Herb Detection using Image Processing

Trees are an inseparable part of our ecosystem and the reducing number of herb varieties is a serious problem. To conserve herbs, their immediate identification by botanists is a must, thus a tool is needed which could identify herbs using easily accessible details. There is a growing scientific consensus that plant shelters have been altered and species are dying at rates never seen before. The biodiversity problem is not just about the problematic state of herbs species but also of the specialists who know them. This initially requires data about various plant species, so that they could be foreseen, protected and can be used for next generation. Plants form the basis of Ayurveda and today's Modern-day medicine are a great source of income. Due to cutting of forests and Pollution, lot of medicinal herb leaves have almost become extinct. So, there is an immediate need for us to identify them and replant them for the use of next generations. Leaf Identification by physical means often leads to incorrect identification. Due to increasing illegal transaction and incorrect practices in the nascent drug industry on one hand and lack of enough professionals on the other hand, a self-automated and robust identification and classification mechanism is needed to manage the huge amount of data and to end the malpractices. This paper aims at implementing such system using image processing with images of the plant leaves as a basis of classification. System returns the closest match to the query. The proposed algorithm is implemented on 5 different plant species.

The leaf of the plant is a very important aspect when it comes to its identification. A plant is affected by many factors like is environment, the ph. balance of the soil, depending on the season the plants of the leaves either sprout or shed. There have been rampant advances in the field of image processing. This system consists of a camera which captures the image of the leaf and processes it in order to generate a textual report detailing the uses and availability of the plant. Ayurvedic herb detection using image processing, like in [4]. One drawback in [4] is that the image which is given as an input must be in a proper orientation. If the orientation of the image is changed the result may get affected. The method proposed by this paper is immune to change in the orientation of the image when giving it as an input. Many systems available are not real time and there is need of lot of pre-processing before feeding the input image to the system. As in [2,4,10] instead of photographed image, a digitally scanned image is required. Some system requires sheet of white paper before leaf being photographed [8]. These systems have big loophole as they require white background. Many systems used SVM classifier [3,7,9] with PNN neural network [3,9] added to PCA variance reduction technique [3,9]. For extraction of high frequency components of leaf images, Fourier transform can be used [1]. Gaussian blurring is better for higher level of noises the median blur [8]. Android app can build using texture extraction algorithm known as Grey level Co-occurrence matrix (GLCM) [5]. This paper also proposes a presence of GUI in the form of a web application. The web application would enable the user to have an administrator access to edit update different images of leaves. The presence of an efficient leaf image detection algorithm is essential for generation of accurate results.

II.
SYSTEM METHODOLOGY A. Captured Image: This system restrains the user to use the leaf image taken from Smartphone and show it to the system. Others digital means of taking image of plant can be considered provided that the image is to be shown to the system webcam through the Smartphone or tablets. The proposed system works fine for any orientation, contrast and brightness of the leaf image.
B. RGB to Gray: Coloured leaf image of ayurvedic plant is obtained and RGB image is converted into Gray scale. Obtained gray scale image is converted into binary using appropriate level of thresholding.

C. Perspective Transform:
End user shows the plant leaf image and system will capture the leaf image with the background along with curves of the Smartphone. It will be necessity to extract only the leaf image frame from the rest. For that purpose, perspective transform is an important task. Perspective transform can be performed using two functions as below: The function warp Perspective transforms the source image using the specified matrix: when the flag WARP_INVERSE_MAP is set. Otherwise, the transformation is first inverted with invert() and then put in the formula above instead of M . The function cannot operate in-place.

D. Smoothing:
On the successful extraction of the leaf image inside the frame. It is now the best time to apply smoothing for removing the noise from the image. For this purpose, you can use guassian blurring. It is used for removing the high frequency content from the image. It is highly effective for removing the guassian noise from the image. In one-dimension guassian function is defined as: When working with images we simply require using twodimension guassian function. This is simply the product of two one-dimension guassian function and is defined as: E. Dataset: Every system needs some precise and concise dataset that will perform the required function with increasing the system complexity. For experimentation purpose a dummy dataset is created of 40 leaf as no standard dataset available for ayurvedic herbs. To increase accuracy, we have taken the image of same plant from various angle. The resolution of the image is 640 by 420 pixels.

Width of leaf:
Itis defined as the distance between the starting and ending point on the minor axis of the leaf contour.

Diameter:
The farthest distance between any two points reside inside the leaf.

Leaf area:
Leaf area is calculated as counting the number of pixels having binary value 1 inside the leaf margin.

Leaf perimeter:
The number of pixels covering leaf margin is termed as leaf perimeter.

Aspect ratio:
It is defined as Length of leaf to the Width.

Arc Length:
It is defined by the integral given below: The bounds of this integral depend on how you define the curve. If the curve is the graph of a function y = f(x), replace the dy term in the integral with f'(x)dx, prime, then factor out the dx.

Rectangularity:
It is defined as the similarity between leaf and the rectangle. It is defined as:

Median:
It is the middle value of the of data distribution arranged in any order. Where M and N are the dimension of the image.P(ij) is the values of the colour on column i and row j. In the implementation the difference between green mean and red mean, difference between green mean and blue mean, difference between green standard deviation and red standard deviation, difference between green standard deviation and blue standard deviation, skewness and kurtosis of the three colour planes are used as parameters in the implementation of the software.

Discrete fourier transform:
c. Texture Features 1. Entropy: Entropy measures the disorder of an image and it achieves its largest value when all elements in P matrix are equal.

Contrast:
Contrast feature is a measure of the image contrast or the amount of local variations present in an image.

Angular Second Moment:
Energy, also called Angular Second Moment and Uniformity is a measure of textural Uniformity of an image. Energy reaches its highest value when grey level distribution has either a constant or a periodic form.
G. Matching: System will try to compare the extracted leaf image threshold with the image threshold calculated for the dataset image. It will find the closest possible match in the dataset. If threshold is less than dataset threshold then no match output is shown to user. In case of match is found appropriate plant, description will be shown.

H. Plant Details:
This is output phase where the plant name along with plant description is shown.

III. IMPLEMENTED ALGORITHM
The main aim of the system is to find the plant from the leaf fed to the system. Proper care should be taken by the end user to improve the accuracy. This system will highly dependent on the brightness, contrast of the background where the software is used.
The care is taken as much as possible to minimise the effect of external factor on the system. But there is some restriction for the end user also. For proper identification the user must feed an image of 640 * 480 resolution pixel image in a proper jpg extension. The contour, guassian blur, perspective transform and then canny's edge detection is used to get the output. Contour is used to make the background black and object white. For better accuracy guassian blurring technique is used for the removal of the noise. Perspective transform is beneficial for reducing the effect of rotation and orientation. Canny's edge detection will connect all the edges of the curve and to capture the edge of the leaf.

IV.
RESULT AND EXPERIMENTATION The outcome of our system is a web page consisting of plant name with its description. It is a real time system. A user can easily get the details of the leaf by showing the image of the leaf in a square frame. If the image matches with the image in the data set, then it redirects the user to a web page consisting of the details of the plant. There are four windows open in front of user when it starts the system. 1st one is main frame which is showing the image captured by the webcam. Its only purpose is to capture the leaf image without filtering. 2nd frame is of matching operation which will try to compare the captured image with image in the data set. It will extract the leaf image shape from the rest of the shape. 3rd frame is corrected perspective which will show the output of the compared image from the dataset. If dataset has the image, then it redirects the user to the desired web page. If not, the it will try to compare unless and until user will close the system. 4th frame of contour will show the shape of filtered curve from the rest of the curves. The final output will be shown on the web browser.
View of the display of the result V.
CONCLUSIONS AND FUTURE WORK This system introduces a statistical method for plant leaf identification. Proposed method is verified for a database of 4 plants. This system proposes identification of selected medicinal plant leaves from a stored data base of the leaves by processing an image of their leaves. The shape colour features of the leaves are used for the purpose of identification of leaf varieties. Such automated classification mechanisms can be useful for efficient classification of plant leaf species. The accuracy of the current method was found to be competitive.
Future work would involve, combining venation and texture features to the present shape colour features to improve recognition accuracy. One major drawback of the implementation is that the client and server is on the same machine. We will be intended to use a dedicated server which will run round the clock. So, Future work can be directed in that way to make the implementation more efficient. The implementation is a little bit computationally expensive. Further optimization of the logic can result in better implementation.