Calculating within-class and between-class scatter matrices