Giter Club home page Giter Club logo

Comments (6)

saudet avatar saudet commented on August 24, 2024

Right, that seems to be a bug in OpenCV... I guess we'll have to create a patch for that. Would you be able to look into this? Thanks!

from javacpp-presets.

eix128 avatar eix128 commented on August 24, 2024

why not.Yes i can test

from javacpp-presets.

jpsacha avatar jpsacha commented on August 24, 2024

@saudet Why do you think it is a bug in OpenCV?

I did a little experiment. The linker complains about

cv::DetectionBasedTracker::Parameters::Parameters(void)

I when to the downloaded header detection_based_tracker.hpp and commented out constructor in struct Parameters that was a potential problem:

        struct Parameters
        {
            int maxTrackLifetime;
            int minDetectionPeriod; 
//            Parameters();
        };

Then I run clean and install -projects .,opencv. Now the build completed without errors (not counting some eror character in in comments in persistance.hpp that I corrected too).
The thing that I do not understand is that in both cases (with and without Parameters(); commented) the generated wrapper code was almost the same. Not counting different comment and order of declarations the class for Parameters was almost identical. Original:

        @NoOffset public static class Parameters extends Pointer {
            static { Loader.load(); }
            public Parameters(Pointer p) { super(p); }
            public Parameters(int size) { allocateArray(size); }
            private native void allocateArray(int size);
            @Override public Parameters position(int position) {
                return (Parameters)super.position(position);
            }

            public native int maxTrackLifetime(); public native Parameters maxTrackLifetime(int maxTrackLifetime);
            public native int minDetectionPeriod(); public native Parameters minDetectionPeriod(int minDetectionPeriod); //the minimal time between run of the big object detector (on the whole frame) in ms (1000 mean 1 sec), default=0

            public Parameters() { allocate(); }
            private native void allocate();
        }

and with Parameters(); commented (order of declarations rearranged to match above):

        public static class Parameters extends Pointer {
            static { Loader.load(); }
            public Parameters(Pointer p) { super(p); }
            public Parameters(int size) { allocateArray(size); }
            private native void allocateArray(int size);
            @Override public Parameters position(int position) {
                return (Parameters)super.position(position);
            }

            public native int maxTrackLifetime(); public native Parameters maxTrackLifetime(int maxTrackLifetime);
            public native int minDetectionPeriod(); public native Parameters minDetectionPeriod(int minDetectionPeriod); //the minimal time between run of the big object detector (on the whole frame) in ms (1000 mean 1 sec), default=0

            public Parameters() { allocate(); }
            private native void allocate();
//            Parameters();
        }

The only difference is @NoOffset annotation (no idea what that actually does).

Can we just fix the issue by commenting out Parameters(); in detection_based_tracker.hpp? When pre-build binaries are used this should have no impact at run-time.

@jduke32 Can you check out if commenting out Parameters(); works for you?

from javacpp-presets.

saudet avatar saudet commented on August 24, 2024

@jpsacha Thanks for starting to look into this! It's a bug in OpenCV because it doesn't give us access to the cv::DetectionBasedTracker::Parameters::Parameters() constructor defined in the .cpp file. Maybe we have to put CV_EXPORT on the nested class as well? I'm not sure what MSVC expects, but something like that is what needs to be adjusted.

from javacpp-presets.

jpsacha avatar jpsacha commented on August 24, 2024

I create PR that adds building OpenCV binaries from source on Windows, as it is done on other platforms. Before the build two patches are applied to correct issues that were breaking creation of wrappers. One reported earlier, and one more found later. You will need to install Visual Studio 2013 (community edition works) and Windows version of CMake to generate Visual Studio project correctly.

Works fine for me, tested with some sample code from the Cookbook Examples.

from javacpp-presets.

saudet avatar saudet commented on August 24, 2024

Fix included in version 1.0. Thanks @jpsacha for the fix and the build!! 👍

from javacpp-presets.

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.