Ask Your Question
0

Number of pixels changed per frame compared to frame before?

asked 2013-12-05 03:33:29 -0600

Dear Forum, I am a newbie to OPENCV and before I dive into it I'd like to ask a question hoping for an answer which allows me to asses if my project can be done with opencv. I have hours of video files with a small black rodent sitting in dem middle of a plexiglas cage with rather bright background. Usually I press a button whenever the animal is moving or not to manually score this movement... However I thought it might be possible to computationally assess roughly this movement by just comparing the color (or gray values or brightness) of each pixel with the one before and at the end of each comparison write the frame number in the first row followed by the number of changed pixels, tab separated. At the end I would normalize the whole file by the maximal changed pixels/frame, which I can do as the 'strength' of movement doesn't count. Later I would have a simple plot where I could manually define a threshold to say moving or not ... What do you think ... is that possible? Thanks for your help - I highly appreciate your advice on this. Best Zeitzeuge

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-12-05 05:07:01 -0600

bpp gravatar image

You could use absdiff to find differences between images:

Mat img1, img2, img3; img3 = absdiff(img1,img2);

http://docs.opencv.org/modules/core/doc/operations_on_arrays.html#absdiff

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-12-05 03:33:29 -0600

Seen: 615 times

Last updated: Dec 05 '13