I am doing a motion detection app as A c# winform app.
I use openCV and the emgu wrapper to discern motion (that I want to trap).
A lot of the time there are no motion changes but I still have to check this within my code.
I gave md5 a go just to see if I could use this to detect quickly if there were any differences between 2 images. I have found in 99% of the time that the md5s of 2 images do not match and thus tells me there are differences between the 2 images. I am assuming for motion detection that md5 would not be too 'sensitive' for such a task?
Can Md5 be set to have % difference threshold or/and is there another way to do this?
thanks
code so far:
private string getMd5Hash(byte[] buffer)
{
MD5 md5Hasher = MD5.Create();
byte[] data = md5Hasher.ComputeHash(buffer);
StringBuilder sBuilder = new StringBuilder();
for (int i = 0; i < data.Length; i++)
{
sBuilder.Append(data[i].ToString("x2"));
}
return sBuilder.ToString();
}
public string GetMD5(byte[] buffer)
{
return getMd5Hash(buffer);
}
//calling code...
string img1= t.GetMD5(data);
string img2= t.GetMD5(data);
if (img1!= img2)
{
//differences
}