as illustrated in fig1 to conduct the segmentation process the captured image is converted from rgb values to a colorimetric space such as cielab . if the rgb values are already in a standard color space ( e . g . srgb ( see m . anderson et . al . , “ proposal for a standard default color space for the internet ,” is & amp ; / sid 4 th color imaging conference , pp . 238 - 246 , 1996 . )), then the transformation is well known and straight - forward . if the rgb values are not in a standard color space , then it is necessary to determine a transformation that will convert the rgb values to cielab in a manner that is known in the art . this transformation can be determined once for the capture device that is used , prior to the on - going operation of the device . details of this operation are given in the block diagram , fig1 , and the discussion below . once , the image is in the cielab color space , each pixel in the image is classified ( box b ). the method for performing this operation is the k - means algorithm . for a discussion of this algorithm see c . therrien , decision , estimation , and classification , john wiley & amp ; sons , n . y ., 1989 , pp 217 - 218 . k - means is a classic iterative pattern recognition algorithm in which a set of data ( i . e . the individual pixels ) is optimally divided into a set of k classes ( i . e . color groups ). in this method , an optimization problem is solved to determine the class in which a pixel is contained ( i . e . into which color group does the pixel best fit ). the selection of the number of categories into which the pixels are classified depends upon the number of distinguishable features in the image or the portion of the image that is the object of the segmentation routine . for the case of teeth , the features may be skin , lips , and teeth ( in this case k = 3 ). additional facial features that are spatially disjointed from the teeth ( e . g . moustaches ) can be either classified as teeth or non - teeth ( e . g ., skin or lips ) groups . if the feature is incorrectly classified as teeth , the algorithm will keep the teeth and the additional facial feature separate due to their unconnectedness or separation in the image . fig2 b illustrates the output of a k - means algorithm ( k = 5 ). after executing the k - means algorithm , there may be several discontinuous or disjointed segments that are contained in the same class or color group . for example teeth and the specular reflection from glossy lips may be within the same class due to the fact that both will appear close to white . if one is only interested in modifying or adjusting the image of the teeth , then it is necessary to separate the teeth pixels from the lip - gloss pixels . if these two sections are not connected , then this separation can be achieved by first identifying a pixel that is within the desired section such as the teeth area . in one embodiment , assuming the desired feature represents the largest section of the image or the targeted area of the image areawise , this identification is achieved by performing a blurring operation on the original rgb image ( box c ). the blurred image represents an averaging of the local pixels . blurring insures that the pixel selected in box d that is closest in color to the expected color of the desired feature will be in an area of the image that corresponds to the segmented or isolated feature and that the pixel selected is not an aberrant pixel in an area of the image that is not the element to be isolated . the blurring operation has the effect of smearing out the segments that are smaller than the blurring kernel , to the point where no feature including the segment &# 39 ; s color is visible . for segments that are larger then the size of the blurring kernel , the color of the segment will remain enabling the determination of the location of one pixel in that segment . the size of the blurring kernel is selected to be smaller than the desired feature . to identify teeth , the expected value might be the whitest pixel . to identify the hair , the expected value might be determined empirically by collecting a set of hair images , blurring them , and computing the average pixel values across the set of images . the picture shown in fig2 has several regions that are the same color as the element that is the target of the isolation . the desired target is the largest region . to identify a pixel in this region , the portion of the image in the boxed target area is blurred as shown in fig2 c using a blurring kernal that is smaller than the desired target . this is the output from box c in fig1 . assuming for explanation , that this region is green , as the next step in the process , the greenest pixel in the blurred image is selected . this pixel location is output from box d in fig1 . having identified the location of one pixel that is within the segment of the class to be separated from the image , to identify the rest of the desired feature , a mask is grown by adding to the identified pixel all pixels that are in this category and connected using a connection definition such as an 8 - point connection definition which is well known in the art ( box e ). the implementation of the growth algorithm is such that it is relatively insensitive to the connection definition . the details of this growth algorithm are given in the block diagram discussion . this mask is the output of box e and is illustrated by the image shown in fig2 e . the mask defines the area of interest . if the mask reaches any of the edges of the image or is outside of some defined region , then the area of interest was either not found or not entirely within the image . in this case , the user may be instructed to relocate the desired target ( e . g ., teeth ) in the target box 18 as shown in fig3 and discussed below ( box f and box h ). if the mask is good , then the image in the mask area is adjusted as discussed herein . fig2 f illustrates the desired segment . let the input rgb image be given by i ( x , y ), where x and y are the spatial location in the image . if the image is contained in a standard rgb color space ( e . g . srgb see m . anderson et . al . , “ proposal for a standard default color space for the internet ,” is & amp ; / sid 4 th color imaging conference , pp . 238 - 246 , 1996 . ), then the conversion from rgb to cielab is well defined . if the image is not contained in a standard rgb color space then it is necessary to determine a transformation from rgb to cielab . this transformation only needs to be determined one time , but is applied to every captured image . specifically , the transformation can be determined as follows : 1 . the mapping from rgb to ciexyz for the input device ( likely a web camera or a digital camera ) is modeled as a linear system where the rgb pixel value is given by the 3 - element vector c , t is the 3 - element ciexyz value , and g is a 3 × 3 matrix that is determined as outlined in step 2 . 2 . the matrix g is determined by measuring a set of n samples with the camera . the cielab values of the n samples are determined with a colorimeter . a matrix g is then determined by solving g = arg ⁡ ( min h ⁢ ( 1 n ⁢ ∑ i = 1 n ⁢  f ⁡ ( h t ⁢ c i ) - u i  ) ) via a modified newton method where the cielab values are given by the vector sequence { u i } i = 1 n , the measured values from the camera ( determined by averaging across a set of pixels ) are given by { c i } i = 1 n , and the mapping from ciexyz to cielab is given by the function f . see g . wyszecki , w . s . stiles , color science : concepts and methods , quantitative data and formaulae , john wiley & amp ; sons , n . y ., 1982 , pp . 166 - 169 . for example , for a nikon coolpix 990 camera , g is : 3 . for simplicity denote the output of this box as { circumflex over ( f )}( i ( x , y )). the output cielab image { circumflex over ( f )}( i ( x , y )) is provided as input to an iterative k - means algorithm in box b . specifically the algorithm is as follows : 1 . the bands of the image { circumflex over ( f )}( i ( x , y )) ( i . e . the 3 color planes ( lab channels ) of the image ) may be equalized or scaled to provide increased dynamic range , and to maximize the likelihood of being able to differentiate between desired and undesired features . the ideal scaling values are determined experimentally , by testing various scaling values on typical images for a given application . 2 . an initial set of k vector values , k l l = 1 , . . . , k is selected that may likely differentiate between the desired feature and undesired features in the image . these values should have been determined through experimentation , which involves testing various values on typical images . 3 . each pixel is assigned to one of the k classes . which class a pixel d is in is determined using c = arg ⁡ ( min l ⁢ (  d - k l  ) ) ⁢ ⁢ l = 1 , … ⁢ , k where k l is the value of the lth class , and k c is the class to which pixel d is assigned . in other words , pixel d is assigned to the class closest to it in terms of euclidean distance . 4 . after each pixel has been assigned to a class , update or refine the class values using which are simply the class value means and reassign the pixels based on the refined class values . 5 . if the maximum number of iterations has been achieved ( a number that is determined experimentally ) or no pixels have changed classes , then stop . if not , then go to step 3 . input : approximate cielab image i ( x , y ). output : blurred image b ( i ( x , y )) process : see w . k . pratt , digital image processing , john wiley & amp ; sons , n . y ., 1991 , pp 171 - 191 . the image i ( x , y ) is blurred in box c using a convolution process . mathematically , convolution is given by b ⁡ ( i ⁡ ( x , y ) ) = ∫ - ∞ ∞ ⁢ ∫ - ∞ ∞ ⁢ h ⁡ ( a , b ) ⁢ i ⁡ ( x - a , y , b ) ⁢ ⁢ ⅆ a ⁢ ⁢ ⅆ b where h ( a , b ) is the blur kernel . the size of the blur kernel should be smaller than the feature that is being detected , and the shape should be symmetric . an example of a symmetric h is given by the equation below , where n is the radius of the blur kernal : h ( a , b )= 1 /( 2 n + 1 ) 2 ∀− n ≦ a ≦ n & amp ; − n ≦ b ≦ n input : blurred image b ( i ( x , y )) output : pixel location [ x 0 , y 0 ] process : in box d , a pixel location that is likely in the desired feature is determined . if the color of the expected feature value is given by the three element vector v , then the following algorithm can be used to identify the pixel that is simply to find the pixel in the blurred image that is closest to v . the solution to the above optimization problem is achieved by an exhaustive search . input : pixel location [ x 0 , y 0 ] & amp ; k - means image k ( i , j ). box e uses the output of the k - means algorithm ( box b ) along with the value [ x 0 , y 0 ] ( box d ) to create a mask of the desired image feature . the algorithm is as follows : 1 . let there be r rows and c columns in the image . 2 . create a pixel connection definition . one definition that is useful is an 8 - point connection . in this case , a pixel d is considered connected to every pixel surrounding it . mathematically , if d is at location [ x , y ], then d is connected to the pixels at locations {[ x − 1 , y − 1 ], [ x − 1 , y ], [ x − 1 , y + 1 ], [ x , y − 1 ], [ x , y + 1 ], [ x + 1 , y − 1 ], [ x + 1 , y ], [ x + 1 , y + 1 ]}. 3 . create a mask image m ( x , y ) of size r × c that is zero everywhere . 4 . assign the pixel location [ x 0 , y 0 ] with a value 1 . 5 . create a temporary mask image m t ( x , y ), which is the same as m ( x , y ). 6 . starting from the spatial locations {[ 0 , 0 ],[ r , 0 ],[ 0 , c ],[ r , c ]}, run through the pixels in the images ( i . e . step through the pixels in a variety of ways ). for a pixel at location [ p , q ], assign a value 1 to m t ( p , q ) if the following conditions are satisfied : pixel m ( p , q ) is connected to a pixel with value 1 . pixel k ( p , q ) is in the same class as k ( x 0 , y 0 ). 7 . compare the temporary mask m t ( x , y ) to the mask m ( x , y ). test if any pixels have been reassigned . if no pixels were reassigned , then stop . otherwise , continue to step 8 . 8 . copy the temporary mask m t ( x , y ) to the mask m ( x , y ) and go to step 6 . a successful segmentation occurs if the feature is within a bounding box . if the mask reaches the edge of this box , then the segmentation algorithm failed . if the mask does not reach the edge of this box , then the segmentation was successful . input : decision from box f , mask image m ( x , y ) & amp ; input image i ( x , y ). if the output of box e , m ( x , y ) is within a pre - defined boundary ( tested in box f ), then it is assumed that the desired feature was found . in this case , the mask m ( x , y ) should be applied to the input image i ( x , y ) through a point by point operation . mathematically , this process is : j ⁡ ( x , y ) = { i ⁡ ( x , y ) for ⁢ ⁢ m ⁡ ( x , y ) = 1 0 for ⁢ ⁢ m ⁡ ( x , y ) ≠ 1 input : decision from box f output : restart image capture process : if m ( x , y ) is outside the pre - defined boundary , then the algorithm failed and a new image i ( x , y ) is captured and the process repeats . the invention is illustrated in more detail by the following non - limiting example . an image is shown in fig2 . fig2 a shows a boxed region which indicates the area of interest . fig2 b illustrates the output from a k - means algorithm in cielab space . in this example , 5 classes ( k = 5 ) were used . the selected in the coat are clearly selected ( they are dark blue here ). this image is the typical output of a k - means algorithm . this is the output from box b in the flow chart diagram . in this example the object is to select one green portion of the jacket . within the bounding box , several green portions exist , but the target is the largest connected portion . to determine a pixel in the largest portion , the image is blurred in the bounding box . this is the output from box c in the flow chart diagram . the greenest pixel in the blurred image is selected by the x as illustrated . this pixel location is the output from box d in the flow chart diagram . the mask image is created from the k - means image and the position marked by the x using the algorithm described for box e . the result is then checked to determine if the mask is at the edges of the bounding box . if not , the feature is complete . this is the analysis made by box f . in this case , the mask is applied to the input rgb image to obtain the segmented image . this is the output from box g . once the segmentation process is completed , a correction can be applied to the segmented portion ( e . g . re - color the teeth to whiten them ). the specific nature and amount of correction is predetermined as a function of the process being simulated ( e . g . the degree to which teeth can be whitened ). the guidelines for the correction can be captured as an equation , algorithm , or look - up table which can be , for example , used with interpolation to map current colors to new colors . once the correction is applied and the new pixels are determined , the old pixels are replaced with the modified ones . the segmentation method can be used in a device in which various components are integrated into a cabinet 10 that is designed to hang on a wall or sit on a shelf or counter . the device includes a means for capturing a digital image — typically either a conventional web cam or digital camera 14 , a display such as a conventional lcd - type color display 12 , a source of light ( not shown ), and an internal processor that runs the subject software . in its idle state , the display screen can display introductory information ( marketing - oriented messages , instructions , or continuous video of images as customers or individuals may see as they pass the camera ), and invites the customer to activate the unit by pressing the “ go ” button 16 on the front of the unit . the go button activates the software . a live image of the subject — as captured by the camera — appears on the screen . the subject is instructed ( using on screen prompts ) to position himself or herself such that the area of interest ( teeth or hair , for example ) appears in the on - screen box 18 , and to press the “ go ” button 16 again . pressing the go button the second time freezes the image on the screen , and begins the segmentation and color analysis . the device segments the image , identifying the pixels of interest , measures the color at multiple points , and calculates an average color value . the device performs calculations based on the initial coloring and displays the result , in this case an image of the customer having whiter teeth or an alternative hair color . after an appropriate delay , the device returns to the idle state . having described the invention in detail and by reference to specific embodiments thereof , it will be apparent the numerous modifications and variations are possible without separating from the spirit and scope of the invention .
a method for isolating an element of an image made up of pixels comprising the steps of classifying the pixels into different groups based on the color value of the pixel , blurring the image , locating a pixel in the blurred image that has a predetermined color value corresponding to the element to be isolated , and growing a mask from the located pixel .