Skip to content
New issue

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

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

Already on GitHub? # to your account

implement warp_affine / warp_perspective #47

Closed
3 tasks done
edgarriba opened this issue Mar 12, 2024 · 4 comments
Closed
3 tasks done

implement warp_affine / warp_perspective #47

edgarriba opened this issue Mar 12, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@edgarriba
Copy link
Member

edgarriba commented Mar 12, 2024

reference:

needs (to abstract / reuse code)

  • grid_sample / map_coordinates
@edgarriba edgarriba added the enhancement New feature or request label Mar 12, 2024
@gau-nernst
Copy link
Contributor

I recently had to implement warp_affine from scratch in Dart to do image transformation in Flutter without OpenCV. I could contribute warp_affine here if you are okay with that. It's probably not gonna be super fast.

grid_sample is not needed. The current bilinear_interpolation() function should be enough.

@edgarriba
Copy link
Member Author

edgarriba commented Mar 28, 2024

feel free to go for it -- about grid_sample, it will basically a way to reuse code. If you see in the resize_native function the ndarray::Zip is basically parallelizing over the destination points. In any case you will have to reimplement that to make it efficient, we don't want regular looping but instead iterators (which is what's happening in that code already.

@gau-nernst
Copy link
Contributor

Interesting. Do you have benchmarks between naive for-loop version and the current version?

Some observations

  • Currently we materialize the whole index array (width x height). This is quite wasteful.
  • There is probably overhead for parallelization (from what I see, ndarray uses rayon https://docs.rs/ndarray/latest/ndarray/parallel/index.html). Perhaps we can parallelize over the rows only instead of all the points to reduce overhead.

In any case, let's get a working implementation first before looking more into the speed.

@edgarriba
Copy link
Member Author

done

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants