An automated, computerized method for distinguishing between illumination boundaries and material boundaries in an image of a scene, wherein the image is an optical color image, comprising the steps of: identifying depth information for the image; identifying X-junctions in the image, as a function of the depth information, by a uniform token analysis, wherein an X-junction is an area of the image where a material boundary and an illumination boundary cross one another, and a uniform token is a connected region of the image with pixel values which are constant within a noise margin, the uniform token analysis testing sets of four tokens {A, B, C, D} whether the respective set is an X-junction, wherein, in the course of the analysis, a given set of tokens {A, B, C, D} is only accepted as a prospective X-junction for further analysis if the depths D A, D B, Dc, D D for the tokens of the set are within a specified percentage of each other; calculating a spectral ratio, which is a ratio of colors, for each bright / dark pixel pair in each identified X-junction, a bright pixel being a pixel on a bright side of the illumination boundary of the X-junction, and a dark pixel being a pixel on a dark side of the illumination boundary of the X-junction; calculating at least one characteristic spectral ratio from the identified X-junctions by performing a mean shift algorithm on the set of calculated spectral ratios; utilizing the at least one characteristic spectral ratio to identify a boundary between areas of different color or intensity in the image as either an illumination boundary, if the spectral ratio for the boundary is approximately equal to the characteristic spectral ratio, or as a material boundary, otherwise. identifying depth information for the image; identifying X-junctions in the image, as a function of the depth information, by a uniform token analysis, wherein an X-junction is an area of the image where a material boundary and an illumination boundary cross one another, and a uniform token is a connected region of the image with pixel values which are constant within a noise margin, the uniform token analysis testing sets of four tokens {A, B, C, D} whether the respective set is an X-junction, wherein, in the course of the analysis, a given set of tokens {A, B, C, D} is only accepted as a prospective X-junction for further analysis if the depths D A, D B, Dc, D D for the tokens of the set are within a specified percentage of each other; calculating a spectral ratio, which is a ratio of colors, for each bright / dark pixel pair in each identified X-junction, a bright pixel being a pixel on a bright side of the illumination boundary of the X-junction, and a dark pixel being a pixel on a dark side of the illumination boundary of the X-junction; calculating at least one characteristic spectral ratio from the identified X-junctions by performing a mean shift algorithm on the set of calculated spectral ratios; utilizing the at least one characteristic spectral ratio to identify a boundary between areas of different color or intensity in the image as either an illumination boundary, if the spectral ratio for the boundary is approximately equal to the characteristic spectral ratio, or as a material boundary, otherwise.