Search code examples
opencv3.0background-foreground

Foreground extraction using opencv


I am working on a dataset (training + testing) which contains a different shopping cart items (eg: biscuits, soaps etc..) with different backgrounds and I need to predict the product id for all testing images (product ids are unique for each product, Let's say Good-day 10 rs is having product id 1 and so on... for different products )

My approach was to :

1) extract the foreground from the image.

2) Apply sift/surf algorithm for finding matching keypoints (or) train a faster RCNN...

I was thinking to build a Haar Cascade classifier, can anyone suggest an easy foreground extraction algorithm possible for this scenario in python ?


Solution

  • For real-time purposes I don't recommend the RCNN models since they are not built for realtime but for precision. Sift or surf can recognise scenes but if the object is deformed in some way they would fail easily. Haar cascade seems to be a good solution. I also recommend checking out Yolo or SSD models since they can be easily trained with transfer learning and they are very successfull at realtime object classification. Opencv also has a DNN module for running these kinds of neural networks.