# Patent

## Title
Up-sampling binary images for segmentation

## Abstract

A method of up-sampling binary images for segmentation is described. In an embodiment, digital images are down-sampled before segmentation. The resulting initial binary segmentation, which has a lower resolution than the original image, is then up-sampled and smoothed to generate an interim non-binary solution which has a higher resolution than the initial binary segmentation. The final binary segmentation for the image is then computed from the interim non-binary solution based on a threshold. This method does not use the original image data in inferring the final binary segmentation solution from the initial binary segmentation. In an embodiment, the method may be applied to all images and in another embodiment, the method may be used for images which comprise a large number of pixels in total or in single dimension and smaller images may not be down-sampled before segmentation.

## Background
BACKGROUND
A number of techniques have been proposed to enable extraction of the foreground from a scene, for example, the extraction of a person from a digital image showing the person standing in front of a scenic view. This process of splitting an image into the foreground and background is known as image segmentation. Image segmentation comprises labeling Image elements (such as pixels, groups of pixels, voxels or groups of voxels) as either a foreground or a background image element. This is useful in digital photography, medical image analysis, and other application domains where it is helpful to find a boundary between an object in the image and a background. The object and the background may then be processed separately, differently, etc. In the case of a medical image it may be appropriate to segment out a region of an image depicting a tumor or organ such as the lungs in order to enable a surgeon to interpret the image data.
As digital camera and other image acquisition technology develops, however, the resolution of the digital images being captured is increasing rapidly and as a result the size of image files is also increasing rapidly. Images of 10-20 MPixels are now not uncommon and many mobile phones contain cameras capable of capturing images of five MPixels or more. Medical imaging systems can acquire 3D volumes with billions of voxels. In addition to requiring larger storage units (both in the digital camera and for off-camera storage), these larger image file sizes require significantly more processing to achieve image segmentation. If known image segmentation techniques are applied to such high-resolution images, the process can be very slow and a user may experience unacceptable delays.
The embodiments described below are not limited to implementations which solve any or all of the disadvantages of known image segmentation techniques.
SUMMARY
The following presents a simplified summary of the disclosure in order to provide a basic understanding to the reader. This summary is not an extensive overview of the disclosure and it does not identify key/critical elements of the invention or delineate the scope of the invention. Its sole purpose is to present some concepts disclosed herein in a simplified form as a prelude to the more detailed description that is presented later.
A method of up-sampling binary images for segmentation is described. In an embodiment, digital images are down-sampled before segmentation. The resulting initial binary segmentation, which has a lower resolution than the original image, is then up-sampled and smoothed to generate an interim non-binary solution which has a higher resolution than the initial binary segmentation. The final binary segmentation solution for the image is then computed from the interim non-binary solution based on a threshold. This method does not use the original image data in inferring the final binary segmentation solution from the initial binary segmentation. In an embodiment, the method may be applied to all images and in another embodiment, the method may be used for images which comprise a large number of pixels in total or in single dimension and smaller images may not be down-sampled before segmentation.
Many of the attendant features will be more readily appreciated as the same becomes better understood by reference to the following detailed description considered in connection with the accompanying drawings.



DESCRIPTION OF THE DRAWINGS
The present description will be better understood from the following detailed description read in light of the accompanying drawings, wherein:
FIG. 1 is a schematic diagram of an image labeling system;
FIG. 2 is a flow diagram of an example method of performing image segmentation;
FIG. 3 is a flow diagram of an example method of image segmentation;
FIG. 4 shows a flow diagram of an example method of up-scaling;
FIG. 5 shows a flow diagram of another example method of up-scaling and a graphical representation of this method;
FIG. 6 shows a graphical representation of an optimization of the up-scaling process;
FIG. 7 is a flow diagram of another example method of performing image segmentation;
FIG. 8 is a schematic diagram of a user interface for performing image segmentation; and
FIG. 9 illustrates an exemplary computing-based device in which embodiments of the methods described herein may be implemented.



