Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   VisionThread Listener? (http://www.chiefdelphi.com/forums/showthread.php?t=153704)

YairZiv 15-01-2017 14:26

VisionThread Listener?
 
Hello, this year my team and I want to try using vision assistance in our code. We have created an opencv program to find what we're looking for but we don't understand how to use it. When we tried constructing a VisionThread object, the last parameter was a listener of a type that extends VisionPipeline. Where do I find that? Or how do I create one? Thanks in advence. Yair Ziv from team MA 5951.

SamCarlberg 15-01-2017 22:30

Re: VisionThread Listener?
 
The listener is more or less a function that gets called every time the pipeline runs. You can write it as a lambda:

Code:

VisionThread visionThread = new VisionThread(usbCamera, myPipeline, () -> {
        // listener code here
    });

Otherwise you just have a class that implements VisionRunner.Listener. The lambda is good because it makes synchronization easier (see this screensteps page)

YairZiv 16-01-2017 06:03

Re: VisionThread Listener?
 
Quote:

Originally Posted by SamCarlberg (Post 1631685)
The listener is more or less a function that gets called every time the pipeline runs. You can write it as a lambda:

Code:

VisionThread visionThread = new VisionThread(usbCamera, myPipeline, () -> {
        // listener code here
    });

Otherwise you just have a class that implements VisionRunner.Listener. The lambda is good because it makes synchronization easier (see this screensteps page)

This gives me an error saying: "The constructor VisionThread(CameraServer, VisionImplementation(A class I've created that extends VisionPipeline), () -> {}) is not defined.". What am I doing wrong?

YairZiv 16-01-2017 07:04

Re: VisionThread Listener?
 
NVM, found the problem, the problem was not in the listener, it was that CameraServer does not extend VideoSource :(, should have found the solution earlier. Thanks for helping though!


All times are GMT -5. The time now is 21:34.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi