|
@ -14,6 +14,7 @@ class Engine extends Logging{ |
|
|
val imageFilter:ImageFilter = new ImageFilter() |
|
|
val imageFilter:ImageFilter = new ImageFilter() |
|
|
|
|
|
|
|
|
def getImagesForDirectory(directoryPath:String):List[Image] = { |
|
|
def getImagesForDirectory(directoryPath:String):List[Image] = { |
|
|
|
|
|
debug(s"Looking for images in directory: $directoryPath") |
|
|
val images:mutable.MutableList[Image] = new mutable.MutableList[Image]() |
|
|
val images:mutable.MutableList[Image] = new mutable.MutableList[Image]() |
|
|
val directory:File = new File(directoryPath) |
|
|
val directory:File = new File(directoryPath) |
|
|
if (directory.isDirectory) { |
|
|
if (directory.isDirectory) { |
|
@ -29,7 +30,32 @@ class Engine extends Logging{ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
def getSimilarImagesForDirectory(directoryPath:String):List[SimilarImages] = { |
|
|
def getSimilarImagesForDirectory(directoryPath:String):List[SimilarImages] = { |
|
|
null |
|
|
|
|
|
|
|
|
debug(s"Looking for similar images in directory: $directoryPath") |
|
|
|
|
|
val images = getImagesForDirectory(directoryPath) |
|
|
|
|
|
val ignoreSet = new mutable.HashSet[Image]() |
|
|
|
|
|
val allSimilarImages = new mutable.MutableList[SimilarImages]() |
|
|
|
|
|
for (rootImage <- images) { |
|
|
|
|
|
if (!ignoreSet.contains(rootImage)) { |
|
|
|
|
|
debug(s"Looking for images similar to: ${rootImage.imagePath}") |
|
|
|
|
|
ignoreSet += rootImage |
|
|
|
|
|
val similarImages = new mutable.MutableList[Image]() |
|
|
|
|
|
for (image <- images) { |
|
|
|
|
|
if (!ignoreSet.contains(image)) { |
|
|
|
|
|
if (rootImage.isSimilarTo(image)) { |
|
|
|
|
|
debug(s"Image: ${image.imagePath} is similar") |
|
|
|
|
|
similarImages += image |
|
|
|
|
|
ignoreSet += image |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
if (similarImages.length > 1) { |
|
|
|
|
|
val similar = new SimilarImages(rootImage, similarImages.toList) |
|
|
|
|
|
debug(s"Found similar images: ${similar.toString}") |
|
|
|
|
|
allSimilarImages += similar |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
allSimilarImages.toList |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |