Removing common background in image processing phase for classification

I'm trying to build a machine learning classifier that can detect which object is in an image. I have a labled training set of images and am currently in the image processing phase. Each of these images has one of the objects. However, almost all images have these objects embedded in a very common background color amongst all images.

These are not the images i'm training on but they give the general idea:

The background red is more or less uninformative of what object is in the picture. In order to reduce the dimensionality of my problem, I'd really like to apply an algorithm that somehow extracts the object from the common background. My idea after that was then to resize the resulting images all to some common dimension. Then i was going to try to do some deep learning. Does anyone know any algorithms in computer processing that can do this?

• What approaches have you considered? Are you familiar with the following? For finding the background: en.wikipedia.org/wiki/Image_segmentation. For object recognition: en.wikipedia.org/wiki/Outline_of_object_recognition, en.wikipedia.org/wiki/Object-class_detection, en.wikipedia.org/wiki/Computer_vision#Recognition. – D.W. Nov 16 '15 at 4:11
• I've considered PCA, but really want to keep as much information as possible about the original object in the image. The objects i'm trying to classify are actually very similar to each other, its in the details that they differ. So i'm very afraid PCA will lose me this fine details. Its also for this reason that i chose to not go the SIFT route. I think because my images are very similair, sift will have trouble with matching. I really think for the kinda of detail I need, i should go some kind of neural net on the objects themselves. – mt88 Nov 16 '15 at 6:19
• OK, but I didn't suggest PCA. Anyway, my advice would be to spend some quality time at the library studying each of those topics. I think you'll find there are many good techniques documented in standard textbooks or resources, which would be the first things to try. (PCA would not have been one of the techniques I would have suggested for image segmentation or object recognition.) – D.W. Nov 16 '15 at 6:54
• Sorry, I didn't mean to say you suggested PCA, I was going over some of the approaches I considered. – mt88 Nov 16 '15 at 21:11
• After looking at your first link. I think K means clustering with K = 2 will probably do the trick for me ( i had not thought of formulating this as a clustering problem). If thats too slow, i think a histogram method might also work. – mt88 Nov 16 '15 at 21:48

Try using clustering on the histogram of pixel color values. I would suggest using $K$-means using $K=2$ as a starting point, but you could use any clustering algorithm.

You might want to convert to HSV color space, build a histogram of the hues, and apply clustering on those values. You could also try other color space models, like CIELAB, but HSV is probably good enough for your purposes. Working in HSV space tends to yield techniques that are more robust to variation in lighting/illumination.

In your examples, the majority class (the cluster containing the majority of pixel values) is the background. You could use heuristics, such as that the cluster that contains the majority of pixels along the boundary of the image is more likely to be the background.

The watershed algorithm or other methods of image segmentation could be an alternative approach that might work well.

If your images are as clean as shown in the example, almost anything should work well.

• Thank you for your excellent answer. Could your answer be applied to removing a powerful coherent laser light of a known wavelength or color from an incoherent light background such as that viewed from a Boeing 767 cockpit window on approach , 100 meters , from the airport? – Frank Jun 10 '16 at 2:45
• @Frank, I don't know. It doesn't sound like a computer vision problem, as the pilots are probably going to be looking through a window (not on a computer screen that's showing a video taken from a camera). But, if you're asking about pictures or videos taken from such an airplane: If it's a known wavelength, that sounds plausibly feasible.... the place to start would be with some example images. – D.W. Jun 10 '16 at 6:20
• I just sent an email to Professor Emmanuel Bossy at ESPCI Paris, PSL Research University Paris, France andOptics Laboratory and Laboratory of Applied Photonics Devices, School of Engineering, Ecole Polytechnique Fédérale de Lausanne (EPFL), 1015 Lausanne, Switzerland asking about your idea of image segmentation using K-means clustering. Hopefully, he might respond. Thank you. – Frank Jun 23 '16 at 7:24