# Patent

## Title
Image detail enhancement and edge sharpening without overshooting

## Abstract

A method can include receiving an input image, performing an edge-preservation enhancement on the input image, performing a local-extrema enhancement on the input image, and performing a digital transient improvement (DTi) operation on the input image. A gradient-based fusion of an output of the edge-preserving enhancement and an output of the local-extrema enhancement may be performed, and a transient-based fusion of an output of the gradient-based fusion and an output of the DTi operation may also be performed.

## Background
CROSS-REFERENCE TO RELATED APPLICATION
This application is related to U.S. patent application Ser. No. 14/106,366, titled TWO-DIMENSIONAL DIGITAL TRANSIENT IMPROVEMENT and filed on Dec. 13, 2013, the content of which is fully incorporated by reference herein.
TECHNICAL FIELD
The disclosed technology pertains to image processing, and more particularly to techniques pertaining to image detail enhancement and edge sharpening.
BACKGROUND
Image enhancement techniques are essential for improving image quality. Sharp images delivered by effective enhancement techniques offer incomparable visual appeal to a viewer.
Traditional enhancement techniques enhance image detail by way of mask filters or other high-pass filters. Though such filters do enhance details, they also introduce many artifacts such as overshooting, halo effect, and ringing, and serve to make the processed image appear unnatural to the viewer.
Current edge-preserving enhancement methods may avoid overshooting, halo effect, and ringing artifacts but in so doing sacrifice the sharpening of edges. One technique includes progressively coarsening an image by way of an edge-preserving operator based on the weighted least squares (WLS) framework, constructing an edge-preserving multi-scale image decomposition, and then enhancing the details at multi-scales. This algorithm only enhances details that are not at an edge, however, and thus does not permit many image enhancement tasks. Moreover, the computation cost and time of WLS operations are significant because a WLS scheme needs a global optimization.
Other current techniques may achieve edge-aware detail enhancement through simple point-wise manipulation of Laplacian pyramids but, similar to the technique discussed above, this technique only enhances details that are not at an edge. Also, because for each pixel in every scale pixel remapping and Laplacian pyramids are computed in a region surrounding this pixel, the processing time and cost are both significant.
Other current techniques may enhance an image by way of a multi-scale morphology. Such techniques can achieve edge-sharpening without the above artifacts by increasing the value of a pixel (i.e., making the pixel brighter) if the pixel value is much closer to a local maximal pixel value than a local minimal one; otherwise, the pixel value is decreased, i.e., the pixel is made darker. Although this enhancement performance is generally better than other methods, the computational time and required resources are both high. Moreover, this technique is very sensitive to noise, especially in large-scale operations.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 illustrates an example of a detail enhancement and edge sharpening framework according to certain embodiments of the disclosed technology.
FIG. 2 illustrates a process of gradient calculation with bilateral filtering and dilation filtering.



