Pomegranate is one of the most important export products of Iran. The appearance of the fruit is main factor in export. One of the most common abnormality in the pomegranate's appearance is sunburn. In this study a fully automatic sorting machine was introduced to separate the sunburned fruits from the healthy ones. Using the proposed sorting machine can reduce the overall price of the product by decreasing number of workers. In order to recognize the defected pomegranates, three different methods were proposed: sunburn detection algorithm, area under envelop of image histogram and variance of envelop of image histogram. Applying the different methods to the sorting machine, it was shown that sunburn detection algorithm with one hundred percent accuracy was the most accurate and area under envelop of image histogram with 0.88 second speed was the fastest method. After sunburn detection the appropriate command will be sent to a servo motor from an Arduino board to separate the sunburned pomegranate. All the algorithms to recognize and separate the defected fruit were written in MATLAB. Keywords: Pomegranate, Sunburned, Sorting machine, Image processing