HOME

TheInfoList



OR:

Directional Cubic Convolution Interpolation (DCCI) is an edge-directed
image scaling In computer graphics and digital imaging, image scaling refers to the resizing of a digital image. In video technology, the magnification of digital material is known as upscaling or resolution enhancement. When scaling a vector graphic image ...
algorithm created by Dengwen Zhou and Xiaoliu Shen. By taking into account the edges in an
image An image is a visual representation of something. It can be two-dimensional, three-dimensional, or somehow otherwise feed into the visual system to convey information. An image can be an artifact, such as a photograph or other two-dimensio ...
, this scaling
algorithm In mathematics and computer science, an algorithm () is a finite sequence of rigorous instructions, typically used to solve a class of specific problems or to perform a computation. Algorithms are used as specifications for performing ...
reduces artifacts common to other image scaling algorithms. For example, staircase artifacts on diagonal lines and curves are eliminated. The algorithm resizes an image to 2x its original dimensions, minus 1.


The algorithm

The algorithm works in three main steps: # Copy the original
pixels In digital imaging, a pixel (abbreviated px), pel, or picture element is the smallest addressable element in a raster image, or the smallest point in an all points addressable display device. In most digital display devices, pixels are the ...
to the output image, with gaps between the pixels. # Calculate the pixels for the diagonal gaps. # Calculate the pixels for the remaining horizontal and vertical gaps.


Calculating pixels in diagonal gaps

Evaluation of diagonal pixels is done on the original image data in a 4×4 region, with the new pixel that is being calculated in the center, in the gap between the original pixels. This can also be thought of as the 7×7 region in the enlarged image centered on the new pixel to calculate, and the original pixels have already been copied. The algorithm decides one of three cases: * Edge in up-right direction —
interpolates In the mathematical field of numerical analysis, interpolation is a type of estimation, a method of constructing (finding) new data points based on the range of a discrete set of known data points. In engineering and science, one often has a n ...
along down-right direction. * Edge in down-right direction — interpolates along up-right direction. * Smooth area — interpolates in both directions, then multiples the values by weights.


Calculating diagonal edge strength

Let d1 be the sum of edges in the up-right direction, and d2 be the sum of edges in the down-right direction. To calculate d1, take the sum of abs(P(X, Y) - P(X - 1, Y + 1)), in the region of X = 1 to 3, and Y = 0 to 2. To calculate d2, take the sum of abs(P(X, Y) - P(X + 1, Y + 1)), in the region of X = 0 to 2, and Y = 0 to 2.


Interpolating pixels

If (1 + d1) / (1 + d2) > 1.15, then there is an edge in the up-right direction. If (1 + d2) / (1 + d1) > 1.15, then there is an edge in the down-right direction. Otherwise, one is in a smooth area. To avoid division and
floating-point In computing, floating-point arithmetic (FP) is arithmetic that represents real numbers approximately, using an integer with a fixed precision, called the significand, scaled by an integer exponent of a fixed base. For example, 12.345 can be ...
operations, this can also be expressed as 100 * (1 + d1) > 115 * (1 + d2), and 100 * (1 + d2) > 115 * (1 + d1).


=Up-right edge

= For an edge in the up-right direction, one interpolates in the down-right direction. Output pixel = (-1 * P(0, 0) + 9 * P(1, 1) + 9 * P(2, 2) - 1 * P(3, 3)) / 16 The pixel value will need to be forced to the valid range of pixel values (usually 0 to 255).


=Down-right edge

= For an edge in the down-right direction, one interpolates in the up-right direction. Output pixel = (-1 * P(3, 0) + 9 * P(2, 1) + 9 * P(1, 2) - 1 * P(0, 3)) / 16 The pixel value will need to be forced to the valid range of pixel values (usually 0 to 255).


=Smooth area

= In the smooth area, edge strength from up-right will contribute to the down-right sampled pixel, and edge strength from down-right will contribute to the up-right sampled pixel. w1 = 1 / (1 + d1 ^ 5) w2 = 1 / (1 + d2 ^ 5) weight1 = w1 / (w1 + w2) weight2 = w2 / (w1 + w2) DownRightPixel = (-1 * P(0, 0) + 9 * P(1, 1) + 9 * P(2, 2) - 1 * P(3, 3)) / 16 UpRightPixel = (-1 * P(3, 0) + 9 * P(2, 1) + 9 * P(1, 2) - 1 * P(0, 3)) / 16 Output Pixel = DownRightPixel * weight1 + UpRightPixel * weight2 The pixel value will need to be forced to the valid range of pixel values (usually 0 to 255).


Calculating remaining pixels

Evaluating the remaining pixels is done on the scaled image data in a 7×7 region, with the new pixel that is being calculated in the center. These calculations either depend on the original pixels of the image or on a diagonal pixel calculated in the previous step. The algorithm decides one of three cases: * Edge in horizontal direction — interpolates along vertical direction. * Edge in vertical direction — interpolates along horizontal direction. * Smooth area — interpolates in both directions, then multiples the values by weights.


Calculating horizontal/vertical edge strength

Let d1 be the sum of edges in the horizontal direction, and d2 be the sum of edges in the vertical direction. Consider a 7×7 diamond-shaped region centered on the pixel to calculate, using only pixel values from the original, and pixel values added from the diagonal direction. To calculate d1, take the sum of the absolute differences of the horizontal edges, sampling these pixel values:
,  P(X+1, Y-2) - P(X-1, Y-2) ,  +
,  P(X+2, Y-1) - P(X, Y-1) ,  + ,  P(X, Y-1) - P(X-2, Y-1) ,  +
,  P(X+3, Y) - P(X+1, Y) ,  + ,  P(X+1, Y) - P(X-1, Y) ,  + ,  P(X-1, Y) - P(X-3, Y) ,  +
,  P(X+2, Y+1) - P(X, Y+1) ,  + ,  P(X, Y+1) - P(X-2, Y+1) ,  +
,  P(X+1, Y+2) - P(X-1, Y+2) , 
To calculate d2, take the sum of the absolute differences of the vertical edges, sampling these pixel values:
,  P(X-2, Y+1) - P(X-2, Y-1) ,  +
,  P(X-1, Y+2) - P(X-1, Y) ,  + ,  P(X-1, Y) - P(X-1, Y-2) ,  +
,  P(X, Y+3) - P(X, Y+1) ,  + ,  P(X, Y+1) - P(X, Y-1) ,  + ,  P(X, Y-1) - P(X, Y-3) ,  +
,  P(X+1, Y+2) - P(X+1, Y) ,  + ,  P(X+1, Y) - P(X+1, Y-2) ,  +
,  P(X+2, Y+1) - P(X+2, Y-1) , 


Interpolating pixels

If (1 + d1) / (1 + d2) > 1.15, then one has an edge in the horizontal direction. If (1 + d2) / (1 + d1) > 1.15, then one has an edge in the vertical direction. Otherwise, one is in the smooth area. To avoid division floating-point operations, this can also be expressed as 100 * (1 + d1) > 115 * (1 + d2), and 100 * (1 + d2) > 115 * (1 + d1).


=Horizontal edge

= For a horizontal edge, one interpolates in the vertical direction, using only the column centered at the pixel. Output pixel = (-1 * P(X, Y - 3) + 9 * P(X, Y - 1) + 9 * P(X, Y + 1) - 1 * P(X, Y + 3)) / 16 The pixel value will need to be forced to the valid range of pixel values (usually 0 to 255).


=Vertical edge

= For a vertical edge, one interpolates in the horizontal direction, using only the row centered at the pixel. Output pixel = (-1 * P(X - 3, Y) + 9 * P(X - 1, Y) + 9 * P(X + 1, Y) - 1 * P(X + 3, Y)) / 16 The pixel value will need to be forced to the valid range of pixel values (usually 0 to 255).


=Smooth area

= In the smooth area, horizontal edge strength will contribute to the weight for the vertically sampled pixel, and vertical edge strength will contribute to the weight for the horizontally sampled pixel. w1 = 1 / (1 + d1 ^ 5) w2 = 1 / (1 + d2 ^ 5) weight1 = w1 / (w1 + w2) weight2 = w2 / (w1 + w2) HorizontalPixel = (-1 * P(X - 3, Y) + 9 * P(X - 1, Y) + 9 * P(X + 1, Y) - 1 * P(X + 3, Y)) / 16 VerticalPixel = (-1 * P(X, Y - 3) + 9 * P(X, Y - 1) + 9 * P(X, Y + 1) - 1 * P(X, Y + 3)) / 16 Output Pixel = VerticalPixel * weight1 + HorizontalPixel * weight2 The pixel value will need to be forced to the valid range of pixel values (usually 0 to 255).


Not specified


Boundary pixels

The algorithm does not define what to do when sampling boundary areas outside of the image. Possible things to do include replicating the boundary pixel, wrapping pixels from the other side of the image, wrapping the same side of the image in reverse, or using a particular border color value.


Color images

Color images are not specified by the algorithm, however, one can sum all RGB component differences when calculating edge strength, and use all RGB components when interpolating the pixels. Or one could split to
YCbCr YCbCr, Y′CbCr, or Y Pb/Cb Pr/Cr, also written as YCBCR or Y′CBCR, is a family of color spaces used as a part of the color image pipeline in video and digital photography systems. Y′ is the Luma (video), luma component and CB and CR are t ...
, process only the luma component and stretch the chroma using a different algorithm.


See also

*
Image scaling In computer graphics and digital imaging, image scaling refers to the resizing of a digital image. In video technology, the magnification of digital material is known as upscaling or resolution enhancement. When scaling a vector graphic image ...
*
Bilinear interpolation In mathematics, bilinear interpolation is a method for interpolating functions of two variables (e.g., ''x'' and ''y'') using repeated linear interpolation. It is usually applied to functions sampled on a 2D rectilinear grid, though it can be ge ...
* Bicubic interpolation *
Spline interpolation In the mathematical field of numerical analysis, spline interpolation is a form of interpolation where the interpolant is a special type of piecewise polynomial called a spline. That is, instead of fitting a single, high-degree polynomial to all ...
* Lanczos resampling * Comparison gallery of image scaling algorithms


References

{{Video processing Image processing