Like reference numerals are used to designate like parts in the accompanying drawings.
DETAILED DESCRIPTION
The detailed description provided below in connection with the appended drawings is intended as a description of the present examples and is not intended to represent the only forms in which the present example may be constructed or utilized. The description sets forth the functions of the example and the sequence of steps for constructing and operating the example. However, the same or equivalent functions and sequences may be accomplished by different examples.
Although the present examples are described and illustrated herein as being implemented in an image labeling system for foreground/background image segmentation, the system described is provided as an example and not a limitation. As those skilled in the art will appreciate, the present examples are suitable for application in a variety of different types of image labeling systems and a non-exhaustive list of examples is: 3D reconstruction, stereo matching, object segmentation, object recognition and optical flow.
FIG. 1 is a schematic diagram of an image labeling system 100 implemented using a computer or processor of any suitable type. It is arranged to receive an image 101 as input and to provide as output a labeled version of that image 104 comprising, for each of a plurality of image elements, one of a specified plurality of possible labels. An image element may be a pixel, a group of pixels, a voxel or a group of voxels and the plurality of image elements may comprise all the image elements in the image or the image elements in one or more portions of the image. The term “image” is used herein in a broad sense to include digital still images such as photographs, video stills, or other digital 2D images, medical images such as CT scans, MRI scans or other digital medical images, digital 3D images or higher dimensional images such as obtained from Z-cameras, voxel volumes, satellite imaging systems, ultra-sound scans, as well as sequences of images such as videos, or other captured or generated sequences of images. The image labeling system optionally receives user input 102 specifying “seeds” for the labeling in the case that the image labeling uses an interactive segmentation algorithm. The image labeling system also optionally receives a user specified threshold 103, although in some embodiments, this may not be user specified and may be set to a fixed value or automatically configured by the image labeling system itself.
The image labeling system 100 may comprise a down-scaling engine 105 arranged to reduce the resolution of the input image 101 as described in more detail below. The image labeling system 100 may also comprise an image segmentation engine 106, an up-scaling and smoothing engine 107 and a thresholding engine 108 and the operation of these engines is described in more detail below. In some embodiments, the image labeling system 100 may further comprise a selection engine 109 and operation of this engine is described below with reference to FIG. 7.
FIG. 2 is a flow diagram of an example method of performing image segmentation on an image, which may be an image comprising a large number of pixels, e.g. a 10 MPixel image. This method (and the other methods described herein) is described with reference to segmenting a foreground region from a background region in a digital image. However, it may be applied to other types of image labeling problem. It will also be appreciated that as camera technology advances, the numbers of pixels in an image may increase and any numbers of pixels given below are by way of example only.
The image is received (block 202) and is scaled down (block 204) to create a modified image 20 that is a version of the input image but has a lower resolution than the input image. Image segmentation is performed (in block 206) on the modified image 20 which creates an initial binary solution 22 (which may also be referred to as a binary mask). This initial binary solution 22 (or initial binary segmentation) labels image elements (e.g. pixels) in the modified image as being either foreground or background (as described above the labels may be applied to all the image elements in the image or to image elements in a portion of the image). In an embodiment of an initial binary solution, a parameter α, which is associated with an image element and may be referred to as an opacity value or binary segmentation parameter, has a value of zero or one. The initial binary solution 22 is then up-scaled and smoothed (block 208) to create an interim solution 24 which has a higher resolution than the initial binary solution 22 and the modified image 20. This interim solution 24 is a smooth, non-binary interpolated mask and may for example be a monochromatic interim solution, such as a gray-scale or red-scale solution, or a full color solution. In an embodiment of the interim solution, the parameter α, which may be referred to as a non-binary segmentation parameter, has a value between zero and one. In many embodiments, the interim solution 24 has the same resolution as the input image 20 but other resolutions may be appropriate in some applications.
In order to obtain a final binary segmentation solution 26 (which may also be referred to as a binary high resolution mask), a threshold is applied to the interim solution 24 (in block 210). The final binary segmentation solution 26 has substantially the same resolution as the interim solution and has a higher resolution than the initial binary solution 22 and the modified image 20. The final binary segmentation solution provides a label for image elements (e.g. pixels) in the image (e.g. in all or a part of the image) as being either foreground or background (e.g. α=0 or 1) and this solution can then be used by image editing tools to extract a portion of the image or for another purpose (e.g. modification or correction of a portion of image). The solution may also be used for image re-composition, e.g. extraction of a foreground from one image (such as a person) and composition of the extracted foreground onto a new background (such as a street). In some embodiments, further processing may be applied to the final binary segmentation solution 26. The results of the segmentation may be displayed to a user via a display (not shown in FIG. 2). e.g. the foreground or the background portions may be displayed or the two portions may be displayed as different layers within an image editing application or tool. The individual steps of the method shown in FIG. 2 are described in more detail below.
Although other methods may perform a part of the image segmentation process on a scaled down version of the input image, these other methods still use the original resolution input image data in order to infer the segmentation solution at the original resolution (i.e. the resolution of the image received in block 202). The method shown in FIG. 2 does not use the original resolution input image data (as received in block 202) or the modified image 20 (which is a version of the input image having lower resolution) in creating the binary segmentation in the original resolution image (i.e. in creating the final binary segmentation solution 26) and therefore may be considered ‘data independent’. The method of FIG. 2 reduces the processing required to perform image segmentation and hence reduces the runtime. This in turn improves the user experience as they do not experience large delays when extracting foreground from a digital image.
Where further processing is applied to the final binary segmentation solution 26 (i.e. after block 210), this may, in some examples, use the original resolution input image data (e.g. as received in block 202).
The input image, received in block 202, may be directly acquired (e.g. by a digital camera) or may be a digitized image (e.g. as created using a scanner) and although the method is described as being applied to images comprising a large number of image elements (e.g. pixels), the method may also be applied to images which comprise smaller numbers of image elements (e.g. 2 MPixel images). In an embodiment, the method may be applied to all images (i.e. to any input image received irrespective of the number of image elements in the image) or in another embodiment it may be applied to images where it is more efficient to use the method of FIG. 2 than to perform the image segmentation on the original resolution image (e.g. see the embodiment described below with reference to FIG. 7).
The down-scaling of the input image (in box 204, e.g. as performed by the down-scaling engine 105 in FIG. 1) may be performed using any suitable method and considering any appropriate factors for the application. In an embodiment, a box filter may be used (e.g. a box filter with fixed point arithmetic and threads parallelized over image regions) and in an example of such an embodiment, the down-scaling may be performed by looping over source image elements (i.e. image elements in the original image) and averaging them over each destination image element region (i.e. image elements in the modified image). In an embodiment, the input image may be down-scaled so that the modified image 20 is of a particular overall size in terms of the number of image elements (e.g. 1.5 MPixels) and in another embodiment, the input image may be down-scaled so that the modified image 20 has a predefined value of its longest dimension (e.g. 1024 pixels). In other embodiments, different criteria may alternatively be used.
The image segmentation of the modified image 20 (in block 206, e.g. as performed by the image segmentation engine 106 in FIG. 1) may be performed using any suitable segmentation method. An example of a suitable method (referred to herein as ‘GrabCut’) is described in U.S. patent application Ser. No. 10/861,771 (Publication No. 2005/0271273) which is incorporated herein by reference in its entirety. A brief overview of an embodiment of GrabCut is provided below with reference to FIG. 3. It will be appreciated that alternative segmentation methods may alternatively be used and GrabCut provides just one example of a suitable method. FIG. 3 is a flow diagram of an example method of image segmentation. This method uses graph cuts applied to a user defined bimap or trimap to segment an image into foreground and background regions. The image, which is considered to comprise pixels zn in color space, is segmented into a bimap or trimap based on user input (block 302). The user defines at least a background region (TB) and may also specify an unknown region (TU) and/or a foreground region (TF). Where the user defines only the background region, the foreground region is set to be the empty set (TF=Ø) and the unknown region is set to the complement of the background region (TU= TB). A parameter αn, which may be referred to as an opacity value, for each pixel is used to express the segmentation of the image and initially the opacity values are initialized as follows:

αn=0 for nεTB 

αn=1 for nεTU 

Gaussian mixture models (GMMs) may be used in defining the foreground and background properties (in block 304) and the foreground and background GMMs are initialized from sets αn=0 and αn=1 respectively. Each GMM (one for the background and one for the foreground) is taken to be a full-covariance Gaussian mixture with K components (e.g. K=5). A vector k=(k1, . . . , kn) is used, with knε{1, . . . , K} to assign a unique GMM component (one component either from the background or the foreground model) to each pixel according to the opacity value αn. For each pixel in the unknown region (i.e. for each n in TU) GMM components are assigned using:




  
    
      
        
          k
          n
        
        :=
        
          
            
              arg
              ⁢
              
                
              
              ⁢
              min
            
            
              k
              n
            
          
          ⁢
          
            
          
          ⁢
          
            
              D
              n
            
            ⁡
            
              (
              
                
                  α
                  n
                
                ,
                
                  k
                  n
                
                ,
                θ
                ,
                
                  z
                  n
                
              
              )
            
          
        
      
    
    
      
        (
        1
        )
      
    
  




And then the GMM parameters are learnt from the data z using:





  
    
      
        
          θ
          _
        
        :=
        
          
            
              arg
              ⁢
              
                
              
              ⁢
              min
            
            
              θ
              _
            
          
          ⁢
          
            
          
          ⁢
          
            U
            ⁡
            
              (
              
                
                  α
                  _
                
                ,
                k
                ,
                
                  θ
                  _
                
                ,
                z
              
              )
            
          
        
      
    
    
      
        (
        2
        )
      
    
  




The Gibbs energy for segmentation may be defined (in block 306) as:

E(α,k,θ,z)=U(α,k,θ,z)+V(α,z)  (3)

Where the parameter θ describes the image foreground and background distributions (as learned in block 304 using equation (2)), V is a smoothness term computed by Euclidean distance in color space, U evaluates the fit of opacity distribution α to the data z, given the parameter θ and taking account of the color GMM models, where:

U(α,k,θ,z):=ΣDn(αn,kn,θ,zn)  (4)

Where:

Dn(αn,kn,θ,zn)=−log p(zn|αn,kn,θ)−log π(αn,kn)

p( ) is a Gaussian probability distribution and π( ) are mixture weighting coefficients, so that (up to a constant):





  
    
      
        
          
            D
            n
          
          ⁡
          
            (
            
              
                α
                n
              
              ,
              
                k
                n
              
              ,
              
                θ
                _
              
              ,
              
                z
                n
              
            
            )
          
        
        =
        
          
            
              -
              log
            
            ⁢
            
              
            
            ⁢
            
              π
              ⁡
              
                (
                
                  
                    α
                    n
                  
                  ,
                  
                    k
                    n
                  
                
                )
              
            
          
          +
          
            
              1
              2
            
            ⁢
            log
            ⁢
            
              
            
            ⁢
            det
            ⁢
            
              ∑
              
                (
                
                  
                    α
                    n
                  
                  ,
                  
                    k
                    n
                  
                
                )
              
            
          
          +
          
            
              
                
                  1
                  2
                
                ⁡
                
                  [
                  
                    
                      z
                      n
                    
                    -
                    
                      μ
                      ⁡
                      
                        (
                        
                          
                            α
                            n
                          
                          ,
                          
                            k
                            n
                          
                        
                        )
                      
                    
                  
                  ]
                
              
              T
            
            ⁢
            
              ∑
              
                
                  
                    (
                    
                      
                        α
                        n
                      
                      ,
                      
                        k
                        n
                      
                    
                    )
                  
                  
                    -
                    1
                  
                
                ⁡
                
                  [
                  
                    
                      z
                      n
                    
                    -
                    
                      μ
                      ⁡
                      
                        (
                        
                          
                            α
                            n
                          
                          ,
                          
                            k
                            n
                          
                        
                        )
                      
                    
                  
                  ]
                
              
            
          
        
      
    
    
      
        (
        5
        )
      
    
  




Therefore the parameters of the model are:

θ={π(α,k),μ(α,k),Σ(α,k),α=0,1,k=1 . . . K}  (6)

The smoothness term V is computed as follows, (where the contrast term is computed using Euclidean distance in the color space):





  
    
      
        
          V
          ⁡
          
            (
            
              
                α
                _
              
              ,
              z
            
            )
          
        
        =
        
          
            γ
            ⁢
            
              
            
            ⁢
            
              
                ∑
                
                  
                    (
                    
                      m
                      ,
                      n
                    
                    )
                  
                  ∈
                  
                    
                  
                  ⁢
                  C
                
              
              ⁢
              
                
                  [
                  
                    
                      α
                      n
                    
                    ≠
                    
                      α
                      m
                    
                  
                  ]
                
                ⁢
                exp
              
            
          
          -
          
            β
            ⁢
            
              
                
                
                  
                    z
                    m
                  
                  -
                  
                    z
                    n
                  
                
                
              
              2
            
          
        
      
    
    
      
        (
        7
        )
      
    
  




Where C is the set of pairs of neighboring pixels. When the constant β=0, the smoothness term is simply the well-known Ising prior, encouraging smoothness everywhere, to a degree determined by the constant γ. In an implementation, β may be greater than zero to relax the tendency to smoothness in regions of high contrast. The constant β may be chosen as:





  
    1
    β
  
  =
  
    2
    ⁢
    
      〈
      
        
          (
          
            
              z
              m
            
            -
            
              z
              n
            
          
          )
        
        2
      
      〉
    
  




Where < > denotes expectation over an image sample. In an implementation, such a choice of β ensures that the exponential term in V (equation (7)) switches appropriately between high and low contrast.

Given the energy model described above, the foreground and background portions can be computed (in block 308) by using a standard minimum cut algorithm to solve:




  
    
      
        
          min
          
            {
            
              
                α
                n
              
              :
              
                n
                ∈
                
                  T
                  U
                
              
            
            }
          
        
        ⁢
        
          
            min
            k
          
          ⁢
          
            E
            ⁡
            
              (
              
                
                  α
                  _
                
                ,
                k
                ,
                
                  θ
                  _
                
                ,
                z
              
              )
            
          
        
      
    
    
      
        (
        8
        )
      
    
  




All pixels in the trimap region TB are assigned to background and all pixels in TF to foreground. Pixels in TU are assigned to either foreground or background, depending on the result of the energy minimization (equation (8)).

