Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extract tile (output image cropped to destiny points) #4

Open
jcphill opened this issue Aug 4, 2023 · 2 comments
Open

extract tile (output image cropped to destiny points) #4

jcphill opened this issue Aug 4, 2023 · 2 comments

Comments

@jcphill
Copy link

jcphill commented Aug 4, 2023

I would like to extract a rectangular tile from a source image via a projective transformation based on mapping the corners of the tile to points in the source image, i.e., destiny points [[0, 0], [0, h], [w, 0], [w, h]].

The current implementation will return an output image that contains the entire input image with dimensions based on the input image dimensions. What I want is a output image of h rows by w pixels that matches the bounding box of the destiny points.

This behavior is already provided for piecewise affine transformations by the second case of _induceBestObjectiveWidthAndHeight() at https://github.com/Eric-Canas/Homography.js/blob/1200c41d713cc40007b3b71c8ab9b4214d837e84/Homography.js#L706C1-L710

@Xiione
Copy link

Xiione commented Jul 3, 2024

I need this as well!

@Xiione
Copy link

Xiione commented Jul 4, 2024

I made a fork and copied some lines to the behavior for projective and affine transformations. There is some repeated code, but this should make it so that the output is properly cropped. This doesn't affect the behavior of transformHTMLElement, though.
https://github.com/Xiione/Homography.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants