Skip to content

Use correct Kernel dimensions and optimize. Fix #786 - #789

Merged
JimBobSquarePants merged 2 commits into
masterfrom
js/fix-gaussian
Dec 16, 2018
Merged

JimBobSquarePants merged 2 commits into
masterfrom
js/fix-gaussian

Conversation

@JimBobSquarePants

Copy link
Copy Markdown
Member

Prerequisites

  • I have written a descriptive pull-request title
  • I have verified that there are no overlapping pull-requests open
  • I have verified that I am following matches the existing coding patterns and practice as demonstrated in the repository. These follow strict Stylecop rules 👮.
  • I have provided test coverage for my change (where applicable)

Description

Our current gaussian kernels are too small and fail to capture the full curve leading to boxed output. I've updated the algorithm based on the information found at http://chemaguerra.com/gaussian-filter-radius/ to correct the output.

@antonfirsov antonfirsov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't gone too deep, but looks good at first look.

We should probably add at least one reference-image based test case to ensure correctness, with a reference image generated by CSS.

@JimBobSquarePants

Copy link
Copy Markdown
Member Author

We should probably add at least one reference-image based test case to ensure correctness, with a reference image generated by CSS.

@antonfirsov I would but CSS blur over-samples past the edge of the image so we can't compare.

Additionally we use a constrained kernel when sampling, capturing 97% of the Gaussian integral but ignoring changes generally invisible to the human eye when compared to an infinite kernel.

@codecov

codecov Bot commented Dec 13, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #789 into master will decrease coverage by 0.03%.
The diff coverage is 95.83%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #789      +/-   ##
==========================================
- Coverage    88.7%   88.66%   -0.04%     
==========================================
  Files        1012     1012              
  Lines       43248    43222      -26     
  Branches     3127     3120       -7     
==========================================
- Hits        38363    38324      -39     
+ Misses       4181     4160      -21     
- Partials      704      738      +34
Impacted Files Coverage Δ
...cessing/Processors/Convolution/BoxBlurProcessor.cs 100% <100%> (ø) ⬆️
src/ImageSharp/Primitives/DenseMatrix{T}.cs 86.53% <100%> (+14.79%) ⬆️
...ts/ImageSharp.Tests/Primitives/DenseMatrixTests.cs 100% <100%> (ø) ⬆️
...ng/Processors/Convolution/GaussianBlurProcessor.cs 92.59% <88.88%> (+19.25%) ⬆️
...Processors/Convolution/GaussianSharpenProcessor.cs 93.93% <92.85%> (+14.62%) ⬆️
...xelFormats/PixelOperations{TPixel}.PixelBenders.cs 89.34% <0%> (-9.84%) ⬇️
...Processing/Processors/Transforms/TransformUtils.cs 88.29% <0%> (-5.32%) ⬇️
src/ImageSharp/Common/Helpers/ImageMaths.cs 82.05% <0%> (-5.13%) ⬇️
.../Processing/Processors/Transforms/CropProcessor.cs 96% <0%> (-4%) ⬇️
...ocessing/Processors/Dithering/ErrorDiffuserBase.cs 93.75% <0%> (-3.13%) ⬇️
... and 20 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 590609a...d7a4688. Read the comment docs.

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