compareImages method
Implementation
Future<double> compareImages(Uint8List inputImageData, Uint8List storedImageData) async {
img.Image? inputImage = await _decodeImage(inputImageData);
final storedImage = await _decodeImage(storedImageData);
if (inputImage == null || storedImage == null) {
throw Exception('Failed to decode one or both images.');
}
final inputEmbeddings = _runInference(_preprocessImage(inputImage));
final storedEmbeddings = _runInference(_preprocessImage(storedImage));
return _cosineSimilarity(inputEmbeddings, storedEmbeddings);
}