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

Add TryGetLinearlySeparableComponents and tests #2224

Merged
merged 7 commits into from
Sep 26, 2022

Conversation

JimBobSquarePants
Copy link
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 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

This is all @Sergio0694 brilliant work from sp/auto-matrix-linear-decomposition. All I've done is copy the code and tests from that branch as it's impossible to merge it following the Git LFS changes.

@Sergio0694
Copy link
Member

Ooh I forgot about this branch, really happy to see it back!
And glad to see that my work with that linear separation method will be useful! 😄

@JimBobSquarePants
Copy link
Member Author

Very useful!!

I'll be incorporating it into the general convolution API I'll be exposing.

@JimBobSquarePants JimBobSquarePants merged commit 0e0c236 into main Sep 26, 2022
@JimBobSquarePants JimBobSquarePants deleted the sp/auto-matrix-linear-decomposition-2 branch September 26, 2022 00:22

for (int x = 1; x < width; x++)
{
if (Math.Abs(ratio - (matrix[y, x] / matrix[0, x])) > 0.0001f)
Copy link
Member

@antonfirsov antonfirsov Sep 26, 2022

Choose a reason for hiding this comment

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

Using a hardcoded epsilon might be problematic in many cases. Personally I prefer to make it a parameter with a default value or at least to work with library-wide constants proven to work well for the given library.

What are ImageSharp use-cases for this feature?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah we should normalise constants. There might be one in Numerics already.

I plan to use this as an underlying optimisation when exposing a general convolution API.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants