Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Java | Get OpenCV working on other PC

Hey Programmers!

GENERAL:

Im programming a face detection Programm with OpenCV and I want to get it working on other Computers without a OpenCV install. So my installer (Java) must install all requirements to get the program working. My Programm is for Mac OS X, Linux and Windows.

WHAT I ALREADY TRIED:

I tried to compile it on my first Mac, then I copied to my second mac, but I always get Errors, because there are absolute paths (i think) that are pointing to my Desktop (Where i compiled the Library on my first mac). I asked my teacher if it is possible to rewrite these absolute paths to relative paths, but he said that it is not possible. Another idea is to download and compile the opencv-library inside the installer. But I have no idea to do that. Now im here :)

CODE: (Nice Formatting xD)

public static void loadOpenCVLibrary() {
    //all opencv libs must be copyed to OpenCV_lib in the project workspace

    File folder = new File(directory+seperator+"System"+seperator+"OpenCV_Linux"+seperator+"build"+seperator+"lib"+seperator);
    //File folder = new File("/Users/Tech/Documents/Development/workspace/opencv-3.0.0/bin/");
    File[] listOfFiles = folder.listFiles(); 

for (int i = 0; i < listOfFiles.length; i++) {
    if (listOfFiles[i].isFile() && listOfFiles[i].getName().endsWith(".dylib")) {
        File lib = new File(directory+seperator+"System"+seperator+"OpenCV_Linux"+seperator+"build"+seperator+"lib"+seperator + listOfFiles[i].getName());
        //File lib = new File("/Users/Tech/Documents/Development/workspace/opencv-3.0.0/bin/" + listOfFiles[i].getName());
        System.load(lib.getAbsoluteFile().toString());
    }
}}

If you need more infos, send a message :)

Thank you very MUCH! Tech