Skip to content
Discussion options

You must be logged in to vote

the get_wcs_to_image_transform function produces a matrix which should be invertible, so as a least effort thing you could implement:

def get_image_to_wcs_transform(ax: plt.Axes, image_size: Tuple[int, int]) -> np.ndarray:
    return np.linalg.inv(get_wcs_to_image_transform(ax, image_size))

If you won't have access to the axes (eg if you are reading in the image in a separate script) then you could generate the matrix when you save the image and write the resulting matrix to a file kind of like a world file which is literally just a matrix stored column-major used to georeference images (transform them into some geo coordinate system).
The easiest way to save and load the matrix would be …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by mozman
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #269 on December 11, 2020 05:00.