Removing common background in image processing phase for classification
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.