On Wed, Apr 5, 2017, at 19:02, Serge Shakhov wrote:
 Just want to clarify. Am I right that your solution isn't applicable to PiecewiseAffineTransform at all?
Do you think it may be possible to find a workaround?

Sorry, I should have been clearer.  With "defined" I meant implemented.

To invert a piecewise affine transform, you'll have to use SciPy KD-tree to find the nearest quad coordinates, and then invert the matching affine.  This is not necessarily hard, but it's not trivial to implement.

Stéfan