ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 21 Mar 2018 14:16:31 +0100Inverse image transformhttps://ask.sagemath.org/question/41646/inverse-image-transform/ Does Sage have an inverse image transform?
By that, I mean is there a function where, given an image $X$, and function $f$, it generates an image $Y$, such that pixel $p$ of $Y$ is assigned the color of $f(p) \in X$?
Note that for convenience, you can also say what rectangle the input and output image represent. (I.e. you could say that pixels in $Y$ correspond to points in $[-1,1] \times [-1,1]$.
For reference, here is mathematica's version is called `ImageTransformation`.Mon, 19 Mar 2018 19:50:10 +0100https://ask.sagemath.org/question/41646/inverse-image-transform/Answer by slelievre for <p>Does Sage have an inverse image transform?</p>
<p>By that, I mean is there a function where, given an image $X$, and function $f$, it generates an image $Y$, such that pixel $p$ of $Y$ is assigned the color of $f(p) \in X$?</p>
<p>Note that for convenience, you can also say what rectangle the input and output image represent. (I.e. you could say that pixels in $Y$ correspond to points in $[-1,1] \times [-1,1]$.</p>
<p>For reference, here is mathematica's version is called <code>ImageTransformation</code>.</p>
https://ask.sagemath.org/question/41646/inverse-image-transform/?answer=41678#post-id-41678The Python Image Library is shipped by Sage in the form of the PIL package.
Then your question becomes how to do image transformation with PIL.
A quick web search:
- [https://duckduckgo.com/?q=mathematica+ImageTransformation+python](https://duckduckgo.com/?q=mathematica+ImageTransformation+python)
reveals
- [https://stackoverflow.com/questions/17056209/python-pil-affine-transformation](https://stackoverflow.com/questions/17056209/python-pil-affine-transformation)
where there is a link to:
- [https://stackoverflow.com/questions/7501009/affine-transform-in-pil-python](https://stackoverflow.com/questions/7501009/affine-transform-in-pil-python)
Using certain functions in PIL might require the presence of a jpeg library
in your system, otherwise you might get error messages such as "decoder jpeg
not available". See
- [https://stackoverflow.com/questions/8915296/python-image-library-fails-with-message-decoder-jpeg-not-available-pil](https://stackoverflow.com/questions/8915296/python-image-library-fails-with-message-decoder-jpeg-not-available-pil)Wed, 21 Mar 2018 14:16:31 +0100https://ask.sagemath.org/question/41646/inverse-image-transform/?answer=41678#post-id-41678