First of all hello to everyone... this is my first post. I did some 'googling' for help with C code and found this place, the reason I need help is because I am working on a (what I consider hard) project and (only) a week and a half to complete it.
To write a C code which extracts the foreground and replaces the background, in other words, chroma key programming, or blue screen editing. Taking a part of an image and replacing the background.
Basically, I have 125 subsequent frames, in which people are moving in and out the frames. The background consists of bushes and trees. The people are walking on a sidewalk. The task at hand is to extract these people and place them walking on an output image, an image of the beach.
So, basically the task consists of... reading in input_image0001.jpg, extracting the foreground, replacing the background with beach.jpg and creating output_image0001.jpg.
What I Know...
So, background information about me: I am not by far a talented coder, but I do love coding and learning. So, I'm here asking for help. So far, I know how to read in the image, i know how write out an image, i know how to isolate each pixel, and "play" with the RGB values.
The input image is 640x140 & the output image is 640x480. I am already aware that vertical offset is going to be necessary to transpose the foreground onto the beach, so the people do not look like they are walking on water, lol.
What I Need Help With...
1. I am trying to figure out an algorithm that will help me extract the people (and clothing, purses, hats, etc) from the original image. The people are not of the same race, therefore not the same color, nor are their clothes the same color. The background is the only thing somewhat constant. I've been considering a "sum of absolute differences." I am confused about how to handle this, because I considered subtracting pixels but then I'm not sure what to subtract from?
One idea I had was if I could somehow run the program to read in all 125 images at the same time and subtract them from each other, meaning any of the background not covered by a person would just be deleted and then take the result and add that to 125 output images. Sounds Crazy?
This is all I can think about for Day 0, it's getting late for me, I'' check back constantly. So, any help is gratelly appreciated it. Thank you and I hope you all have a wonderful Monday.
I am Confused