The process may be repeated, as indicated by the dotted arrow 30, in an iterative minimization process (or other iterative optimization process) until convergence. Further processing may then be used, such as border matting.
In another example of further processing, an additional image segmentation process may be performed. In such an embodiment, a band or ribbon of image elements is identified from the final segmentation solution 26 (e.g. following block 210 in FIG. 2). This band or ribbon comprises image elements within a defined distance of a foreground/background transition. Image segmentation at the original resolution of the input image may then be performed on those image elements within the band or ribbon and the results used to update the final segmentation solution 26.
Having segmented the image (in block 206) and generated an initial binary solution 22, this initial binary solution is up-scaled (or up-sampled) and smoothed to generate an interim solution 24 (in block 208, e.g. as performed by the up-scaling and smoothing engine 107 in FIG. 1) which has a higher resolution than the initial binary solution 22 and which is a smooth, non-binary interpolated solution (as described above). FIG. 4 shows a flow diagram of an example method of up-scaling and smoothing which may be used. In this method, the initial binary solution 22 is first up-scaled using nearest-neighbor up-scaling (block 402) which generates a binary intermediate solution of higher resolution than the initial binary solution. This intermediate solution is then smoothed using a 2D Gaussian function as an interpolating kernel (block 404) in order to create the interim solution 24. If the binary intermediate solution was used instead of the final binary segmentation solution as the output from the method (i.e. without performing the smoothing operation), the segmentation would be of poor quality because of up-scaling artifacts.
In another embodiment, however, the convolution and up-scaling may be performed in a single step (block 502), as shown in FIG. 5. In this embodiment, a Gaussian kernel is sampled at the image element centers in the interim solution (i.e. the output image element centers for this step which are more closely spaced than the image element centers in the initial binary solution) and convolved with the initial binary solution 22 to generate the interim solution 24. As described above, the interim solution 24 is a non-binary solution of higher resolution than the initial binary solution 22 and may be referred to as a monochrome or gray-scale solution. A one-dimensional (1D) representation 500 of this operation, also in FIG. 5, which uses pixels as the image element, shows the pixel centers 504 from the initial binary solution 22, a graphical representation 506 of the initial binary solution 22, a Gaussian function 508 and the pixel centers 510 from the resultant interim solution 24. In this 1D example, the opacity value (which may alternatively be referred to as a gray-scale value or non-binary segmentation parameter) of the pixel marked by arrow 512 comprises a weighted sum of the four opacity values α1-α4. The weights are given by the Gaussian interpolation function, as indicated by the dotted lines in FIG. 5. By performing the convolution and up-scaling in a single step, as shown in FIG. 5, the amount of computation that is required to perform the interpolation is reduced (e.g. M2 compared to (Mu)2, where u is the up-scaling factor and the Gaussian interpolation function comprises a M×M kernel). The method shown in FIG. 5 provides an efficient method of smoothly up-scaling binary images for use in image segmentation.
In order to further reduce the computational requirements for interpolation, the interpolation may be performed in two passes (e.g. by processing rows and columns of the image in two separate passes) and a 1D Gaussian kernel may be used (e.g. a 1×N kernel followed by a N×1 kernel rather than using a N×N kernel, which reduces the amount of computation for each pixel from N2 multiply-add operations to 2N, where N is an integer). FIG. 6 shows a graphical representation of this optimization of the up-scaling and smoothing process (of block 208). In a first step (arrow 602), sampling and convolution occurs in the x-dimension (or horizontal dimension i.e. processing rows) to generate an intermediate solution 64 (e.g. 300×40 pixels in size, for an up-scaling factor of 5) from the initial binary solution 62 (e.g. 60×40 pixels). The sampling and convolution in the γ-dimension (or vertical dimension, arrow 604, i.e. processing columns) is then applied to the intermediate solution 64 to create the interim solution 66 (e.g. 300×200 pixels). This optimization provides larger savings where a bigger kernel is used but may be used for any size of kernel and may be used with either of the methods described above (e.g. the two passes may be implemented within the single step of block 502 shown in FIG. 5).
In an example, the standard deviation of the Gaussian kernel used in the methods described above is, in terms of image elements (e.g. pixels), approximately 0.74 times the up-scaling factor (in the interim solution image space, or 0.74 pixels in the initial binary solution image space). Although the above description refers to the use of a Gaussian function as an interpolating or smoothing kernel, it will be appreciated that other functions may alternatively be used for the interpolation, such as a Lanczos filter, tent filter or cubic polynomial. Additionally it will be appreciated that the two pass process shown in FIG. 6 and described above may be used with any separable kernel and not just with a Gaussian kernel.
Having generated an interim solution 24 (in block 208), a threshold is applied (in block 210, e.g. as performed by the thresholding engine 108 in FIG. 1) to create the final binary segmentation solution 26. This threshold (which may be a user specified threshold 103, as shown in FIG. 1) may be set at the mid-point, e.g. the threshold, which is applied to the opacity values α, is, for example, set at 0.5, or alternatively another value may be used (e.g. a value higher than 0.5 may be used in an embodiment which favors background image elements above foreground image elements).
Once the final binary segmentation solution 26 has been generated (in block 210), the solution may be displayed to a user via a display device. In some embodiments, the solution 26 may be processed further before being presented to the user (as described above). Once the solution has been displayed to the user, the user may refine the segmentation through user editing. This user editing may result in a further image segmentation process being performed and this may use one of the methods described herein.
FIG. 7 is a flow diagram of another example method of performing image segmentation which is a variation of that shown in FIG. 2 and described above. In this method, a decision is made (in block 702, e.g. as performed by the selection engine 109 in FIG. 1) which determines whether the image segmentation is performed on the original input image (in block 704) or on a modified image which comprises a reduced resolution version of the image (in block 206). The decision may be made (in block 702) by comparing a size parameter of the image, S, with a threshold, Th. In an embodiment, the size parameter is the number of image elements in the original input image and the threshold may, for example, be set at 1.3 or 1.5 MPixels. If the image file (received in block 202) has a size parameter which is equal in size or larger than the threshold size (i.e. the size parameter is not smaller than the threshold size), it is down-scaled to a smaller predefined size, e.g. 0.8 or 1.0 MPixels (in block 204). In another embodiment, the size parameter is the longest dimension of the image in terms of image elements and the threshold may, for example, be set at 1280 pixels. If the longest dimension of the image (received in block 202) is 1280 pixels or more, the image is down-scaled to a smaller predefined size, e.g. such that its longest dimension is 1024 pixels (in block 204).
Where the original image (received in block 202) is segmented without down-scaling (in block 704), any suitable image segmentation method may be used. In an example, the GrabCut method, as described above with reference to FIG. 3, may be used.
The values of the thresholds given above are provided by way of example only and other values may alternatively be used. In an embodiment, the threshold and the predefined size may be the same, such that all images which are larger than (or not smaller than) the predefined size (however this is specified) are downscaled to the predefined size. In another embodiment, a predefined size may not be used and instead a down-scaling factor may be defined. In this embodiment, if the size parameter of the image exceeds the threshold (‘Yes’ in block 702), the image is down-scaled (in block 204) by the predefined down-scaling factor before being segmented (in block 206). The values of the threshold, smaller predefined size and/or down-scaling factor may be set to maximize the efficiency of the method, dependent upon the processing power available, the speed required and the required quality of the segmentation.
The methods described above may be implemented in an image editing tool within a software application. In an embodiment, the software application is an image editing application. In another embodiment, the software application is not a dedicated image editing application, but may instead be a word processing application, a spreadsheet application, a slide presentation application, a database application, an email application etc. Where a number of software applications are combined within a multiple functionality application, the image editing tool may be available within each application and may be presented to the user in the same or a similar manner in each application within the multiple functionality application. In an example, a dedicated control 802 for image segmentation may be provided within a ribbon-shaped user interface 804 above the software application workspace 806, as shown in the schematic diagram of FIG. 8.
When a user clicks (e.g. with a mouse or other pointing device, which may include a finger if the display device is touch sensitive) on the dedicated control 802, having selected an image 808 which is displayed in the software application workspace 806, one of the methods (e.g. the method shown in FIG. 2 or FIG. 7) described herein is performed, for example, the step of down-scaling the image to generate a modified version of the image may be performed in response to receiving a user input, such as a user click. The image 808 may, for example, have been pasted into a word processing document, a spreadsheet, an email, a database or a slide presentation. User interaction may be used (e.g. user brush strokes 102, as shown in FIG. 1) to define the bimap or trimap which is used in segmentation of the image (e.g. in block 302 of FIG. 3) and this user input may be provided before or after clicking on the dedicated control 802. In an example, the user marks a rectangle on the image (e.g. as indicated by dotted rectangle 810) and this has the effect that the initial background region (e.g. TB using the notation of the GrabCut example provided above) is set to the area outside the marked rectangle. In another example, the background region may be set to comprise a strip of image elements (e.g. pixels) around the outside of the marked rectangle. Other forms of user input may be used and the user input received may be interpreted in different ways in setting the initial background/foreground regions.
FIG. 9 illustrates various components of an exemplary computing-based device 900 which may be implemented as any form of a computing and/or electronic device, and in which embodiments of the methods described herein may be implemented.
Computing-based device 900 comprises one or more processors 902 which may be microprocessors, controllers or any other suitable type of processors for processing computing executable instructions to control the operation of the device in order to perform image segmentation, as described herein. Platform software comprising an operating system 904 or any other suitable platform software may be provided at the computing-based device to enable application software 906 to be executed on the device. The application software 906 may include software (i.e. executable instructions) for performing image segmentation or separate software 908 may be provided. Where separate software is provided, this may be called by the application software 906 or may be called directly by the user (e.g. as an image segmentation application).
The computer executable instructions may be provided using any computer-readable media, such as memory 910. The memory is of any suitable type such as random access memory (RAM), a disk storage device of any type such as a magnetic or optical storage device, a hard disk drive, or a CD, DVD or other disc drive. Flash memory, EPROM or EEPROM may also be used. Although the memory is shown within the computing-based device 900 it will be appreciated that the storage may be distributed or located remotely and accessed via a network or other communication link (e.g. using communication interface 914).
The memory 910 may comprise an image store 912 for storing the images which are segmented using the methods described herein. In an embodiment, the image file may be received (in block 202) having been accessed from the image store 912. In another embodiment, the image file may be received from another location, e.g. via a communication interface 914, and stored in the image store 912. The communication interface 914 is arranged to send/receive information over a network 916. Any suitable network technology (including wired and wireless technologies) and network protocol(s) may be used.
The computing-based device 900 also comprises an input/output controller 918 arranged to output display information to a display device 920 which may be separate from or integral to the computing-based device 900. The display information may provide a graphical user interface and may be arranged to display the results of the image segmentation method described herein to the user. The input/output controller 918 is also arranged to receive and process input from one or more devices, such as a user input device 922 (e.g. a mouse or a keyboard). This user input may be used to initiate image segmentation (e.g. by clicking control 802), to select the image to be segmented, to define a bimap/trimap (as used in block 302 of FIG. 3) etc. In an embodiment the display device 920 may also act as the user input device 922 if it is a touch sensitive display device. The input/output controller 918 may also output data to devices other than the display device, e.g. a locally connected printing device (not shown in FIG. 9).
Although the present examples are described and illustrated herein as being implemented in the system shown in FIG. 9, the system described is provided as an example and not a limitation. As those skilled in the art will appreciate, the present examples are suitable for application in a variety of different types of computing systems.
The term ‘computer’ is used herein to refer to any device with processing capability such that it can execute instructions. Those skilled in the art will realize that such processing capabilities are incorporated into many different devices and therefore the term ‘computer’ includes PCs, servers, mobile telephones, personal digital assistants and many other devices.
The methods described herein may be performed by software in machine readable form on a tangible storage medium. Examples of tangible (or non-transitory) storage media include disks, thumb drives, memory etc and do not include propagated signals. The software can be suitable for execution on a parallel processor or a serial processor such that the method steps may be carried out in any suitable order, or simultaneously.
This acknowledges that software can be a valuable, separately tradable commodity. It is intended to encompass software, which runs on or controls “dumb” or standard hardware, to carry out the desired functions. It is also intended to encompass software which “describes” or defines the configuration of hardware, such as HDL (hardware description language) software, as is used for designing silicon chips, or for configuring universal programmable chips, to carry out desired functions.
Those skilled in the art will realize that storage devices utilized to store program instructions can be distributed across a network. For example, a remote computer may store an example of the process described as software. A local or terminal computer may access the remote computer and download a part or all of the software to run the program. Alternatively, the local computer may download pieces of the software as needed, or execute some software instructions at the local terminal and some at the remote computer (or computer network). Those skilled in the art will also realize that by utilizing conventional techniques known to those skilled in the art that all, or a portion of the software instructions may be carried out by a dedicated circuit, such as a DSP, programmable logic array, or the like.
Any range or device value given herein may be extended or altered without losing the effect sought, as will be apparent to the skilled person.
It will be understood that the benefits and advantages described above may relate to one embodiment or may relate to several embodiments. The embodiments are not limited to those that solve any or all of the stated problems or those that have any or all of the stated benefits and advantages. It will further be understood that reference to ‘an’ item refers to one or more of those items.
The steps of the methods described herein may be carried out in any suitable order, or simultaneously where appropriate. Additionally, individual blocks may be deleted from any of the methods without departing from the spirit and scope of the subject matter described herein. Aspects of any of the examples described above may be combined with aspects of any of the other examples described to form further examples without losing the effect sought.
The term ‘comprising’ is used herein to mean including the method blocks or elements identified, but that such blocks or elements do not comprise an exclusive list and a method or apparatus may contain additional blocks or elements.
It will be understood that the above description of a preferred embodiment is given by way of example only and that various modifications may be made by those skilled in the art. The above specification, examples and data provide a complete description of the structure and use of exemplary embodiments of the invention. Although various embodiments of the invention have been described above with a certain degree of particularity, or with reference to one or more individual embodiments, those skilled in the art could make numerous alterations to the disclosed embodiments without departing from the spirit or scope of this invention.

