image-js / image-js-typescript

Temporary repository to work on the migration of image-js to TypeScript
https://image-js.github.io/image-js-typescript/
MIT License
5 stars 5 forks source link

Implement full affine transform #364

Open opatiny opened 1 year ago

opatiny commented 1 year ago

We want a function that takes in two sets of N points and returns the best 2x3 transformation matrix between them. image image https://nghiaho.com/?p=2208

We need a minimum of 3 points to get the affine transform. The best affine transform can then be found using RANSAC.

targos commented 1 year ago

Shouldn't this issue be in https://github.com/mljs/affine-transform ?

opatiny commented 1 year ago

Oh no.... I got confused again...

Actually they are 2 different things I think: 1) the function that takes only 3 points and returns the matrix -> this should indeed go to affine-transform 2) the function that takes more than 3 points and that returns the best fitting transform (using ransac) -> put that in image-js-ts?

Currently for the partial affine transform, point 2 is made in image-js-ts, but I feel that it would be nearly more intuitive to have the function fitting N points in affine-transform as well. Indeed this function is completely unrelated to images.

This would imply migrating some of the code from image-js-ts to ml-affine-transform, which would then have ml-ransac as a dependency.

Wdyt @targos ?

targos commented 1 year ago

I'd be fine migrating code from image-js to ml-affine-transform, especially since the existing getAffineTransform function over there already takes many points (not just 3).