-
Notifications
You must be signed in to change notification settings - Fork 19
Seperable Convolution with Asymmetric Kernels + Fast Gauss #46
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
Conversation
|
Do we want to move the classes for separable (symmetric) convolution to |
f190097 to
a2b3399
Compare
|
I think this PR is ready to be merged and I need it to implement features for pixel classification. |
a2b3399 to
c2718c2
Compare
This makes ClassCopyProvider available.
43b47b5 to
574e43e
Compare
| * <p> | ||
| * The result is a good approximation to "real" gauss. But the | ||
| * same holds for {@link net.imglib2.algorithm.gauss3.Gauss3}. | ||
| * Which one is better is not known so far. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is not very helpful IMO. Would be better to state what the difference in approximation is.
I.e. Gauss3 does a (non-approximated) convolution with a Gaussian kernel truncated at 3*sigma+1.
What is the approximation here?
Also, you should add a reference to the paper that is implemented here.
| final double[][] halfkernels = halfkernels( sigma ); | ||
| final ExecutorService service = Executors.newFixedThreadPool( numThreads ); | ||
| SeparableSymmetricConvolution.convolve( halfkernels, source, target, service ); | ||
| SeparableKernelConvolution.convolve( Kernel1D.symmetric( halfkernels ), source, target ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not use the provided ExecutorService
| { | ||
| final double[][] halfkernels = halfkernels( sigma ); | ||
| SeparableSymmetricConvolution.convolve( halfkernels, source, target, service ); | ||
| SeparableKernelConvolution.convolve( Kernel1D.symmetric( halfkernels ), source, target ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does not use the provided ExecutorService
| /** | ||
| * Return an object, that performs the separable convolution with the give kernel. | ||
| * It additional allows to set the {@link java.util.concurrent.ExecutorService} to use | ||
| * or to query for the required input image size, ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typos: "give" --> "given"
"additional" --> "additionally"
It's faster than the older one and allows asymmetric kernels.
It's functionality is replaced by SeparableKernelConvolution.
It is an approximate algorithm to calculate Gaussian blur. But way faster for sigma greater than 3.
574e43e to
64429bb
Compare
|
@maarzt Could you please fix, what I have commented on so far? |
|
@tpietzsch I made all the changes you required. And finally I cited the paper describing the fast gauss algorithm that is implemented. |
|
@maarzt Did you push your changes? |
* Use fork( 1 ) to avoid potential dependency of results on execution order. * Longer warmup for GaussBenchmark.
This makes it clear that benchmarkSeparableKernelConvolution() is using the same number of threads as benchmarkSeparableSymmetricConvolution().
Also brings a slight speed up
The tests are no longer needed, because they test the same functionality as ConvolverTest.
…e except DoubleType This is required for higher precision when blurring for example ByteType images.
|
@tpietzsch I did the changes you asked for:
|
|
Great, thanks! |
Separable asymmetric kernels are used in image processing.
One example: The derivative of a gauss kernel is a separable, asymmetric kernel, and is used to calculate exact derivatives of an gaussian blurred image.
This PR deprecates the current separable symmetric convolution algorithm. And adds generalized algorithm for separable convolution. The new algorithm has been benchmarked against the current implementation an proved to be just as fast.
Gauss3 is changed to use the new implementation.