DETAILED DESCRIPTION
Embodiments of the disclosed technology generally pertain to detail enhancement and edge sharpening techniques that avoid overshooting, halo effects, and ringing artifacts, and deliver a processed image having rich details and sharp edges. Such techniques may include the utilization of various methods such as edge-preserving enhancement, local extrema enhancement, and digital transient improvement.
Edge-preserving enhancement techniques generally deal with image details without large gradients, so edges with large gradients may be preserved and, thus, no halo effect is provoked. Local-extrema based enhancement techniques generally deal with details and edges with large gradients. Digital transient improvement techniques may be applied to change transitional edges from smooth to sharp.
Framework of Image Detail Enhancement and Edge Sharpening Techniques without Overshooting
Image detail enhancement and edge sharpening techniques that avoid overshooting may be accomplished by way of an algorithm includes three parts: edge-preserving enhancement, local extrema enhancement, and digital transition improvement. Such an algorithm can deal with luminance (Y) and chroma (Cb, Cr) channels respectively. Because human vision is generally more sensitive to luminance than chroma, enhancement only may be implemented for luminance.
FIG. 1 illustrates an example of a detail enhancement and edge sharpening framework 100 according to certain embodiments of the disclosed technology. The framework 100 includes an edge-preserving enhancement block 101, a local extrema enhancement block 121, and a gradient-based fusion block 132. In the example, the framework 100 also includes a digital transient improvement (DTi) block 134 and a transition-based fusion block 136.
Edge-Preserving Enhancement Block
The edge-preserving enhancement block 101 generally deals only with image details without large gradients. The edge-preserving enhancement block 101 first decomposes an image I into K levels. The image of level (i+1) is generally coarser than that of level i except for edges, i.e., i=0, 1, . . . , K−1. In all of these levels, the details may be smoothed while any edges may be preserved as those in original image.
Whereas current techniques may use a global-optimization WLS framework to achieve edge-preserving smoothness, the computational time and cost of which are significant, the edge-preserving enhancement block 101 may achieve edge-preserving smoothness by simple edge-adaptive low pass filtering in local windows. Thus, no optimization technique is required and there is greater control over the preservation of edges.
In the example, the edge-preserving enhancement block 101 has a gradient calculation with bilateral filtering and dilation filtering block 102. FIG. 2 illustrates a detailed example of the gradient calculation with bilateral filtering and dilation filtering block 102. In the example, the gradient calculation with bilateral filtering and dilation filtering block 102 has a gradient calculation block 202, a bilateral filtering 204, and a dilation filtering block 206.
The gradient calculation block 202 of the gradient calculation with bilateral filtering and dilation filtering block 102 may perform a gradient calculation in which, for a given pixel p(r, c), the gradient may be calculated based on its forward difference as shown below:

gx=p(r,c+1)−p(r,c);

gy=p(r+1,c)−p(r,c);

r_gxy=max(abs(gx),abs(gy)).

where r_gxy is the raw gradient of pixel p(r, c).
The bilateral filtering 204 of the gradient calculation with bilateral filtering and dilation filtering block 102 may be used to refine the raw gradients. For a pixel p(r, c) with gradient r_gxy(r, c), gradients in a 3×5 window surrounding the pixel p(r,c) may be fetched and the weights may be computed based on gradient difference and spatial distance, for example.
The weight may be computed based on gradient difference by way of the following:

g_wgt(s,t)=fg(abs(gxy_raw(r,c)−gxy_raw(s,t)))

where fg may be a monotone-decreasing exponential function.
The weight may be computed based on spatial distance by way of the following:

s_wgt(s,t)=fs(∥(s−r,t−c)∥))

where fs may be a monotone-decreasing exponential function.
The weight for the bilateral filtering may be computed as follows:

b_wgt(s,t)=g_wgt(s,t)*s_wgt(s,t)

The bilateral filtering 204 may then be determined by way of the following:




  
    b_gxy
    ⁢
    
      (
      
        r
        ,
        c
      
      )
    
  
  =
  
    
      
        ∑
        
          
            (
            
              s
              ,
              t
            
            )
          
          ∈
          
            N
            ⁡
            
              (
              
                r
                ,
                c
              
              )
            
          
        
      
      ⁢
      
        b_wgt
        ⁢
        
          (
          
            s
            ,
            t
          
          )
        
        *
        r_gxy
        ⁢
        
          (
          
            s
            ,
            t
          
          )
        
      
    
    
      
        ∑
        
          
            (
            
              s
              ,
              t
            
            )
          
          ∈
          
            N
            ⁡
            
              (
              
                r
                ,
                c
              
              )
            
          
        
      
      ⁢
      
        b_wgt
        ⁢
        
          (
          
            s
            ,
            t
          
          )
        
      
    
  




After bilateral filtering, the dilation filtering block 206 may replace the original gradient with a maximal gradient in a 3×3 neighborhood in a gradient field generated by the bilateral filtering 204.
In the example, K levels of low pass filtering with different smoothness are used. Here, K is 2. Each low pass filtering, such as 104 and 105, may be performed by convolving the input image with one low pass filter. From level 1 to level K, the corresponding low pass filters are more and more soft. So, the image results after low pass filtering become progressively coarser from level 1 to level K, i.e., more and more details are removed. Comparing 104 and 105, the result of 105 has fewer details (i.e., coarser) than that of 104.
Edge-preserving filterings 108 and 114 may be used to preserve the edge and detail with large gradient. For a pixel p, its low pass filtering result p_lpf may be determined from the low pass filtering sub-block. The 3×3 video data surrounding pixel p may be retrieved from the original input image, then the maximum p_max and minimum p_min in the window may be determined. The low pass filtering p_lpf may be limited to a range between p_min and p_max as follows:

