GithubHelp home page GithubHelp logo

Comments (2)

jcupitt avatar jcupitt commented on May 28, 2024

Yes, I think this is a bug -- it looks like affine is not calculating the error residual correctly at the start of generate. I'll have a look, and thanks for reporting!

from libvips.

jcupitt avatar jcupitt commented on May 28, 2024

I did some more digging and affine is fine, it's just a rounding problem.

When affine generates the large image, pixel (0, 5) is computed like this:

vips_interpolate_nearest_interpolate: (1, 1) (0, 1): 0 

Where the first coordinate is the sample position as a pair of doubles, and the second is after nearest rounding (ie. floor()). Obviously the second pair must be (1, 1) as well, so this looks bizarre.

If you pause there in a debugger, you see:

344		const VipsPel *restrict p = VIPS_REGION_ADDR(in, xi, yi);
(gdb) p x
$20 = 0.99999999999999989
(gdb) p y
$21 = 1.0000000000000004
(gdb) 

x is just under 1.0, so it becomes 0.

I don't think there's anything we can do about this, nearest interpolation will always be noisy.

from libvips.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.