You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
795 B

  1. package com.sothr.imagetools.image
  2. import com.sothr.imagetools.dto.ImageHashDTO
  3. import com.sothr.imagetools.hash.HashService
  4. class Image(val imagePath:String, val thumbnailPath:String, val imageSize:Tuple2[Int,Int], var hashes:ImageHashDTO = null) {
  5. var imageType:ImageType = ImageType.SingleFrameImage
  6. def isSimilarTo(otherImage:Image):Boolean = {
  7. HashService.areImageHashesSimilar(this.hashes,otherImage.hashes)
  8. }
  9. def getSimilarity(otherImage:Image):Float = {
  10. HashService.getWeightedHashSimilarity(this.hashes, otherImage.hashes)
  11. }
  12. /*def getSimilar(otherImages:Traversable[Image]):Traversable[Image] = {
  13. }*/
  14. override def toString:String = {
  15. s"Image: $imagePath Thumbnail: $thumbnailPath Image Size: ${imageSize._1}x${imageSize._2} Hashes: $hashes"
  16. }
  17. }