p_lpf=max(min(p_lpf,p_max),p_min).

This logic aims to avoid that a pixel on one side of an edge is changed too much by the pixel on the other side of the edge after low pass filtering.
Based on the gradient value gxy, the blending weight between p and p_lpf may be solved. The larger the gradient is, the smaller the weight may be. This logic may be as follows:

if(gxy<Gxy_Low_Thr)wgt=1;

else if(gxy<Gxy_High_Thr)wgt=1−(gxy−Gxy_Low_Thr)*Gxy_High_Slope;

else wgt=Gxy_High_Gain−(gxy−Gxy_High_Thr)*Gxy_Large_Slope;

wgt=max(wgt,0);

Here, Gxy_Low_Thr and Gxy_High_Thr are thresholds to control gradient interval partition. Gxy_High_Slope and Gxy_Large_Slope are slopes to adjust weight curve. And Gxy_High_Gain equals 1−(Gxy_High_Thr-Gxy_Low_Thr)*Gxy_High_Slope.

p and p_lpf may be blended as follows:

p_ep=p+wgt*(p_lpf−p).

After edge preserving filtering, the edges and details with large gradients are preserved while the rest pixels are smoothed, whose smoothness level is controlled by low pass filtering. Compared 108 and 114, the result of 114 is much smoother than that of 108.
In the example, the edge-preserving enhancement block 101 also includes multiple detail layer extraction blocks 110 and 116. For level 1, the detail may be defined as the difference between the input image I (i.e., whose pixels are p(r, c)) and the edge-preserving filtered image of level 1 (whose pixels are p_ep1(r,c)), in accordance with the following:

di(r,c)=p(r,c)−p_ep1(r,c).

For another level i (level 2 in the example), the detail may be defined as the difference between the edge-preserving filtered image of level i−1 (i.e., whose pixels are p_epi-1(r, c)) and that of level i (i.e., whose pixels are p_ep1(r, c)), in accordance with the following:

di(r,c)=p_epi-1(r,c)−p_epi(r,c).

Detail remapping blocks 112 and 118 may use a remapping function to enhance details after they've been extracted in accordance with a remapping framework: for smooth regions and regions with large gradients, it is usually not appropriate to do enhancement so, in such situations, the details will generally remain unchanged; for other regions, however, enhancement may be performed. The basic remapping of detail may be calculated based on a sigmoid function as follows:




  d_brmp
  =
  
    Std
    *
    
      (
      
        
          1
          
            1
            +
            
              exp
              ⁡
              
                (
                
                  
                    -
                    alpha
                  
                  *
                  d_raw
                
                )
              
            
          
        
        -
        0.5
      
      )
    
  




where d_raw refers to the original detail (i.e., di(r, c)) and d_brmp refers to the basic remapped detail.

The remapped details may be further adjusted based on the remapping framework noted above. First, the average detail level in the 3×3 neighborhood may be calculated as follows:




  d_avg
  =
  
    
      (
      
        d_raw
        ⊗
        
          (
          
            
              
                1
              
              
                2
              
              
                1
              
            
            
              
                2
              
              
                4
              
              
                2
              
            
            
              
                1
              
              
                2
              
              
                1
              
            
          
          )
        
      
      )
    
    /
    16
  




Then, the weight for blending raw details and remapped details may be calculated in accordance with the following:

if(d_avg<Detail_Low_Thr)d_wgt=min((Detail_Low_Thr−d_avg)*Detail_Low_K,1);

else if(d_avg<Detail_High_Thr)d_wgt=0;

else d_wgt=min((d_avg−Detail_High_Thr)*Detail_High_K,1).

Here, Detail_Low_Thr and Detail_High_Thr are threshold to partition average detail interval, Detail_Low_K and Detail_High_K are gains to control blending weight.

The remapped details d_rmp may be adjusted by blending the raw details and basic remapped details in accordance with the following:

d_rmp=d_brmp+wgt*(d_raw−d_brmp).

A reconstruction block 120 may be used to reconstruct the image after the details have been remapped in each level. For an input pixel p, the result p_ep_enh by edge-preserving based enhancement is as follows:




  
    p_ep
    ⁢
    _enh
  
  =
  
    
      p_ep
      K
    
    +
    
      
        ∑
        
          i
          =
          1
        
        K
      
      ⁢
      
        d_rmp
        i
      
    
  




Here, p— epK refers to the edge-preserving filtered result at level K and d_rmpi refers to the remapped details at level i. p_ep_enh represents the enhanced output.
Local Extrema Enhancement Block
The local-extrema enhancement block 121 may be used to enhance details and edges with large gradients while avoiding artifacts such as overshooting, halo effect, and ringing. Whereas current techniques use multi-scale operators, the local-extrema enhancement block 121 uses only a single scale operator because the edge-preserving enhancement block 101 enhances many details and the residual parts are strong edges and details that can be enhanced in a small local window. So, the local-extrema enhancement block 121 advantageously preserves resources and provides faster processing times.
In the example, a first erosion block 122 and a first dilation block 124 may be used to process an open operator. For each pixel p(r, c), the first erosion block 122 may find the minimum pixel p_eros(r, c) in a 3×3 window of the input image. For each pixel p_eros(r, c), the first dilation block 124 may find the maximum pixel in a 3×3 window of the erosion image. The open result is p_open.
In the example, a second dilation block 126 and a second erosion block 128 may be used to process a close operator. For each pixel p(r, c), the second dilation block 126 may find the maximum pixel p_dila(r, c) in a 3×3 window of the input image. For each pixel p_dila(r, c), the second erosion block 128 may find the minimum pixel in a 3×3 window of the dilation image. The close result is p_close.
A local-extrema enhancement processing block 130 may be used to solve the delta between original input pixels p and open/close pixels in accordance with the following:

p_open_delta=p−p_open;

p_close_detaI=p−p_close;

The delta may then be synthesized as follows:

p_delta=max(min(LE_K*(p_open_delta+p_close_detal),LE_Thr),−LE_Thr);

Here, LE_K and LE_Thr are gain and threshold, respectively, to adjust the delta.

The processed pixel may then be outputted as follows:

p_le=p+p_delta

A gradient-based fusion sub-block 132 may be used to blend the results of the edge-preserving enhancement block 101 and those of local-extrema enhancement block 121. The blending weight wgt is same as that used by the edge-preserving filters 108 and 114.
The refined result may be generated by blending p_ep_enh and p_le as follows:

p_grad=p_ep_enh+wgt*(p_le−p_ep_enh).

A transient-based fusion sub-block 136 may be used to fuse the result of the gradient-based fusion sub-block 132 and that of a digital transient improvement (DTi) block 134.
The delta of the gradient-based fusion result p_grad and DTi result p_dti may be respectively calculated based on the input value p in accordance with the following:

delta_grad=p_grad−p 

delta_dti=p_dti−p; 

The sign of delta_grad and delta_dti may be checked and the blending delta blnd_delta may then be calculated as follows:

if both delta_grad and delta_dti are positive,blnd_delta=max(delta_grad,delta_dti);

else if both delta_grad and delta_dti are negative,blend_delta=min(delta_grad,delta_dti);

else blnd_delta=delta_grad+delta_dti. 

The final enhancement result p_enh may be determined in accordance with the following:

p_enh=p+blnd_delta.

