All over the world, the population depends on agriculture. Research in agriculture aims to increase the quality and quantity but pests decrease the quality. To stop the effect of these pests, Pesticides are used. But the excessive use of pesticides is very harmful to the environment. So the early pest detection is necessary. Pest detection is to get the information and location of the pest and this can be done only temperature controlled room like in the greenhouse. The project proposes pest detection by using the image processing system at early stage to optimize the use of pesticides. To detect these pests, images are captured by camera in real time. An algorithm is developed for detection and classification of pest. Proposed system provides a simple, efficient and fast solution in detecting pests.