0

I'm using the CodeBook Method that the OpenCV library has integrated in a project. Till now I've managed to make it work on my webcam but there seems to be some problems. The brightness auto-adjust of the camera messes up the whole end result since whole regions(sometimes the whole image) get tagged as foreground.

I really want to know if I can access the background model that the algorithm produces in order to make some basic shadow detection that will eliminate the brightness changes. As an end result I would like to have the foreground images classified as: a) foreign object b) region that only has the brightness changed.

PS: I'm using OpenCV 2.1 along with Dev C++ 4.9.9.2

2 Answers 2

2

The BackgroundSubtractorMOG2 and every other backgrounsubstractor for that matter has a function that returns the background image. You'd be better off turning the camera's white balance and auto focus off though.

Sign up to request clarification or add additional context in comments.

1 Comment

since this is a webcam from my laptop I didn't manage to turn those off. this approach would also help with the functionality of the program. thanks for the info though!
0

As far as I know, no background model can't remove shadow. To do so, you may need to use some method like scene detection which requires machine learning. Or, you may try some method using super pixel matching to remove shadow.

BTW, CodeBook model is kind of old and slow method, one the best background model I know is called ViBe, it is patented, but if you used that for academic purpose, you can get the SDK from the inventor, here is video of my implementation.When it is applied to traffic detection, here is another video https://www.youtube.com/watch?v=uzY76q0mrh4

you can implement your own version if you read their published papers. Hope this helps!

2 Comments

MOG2 can remove shadows.
Thanks for the info guys. Although I kinda finished with this project I will still look into what you suggested. There is always room for improvement.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.