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

Use Lanczos interpolation for affine warp #97

Closed
wants to merge 1 commit into from

Conversation

Messier-16
Copy link

@Messier-16 Messier-16 commented Mar 12, 2024

The Bicubic interpolation algorithm is not great for astronomy image subtraction; Lanczos is better. However, scikit does not support this, so I used the OpenCV implementation.

In any case, there should also be an option to pass in an argument to change the interpolation method (even to nearest neighbors instead of bicubic).

The Bicubic interpolation algorithm is not great for astronomy image subtraction; Lanczos is better. However, scikit does not support this, so I used the OpenCV implementation.
@martinberoiz
Copy link
Member

Hello,

Thanks for your PR I am currently out of town for a conference. I will look into it next week.

In the meantime, it seems that your PR introduces a new dependency (OpenCV). While I'm all for adding interpolation options (see #58) I'm very reluctant to introduce new dependencies to the package. Maybe I can consider OpenCV as an optional dependency.

@Messier-16
Copy link
Author

Got it -- let me know what you think once you get to it! I'm not sure that Lanczos is flux-preserving either.

@martinberoiz
Copy link
Member

Hi, I checked up on scikit-image to see if they had a Lanczos option and they don't. But in the warp method, the inverse_map argument accepts a function that does the mapping. This gives enough flexibility to inject there an exact or Lanczos interp. It has the caveat that it will be slower than providing a matrix but I think it's worth a try.

There are several projects on GitHub with implementations of Lanczos interp.

Do you have any reference where I can read more on why bi-cubic is not good for astronomy image subtraction? or why Lanczos is better?

@Messier-16
Copy link
Author

https://pixinsight.com/doc/tools/StarAlignment/StarAlignment.html

This tool might have some insight for that, as they use it. The reason I believe it is because I personally did some empirical testing on my own data and the alignment was better.

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

Successfully merging this pull request may close these issues.

2 participants