WPIRoboticsProjects/opencv-installer

Name: opencv-installer

Owner: WPIRoboticsProjects

Description: Simple application to install OpenCV

Created: 2016-09-10 20:42:29.0

Updated: 2018-02-18 16:26:20.0

Pushed: 2018-02-24 19:06:35.0

Homepage: null

Size: 88

Language: Java

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

opencv-installer

Simple application to install OpenCV.

This assumes that the OpenCV artifacts are located in the FRC maven repository at http://first.wpi.edu/FRC/roborio/maven/development or in the local maven repository.

(Artifacts for this project are also available in the above repository)

Link to the maven repo

For now, this is just a CLI app with no GUI.

Supported platforms

This currently supports

Windows notes

Artifacts are installed by default in C:\Users\<user>\OpenCV\. You will need to add the install locations to the PATH environment variable.

Linux notes

JNI and native bindings will be installed in /usr/local/lib and the headers will be installed in /usr/local/include. If you don't have write access to these folders, you can run the installer with

sudo java -Duser.home=$HOME -jar ...

Make sure that /usr/local/lib is on LD_LIBRARY_PATH or the JNI bindings won't be loaded by the JVM.

OS X notes

Similar to Linux, but you probably won't need to use sudo.

Command line arguments

Short name | Long name | Description | Argument —|—|—|— | h | help | Prints the help text | | v | version | Sets the OpenCV version | The version in the format x.x.x e.g. 3.1.0 | j | java | Flags the Java API for install. This does not install JNI bindings | Install location (optional) | i | jni | Flags the JNI bindings for install | Install location (optional) | s | headers | Flags the C++ headers for install | Install location (optional) | n | natives | Flags the C++ native libraries for install | Install location (optional) | a | all | Installs all OpenCV artifacts | o | overwrite | Overwrite already installed files | p | platform | Download artifacts for a specific platform. They will be located in ./install | The platform to download artifacts for

Options for platform
ows-x86
ows-x86_64
x86_64
x-x86
x-x86_64
x-arm
x-armhf
Usage
 -jar opencv-installer --version <version> --platform <platform> --java <location> --jni <location> --headers <location> --natives <location> --overwrite
Using the installer in Gradle build scripts
dscript {
positories {
maven {
  url 'https://github.com/WPIRoboticsProjects/opencv-maven/raw/mvn-repo'
}

pendencies {
classpath group: 'edu.wpi.first.wpilib.opencv', name: 'opencv-installer', version: '+'



rt edu.wpi.first.wpilib.opencv.installer.Installer
rt edu.wpi.first.wpilib.opencv.installer.PlatformDetector

openCvPlatform = PlatformDetector.getPlatform()
openCvVersion = '3.1.0'

ndencies {
mpile group: 'org.opencv', name: 'opencv-java', version: openCvVersion
.


 installOpenCvJni(type: Copy) {
staller.setVersion(openCvVersion)
staller.installJni(openCvPlatform.defaultJniLocation())
 Or manually set the install location
staller.installJni('/usr/local/lib')

Using the installer as Java library

First, add

sitories {
ven {
url 'https://github.com/WPIRoboticsProjects/opencv-maven/raw/mvn-repo'


ndencies {
mpile group: 'edu.wpi.first.wpilib.opencv', name: 'opencv-installer', version: '+'

to your build.gradle file.

Then to make sure that OpenCV is installed prior to using any OpenCV code:

rt edu.wpi.first.wpilib.opencv.installer.Installer;
rt edu.wpi.first.wpilib.opencv.installer.PlatformDetector;
rt org.opencv.core.Core;

s Main {

atic {
Installer.setOpenCvVersion(Core.VERSION);
Installer.installJni(PlatformDetector.getPlatform().defaultJniLocation());
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);



This will install OpenCV on the current system if the JNI bindings are available for it. If there aren't any JNI bindings, an IOException will be thrown by the call to Installer.installJni()


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.