mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
3845 handle exception with bad classifier image combo, log but otherwise hide from user
This commit is contained in:
parent
7f32cfa261
commit
1b0e35122e
@ -27,6 +27,7 @@ import java.util.Map;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.opencv.core.CvException;
|
||||||
import org.opencv.core.Mat;
|
import org.opencv.core.Mat;
|
||||||
import org.opencv.core.MatOfByte;
|
import org.opencv.core.MatOfByte;
|
||||||
import org.opencv.core.MatOfRect;
|
import org.opencv.core.MatOfRect;
|
||||||
@ -112,7 +113,14 @@ public class ObjectDetectectionFileIngestModule extends FileIngestModuleAdapter
|
|||||||
MatOfRect detectionRectangles = new MatOfRect(); //the rectangles which reprent the coordinates on the image for where objects were detected
|
MatOfRect detectionRectangles = new MatOfRect(); //the rectangles which reprent the coordinates on the image for where objects were detected
|
||||||
for (String classifierKey : classifiers.keySet()) {
|
for (String classifierKey : classifiers.keySet()) {
|
||||||
//apply each classifier to the file
|
//apply each classifier to the file
|
||||||
|
try {
|
||||||
classifiers.get(classifierKey).detectMultiScale(originalImage, detectionRectangles);
|
classifiers.get(classifierKey).detectMultiScale(originalImage, detectionRectangles);
|
||||||
|
} catch (CvException ignored) {
|
||||||
|
//The image was likely an image which we are unable to generate a thumbnail for, and the classifier was likely one where that is not acceptable
|
||||||
|
logger.log(Level.INFO, String.format("Classifier '%s' could not be applied to file '%s'.", classifierKey, file.getParentPath() + file.getName())); //NON-NLS
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!detectionRectangles.empty()) {
|
if (!detectionRectangles.empty()) {
|
||||||
//if any detections occurred create an artifact for this classifier and file combination
|
//if any detections occurred create an artifact for this classifier and file combination
|
||||||
try {
|
try {
|
||||||
@ -137,6 +145,7 @@ public class ObjectDetectectionFileIngestModule extends FileIngestModuleAdapter
|
|||||||
* Send an event to update the view with the new result.
|
* Send an event to update the view with the new result.
|
||||||
*/
|
*/
|
||||||
services.fireModuleDataEvent(new ModuleDataEvent(ObjectDetectionModuleFactory.getModuleName(), TSK_OBJECT_DETECTED, Collections.singletonList(artifact)));
|
services.fireModuleDataEvent(new ModuleDataEvent(ObjectDetectionModuleFactory.getModuleName(), TSK_OBJECT_DETECTED, Collections.singletonList(artifact)));
|
||||||
|
|
||||||
} catch (TskCoreException ex) {
|
} catch (TskCoreException ex) {
|
||||||
logger.log(Level.SEVERE, String.format("Failed to create blackboard artifact for '%s'.", file.getParentPath() + file.getName()), ex); //NON-NLS
|
logger.log(Level.SEVERE, String.format("Failed to create blackboard artifact for '%s'.", file.getParentPath() + file.getName()), ex); //NON-NLS
|
||||||
return IngestModule.ProcessResult.ERROR;
|
return IngestModule.ProcessResult.ERROR;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user