The whitefly is a small white insect which feeds from the sap of different variety of plants and causes wide spread destruction. It is one of the most harmful pests for crops like tomato, cabbage, broccoli etc. The small size of the pest, which is around 2mm in length, poses a great challenge to detect these pests using image processing technique in the presence of noise, which could be in the forms of leaf veins, trichomes, water droplets and dust etc. Early detection of pests is required to reduce or prevent the damage caused by the white-flies. It is also important to count the number of pests as accurately as possible, because based on the number of pests the amount of pesticide can be determined or appropriate advice can be given to the persons concerned. Manual counting of white-flies is very tedious and error prone if the number of pests is very high. We can do the counting satisfactorily by using efficient image processing methods. In this paper a method is proposed to detect and count the number of white-flies using image processing on Simulink and Matlab software.