## Claims

1. A method comprising:
receiving, by a computer, an image;
generating a modified image from the image, the modified image having a lower image resolution than the image;
segmenting at least a part of the modified image into a background portion and a foreground portion to create an initial binary solution, the initial binary solution comprising data labeling a plurality of image elements in the modified image as either background or foreground;
up-scaling and smoothing the initial binary solution to create an interim solution having a higher resolution than the initial binary solution and comprising a non-binary segmentation parameter associated with each of a plurality of image elements in the interim solution; and
based on a threshold, creating a final binary segmentation solution from the interim solution, the final binary segmentation solution having substantially the same resolution as the interim solution and comprising data labeling a plurality of image elements in the received image as either background or foreground.

2. A method according to claim 1, wherein the up-scaling and smoothing is performed without using the received image.

3. A method according to claim 1, wherein up-scaling and smoothing the initial binary solution to create an interim solution comprises:
interpolating the initial binary solution by convolution with a smoothing kernel to compute a non-binary segmentation parameter for each of a plurality of image elements in the interim solution.

4. A method according to claim 3, wherein the smoothing kernel comprises a Gaussian kernel.

5. A method according to claim 4, wherein the Gaussian kernel comprises a one-dimensional Gaussian kernel and wherein interpolating the initial binary solution by convolution with a smoothing kernel comprises processing rows and columns of the initial binary solution in two separate passes.

