3845 load opencv libraries in manner that works for object detection module

This commit is contained in:
William Schaefer 2018-05-22 16:44:58 -04:00
parent 6bc92a2e11
commit 00b13e0d0e
2 changed files with 10 additions and 8 deletions

View File

@ -121,12 +121,12 @@ public class ImageUtils {
//load opencv libraries
boolean openCVLoadedTemp;
try {
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
if (System.getProperty("os.arch").equals("amd64") || System.getProperty("os.arch").equals("x86_64")) { //NON-NLS
System.loadLibrary("opencv_ffmpeg2413_64"); //NON-NLS
} else {
System.loadLibrary("opencv_ffmpeg2413"); //NON-NLS
}
// System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
// if (System.getProperty("os.arch").equals("amd64") || System.getProperty("os.arch").equals("x86_64")) { //NON-NLS
// System.loadLibrary("opencv_ffmpeg2413_64"); //NON-NLS
// } else {
// System.loadLibrary("opencv_ffmpeg2413"); //NON-NLS
// }
openCVLoadedTemp = true;
} catch (UnsatisfiedLinkError e) {

View File

@ -24,6 +24,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import org.apache.commons.io.FilenameUtils;
import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.core.MatOfRect;
import org.opencv.highgui.Highgui;
@ -55,7 +56,8 @@ public class ObjectDetectectionFileIngestModule extends FileIngestModuleAdapter
@Override
public void startUp(IngestJobContext context) throws IngestModule.IngestModuleException {
System.load("C:\\project_code\\autopsy\\thirdparty\\opencv\\lib\\amd64\\opencv_java2413.dll");
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
System.loadLibrary("opencv_java2413");
File classifierDir = new File(PlatformUtil.getObjectDetectionClassifierPath());
cascades = new HashMap<>();
if (classifierDir.exists() && classifierDir.isDirectory()) {
@ -94,7 +96,7 @@ public class ObjectDetectectionFileIngestModule extends FileIngestModuleAdapter
BlackboardArtifact artifact = file.newArtifact(TSK_OBJECT_DETECTED);
artifact.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DESCRIPTION, ObjectDetectionModuleFactory.getModuleName(), cascadeKey));
artifact.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT, ObjectDetectionModuleFactory.getModuleName(), comment));
try {
/*
* Index the artifact for keyword search.