Selection of healthy raw ingredient and similarly rejection of defective ones in an automatic and non-destructive way is becoming an essential job in food industry. In this paper, binary classification of raw food ingredients is presented using x-ray images of pistachio nuts. The objective is to develop an in-line defect detection system capable of detection and classification of raw food ingredients without any damage. A method is devised for detection and segmentation of each independent ingredient from the large x-ray image. For quality assessment, six textures properties from the images are calculated on global level, in addition to sixteen features, extracted by calculating the Gray Level Co-occurrence Matrices (GLCMs) at angles of 0, 45, 90 and 135 respectively. Artificial Neural Network (ANN) is used as classifier. Results are calculated using extracted features and presented in terms of accuracy, sensitivity and specificity. Later, Principal Component Analysis (PCA) is used in order to achieve discrimination among features. Results are calculated again using features obtained after PCA. Texture features with PCA out-performed previous outcomes, producing excellent classification results while achieving higher accuracy in comparison to similar approaches.