-
Notifications
You must be signed in to change notification settings - Fork 17
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
Lanczos resampling #38
Comments
I think the suggested approach C. is the best one. Making it even slightly more general would be even better: data Lanczos (n :: Nat) = Lanczos
instance (KnownNat n, 1 <= n) => Interpolation (Lanczos n) where Later it would be possible to simplify it for users a bit with type Lanczos2 = Lanczos 2
pattern Lanczos2 :: Lanczos2
pattern Lanczos2 = Lanczos
type Lanczos3 = Lanczos 3
pattern Lanczos3 :: Lanczos3
pattern Lanczos3 = Lanczos
type Lanczos4 = Lanczos 4
pattern Lanczos4 :: Lanczos4
pattern Lanczos4 = Lanczos |
Regardless of the approach if at least one of those is implemented (eg. |
Great idea! Does it require a collection like |
I guess it all depends on the implementation. Try getting the one you suggested first instance Interpolation (Lanczos 3) where and then I can recommend a proper way going forward from there. |
OK, I challenge it. |
If you're thinking of adding any other algorithms, there's a selection of filters here, with some key details about their implementation. : https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/corefilters/resize.html It might also help or hinder the the understanding of what a bicubic filter really is :P |
Description
I thought "Bicubic" which is used in raster graphic editors like Photoshop, GIMP and so on used "Bicubic interpolation", but, I hear that they really use Lanczos filter or Mitchell-Netravali filter (This so confused me!:confused:).
I want to downsize images so need Lanczos filter and plan to implement it. Lanczos filter takes a positive integer value as the size of the kernel. I have three suggestions about implementation.
Implementation
A. Let ADT have the kernel size
Define such that:
This way is simple but needs to allocate memory by dynamic way, so it maybe causes slow.
B. Let the name of ADT have kernel size
This way is simple too, but not cool. To take into account that it can use several kernel sizes only, this selection may be good. And it require implementation each data type, so not need dynamic memory allocation.
C. Use type level number
Black magic:
The way of implementation is same as B, but looks cooler. It requires type annotation to use:
D. Implement only Lanczos-3
It's a possibly.
The text was updated successfully, but these errors were encountered: