10 Feb 18:53
Image transforms
In much the same way Basemap can take an image in a Plate Carree map projection (e.g. blue marble) and transform it onto another projection in a non-affine way, I would like to be able to apply a non-affine transformation to an image, only using the proper matplotlib Transform framework. To me, this means that I should not have to pre-compute the projected image before adding it to the axes, instead I should be able to pass the source image and the Transformation stack should take care of transforming (warping) it for me (just like I can with a Path). As far as I can tell, there is no current matplotlib functionality to do this (as I understand it, some backends can cope with affine image transformations, but this has not been plumbed-in in the same style as the Transform of paths and is done in the Image classes themselves). (note: I am aware that there is some code to do affine transforms in certain backends - http://matplotlib.sourceforge.net/examples/api/demo_affine_image.html - which is currently broken [I have a fix for this], but it doesn't fit into the Transform framework at present.) I have code which will do the actual warping for my particular case, and all I need to do is hook it in nicely... I was thinking of adding a method to the Transform class which implements this functionality, psuedo code stubs are included: class Transform: ... def transform_image(self, image): return self.transform_image_affine(self.transform_image_non_affine(image))(Continue reading)
RSS Feed