You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometime algorithm: PerceptualHash() produces the exact same results on different images.
Is this expected behavior?
Log:
flutter: 2.png and 1.png
flutter: PerceptualHash: 39.0625%
flutter: 3.png and 1.png
flutter: PerceptualHash: 19.140625%
flutter: 4.png and 1.png
flutter: PerceptualHash: 39.0625% <= same as 2.png
flutter: 5.png and 1.png
flutter: PerceptualHash: 47.265625%
Code:
for (var i = 1; i < 6; i++) {
ByteData data = await rootBundle.load('lib/images/$i.png');
Uint8List bytes = data.buffer.asUint8List();
img.Image image = img.decodeImage(bytes)!;
if (img1 != null) {
debugPrint('$i.png and 1.png');
await imageCompareTest(img1, image);
}
img1 = image;
}
imageCompareTest(img.Image img1, img.Image img2) async {
Directory tempDir = await getTemporaryDirectory();
var url1 = '${tempDir.path}/file1.png';
var url2 = '${tempDir.path}/file2.png';
// it's a bit redundant but crucial for our use-case
Uint8List bytes1 = Uint8List.fromList(img.encodePng(img1));
Uint8List bytes2 = Uint8List.fromList(img.encodePng(img2));
var file1 = File(url1);
await file1.writeAsBytes(bytes1);
var file2 = File(url2);
await file2.writeAsBytes(bytes2);
var assetResults = await listCompare(
target: file1,
list: [
file2
],
algorithm: PerceptualHash(),
);
for (var e in assetResults) {
print('PerceptualHash: ${e * 100}%');
}
}
Images used:
1.png
2.png
3.png
4.png
5.png
The text was updated successfully, but these errors were encountered:
ChurikiTenna
changed the title
PerceptualHash algorithm produces same result on different images.
PerceptualHash algorithm produces same results on different images.
Nov 8, 2024
Sometime
algorithm: PerceptualHash()
produces the exact same results on different images.Is this expected behavior?
Log:
flutter: 2.png and 1.png
flutter: PerceptualHash: 39.0625%
flutter: 3.png and 1.png
flutter: PerceptualHash: 19.140625%
flutter: 4.png and 1.png
flutter: PerceptualHash: 39.0625% <= same as 2.png
flutter: 5.png and 1.png
flutter: PerceptualHash: 47.265625%
Code:
Images used:
1.png
2.png
3.png
4.png
5.png
The text was updated successfully, but these errors were encountered: