The following relates to computing alpha channel values for use in defining the boundaries of a transformed digital video or digital image.
In digital video, an alpha channel is used to define the transparency of the video when that video is mixed with a background image or background video. For example, a source video may undergo a transformation in video production equipment to produce an effect (e.g. the shrinking and/or rotating of the source video), and then the resultant transformed source video may be layered on top of a background image or background video. The alpha channel defines the transparency of the transformed source video when it is layered on top of the background image or background video. For example, an alpha channel can be used to make the transformed source video semi-transparent.
A shaping alpha is an alpha channel that defines the boundaries of the transformed source video when the transformed source video is layered on top of a background image or video. In particular, it has been found to be aesthetically pleasing to a human eye to have the transformed source video fade into the background image or background video at the boundaries of the transformed source video. This may be achieved through the use of a shaping alpha that defines the semi-transparency of the transformed source video at or around its boundaries.
Methods and systems for computing the shaping alpha in video production equipment are desired.
Methods and systems for computing an alpha channel value are provided below.
In one embodiment, a set of parameters is obtained based on an effect (transformation) to be applied to a source image. A value is also obtained that defines a uniform width of an area that borders at least one boundary of the transformed source image in the target image. For a target image pixel coordinate in the area, a corresponding source pixel coordinate is computed that is within another non-uniform area bordering the source image. An alpha channel value defining semi-transparency of a pixel associated with the target image pixel coordinate is computed as a function of a location of the corresponding source pixel coordinate in the another area bordering the source image.
More particularly, in one example embodiment, the method is performed by a computational device, and the method is performed as part of transforming a source digital image into a digital object in a target digital image. The source digital image and the target digital image each comprise a plurality of pixels. The method comprises the following steps: (i) receiving an indication of an effect to be applied to the source digital image; (ii) obtaining a set of parameters based on the indication of the effect; (iii) obtaining a value defining a width of an area that borders at least one boundary of the digital object in the target digital image; the width of the area is uniform along the at least one boundary of the digital object; (iv) for a pixel coordinate (xt,yt) of the target digital image that is within the area that borders the at least one boundary of the digital object, computing, using the pixel coordinate (xt,yt) of the target digital image and at least some of the parameters, a corresponding source pixel coordinate (xs,ys) that is within another area bordering the source digital image; the another area has a width that is non-uniform along a boundary of the source digital image; and (v) computing an alpha channel value defining semi-transparency of a pixel associated with the pixel coordinate (xt,yt) of the target digital image. The alpha channel value is computed as a function of a location of the corresponding source pixel coordinate (xs,ys) in the another area bordering the source digital image.
A digital video effects (DVE) device for performing the methods herein is also disclosed. Also disclosed is a computer readable storage medium having instructions stored thereon that, when executed, cause a computational device to perform the methods herein.
For example, in another embodiment, there is provided a digital video effects (DVE) device for transforming a source digital image in source video into a digital object in a target digital image in target video, where the source digital image and the target digital image each comprise a plurality of pixels. The DVE device comprises memory to store the source digital image when received by the DVE, and to store a value defining a width of an area that borders at least one boundary of the digital object in the target digital image. The width of the area is uniform along the at least one boundary of the digital object. The DVE device also comprises a user interface to receive an indication of an effect to be applied to the source digital image. The DVE device also comprises circuitry to perform operations including: obtaining a set of parameters based on the indication of the effect; for a pixel coordinate (xt,yt) of the target digital image that is within the area that borders the at least one boundary of the digital object, computing, using the pixel coordinate (xt,yt) of the target digital image and at least some of the parameters, a corresponding source pixel coordinate (xs,ys) that is within another area bordering the source digital image, the another area having a width that is non-uniform along a boundary of the source digital image; and computing an alpha channel value defining semi-transparency of a pixel associated with the pixel coordinate (xt,yt) of the target digital image. The alpha channel value is computed as a function of a location of the corresponding source pixel coordinate (xs,ys) in the another area bordering the source digital image.
In another embodiment, there is provided a computer readable storage medium having stored thereon computer executable instructions for transforming a source digital image into a digital object in a target digital image, where the source digital image and the target digital image each comprise a plurality of pixels. The computer executable instructions, when executed by a computational device, cause the computational device to perform operations comprising: receiving and storing the source digital image in a memory; receiving from a user interface an indication of an effect to be applied to the source digital image; obtaining a set of parameters based on the indication of the effect; obtaining a value defining a width of an area that borders at least one boundary of the digital object in the target digital image, where the width of the area is uniform along the at least one boundary of the digital object; for a pixel coordinate (xt,yt) of the target digital image that is within the area that borders the at least one boundary of the digital object, computing, using the pixel coordinate (xt,yt) of the target digital image and at least some of the parameters, a corresponding source pixel coordinate (xs,ys) that is within another area bordering the source digital image, the another area having a width that is non-uniform along a boundary of the source digital image; and computing an alpha channel value defining semi-transparency of a pixel associated with the pixel coordinate (xt,yt) of the target digital image. The alpha channel value is computed as a function of a location of the corresponding source pixel coordinate (xs,ys) in the another area bordering the source digital image.
Embodiments of the present application will be described, by way of example only, with reference to the accompanying figures wherein:
Like reference numerals are used in different figures to denote similar elements.
For illustrative purposes, specific example embodiments will now be explained in greater detail below in conjunction with the figures.
The embodiments set forth herein represent information sufficient to practice the claimed subject matter and illustrate the best way of practicing such subject matter. Upon reading the following description in light of the accompanying figures, those of sufficient skill will understand the concepts of the claimed subject matter and will recognize applications of these concepts not particularly addressed herein. It should be understood that these concepts and applications fall within the scope of the disclosure and the accompanying claims.
Moreover, it will be appreciated that any module, component, or device exemplified herein that executes instructions may include or otherwise have access to a non-transitory computer/processor readable storage medium or media for storage of information, such as computer/processor readable instructions, data structures, program modules, and/or other data. A non-exhaustive list of examples of non-transitory computer/processor readable storage media includes magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, optical disks such as CD-ROM, DVDs, Blu-ray, or other optical storage, volatile and non-volatile, removable and non-removable media implemented in any method or technology, RAM, ROM, EEPROM, flash memory or other memory technology. Any such non-transitory computer/processor storage media may be part of a device or accessible or connectable thereto. Any application or module herein described may be implemented using computer/processor readable/executable instructions that may be stored or otherwise held by such non-transitory computer/processor readable storage media.
Turning now to the figures, some specific example embodiments will be described.
Digital video comprises a series of digital images displayed in rapid succession. Each digital image includes a picture portion, which is what is displayed, and typically some ancillary information (e.g. audio, metadata, etc.).
Digital video may be manipulated. One type of manipulation is video layering. Video layering may also be referred to as video compositing or video keying in production switchers. Video layering is a process which combines a sequence of separate video sources into a single video. For example,
A digital video may also (or instead) be manipulated by a digital video effects (DVE) device to produce a digital video effect such as resizing, rotation, translation, and/or distortion of the video. A “DVE device” is sometimes also referred to as a “DVE system” or just a “DVE”. Often, a video source undergoing digital video effects in a DVE device is further layered over other video images using video layering.
A digital video effect is a visual effect which provides comprehensive video image manipulations in 3-D space, primarily dealing with resizing, rotation, translation or distortion of a source visual image. For example,
One way to perform the digital video effect in the DVE device is to apply a geometric transformation (or mapping) to each digital image of the digital video. Such geometric transformations are also referred to as geometrical coordinates mapping. A geometrical mapping is called forward mapping if coordinates of a source video image are transformed into coordinates of a target video image. Conversely, a geometrical mapping is called an inverse mapping if a transform starts from a target video image and ends at a source image.
With reference now to
In operation, the DVE device 120 receives as an input a source video Vsource comprising a series of source images (source image 122 being illustrated). The DVE device 120 outputs the manipulated video, which will be referred to as the “target video” Vtarget. The target video Vtarget comprises a series of target images (target image 124 being illustrated). The mixer 118 layers the target video Vtarget on top of a background video or image Vbackground to produce an output video Vout.
When the source video Vsource undergoes manipulation in the DVE device 120, a shaping alpha αshp may also be created. The shaping alpha αshp is an alpha channel associated with the video that defines the resultant boundaries of the transformed source video in the target video Vtarget. The shaping alpha αshp is particularly useful for situations like that illustrated in
As shown in
The source video Vsource is manipulated on an image-by-image basis, and so the target video Vtarget is created on an image-by-image basis and is layered on top of the background on an image-by-image basis. Therefore, in the remaining discussion, “source image” and “target image” will be used, it being understood that in the context of digital video, each “image” is a video image (e.g. a frame or field) of a digital video. Also, in the following discussion, “background image” will be used, it being understood that this may be a stand-alone image or a video image (e.g. frame or field) of a background digital video.
Therefore, for each source image 122, the DVE device 120 creates a corresponding target image 124 that includes an object 123 representing the transformed source image 122. In general, some of the pixels of the target image 124 will be within source bounds (i.e. within object 123) and others will be outside source bounds (i.e. in area O). This scenario is illustrated in
For each target image 124, the DVE device 120 also creates a shaping alpha αshp. The shaping alpha αshp comprises a plurality of values, each one of the values of the shaping alpha αshp corresponding to a respective pixel in the target image 124. Each one of the shaping alpha values of the shaping alpha αshp will therefore be denoted as αshp(xt,yt). Generally, each value αshp(xt,yt) in the shaping alpha will range from zero to one (i.e. 0≦αshp (xt,yt)≦1). A value of zero indicates that the corresponding target image pixel is out of bounds of the source image (i.e. the pixel of the target image 124 is in area O), and therefore when the target image 124 is layered on top of a background image 126, that pixel of the target image will be completely transparent, such that only the background 126 is seen. On the other hand, a shaping alpha value αshp(xt,yt) of one indicates that the corresponding target image pixel is within the bounds of the source image (i.e. the pixel of the target image 124 is within the area defined by L, R, T, and B), and therefore when the target image 124 is layered on top of the background 126, that pixel of the target image will be completely opaque in the sense that it will not show any of the background image and only show the target image. A shaping alpha value αshp(xt,yt) between zero and one indicates a boundary condition (a border area of the object 123) in which partial transparency (semi-transparency) is present to allow for a smooth transition between the edge of the object 123 and the background image 126. The closer the shaping alpha value αshp (xt,yt) is to 1, the more the object 123 will show, and the closer the shaping alpha value is to zero, the more the background image 126 will show. By using the shaping alpha αshp, the transformed source image (i.e. the object 123) may be made to fade out gradually into the background image 126 at edge boundaries L, R, T, and B, which is typically more aesthetically pleasing to a human eye.
The shaping alpha αshp corresponding to the target image 124 is shown as 128 in
As a simple example to further help illustrate the principle of the shaping alpha αshp, consider
For example, target image pixel (103,74) is outside the boundary L and specifically in area O of the target image 124. Therefore, this pixel has a corresponding shaping alpha value of zero (αshp(103,74)=0). This means that this pixel will be completely transparent in that it will only show the background image 126 at this pixel location when the background image 126 is layered underneath the target image 124. That is, no matter what the target image pixel value Y(103,74) is, it will not be displayed. Instead, only the pixel value of the background image 126 layered underneath the target image 124 will be displayed. On the other hand, target image pixel (106,74) is within the boundaries of the source image and has a corresponding shaping alpha value of one (αshp(106,74)=1). This means that this pixel will be completely opaque in that it will only show the target image 124 at this pixel location when the background image 126 is layered underneath the target image 124. That is, Y(106,74) will be displayed with no corresponding background image pixel being shown. Target image pixel (105,74) is on the boundary L (specifically in the softness range) and therefore has a corresponding shaping alpha value that is between zero and one and specifically 0.8 in this example (αshp(105,74)=0.8). This means that this pixel of the target image 124 will have semi-transparency in that it will show some of the background image 126 at this pixel location when the background image 126 is layered underneath the target image 124. That is, no matter what the target image pixel value Y(105,74), the pixel value of the background image 126 layered underneath the target image 124 at this point will still also be partially displayed. Similarly, target image pixel (104,74) is also on the boundary L and therefore has a corresponding shaping alpha value that is between zero and one and specifically 0.5 in this example (αshp(104,74)=0.5). This means that this pixel of the target image 124 will also have semi-transparency in that it will show some of the background image 126 at this pixel location when the background image 126 is layered underneath the target image 124. Since 0.5 is closer to 0 than 0.8, the pixel value Y(104,74) will be more transparent than the pixel value Y(105,74). As mentioned above, a primary purpose of the shaping alpha is to cause the transformed source image (i.e. the object 123 in the target image 124) to fade out gradually into the background image 126 at edge boundaries of the object 123 (e.g. at boundary L), which is typically more aesthetically pleasing to a human eye.
One way to apply the shaping alpha αshp is to multiply each pixel value Y(xt,yt) in the target image with its corresponding shaping alpha value αshp(xt,yt). The examples illustrated herein use this method, which is one reason why αshp(xt,yt)=0 is used to denote full transparency of the target image pixel and αshp(xt,yt)=1 is used to denote full opaqueness of the target image pixel. Specifically, when αshp(xt,yt)=0, then Y(xt,yt)×αshp(xt,yt)=Y(xt,yt)×0=0, which means that the target image pixel displays no value and hence is fully transparent, and when αshp(xt,yt)=1, then Y(xt,yt)×αshp(xt,yt)=Y(xt,yt)×1=Y(xt,yt), which means the target image pixel displays its full value.
In operation, the mixer 118 multiplies each pixel value Y(xt,yt) in the target image with its corresponding shaping alpha value αshp(x,y), as per above. As shown in
More specifically, with reference to
Returning to
As shown in
In operation, and as shown in
The corresponding target image 124 is then also generated on a pixel-by-pixel basis as follows.
Assume the picture portion of the target image 124 comprises an (m+1)×(n+1) grid of pixels, where each target pixel has a location (xt,yt) and an associated pixel value Yt(xt,yt). The raster-scan counter 206 begins at (xt,yt)=(0,0) and counts up to (xt,yt)=(m,n). That is, the raster-scan counter 206 generates each geometrical target pixel coordinate (xt,yt). For each target pixel coordinate (xt,yt), the target coordinate values xt and yt are input into the perspective transform engine 208, which computes the corresponding source pixel coordinate (xs,ys) of the source image 122 stored in memory 204. The source pixel coordinate (xs,ys) corresponding to the target pixel coordinate (xt,yt) is a function of the manipulation being applied by the DVE device 120 and is guided by parameters 210. For example, in one embodiment, to obtain the corresponding x-coordinate of the source pixel (i.e. xs) for a given target pixel coordinate (xt,yt), the following computation is performed by the perspective transform engine 208:
To obtain the corresponding y-coordinate of the source pixel (i.e. ys) for a given target pixel (xt,yt), the following computation is performed by the perspective transform engine 208:
Equations 1 and 2 are based on mapping of a target pixel coordinate to a corresponding source pixel coordinate using the following inverse mapping function (geometric transformation):
where M−1 is a homogeneous matrix, inverse to a forward mapping M, where a 4×4 homogeneous matrix represents a geometrical transformation. The value f represents a focus distance between the viewer and the target screen.
In this example, Ta, Tb, Tc, Td, Te, Tf, Tg, Th, Pa, Pb, Pc, Pd, and f are the parameters 210, and their values are set by the CPU 212 based on the specific effect requested by the user via the user interface 214. For example, if a user indicated via the user interface 214 that it was desired to rotate the image by 15 degrees and shrink the image to half its size, then the user interface 214 would electronically forward this request to the CPU 212, which would compute the corresponding values of the parameters 210, and forward these specific parameter values 210 to the perspective transform engine 208 via a parameter bus.
One way to compute the parameters is as follows. A matrix M=Mt×My×Mz is computed where
which represents the translation or shift in 3D space by (x, y, z), where
which represents the rotation at angle β around the y-axis, and where
which represents a rotation at angle φ around the z-axis. M−1 is then the inverse of M. Therefore, for a given effect, the translation and rotation angles around the y and z axis are determined. Then, M=Mt×My×Mz is computed, which gives the effect of rotation around the z-axis first, then rotation around the y-axis, and then translation. Either in parallel to computing M (or from M), the inverse matrix M−1 is computed to determine parameters Ta, Tb, Tc, Td, Te, Tf, Tg, Th, Pa, Pb, Pc, Pd. Also, the focus f is determined, which is representative of the rotation around the x-axis. Then, Equations (1) and (2) above may be computed for each target pixel coordinate (xt,yt).
Equations (1) and (2) relate to the parameters from matrix M−1 as follows. Subjected to perspective projection, the depth of a point in 3-D space may be expressed in terms of a target pixel coordinate (xt,yt) such that
where
Equations (1) and (2) may also be rearranged to instead be in terms of unified source coordinates
The parameters above (i.e. the parameters in matrix M−1, and the value of f) are computed on an image-by-image basis, although this need not be the case (particularly if the effect does not change between video images). Also, in an alternative embodiment, the user of the DVE device 120 could also (or instead) be provided with pre-selected effects, with corresponding pre-computed parameters stored in memory and retrieved by the CPU 212, rather than computed.
In the matrix M−1, the parameters in the first two rows (Ta, Tb, Tc, Td, Te, Tf, Tg, Tb) generally relate to providing the transform, whereas the parameters in the third row (Pa, Pb, Pc, Pd) generally relate to providing the perspective.
In the illustrated embodiments, the parameters 210 are pre-calculated per image (field or frame) before the raster-scan counter 206 begins counting target pixel coordinate values (xt,yt).
As discussed above, the perspective transform engine 208 computes a corresponding source pixel coordinate (xs,ys) for each target pixel coordinate (xt,yt). In general, the target pixel value Yt(xt,yt) will then be set as the corresponding source pixel value Ys(xs,ys) which is stored in and retrieved from memory 204. However, there is a caveat. In general, the corresponding source pixel coordinate (xs,ys) computed by the perspective transform engine 208 for a given target pixel coordinate (xt,yt) will not be an integer, but will be a fractional value. For example, if (xt,yt)=(12,14) is input into the perspective transform engine 208, then the corresponding source pixel coordinate (xs,ys) (computed using Equations 1 and 2, for example) may be (xs,ys)=(23.63, 17.27). Therefore, to compute the target pixel value Yt(xt,yt) interpolation is used. In one embodiment, bilinear interpolation is used as follows: assume a source pixel coordinate of (xs,ys)=(i+u, j+v) where (i,j) is the integer and (u,v) is the fraction. For example, in the example above of (xs,ys)=(23.63, 17.27), then i=23, u=0.63, j=17, and v=0.27. The source pixel values neighbouring (xs,ys)=(i+u, j+v) are therefore Ys(i,j), Ys(i+1, j), Ys(i, j+1), and Ys(i+1, j+1). The target pixel value Yt(xt,yt) is then computed as Yt(xt,yt)=Yj×(1−v)+Yj+1×v, where Yj=Y(i,j)×(1−u)+Y(i+1, j)×u and where Yj+1=Y(i, j+1)×(1−u)+Y(i+1, j+1)×u. To perform interpolation of this nature, the DVE device 120 includes the interpolator 216. It will be appreciated that another type of interpolation could be performed instead (e.g. a higher order of interpolation that uses a higher order of polynomial in the x-axis and y-axis).
As shown in
The process above is repeated for each target image coordinate (xt,yt) such that the target image 124 is created on a pixel-by-pixel basis. In this example, in the cases in which a given target pixel coordinate (xt,yt) maps to a corresponding source pixel coordinate (xs,ys) that is out of source bounds, then the target pixel value Yt(xt,yt) is set to the source pixel value Ys(xs,ys) of the closest source boundary pixel. For example, assume that the effect being applied to the source image 122 includes reducing the size of the image 122 so that the transformed source image (i.e. the object 123) is smaller than the source image 122. In this case, there will be some target pixel coordinates that will be outside of the transformed source image (i.e. in area O in
The DVE device 120 also includes the shaping alpha generator 220. Computation of the shaping alpha αshp for the target image 124 is discussed below.
There are different ways to compute the shaping alpha αshp for the target image 124. One method to compute the shaping alpha αshp assumes a fixed (uniform) range of softness around each of boundary edges L, R, T, and B of the source image 122 (that is, a fixed pixel width around each of the boundary edges L, R, T, and B in which the shaping alpha value is between zero and one). An example of this is shown in
Depending on how the source image 122 has been manipulated by the perspective transform engine 208, a pixel of the target image on the boundary of the manipulated source image could map outside of the softness range Δs in some places, as shown at 280 in
With the mapping shown in
One reason for jagged edges may be as follows: when a source image is rotated around the x-axis and moved away from a viewer, perspective effect makes the top area of the target image squeezed more than the bottom area. With a uniform softness range defined around the source image 122, a mapping such as that shown in
Jagged or step boundary edges, such as that described above with reference to
One method to address the jagged edges discussed above is to use anti-aliasing techniques. For example, an anti-alias method may be used employing super-samples or multi-samples, for example, 4×4 multiple samples in one normal square pixel area, as illustrated in
Another method to address the jagged edges problem discussed above is to use post-filtering image processing techniques to filter the jagged alpha to smooth the boundary edges. This method also has disadvantages relating to cost (computational resources and/or time) and quality. For example, boundary edge detection of the object in the target image is still required, and good quality filtering typically requires 2-D filtering techniques, which has a higher cost in terms of computational resources. Also, the post-filter bandwidth may be required to be dynamically changed in order to smooth different jagged edges. This is shown in
In contrast to the methods described with reference to
One method of creating a shaping alpha αshp to result in a uniform softness around the transformed source image (i.e. object 123) in the target image 124 is explained below.
In the embodiments described below, the parameters 210 and inverse mapping function M−1 discussed above will be assumed, such that Equations 1 and 2 represent the relationship between the source pixel coordinates and the target pixel coordinates. That is, to obtain the corresponding source pixel coordinate (xs,ys) for a given target pixel coordinate (xt,yt), the following computation is performed by the perspective transform engine 208:
Generally, a valid source image picture area is defined by the four boundary lines left (L), right (R), top (T), and bottom (B). However, in many applications, the source image may be further limited through a cropping effect, as shown in
Given that cropping can be applied to the source image, the source image will therefore be considered to be defined by four lines (left, right, top, and bottom), which will be designated as left cropping boundary line CL, right cropping boundary line CR, top cropping boundary line CT, and bottom cropping boundary line CB. This is shown in
A cropping boundary line can be denoted as:
Another way to denote these cropping lines is as follows:
Consider horizontal cropping first. In this case, on the cropping line (CL or CR), the source x-coordinate xs will be a constant xs=CH.
By substituting xs=CH into Equation 1 and we have:
Therefore, the horizontal crop line xs=CH in the source image 122 has the corresponding horizontal crop line in the target image 124 defined by Equation 6. Note that Equation 6 is a linear function (geometric line) in target space, which includes two extreme cases:
(which means that the target line is completely horizontal), and
when (PbW−Tb)=0 (which means that the target line is completely vertical).
Equation 6 can be expressed in slope intercept form in two different ways:
yt=φx
or
xt=φy
Note that:
Equations 7 and 8 are equivalent. Which one of Equations 7 and 8 to use in the computations is decided on an image-by-image basis. Specifically, for each target image, and therefore for each set of parameters Ta to Th, Pa to Pd, and f, the Equation 7 or 8 used depends upon which one has the smallest slope (φx
Therefore, for each target image, and therefore set of parameters Ta to Th, Pa to Pd, and f, Equation 6 is expressed as Equation 7 when
(which means |φy
Therefore Equation 6 in slope intercept form is:
Consider now the vertical cropping. In this case, on the cropping line (CT or CB), the source y-coordinate ys will be a constant ys=CV.
By substituting ys=CV into Equation 2 and we have:
Therefore, the vertical crop line ys=CV in the source image 122 has the corresponding crop line in the target image 124 defined by Equation 10. Note that Equation 10 is a linear function (geometric line) in target space, which includes two extreme cases:
when (PaH−Te)=0 (which means that the target line is completely horizontal), and
when (PbH−Tf)=0 (which means that the target line is completely vertical).
Equation 10 can also be expressed in slope intercept form in two different ways:
yt=φx
or
xt=φy
Note that:
Equations 11 and 12 are equivalent. As was the case for horizontal cropping, for vertical cropping which one of Equations 11 and 12 to use in the computations is decided on an image-by-image basis. Specifically, for each target image, and therefore for each set of parameters Ta to Th, Pa to Pd, and f, the Equation 11 or 12 used depends upon which one has the smallest slope (φx
Therefore, for each target image, and therefore set of parameters Ta to Th, Pa to Pd, and f, Equation 10 is expressed as Equation 11 when
(which means |φy
Therefore Equation 10 in slope intercept form is:
Therefore, in summary, a target image boundary line mapped from a source cropping image line is expressed as either:
As mentioned above, a smaller slope lets the intercept dominate the softness on the target plane. This is illustrated in
Also, since (as described above) φx
Analysis leading to the construction of the shaping alpha value will now be described.
A constant spatial softness area of width Δtgt around the target object provides for uniform softness. Therefore, each boundary of the target object is parallel-shifted by an amount Δtgt. When this shift Δtgt is inversely mapped onto the source image space, it appears as non-uniform spatial area of width Δsrc, as previously shown in
Consider first the case where it is a horizontal cropping (therefore xs=CH), and assume that |φx
We are interested in the case where there is a small change in τy
Therefore, the differential
is to be computed.
Let
Therefore,
The differential
can be expressed as
(since rearranging the equation
in terms of xs and then computing
results in
Therefore, substitute yt=φx
and taking the differential
(using the quotient rule for derivatives):
The range in softness at the horizontal source boundary edge W is the absolute value of Equation 16 when
This defines the change (parallel shift) in the horizontal source cropping line. Recall that
where CH=CL for left source cropping and CH=CR for right source cropping.
Consider now the case where it is a horizontal cropping still (therefore xs=CH), but assume that |φx
We are interested in the case where there is a small change in τx
Therefore, the differential
is to be computed.
The differential
can be expressed as
Therefore, substitute xt=φy
and taking the differential
(using the quotient rule for derivatives):
The range for softness at the horizontal source boundary edge W is the absolute value of Equation 18 when
This defines the change (parallel shift) in the horizontal source cropping line.
Consider now the case where it is a vertical cropping (therefore ys=CV), and assume that |φx
We are interested in the case where there is a small change in τy
Therefore, the differential
is to be computed.
Therefore,
The differential
can be expressed as
Therefore, substitute yt=φx
and taking the differential
(using the quotient rule for derivatives):
The range for softness at the vertical source boundary edge H is the absolute value of Equation 21 when
This defines the change (parallel shift) in the vertical source cropping line.
Consider now the case where it is a vertical cropping still (therefore ys=CV), but assume that |φx
We are interested in the case where there is a small change in τx
Therefore, the differential
is to be computed.
The differential
can be expressed as
Therefore, substitute xt=φy
and taking the differential
(using the quotient rule for derivatives):
The range for softness at the vertical source boundary edge H is the absolute value of Equation 23 when
This defines the change (parallel shift) in the vertical source cropping line.
Constructing the shaping alpha αshp will now be described.
A constant spatial softness area bordering the target object provides for uniform softness. Therefore, each boundary of the target object is parallel-shifted by an amount Δtgt. This is a user-controllable parameter, and the corresponding change in the source image is Δsrc. The value Δsrc is determined by multiplying the amount Δtgt in the target space by the absolute value of the value that represents the change in the corresponding source cropping boundary with respect to the change in the target image boundary. That is, for the horizontal boundary:
For the vertical boundary:
Δsrcx, and Δsrcy, are spatial-variant ranges or dynamic ranges in the source image space, horizontally and vertically respectively.
In the equations above, absolute values of differentiations are used because mathematically, increments dτx
To construct the shaping alpha value αshp(xt,yt) for each target pixel (xt,yt) mapped to a corresponding source pixel (xs,ys), a pre-alpha value α′i(xs,ys) is first computed as
where ΔDi is a distance difference between a source coordinate and a cropping line (boundary line in the source image), and Δx and Δy are horizontal and vertical distance differences respectively.
The shaping alpha value on each source boundary is then constructed by the following clipping function:
where i=L, R, T, B.
To assist in understanding Equations 27 and 28, please consider
With reference first to
Note that 0<α′T (xs,ys)<1 in this example since ys−CT<ΔsrcT. The shaping alpha value αT(xs,ys) for the top boundary for source pixel coordinate (xs,ys) is therefore αT(xs,ys)=α′T(xs,ys). The pre-alpha value for the left boundary α′L(xs,ys) is (via Equation 27):
Note that 0<α′L(xs,ys)<1 in this example since xs−CL<ΔsrcL. The shaping alpha value αL(xs,ys) for the left boundary for source pixel coordinate (xs,ys) is therefore αL(xs,ys)=α′L(xs,ys). The shaping alpha value for the bottom boundary (αB(xs,ys)) and the right boundary (αR(xs,ys)) are computed in a similar manner.
Now consider the situation in
Note that α′T(xs,ys)<0 in this example since CT>ys. The shaping alpha αT(xs,ys) for the top boundary for source pixel coordinate (xs,ys) is therefore αT(xs,ys)=0. Similarly, the shaping alpha αL(xs,ys) for the left boundary for source pixel coordinate (xs,ys) is also αL(xs,ys)=0 since a′L(xs,ys)<0. The shaping alpha value for the bottom boundary αB(xs,ys)) and the right boundary (αR(xs,ys)) are computed in a similar manner.
As a third example, consider the situation in
Note that α′T(xs,ys)>1 in this example since ys>CT and ys−CT>ΔsrcT. The shaping alpha αT(xs,ys) for the top boundary for source pixel coordinate (xs,ys) is therefore αT(xs,ys)=1 as per Equation 28. Similarly, the shaping alpha αL(xs,ys) for the left boundary for source pixel coordinate (xs,ys) is also αL(xs,ys)=1 since xs>CL and xs−CL>ΔsrcL. The shaping alpha value for the bottom boundary (αB(xs,ys)) and the right boundary (αR(xs,ys)) are computed in a similar manner.
As mentioned above, the Equation 27 is specific to an inward ramping implementation. This is in contrast to outward ramping. Outward ramping would require a straight-forward modification to Equation 27 to instead be:
In the method above, for each target pixel coordinate (xt,yt) that is mapped to a corresponding source pixel coordinate (xs,ys), four boundary shaping alpha values are computed (one for each boundary, i.e. αL(xs,ys), αR(xs,ys), αT(xs,ys), and αB(xs,ys)). The shaping alpha value αshp(xt,yt) is generated from (or based on) these four boundary shaping alpha values αL(xs,ys), αR(xs,ys), αT(xs,ys), and αB(xs,ys). One way to achieve this is to use a fuzzy logic function, such as:
where ∩ is fuzzy logic AND. One example way of computing this fuzzy logic AND is as follows:
αshp(xt,yt)=min{αL(xs,ys),αR(xs,ys),αT(xs,ys),αB(xs,ys)} (Equation 30).
Another example way of computing this fuzzy logic AND is as follows:
αshp(xt,yt)=αL(xs,ys)×αR(xs,ys)×αT(xs,ys)×αB(xs,ys) (Equation 31).
Therefore, for each target pixel coordinate (xt,yt) that is mapped to a corresponding source pixel coordinate (xs,ys), a corresponding shaping alpha value αshp(xt,yt) may be computed in the manner described above. The shaping alpha αshp for the target image comprises the set of shaping alpha values: {αshp(xt,yt)}; i.e. a set comprising one shaping alpha value αshp(xt,yt) for each pixel coordinate (xt,yt) in the target image.
Note that if using outward ramping instead to produce the complementary alpha (αc=1−α), the fuzzy logic AND of Equation 29 would be replaced with a fuzzy logic OR (e.g. which may be implemented, for example, as αcshp(xt,yt)=max{αcL(xs,ys), αcR(xs,ys), αcT(xs,ys), αcB(xs,ys)}).
The method described above may be considered a “slope-preserved” method. This is because the spatial range Δsrc in the source image is derived under the condition of the target line slope being preserved. More specifically, a uniform softness around the transformed source image (in the target image) is defined, to result in a non-uniform (or spatial variant) softness range around the source image (e.g. as is shown in
Turning now to
As shown in
In operation, the DVE device 320 receives as an input source image 322 and produces as an output the target image 324 and its corresponding shaping alpha αshp. The source image 322 may first be subject to pre-filtering 302 (e.g. to reduce alias artifacts caused by down-sampling), and is then stored in the memory 304. The raster-scan counter 306 can be used to write the source image 322 into the memory 304 on a pixel-by-pixel basis.
The corresponding target image 324 is then also generated on a pixel-by-pixel basis as follows.
The raster-scan counter 306 begins at (xt,yt)=(0,0) and counts up to (xt,yt)=(m,n) (assuming the target image 324 comprises an (m+1)×(n+1) grid of pixels). For each target pixel coordinate (xt,yt), the target coordinate values xt and yt are input into the perspective transform engine 308, which computes the corresponding source pixel coordinate (xs,ys) of the source image 322 stored in memory 304. The source pixel coordinate (xs,ys) corresponding to the target pixel coordinate (xt,yt) is a function of the manipulation being applied by the DVE device 320 and is defined by parameters 310. In this embodiment, to obtain the corresponding x-coordinate of the source pixel (i.e. xs) for a given target pixel coordinate (xt,yt), the following computation is performed by the perspective transform engine 308:
To obtain the corresponding y-coordinate of the source pixel (i.e. ys) for a given target pixel (xt,yt), the following computation is performed by the perspective transform engine 308:
As discussed earlier, Equations 1 and 2 are based on mapping of a target pixel coordinate to a corresponding source pixel coordinate using the following inverse mapping function:
In this example, Ta, Tb, Tc, Td, Te, Tf, Tg, Th, Pa, Pb, Pc, Pd, and f are the parameters 310, and their specific values are computed by the CPU 312 based on the specific effect requested by the user via user interface 314. For example, if a user indicated via the user interface 314 that it was desired to rotate the source image 322 by 15 degrees and shrink the source image 322 to half its size, then the user interface 314 would electronically forward this request to the CPU 312, which would compute the corresponding values of the parameters 310, and forward these specific parameter values 310 to the perspective transform engine 308. There is also now an additional parameter Δtgt. Specifically, the user may also control the width of the softness area bordering the target object by setting the value Δtgt (either directly or indirectly) via the user interface 314.
In general, the target pixel value Yt(xt,yt) will be set as the corresponding source pixel value Ys(xs,ys), which is stored in and retrieved from memory 304. However, the corresponding source pixel coordinate (xs,ys) computed by the perspective transform engine 308 for a given target pixel coordinate (xt,yt) will (in general) not be an integer, but will be a fractional value. For example, if (xt,yt)=(12, 14) is input into the perspective transform engine 308, then the corresponding source pixel coordinate (xs,ys) may be, for example, (xs,ys)=(23.63, 17.27). Therefore, to compute the target pixel value Yt (xt,yt), interpolation is used, as described earlier. To perform such interpolation, the DVE device 320 includes the interpolator 316.
As shown in
The process above is repeated for each target image coordinate (xt,yt) such that the target image 324 is created on a pixel-by-pixel basis. In this embodiment, in the cases in which a given target pixel coordinate (xt,yt) maps to a corresponding source pixel coordinate (xs,ys) that is out of source bounds, then the target pixel value Yt(xt,yt) is set to the source pixel value Ys (xs,ys) of the closest source boundary pixel.
As discussed above, the parameters 310 include Ta, Tb, Tc, Td, Te, Tf, Tg, Th, Pa, Pb, Pc, Pd, and f. In operation of the perspective transform engine 308, the parameters Ta, Tb, Tc, and f are combined with target image coordinates xt and yt to compute ΣX=Taxt+Tbyt+Tcf, as per computational block 402. The parameters Te, Tf, Tg, and f are combined with target image coordinates xt and yt to compute ΣY=Text+Tfyt+Tgf, as per computational block 404. The parameters Pa, Pb, Pc, and f are combined with target image coordinates xt and yt to compute ΣP=Paxt+Pbyt+Pcf, as per computational block 406. The parameter Pd is divided by ΣP=Paxt+Pbyt+Pcf to generate
as per divider 408. The value
is then multiplied with ΣX=Taxt+Tbyt+Tcf at multiplier 410 and this result subsequently added to parameter Td at adder 412 to generate
(i.e. Equation 1). Similarly, the value
is multiplied with ΣY=Text+Tfyt+Tgf at multiplier 414 and this result subsequently added to parameter Th at adder 416 to generate
(i.e. Equation 2).
In the illustrated embodiment, the perspective transform engine 308 additionally includes overflow/underflow circuitry 418, which detects any overflow or underflow or data out-of-range conditions, such as situations in which ΣP=Paxt+Pbyt+Pcf=0 (e.g. a singularity that occurs when the target object is located at a vanishing line), or an effect causing an invisibility (e.g. unified depth z<0, which corresponds to the object behind the viewers).
Returning to
where ∩ is fuzzy logic AND and (xs,ys) is the source pixel coordinate corresponding to the target image pixel coordinate (xt,yt). That is, (xs,ys) is the output of the perspective transform engine 308, which is why these coordinates are fed to the shaping alpha generator 326 in the DVE device 320. As described above, each αi(xs,ys) may be computed via Equation 28, that is:
where α′i(xs,ys) is the pre-alpha value defined via Equation 27, that is:
The value Δsrcx is defined via Equation 25, that is:
In other words, for the left edge (i=L), then:
and for the right edge (i=R), then:
Recall that CL and CR are the left and right cropping lines respectively defining the left and right boundaries of the source image 322. That is, on the left boundary of the source image 322 the source x-coordinate xs will be a constant xs=CL, and on the right boundary of the source image 322, the x-coordinate xs will be a constant xs=CR.
The value Δsrcy is defined by Equation 26, that is:
In other words, for the top edge (i=T), then:
and for the bottom edge (i=B), then:
Recall that CT and CB are the top and bottom cropping lines respectively defining the top and bottom boundaries of the source image 322. That is, on the top boundary of the source image 322 the source y-coordinate ys will be a constant ys=CT, and on the bottom boundary of the source image 322, the y-coordinate ys be a constant ys=CB.
Note that in this embodiment, advantageously the term Paxt+Pbyt+Pcf required to compute each shaping alpha value needs to be computed by the perspective transform engine 308 (ΣP=Paxt+Pbyt+Pcf). Therefore, as shown in the DVE device 320 in
for example, using a comparator to evaluate whether α′L(xs,ys) (from multiplier 514) is less then zero, between zero or one, or greater than zero.
The shaping alpha generator 326 further includes fuzzy logic AND blocks 520, 524, and 522, as well as multiplexer 526. The fuzzy logic AND blocks may be implemented using computational circuitry configured to implement the fuzzy logic AND operations described herein (e.g. as described in more detail later with respect to
In operation, the left alpha processing path 502 computes
where
by subtracting parameter CL from source coordinate xs, as at subtractor 510, and by multiplying |Paxt+Pbyt+Pcf| by parameter SL, as at multiplier 512, and then multiplying xs−CL by |Paxt+Pbyt+Pcf|SL, as at multiplier 514. Note that:
As mentioned above, the block 516 represents the clipping function
to produce left boundary shaping alpha value αL(xs,ys).
Right alpha processing path 504, top alpha processing path 506, and bottom alpha processing path 508 are of the same structure as left alpha processing path 504, except that different parameter inputs are used to respectively compute right boundary shaping alpha value αR(xs,ys), top boundary shaping alpha value αT(xs,ys), and bottom boundary shaping alpha value αB(xs,ys) as per the equations above. Note that in
Each parameter CL, CR, CT, and CB can be considered a crop parameter, and each parameter SL, SR, ST, and SB can be considered a scaling parameter, such that each of processing path 502 to 508 are of identical structure, but fed with a respective different crop and scale parameter.
As can be seen from the above, the output of multiplier 514 in
The fuzzy logic AND block 518 implements the fuzzy logic AND
Note that in this embodiment, the left and right boundary shaping alpha values αL(xs,ys) and αR(xs,ys) are used as the set of inputs for a first fuzzy logic AND
as at block 520, and the top and bottom boundary shaping alpha values αT(xs,ys) and αB(xs,ys) are used as the set of inputs for a second fuzzy logic AND
as at block 522, and then these two results are used as the set of inputs for a third fuzzy logic AND, as at block 524, to generate the shaping alpha value αshp(xt,yt) for the pixel coordinate (xt,yt) of the target image. This can be considered parallel or cascade merging of multiple binary operation fuzzy logic ANDs to construct a fuzzy logic AND having more than 2 operands.
Then, as shown at 526, the shaping alpha value αshp(xt,yt) is multiplexed with the value “0”, with the overflow/underflow choosing “0” if there was an overflow/underflow error in the computations. This multiplexer implements a switch that can switch between “0” and the shaping alpha value αshp(xt,yt). By choosing “0”, this results in the pixel being fully transparent if there is an overflow/underflow condition.
One example way to implement the fuzzy logic of block 518 is illustrated in
the minimum of left boundary shaping alpha value αL(xs,ys) and right boundary shaping alpha value αR(xs,ys) is selected via comparator 562 and multiplexer 564. Similarly, the minimum of top boundary shaping alpha value αT(xs,ys) and bottom boundary shaping alpha value αB(xs,ys) is selected via comparator 566 and multiplexer 568. The output of each of multiplexers 564 and 568 are then compared using comparator 570 and the smallest value selected using multiplexer 572. The output is then Equation 30, that is:
αshp(xt,yt)=min{αL(xs,ys),αR(xs,ys),αT(xs,ys),αB(xs,ys)}.
Another example way to implement the fuzzy logic of block 518 is illustrated in
αshp(xt,yt)=αL(xs,ys)×αR(xs,ys)×αT(xs,ys)×αB(xs,ys).
The
Using the example implementation discussed above in relation to
It will be appreciated that
In the examples described with respect to
With reference again to
The processor 606 may be, for example, a central processing unit (CPU), a graphics processing unit (GPU), or general-purpose computing on graphics processing units (GPGPU).
The benefit of the field programmable gate array (FPGA) or application specific integrated circuit (ASIC) implementation is that it can generally execute the computations faster, making it more desirable for real-time processing, such as when producing a live video (live production). The general processor implementation shown in
Although specific illustrated embodiments have been described above, variations and alternatives will be apparent. Some variations and alternatives are discussed above. Other example variations and alternatives are mentioned below for completeness.
In the embodiments above, it is assumed that each source image and corresponding target image is a component (e.g. a field or frame) of digital video, where the digital video comprises a series of digital images displayed in rapid succession. In a non-video environment, one could perform the methods above with digital images (e.g. a digital picture) to perform an effect on one or more digital images. This may be useful, for example, in a computer graphics application, such as (for example) in polygon rendering or texture mapping around edges in computer graphics to produce an anti-aliasing effect.
In the example shaping alpha computation described above, a pre-alpha value α′i(xs,ys) is first computed via Equation 27 as
In an alternative embodiment, an initial offset value α0 may be added, such that Equation 27 above is instead:
The initial offset value α0 is between 0 and 1, and in some embodiments the exact value of the initial offset value α0 may be controlled by the user through the user interface (e.g. user interface 608 or 314). The initial offset value α0 is an effect. Specifically, it causes the softness range to shift inside or outside the target object. For example, when α0=0, the alpha curve (softness range) starts from the source cropping boundary edge and inwardly ramps up, when α0=0.5, the alpha curve (softness range) starts from the outside of the source cropping boundary edge and inwardly ramps up but ends up at the inside of the source image, and when α0=1 the alpha curve (softness range) starts from the outside of the source cropping boundary edge and ends up just at the cropping boundary edge. This is illustrated in
In short, the initial offset value α0 shifts where the softness area is located relative to the boundary of the target object. The higher the initial offset value α0, the more outwardly extended the softness area is. It will be appreciated that in some embodiments, a different initial offset value α0,i may be chosen for each boundary, if desired.
As mentioned above, the initial offset value α0 can be considered an effect. However, in some embodiments it also plays a role in preventing a warped picture from protruding too much. This is explained below with respect to
A larger positive initial offset value α0 keeps the ramping (softness area) towards the outside of the picture area and therefore leaves pixels near boundaries of the picture intact or with fewer fadeouts. In most cases, it is preferred that all of the picture content is visible, rather than the fading (semi-transparency) happening too much inside the picture boundary and having some of the picture parts fade out. This is shown in
However, in cases in which the picture is extremely warped by an effect, the uniform softness around the target object in the target image (e.g. target object 123) may produce some protruding corners. This is illustrated in
The initial offset value α0 may be used to help address this problem.
One method of using the initial offset value α0 in order to accommodate both “normal” cases (not extreme warping), and “extreme warping” cases is as follows. The initial offset value α0 can be varied between 0 and 1 during operation depending upon the effect (particularly the rotation angle) so that, when necessary, the ramping (the softness area) may be moved completely inside the picture to eliminate extreme protruding corners. By moving the softness area completely inside the picture, the protruding corners would then be outside the softness area and would have an alpha shaping value of zero and so would be transparent. On the other hand, when the effect is such that there is no such problematic protruding corners, the ramping (the softness area) may instead be completely outside the picture to let the entire picture contents display with no fading of any of the picture contents. Depending upon the effect (the amount of protruding corners), the initial offset value α0 can also be chosen as somewhere between 0 and 1.
One way to achieve the above is to compute an appropriate corresponding initial offset value α0 each time the transformation parameters are computed (i.e. each time M−1 and the value of f are computed). One such example computation of the initial offset value α0 for a given set of parameters is as follows.
First define a ratio R as:
where “WIDTH” is the horizontal resolution and “HEIGHT” is the vertical resolution. The other parameters have been introduced earlier.
Then, the initial offsets for the horizontal and vertical boundaries are determined, respectively, as:
where Tmin, <Tmax. The specific values for Tmin and Tmax are implementation specific and may be determined through experimentation. The thresholds T0 and T1 are also implementation specific. In one implementation, these values are as follows T0=Tmin=0.2 and T1=Tmax=0.5.
Note that the conditions in Equations 38 and 39 are opposite because vertical source boundaries (left and right sides) require a smaller threshold T0 but horizontal source boundaries (top and bottom sides) require a larger threshold T1 when rotation is beyond 45 degrees.
The initial offset value α0 is then chosen as:
α0=min{α0H,α0V} (Equation 40).
By using as the initial offset value α0 the minimum of α0H and α0V, this prioritizes an alpha shaping ramp inside the picture boundary.
The above is one example way to use and compute an initial offset value α0. More generally, the computation of the initial offset value α0 comprises: for a given effect (set of parameters), computing a ratio R based on the boundary line rotation angle (or more generally, based on the effect chosen by the user, which determines the boundary line rotation angle), and then computing horizontal and vertical offset values using the ratio R, and then choosing as the initial offset value α0 the minimum of the horizontal and vertical offset values.
The variation of having an initial offset value α0 is described above. As another example, in another embodiment there may instead (or in addition) be a global transparency clipping function, which may be combined with the shaping alpha αshp to provide a transparency effect (e.g. for dissolving the target object into the background). This may be applied as follows:
where αTran is a value between 0 and 1. In some embodiments the exact value of αTran may be controlled by the user through the user interface (e.g. user interface 608 or 314). The use of αTran is an effect. As is clear from Equation 41, it clips the shaping alpha value so that the shaping alpha value can never be greater than αTran. Therefore, if αTran is less than one, the whole target object will be semi-transparent. If αTran=0 then the target object is completely transparent and only the background is shown. If αTran=1 then no additional effect is provided (i.e. it is as if αTran is not being used).
As an example,
In other embodiments, the global transparency clipping function may be replaced more generally with a fuzzy logic AND function: αshp=αTran ∩αshp where αTranε[0,1]. Equation 41 above is one implementation of the fuzzy logic AND in which an arithmetic minimum is taken (i.e. αshp=min(αTran,αshp)). Another implementation may be, for example, αshp=αTranαshp (i.e. arithmetic multiplication), which is illustrated with respect to
The above describes some specific embodiments, including some specific example computations using an assumed set of parameters and mapping function (e.g. M−1).
Please now consider
With reference to
The source digital image 1002 is defined by four boundaries B1, B2, B3, and B4. These boundaries may be boundaries of the original source image, or they may be cropping boundaries from previous cropping of the source image 1002. Each one of these four boundaries respectively corresponds to one of four boundaries of the digital object 1004 in the target digital image 1006.
Bordering a boundary of the digital object 1004 is an area A1 having a width W1 uniform along at least that boundary. This area A1 defines the softness range or softness margin of the boundary of the object 1004. In
The width W1 of area A1 is uniform in that the number of pixels in the target image 1006 between the boundary B1 of the object 1004 and an edge of the border, measured along a coordinate axis (in this case along the x-coordinate axis), is the same at each point or location along the boundary. This is shown in
A pixel coordinate (xt,yt) of the target image 1006 that is within the area A1 is mapped to a corresponding source pixel coordinate (xs,ys) that is within another area A2 bordering the source digital image 1002. This mapping may involve computing the corresponding source pixel coordinate using parameters obtained based on the effect requested by the user and applying those parameters to the target pixel coordinate. Because of the use of an area A1 of uniform width in the target image 1006, the area A2 bordering the boundary of the source image 1002 has a width that is non-uniform along a corresponding boundary of the source image 1002. This width is non-uniform in that the number of source pixels between the boundary of the source digital image 1002 and an edge of the border, measured along a coordinate axis, is different at two different points (locations) along the boundary of the source digital image 1002. This is shown in
Area A1 (and corresponding area A2) define a range or area of “softness” around the object 1004. A shaping alpha channel defines the amount of the “softness”. Specifically, each shaping alpha channel value defines the semi-transparency of a respective pixel associated with a pixel coordinate (xt,yt) of the target digital image 1006. In particular, for the target pixel coordinate (xt,yt) in area A1 of the target image 1006, the pixel is mapped to a corresponding source pixel coordinate (xs,ys) in area A2, and the alpha channel value for that target pixel coordinate (xt,yt) is then computed as a function of the location of the corresponding source pixel coordinate (xs,ys) in area A2. For example, in one embodiment, the alpha channel value is computed as a function of: (i) a distance between the corresponding source pixel coordinate (xs,ys) and the boundary of the source digital image 1002 and (ii) the width of area A2 at the location of the corresponding source pixel coordinate (xs,ys). In
This method of computing the alpha channel value for the target pixel coordinate (xt,yt) can be repeated for each target pixel coordinate in the softness area bordering the target digital object 1004.
By using the approach above to compute the alpha channel values for the target pixels in the softness area bordering the digital object 1004, the result is an ability to have a more uniform range of softness around the object 1004 in the target image 1006, since a uniform area A1 is defined to result in an area of uniform width (e.g. width W1) bordering a boundary of the object 1004, and then the appropriate alpha channel values are computed based on this. Specifically, an alpha channel value for a pixel coordinate (xt,yt) of the target image 1006 in the uniform softness area A1 is computed as a function of the location of the corresponding source pixel coordinate (xs,ys) in the area A2 of non-uniform width bordering the source image 1004).
Example devices for performing the method above are disclosed, for example, in
Some general embodiments will now be described.
In one embodiment, a method for computing an alpha channel value is provided. In this method, a set of parameters is obtained based on an effect (transformation) to be applied to a source image. A value is also obtained that defines a uniform width of an area that borders at least one boundary of the transformed source image in the target image. For a target image pixel coordinate in the area, a corresponding source pixel coordinate is computed that is within another non-uniform area bordering the source image. An alpha channel value defining semi-transparency of a pixel associated with the target image pixel coordinate is computed as a function of a location of the corresponding source pixel coordinate in the another area bordering the source image.
In one example embodiment, the method is performed by a computational device, and the method is performed as part of transforming a source digital image into a digital object in a target digital image. The source digital image and the target digital image each comprise a plurality of pixels. The method comprises the following steps: (i) receiving an indication of an effect to be applied to the source digital image; (ii) obtaining a set of parameters based on the indication of the effect; (iii) obtaining a value defining a width of an area that borders at least one boundary of the digital object in the target digital image; the width of the area is uniform along the at least one boundary of the digital object; (iv) for a pixel coordinate (xt,yt) of the target digital image that is within the area that borders the at least one boundary of the digital object, computing, using the pixel coordinate (xt,yt) of the target digital image and at least some of the parameters, a corresponding source pixel coordinate (xs,ys) that is within another area bordering the source digital image; the another area has a width that is non-uniform along a boundary of the source digital image; and (v) computing an alpha channel value defining semi-transparency of a pixel associated with the pixel coordinate (xt,yt) of the target digital image. The alpha channel value is computed as a function of a location of the corresponding source pixel coordinate (xs,ys) in the another area bordering the source digital image.
In some embodiments, the value defining the width of the area that borders the at least one boundary of the digital object in the target digital image is controlled by the user via the user interface (e.g. the user inputs a command to the user interface that translates to a specific value of the width of the area that borders the at least one boundary of the digital object in the target digital image).
In some embodiments, the value defining the width of the area that borders the at least one boundary of the digital object in the target digital image may be different for different boundaries of the digital object.
In some embodiments, the effect to be applied to the source digital image is a transformation/modification of the source digital image, such as resizing, rotation, translation, and/or distortion of the source image. The set of parameters obtained based on the indication of the effect are parameters defining the effect (transformation). More specifically, the parameters may define the mapping between target pixel coordinates and source pixel coordinates.
In some embodiments, the “at least one boundary” of the digital object may be all boundaries of the digital object (i.e. a uniform area bordering the entire digital object, as shown in
In general, the source digital image is defined by four boundaries (e.g. left, right, top, and bottom), and each one of the four boundaries respectively corresponds to one of four boundaries of the digital object in the target digital image.
In some embodiments, the width of the area that borders the at least one boundary of the digital object is defined as the number of pixels in the target image between the at least one boundary of the digital object and an edge of the border, measured along a coordinate axis (e.g. along a coordinate axis perpendicular to the boundary), and the width of said another area that borders the source digital image is defined as the number of source pixels between the boundary of the source digital image and an edge of the border, measured along a coordinate axis (e.g. along a coordinate axis perpendicular to the boundary).
In some embodiments, computing the alpha channel value specifically comprises computing the alpha channel value as a function of: (i) a distance between the corresponding source pixel coordinate (xs,ys) and the boundary of the source digital image, and/or (ii) the width of said another area at the location of the corresponding source pixel coordinate (xs,ys). The distance between the corresponding source pixel coordinate (xs,ys) and the boundary of the source digital image may be measured along a coordinate axis. The coordinate axis may be the coordinate axis that is perpendicular to the boundary.
In some embodiments, the width of said another area at the location of the corresponding source pixel coordinate (xs,ys) is a function of the value defining the width of the area that borders the at least one boundary of the digital object in the target digital image, and/or the target pixel coordinate (xt,yt), and/or at least some of the parameters.
In some embodiments, the width of the area that borders the at least one boundary of the digital object is uniform along the at least one boundary in that: the number of pixels in the target digital image between the at least one boundary and an edge of the area that borders the at least one boundary, measured along a coordinate axis, is the same at each point along the at least one boundary.
In some embodiments, the width of said another area that borders the source digital image is non-uniform along the boundary of the source digital image in that: the number of source pixels between the boundary of the source digital image and an edge of said another area that borders the source digital image, measured along a coordinate axis, is different at two different points along the boundary of the source digital image.
In some embodiments, the computational device performs: computing, for each one of a plurality of pixel coordinates of the target digital image, a respective corresponding source pixel coordinate. Each target pixel coordinate that is within the area that borders the at least one boundary of the digital object in the target digital image has a corresponding source pixel coordinate that is within said another area bordering the source digital image. In some of such embodiments, it may be that an alpha channel value is computed for each one of the plurality of pixel coordinates of the target digital image in said area.
An alpha channel value may, in some embodiments, be computed as a function of a distance between the respective corresponding source pixel coordinate and the boundary of the source digital image.
In some embodiments, computing the alpha channel value comprises: computing four pre-alpha values, one for each of four boundaries of the source digital image, and obtaining the alpha channel value using the four pre-alpha values.
In some embodiments, each one of the four pre-alpha values may be computed as a function of: (i) the distance between the corresponding source pixel coordinate (xs,ys) and a respective one of the four boundaries of the source digital image, and/or (ii) the value defining the width of the area that borders the at least one boundary of the digital object, and/or (iii) the target pixel coordinate (xt,yt), and/or (iv) at least some of the parameters.
In some embodiments, the alpha channel value may be computed using four pre-alpha values as inputs to one or more fuzzy logic functions.
In some embodiments, each one of four pre-alpha values may be computed in parallel.
In some embodiments, computing each one of four pre-alpha values comprises: using computational circuitry that is substantially identical to other computational circuitry used to compute each other of the four pre-alpha values; and inputting into the computational circuitry parameter values that are different from parameter values used to compute each other of the four pre-alpha values.
In some embodiments, each one of four pre-alpha values is a function of an initial alpha offset value. The initial offset value may be between 0 and 1.
In some embodiments, the computational device may obtain an intermediary computational result when computing the corresponding source pixel coordinate (xs,ys), and then use this intermediary computational result in computing the alpha channel value.
In some embodiments, the source digital image discussed herein may be an image in a source digital video, and the target digital image discussed herein may be an image in a target digital video.
In some embodiments, the alpha channel value is a real number in the range 0≦α≦1, where α is the alpha channel value, although more generally, the alpha value does not have to be between zero and one.
In some embodiments, the computational device may compute a pixel value for the pixel coordinate (xt,yt) of the target digital image using one or more pixel values in the source digital image that are obtained based on the corresponding source pixel coordinate (xs,ys).
In some embodiments, the computational device may combine the alpha channel value with a pixel value for the pixel coordinate (xt,yt) of the target digital image to effect transparency of the pixel value and result in a semi-transparent pixel value. The “combining” may comprise multiplying the pixel value for the pixel coordinate (xt,yt) with the corresponding alpha channel value, or some other operation (e.g. divisional, addition, some sort of fuzzy logic, etc.). The semi-transparent pixel value may be mixed with a pixel of a background image.
In some embodiments, the alpha channel value is further modified by a global transparency function.
In some embodiments, computing the alpha channel value further comprises computing an initial offset value. For example, the alpha channel value may be computed as a function of a location of the corresponding source pixel coordinate (xs,ys) in the another area bordering the source digital image and as a function of the initial offset value. As another example, the alpha channel value may be a function of: (i) a distance between the corresponding source pixel coordinate (xs,ys) and the boundary of the source digital image, and (ii) the width of said another area at the location of the corresponding source pixel coordinate (xs,ys), and (iii) the initial offset value. In some embodiments, the initial offset value may be computed at least each time the effect is changed (i.e. when there is a new set of parameters or when one or more of the parameters change). In such embodiments, the initial offset value is a function of at least some of the parameters. The initial offset may be computed at least each time the effect is changed in order to control the softness boundary of a warped picture. In some embodiments, the computation of the initial offset value may comprise: for a given set of parameters, computing a ratio R based on a boundary line rotation angle (or more generally, based on the effect chosen by the user, which defines the set of parameters and which determines the boundary line rotation angle), and then computing horizontal and vertical offset values using the ratio R, and then choosing as the initial offset value α0 the minimum of the horizontal and vertical offset values.
In one embodiment, there is provided a digital video effects (DVE) device for performing any of the methods described herein. In one implementation, the DVE device transforms a source digital image in source video into a digital object in a target digital image in target video, and the DVE device comprises: memory to store the source digital image when received by the DVE device, and to store a value defining a width of an area that borders at least one boundary of the digital object in the target digital image. The width of the area is uniform along the at least one boundary of the digital object. The DVE device can further comprise a user interface to receive an indication of an effect to be applied to said source digital image. The DVE device can further comprise circuitry to perform operations including: (i) obtaining a set of parameters based on the indication of the effect; (ii) for a pixel coordinate (xt,yt) of the target digital image that is within the area that borders the at least one boundary of the digital object, computing, using the pixel coordinate (xt,yt) of the target digital image and at least some of the parameters, a corresponding source pixel coordinate (xs,ys) that is within another area bordering the source digital image, the another area having a width that is non-uniform along a boundary of the source digital image; (iii) computing an alpha channel value defining semi-transparency of a pixel associated with the pixel coordinate (xt,yt) of the target digital image. The alpha channel value may be computed as a function of a location of the corresponding source pixel coordinate (xs,ys) in said another area bordering the source digital image.
In some embodiments, the DVE device may comprise a processor to execute instructions stored in memory in the DVE device. The instructions, when executed by the processor, cause the DVE device to perform the operations discussed herein. In some embodiments, this processor may be part of the “circuitry” referred to in the paragraph above.
In some embodiments, the DVE device may comprise an integrated circuit to perform the operations discussed herein. The integrated circuit may (in some embodiments) comprise a field-programmable gate array (FPGA) or an application-specific integrated circuit (ASIC). In some embodiments, the integrated circuit may be part of the “circuitry” referred to two paragraphs above.
In another embodiment, there is provided a computer readable storage medium having stored thereon computer executable instructions that, when executed by a computational device, cause the computational device to perform the operations discussed herein.
Finally, although boundaries of images are discussed, it will be appreciated that the methods described herein could be adapted to introduce uniform softness along another line or in an area inside an image away from the image boundaries. Such another line or area may be considered as bounded by “boundaries”, and the methods described herein applied as such.
Although the foregoing has been described with reference to certain specific embodiments, various modifications thereof will be apparent to those skilled in the art without departing from the scope of the claims appended hereto.
Number | Name | Date | Kind |
---|---|---|---|
6229550 | Gloudemans | May 2001 | B1 |
20030179214 | Saund | Sep 2003 | A1 |
20070139707 | Takami | Jun 2007 | A1 |
20100007665 | Smith | Jan 2010 | A1 |
20120206468 | Bratt | Aug 2012 | A1 |
Number | Date | Country | |
---|---|---|---|
20160071240 A1 | Mar 2016 | US |