Remove handled images from slice

This commit is contained in:
Jan Bader 2023-12-06 16:21:13 +01:00
parent ccd2ea8fcd
commit bfbd6de40b

14
main.go
View File

@ -174,15 +174,15 @@ func main() {
countInstances := 0 countInstances := 0
countDupeSets := 0 countDupeSets := 0
for fileIndex := range filesMap.Images { for len(filesMap.Images) > 0 {
file := filesMap.Images[0]
newLength := len(filesMap.Images) - 1
filesMap.Images[0] = filesMap.Images[newLength]
filesMap.Images = filesMap.Images[:newLength]
var currentCluster []imageEntry var currentCluster []imageEntry
file := filesMap.Images[fileIndex]
currentCluster = append(currentCluster, filesMap.Images[fileIndex])
for otherIndex := range filesMap.Images {
if fileIndex == otherIndex {
continue
}
currentCluster = append(currentCluster, file)
for otherIndex := range filesMap.Images {
otherFile := filesMap.Images[otherIndex] otherFile := filesMap.Images[otherIndex]
var distance = hamming.Uint64(file.imageHash, otherFile.imageHash) var distance = hamming.Uint64(file.imageHash, otherFile.imageHash)
if distance > 5 { if distance > 5 {