From 00b13e0d0e9d35250272149c1111af2dbc8ffb7c Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 22 May 2018 16:44:58 -0400 Subject: [PATCH] 3845 load opencv libraries in manner that works for object detection module --- .../org/sleuthkit/autopsy/coreutils/ImageUtils.java | 12 ++++++------ .../ObjectDetectectionFileIngestModule.java | 6 ++++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java b/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java index d9523fe389..f3799721d5 100644 --- a/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java +++ b/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java @@ -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) { diff --git a/Experimental/src/org/sleuthkit/autopsy/experimental/objectDetection/ObjectDetectectionFileIngestModule.java b/Experimental/src/org/sleuthkit/autopsy/experimental/objectDetection/ObjectDetectectionFileIngestModule.java index 832cbff471..315d7174d8 100644 --- a/Experimental/src/org/sleuthkit/autopsy/experimental/objectDetection/ObjectDetectectionFileIngestModule.java +++ b/Experimental/src/org/sleuthkit/autopsy/experimental/objectDetection/ObjectDetectectionFileIngestModule.java @@ -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.