0

I was thinking about writing a very simple program to compare 2 ARGB array pixel by pixel. Both images are same resolution, taken with the same camera source.

Since the camera is being hold still, I was expecting it's a fairly simple program to compare bitmap source by

  1. Convert every pixel into Gray scale pixel
  2. Literally compare each pixel from position 0 to N.
  3. Have a isClose method to do an approximate +/- 3.

The result is that I have too much error bits. But when taking JPEG out of it and view it with naked eye, they seem to be identical (which is the case).

Why do you think I am seeing so much error when comparing them?

BTW - I am trying a write a very basic version of motion detection.

SamLosAngeles
  • 2,660
  • 2
  • 14
  • 12
Kenny Lim
  • 1,193
  • 1
  • 11
  • 31
  • this may help http://www.hackerfactor.com/blog/?/archives/529-Kind-of-Like-That.html and here is a c# implementation http://01101001.net/Imghash.zip – user3473830 Sep 22 '14 at 04:59
  • Sounds promising ... will check it out. Thanks. – Kenny Lim Sep 22 '14 at 06:25
  • You could first resample the photos to a very course resolution such that one pixel is the approximate size of the object you're tracking. That would definitely reduce the number of errors you'd see when comparing images, but whether it would help in detection or not, I don't know. – dodgy_coder Sep 22 '14 at 07:52

2 Answers2

1

If you are tracking a known object you can pre-process your images before you compare them. For example, if it's a ball you're tracking and it appears brighter than its surroundings, you can threshold your greyscale image that will produce an image with only black or white. You then detect what are known as "contours" (see openCV documentation). Once you get the contour you are after (the ball) in any image, you can compare the location of it in each successive image. There are some algorithms that help figure out where a moving object will be next so it helps finding it in the next frame. Without knowing exactly what you are doing, it's hard to give anything concrete.
And I see you're C#...maybe this will help: .Net (dotNet) wrappers for OpenCV?

Community
  • 1
  • 1
user1269942
  • 3,772
  • 23
  • 33
0

b/c the pictures are not the same. each one you pressed the button of the camera a little differently. the change is "huge" if you compare pixel by pixel.

I'm not an expert on motion detection, but try to compare averages around a pixel - I think it will give you better results.

Dani
  • 14,639
  • 11
  • 62
  • 110