6. A method according to claim 5, wherein a standard deviation of the one-dimensional Gaussian kernel is substantially equal to 0.74 times the size of an image element in the initial binary solution.

7. A method according to claim 1, wherein segmenting at least a part of the modified image into a background portion and a foreground portion to create an initial binary solution comprises:
segmenting the modified image into a foreground portion and a background portion;
determining properties corresponding to the foreground and background portions;
updating the background and foreground properties based on the portions; and
updating the foreground and background portions based on the updated background and foreground properties.

8. A method according to claim 1, further comprising:
displaying, on a display device, at least one of a background and a foreground portion of the image, the background and foreground portions being determined using the final binary segmentation solution.

9. A method according to claim 1, implemented in an image editing tool in a software application.

10. A method according to claim 9, wherein the software application comprises one of a word processing application, a spreadsheet application, a slide presentation application, a database application and an email application.

11. A method according to claim 1, wherein the step of generating a modified image from the image is performed in response to receiving at least one user input.

12. One or more tangible device-readable media with device-executable instructions that, when executed by a computing system, direct the computing system to perform steps comprising:
accessing an image; and
if a size parameter associated with the image is not less than a predefined threshold:
down-scaling the image to create a modified image from the image, the modified image having a lower image resolution than the image;
segmenting the modified image to create an initial binary solution comprising a binary parameter associated with each of a plurality of image elements in the modified image, the binary parameter assigning an image element to a background or a foreground portion;
up-scaling and smoothing the initial binary solution to form an interim solution, the interim solution having a higher resolution than the initial binary solution and comprising a non-binary parameter associated with each of a plurality of image elements in the interim solution; and
generating a final binary segmentation solution based on a threshold value of the non-binary parameter, the final binary segmentation solution having a higher resolution than the initial binary solution and comprising data assigning a plurality of image elements in the accessed image to either a background or a foreground portion.

