I'm very new to processing, so bear with me if this is a stupid question. I have been hunting all over the forum (and the web) for an answer, but I can't seem to get my head around the logic.
I was wondering if anyone can point me in the direction of any tutorials that convey the recent best practices for background subtraction in processing. There seem to be a lot of libraries that are available to use that help with this (so far I have JMyron and GSVideo) but not a lot of documentation on the topics.
In short, I have found myself spending more time trying to adjust code to fit what I am doing that I feel should have been spent. What I am trying to do is create silhouettes based on the difference in pixels from the background shot, then break using the coordinates, affect a grid of squares (so in effect, the screen would display a matrix of blocks with a pixelated looking silhouette.
I think I understand the concept behind background subtraction - take a snapshot of the background, then analyse every incoming frame to check for the change in pixel color taking into account a tolerance. What I don't get is how to apply that concept to what I want to do and how these tools like JMyron and GSVideo can help. (I can find a lot of info on them). Any insight on the topic would be hugely helpful.
Well, progress so far, but the logic behind what I wanted to do doesn't really appear to be a "best practice" way of doing it.
Using JMyron, I was able to get the average pixel color of the background and then compare it to that of the current scene, but this way of doing things seem to rely heavily on stable conditions for the background. When, for instance, it gets sunnier in a room the background no longer matches. This can be solved by increasing the tolerance, but that also seems to be a strange way to go about it. All together, using the average colour of a pixel to determine change seems to be flawed in cases where there is no control due to the fact that, say, the person passing by could be wearing the same colour as the background and sneak by undetected.
Does anyone have any other ways one might accomplish this task of background subtraction?
My current code is below so you can see.
Pressing < / > increases and decreases the tolerance and hitting the spacebar takes a new snapshot of the background.
Hey, thanks for the reply. I saw that example actually and it is great, but sadly, that more or less what I am doing in mine above (just without the bit shifting as I will have a low frame rate anyhow so speeds won't be an issue). I wonder if the problem I am having comes from the fact that I am taking the average colour of a group of pixels?
I would guess that taking an average colour would make the response less sensitive and not more because more change needs to occur for something to show.
Perhaps I should sample one pixel in the middle of each of my cells instead?
Leave a comment on kitzstanza's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic