Vision Thread error

visionThread = new VisionThread(server,new Pipeline(), pipeline -> {
if (!pipeline.filterContoursOutput().isEmpty()) {
Rect r = Imgproc.boundingRect(pipeline.filterContoursOutput().get(0));
synchronized (imgLock) {
centerX = r.x + (r.width / 2);
}
}
});

We met an error: The constructor VisionThread(CameraServer, Pipeline, (<no type> pipeline) -> {}) is undefined.
Can you help us with that ? And can you explain the code ?

Make sure your pipeline extends VisionPipeline.

  1. VisionThread needs a VideoSource (like a UsbCamera), not a CameraServer, for the first argument.
  2. Pipeline has to implement VisionPipeline
  3. Don’t copy-paste code you don’t understand and expect it to work. If you have questions about what a piece of code is doing, all you have to do is ask.