Skip to content
Advertisement

Images constructed from dataset rotated

I am not very experienced with python plotting. I want to work with YaleB_32x32 dataset (https://github.com/flatironinstitute/online_psp/blob/master/datasets/YaleB_32x32.mat). This is my code :

JavaScript

This is the output. As you can see that images are rotated. Could someone please help me with where am I going wrong?

Advertisement

Answer

You can use rot90 to rotate faces with numpy lib. Use axes=(1, 0) to rotate clockwise:

JavaScript

Edit With @bitastap comment, I realize that reshape operation needs Fortan style order :

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement