Abstract
Embodiments disclosing a controller for controlling a robot to perform a task are provided. The task is performed in an environment that is represented by an input image. The controller causes segmenting of an object in the input image. A confidence level of segmentation is updated by comparing the segmented object with constrained affined transformations of a template of the object. The constrained affine transformations are based on constraints indicative of a property of the object. The property of the object and the updated confidence level of segmentation are then used for performing the task.