1. A system for object recognition, the system comprising: one or more processors and a memory having instructions such that when the instructions are executed, the one or more processors perform operations of: in a training phase, extracting a set of features from a set of foreground training images of foreground objects captured in a first lighting condition with a camera having a first viewpoint using a feature detection algorithm, resulting in a set of foreground features; in a testing phase, extracting at least one region of interest from an input image, wherein the at least one region of interest represents a potential foreground object, wherein at least one of the following applies to the input image: the input image is captured in a second lighting condition that is different from the first lighting condition, and the input image has a second viewpoint that is different from the first viewpoint: segmenting the input image, resulting in a set of segments; processing the input image with a feature detection algorithm to detect a set of features, resulting in a set of detected features; assigning each feature in the set of detected features to a class, resulting in as set of assigned features; classifying each segment in the set of segments as representing foreground or background based on the assigned features in each segment; and outputting the segments representing a foreground object in the input image.