change img to numpy matrix