nu.pattern.OpenCV Java Examples

The following examples show how to use nu.pattern.OpenCV. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OpenCVHooks.java    From justtestlah with Apache License 2.0 5 votes vote down vote up
@Override
public void before(Scenario scenario) {
  if (configuration.isOpenCvEnabled()) {
    try {
      // load OpenCV library
      OpenCV.loadShared();
      OpenCV.loadLocally();
      System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
    } catch (ExceptionInInitializerError exception) {
      LOG.error("Error loading OpenCV libraries", exception);
    }
  }
}
 
Example #2
Source File: TemplateMatcherTest.java    From justtestlah with Apache License 2.0 5 votes vote down vote up
/** Initialise mocks and configuration. */
@BeforeAll
public static void init() {
  assumeTrue(javaVersionLessThan12());
  OpenCV.loadShared();
  OpenCV.loadLocally();
  System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
  JustTestLahConfiguration configuration = mock(JustTestLahConfiguration.class);
  when(configuration.isOpenCvEnabled()).thenReturn(true);
  target.setConfiguration(configuration);
}
 
Example #3
Source File: CameraStream.java    From tutorials with MIT License 5 votes vote down vote up
public void start(Stage stage) throws Exception {
    OpenCV.loadShared();
    capture=  new VideoCapture(0); // The number is the ID of the camera
    ImageView imageView = new ImageView();
    HBox hbox = new HBox(imageView);
    Scene scene = new Scene(hbox);
    stage.setScene(scene);
    stage.show();
    new AnimationTimer(){
        @Override
        public void handle(long l) {
            imageView.setImage(getCapture());
        }
    }.start();
}