Added code to calculate moments for feature extraction.