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

Null Pointer Exception in PointTrackerKltPyramid #30

Closed
ericbhatti opened this issue Oct 16, 2015 · 1 comment
Closed

Null Pointer Exception in PointTrackerKltPyramid #30

ericbhatti opened this issue Oct 16, 2015 · 1 comment

Comments

@ericbhatti
Copy link

Hey Peter. Great work on this awesome library. I was using the PointTrackerKltPyramid and got a null pointer exception.

I read the source code, and it looks like you missed an initialization in one of the constructors.

          public PointTrackerKltPyramid(KltConfig config,
                              int templateRadius ,
                              PyramidDiscrete<I> pyramid,
                              ImageGradient<I, D> gradient,
                              InterpolateRectangle<I> interpInput,
                              InterpolateRectangle<D> interpDeriv,
                              Class<D> derivType ) {

    this.config = config;
    this.templateRadius = templateRadius;
    this.gradient = gradient;
    this.basePyramid = pyramid;

    KltTracker<I, D> klt = new KltTracker<I, D>(interpInput, interpDeriv,config);
    tracker = new PyramidKltTracker<I, D>(klt);
}

You didn't initialize the derivType member variable. The fixed constructor will be:

          public PointTrackerKltPyramid(KltConfig config,
                              int templateRadius ,
                              PyramidDiscrete<I> pyramid,
                              ImageGradient<I, D> gradient,
                              InterpolateRectangle<I> interpInput,
                              InterpolateRectangle<D> interpDeriv,
                              Class<D> derivType ) {

    this.config = config;
    this.templateRadius = templateRadius;
    this.gradient = gradient;
    this.basePyramid = pyramid;

    //// The added line
    this.derivType = derivType;

    KltTracker<I, D> klt = new KltTracker<I, D>(interpInput, interpDeriv,config);
    tracker = new PyramidKltTracker<I, D>(klt);
}
@lessthanoptimal
Copy link
Owner

You're right. Was a bit surprised that a simple bug was found in code that old. Ended up combining those two constructors. You can now specify null for the detector, but don't expect spawn to work if you do.

83298a9

Thanks!

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

No branches or pull requests

2 participants