The following discussion is intended to provide a brief, general description of a suitable machine (e.g., projector system) in which embodiments of the disclosed technology can be implemented. Typically, the machine includes a system bus to which are attached processors, memory (e.g., random access memory (RAM), read-only memory (ROM), or other state preserving medium), storage devices, a video interface, and input/output interface ports. The machine may be controlled, at least in part, by input from conventional input devices, such as keyboards, mice, etc., as well as by directives received from another machine, interaction with a virtual reality (VR) environment, biometric feedback, or other input signal.
The machine may include embedded controllers, such as programmable or non-programmable logic devices or arrays, Application Specific Integrated Circuits (ASICs), embedded computers, smart cards, and the like. The machine may utilize one or more connections to one or more remote machines, such as through a network interface, modem, or other communicative coupling. Machines may be interconnected by way of a physical and/or logical network, such as an intranet, the Internet, local area networks, wide area networks, etc. One skilled in the art will appreciated that network communication may utilize various wired and/or wireless short range or long range carriers and protocols, including radio frequency (RF), satellite, microwave, Institute of Electrical and Electronics Engineers (IEEE) 802.11, Bluetooth, optical, infrared, cable, laser, etc.
Embodiments of the disclosed technology may be described by reference to or in conjunction with associated data including functions, procedures, data structures, application programs, etc. which when accessed by a machine results in the machine performing tasks or defining abstract data types or low-level hardware contexts. Associated data may be stored in, for example, the volatile and/or non-volatile memory, e.g., RAM, ROM, etc., or in other tangible storage devices and non-transitory storage media, including hard-drives, floppy-disks, optical storage, tapes, flash memory, memory sticks, digital video disks, biological storage, etc. Associated data may be delivered over transmission environments, including the physical and/or logical network, in the form of packets, serial data, parallel data, propagated signals, etc., and may be used in a compressed or encrypted format. Associated data may be used in a distributed environment, and stored locally and/or remotely for machine access.
Having described and illustrated the principles of the disclosed technology with reference to described embodiments, it will be recognized that the illustrated embodiments may be modified in arrangement and detail without departing from such principles. And although the foregoing discussion has focused on particular embodiments, other configurations are contemplated. In particular, even though expressions such as “according to an embodiment of the disclosed technology” or the like are used herein, these phrases are meant to generally reference embodiment possibilities, and are not intended to limit the invention to any particular embodiment configurations. As used herein, these terms may reference the same or different embodiments that are combinable into other embodiments.
Consequently, in view of the wide variety of permutations to the embodiments described herein, this detailed description and accompanying material is intended to be illustrative only, and should not be taken as limiting the scope of the invention. What is claimed as the invention, therefore, is all such modifications as may come within the scope and spirit of the following claims and equivalents thereto.

## Claims

1. A method, comprising:
receiving an input image;
performing an edge-preservation enhancement on the input image, wherein performing the edge-preservation enhancement on the input image comprises performing a gradient calculation, bilateral filtering of gradients, and dilation of bilateral filtered gradients in the input image, wherein performing the gradient calculation, bilateral filtering of gradients, and dilation of bilateral filtered gradients in the input image comprises:
calculating a gradient for a pixel in the input image;
retrieving gradients in a window surrounding this pixel p;
doing bilateral filtering for gradients according to weights based on pixel difference and spatial distances;
determining a maximal gradient among the bilateral filtered gradients; and
replacing the gradient for the pixel with the maximal gradient;

performing a local-extrema enhancement on the input image;
performing a digital transient improvement (DTi) operation on the input image;
performing a gradient-based fusion of an output of the edge-preserving enhancement and an output of the local-extrema enhancement; and
performing a transient-based fusion of an output of the gradient-based fusion and an output of the DTi operation.

2. The method of claim 1, wherein performing the edge-preservation enhancement on the input image further comprises performing low-pass filtering on the input image.

3. The method of claim 2, wherein performing the edge-preservation enhancement on the input image further comprises smoothing the input image while preserving edges of the input image according to local gradients.

4. The method of claim 3, wherein performing the edge-preservation enhancement on the input image further comprises determining a first difference between the input image and the edge-preserved filtered image.

5. The method of claim 4, wherein performing the edge-preservation enhancement on the input image further comprises applying a first remapping function to the determined first difference.

6. The method of claim 5, wherein performing the edge-preservation enhancement on the input image further comprises determining a second difference between a first level of the edge-preserved filtered image and a second level of the edge-preserved filtered image.

7. The method of claim 6, wherein performing the edge-preservation enhancement on the input image further comprises applying a second remapping function to the determined second difference.

8. The method of claim 7, wherein performing the edge-preservation enhancement on the input image further comprises performing a reconstruction based on outputs of a second level of the edge-preserved filtered image and the first and second remapping functions.

9. The method of claim 1, wherein performing the local-extrema enhancement on the input image comprises:
determining an open operator;
determining a close operator; and
solving a delta based on the open operator and close operator.

10. One or more tangible, non-transitory computer-readable media storing computer-executable instructions that, when executed by a processor, perform the method recited by claim 1.