I'm working on a project where I have to automatically segment different parts of a car (i.e. door, headlight, etc.) in an image provided by a cam.
In a first step I'd like to remove the background, so the algorithm won't find anything where it's not supposed to.
I also have the image of just the background, but the illumination is very different due to exposure time, reflection of light of the car, etc.
I tried to get rid of the BG by simple subtraction, unfortunately due to the very different lighting conditions this didn't turn out to be very helpful.
So next I applied a histogram equalization, but this also didn't help very much.
How can I get rid of the background in this differently lighted scene? Is there a OpenCV method that I could use with these two images?
Opencv has three different methods for background subtraction:
BackgroundSubtractorGMG bs_gmg;
BackgroundSubtractorMOG bs_mog;
BackgroundSubtractorMOG2 bs_mog2;
Mat foreground_gmg;
bs_gmg ( image, foreground_gmg, -1.0 );
Mat foreground_mog;
bs_mog ( image, foreground_mog, -1.0 );
Mat foreground_mog2;
bs_mog2 ( image, foreground_mog2, -1.0 );
You can read about them and use the one that works best for you.