Comment
Comment by aktiur
More generally, for an image im with shape (width, height, channels) and a square transformation matrix M of shape (channels, channels), you can do :
It will work with affine transformation as well if you add a 1 component to every pixel. It will also work with higher dimensional images if I'm not mistaken.