13. One or more tangible device-readable media according to claim 12, wherein the up-scaling and smoothing is performed without using the accessed image.

14. One or more tangible device-readable media according to claim 12, further comprising device-executable instructions that, when executed by a computing system, direct the computing system to perform a step comprising:
displaying at least one background or foreground portion of the image.

15. One or more tangible device-readable media according to claim 12, wherein the size parameter comprises one of a number of image elements in the image and a longest image dimension.

16. One or more tangible device-readable media according to claim 12, wherein up-scaling and smoothing the initial binary solution to form an interim solution comprises:
sampling a smoothing kernel at an image element center in the interim solution;
convolving the smoothing kernel with the initial binary solution to compute a non-binary parameter for the image element; and
repeating the sampling and convolving steps for each of the plurality of image elements in the interim solution.

17. One or more tangible device-readable media according to claim 16, wherein the sampling and convolving is performed in two passes, one pass using a 1×N Gaussian kernel and one pass using a N×1 Gaussian kernel, where N is an integer.

18. A computer-implemented method of segmenting an image into a foreground portion and a background portion comprising:
accessing the image;
down-scaling the image to create a modified version of the image having a lower image resolution than the image;
segmenting the modified version of the image to generate an initial binary segmentation, the initial binary segmentation comprising data labeling a plurality of image elements in the modified version of the image as part of a background portion or a foreground portion;
generating an interim solution having a higher resolution than the initial binary segmentation by, for each of a plurality of image elements in the interim solution, computing a non-binary value by convolving an interpolation kernel centered on the image element with the initial binary segmentation;
based on a threshold, generating a final binary segmentation solution having substantially the same resolution as the interim solution and comprising data labeling a plurality of image elements in said image as part of a background portion or a foreground portion; and
displaying at least one background or foreground portion of said image.

19. A computer-implemented method according to claim 18, wherein segmenting the modified of the image comprises:
segmenting the modified version of the image into a foreground portion and a background portion;
determining properties corresponding to the foreground and background portions;
updating the background and foreground properties based on the portions; and
updating the foreground and background portions based on the updated background and foreground properties.

20. A computer-implemented method according to claim 18, wherein computing a non-binary value by convolving an interpolation kernel centered on the image element with the initial binary segmentation uses a one-dimension Gaussian kernel and is performed in two passes, one operating on rows of image elements and one operating on columns of image elements.