The following documents are incorporated herein by reference as if fully set forth: German Patent Application No. 10 2021 113 909.0, filed May 28, 2021.
The invention relates to a method for transforming a data field. Such transformations are widely used in practice, for example in image post-processing with regard to color values or related geometric corrections.
The invention further relates to a transformation device, having means for applying a transformation to a data field, wherein data points can be transformed with at least one transformation rule.
The object of the invention is to apply the transformation to a data field in such a way that the calculation speed is increased and the memory requirement during the calculation is reduced.
To achieve this object, the invention provides one or more of the features as described herein. In particular, it is proposed according to the invention that the data field is divided into segments, that for each data point to be transformed of the data field a test is performed to identify the segment in which the data point is arranged, and that a transformation rule is subsequently selected depending on the segment found and the rule is applied to this data point. The advantage obtained is that a location-dependent transformation rule can be stored without the need for a closed formula to be available and without the need to define an individual transformation rule—for example in the form of a lookup table—for each data point. This saves memory space and can simplify the calculation algorithm.
It is particularly advantageous if the transformation rules are given by at least one function, in particular a polynomial. For example, a polynomial of n-th degree can be defined by (n+1) coefficients. This can be used to minimize the memory requirements for the calculation. This allows for a resource-saving storage of different transformation rules.
The classical approach used in the prior art involves the use of lookup tables (LUT). For example, in a 2D problem, values are stored in LUTs for each coordinate point (x,y), wherein they characterize the values of f(x,y). A 2D lookup table can easily be implemented in software applications as a 2D array (e.g.: ARRAY[x][y]), but in hardware implementations, for example in a field programmable gate array (FPGA) or an application-specific integrated circuit (ASIC), it is very resource-intensive. In particular, FPGAs have little chip memory space.
To solve this problem in hardware applications, in the prior art smaller 2D LUTs are usually used (e.g.: ARRAY[x/100][y/100]) and missing intermediate points are interpolated. However, such an approach is still resource-intensive.
The invention, by contrast, allows LUTs to be replaced, in particular by the present method.
In a further advantageous design, it may be provided that the boundaries of the segments are described by at least one function, in particular polynomials, preferably with equipotential surfaces of the at least one function, in particular wherein the respective segment belonging to a data point is determined by finding the equipotential surfaces between which the data point is located. This means that it is easy to test numerically between which segment boundaries, and thus in which segment, a data point lies.
In this context, an equipotential surface can be understood, for example, as a set of all points in which a function assumes a constant value. Equipotential surfaces in this sense can also be a line or a higher-dimensional object.
In a further advantageous embodiment, it may be provided that the transformation rule of a segment includes at least one transformation of a boundary, for example the already mentioned boundary, of the segment. This means that interpolation points can be defined for the transformation rule.
In a further advantageous embodiment it can be provided that if the data point to be transformed is located between the boundaries of the segments, an interpolation is applied between segment boundary values of the boundaries of the segments. This enables a location-dependent, fine-grained adaptation of the transformation rule.
The data field is preferably at least two-dimensional, in particular two-dimensional, or three-dimensional. This means that typical problems found in image processing, such as correction of geometric or color-related imaging errors or brightness corrections, can be addressed.
In an alternative, the transformation can change the dimension of the data fields. Thus, the method according to the invention can be integrated into image processing methods.
In another alternative, the transformation cannot change the dimension of the data fields. Thus, the method according to the invention can be used, for example, to obtain image-related or metadata for an image.
In an advantageous embodiment, it may be provided that the transformation affects the dimensions of the data field that define the segmentation. A transformation rule can therefore be used that depends on the data points which it affects. Examples may include corrections of visual imaging errors, such as aberration or distortion.
In one advantageous embodiment, it may be provided that the transformation affects those dimensions of the data field that do not define the segmentation. This means that a transformation rule can be used that does not depend on the data points which it affects. Examples can include location-based color corrections or location-dependent brightness corrections.
In a further advantageous embodiment, it may be provided that the interpolation is linear, bilinear, trilinear, bicubic, polynomial or performed according to the nearest neighbor method. This makes it possible to select the interpolation depending on the situation and precision.
In a further advantageous embodiment, it can be provided that the interpolation comprises a subdivision of the segment into interpolation points and that as the transformation value for a data point in the segment, a value is selected which corresponds to the transformation value of the nearest interpolation point. This has the advantage that the calculation speed of the interpolation is increased. The number of interpolation points can depend on the desired precision of the interpolation. For example, a large number of interpolation points will be necessary if the desired precision is high. This provides flexibility depending on the application and situation.
The described transformation method is preferably used for geometric transformations, color transformations, and/or for generating additional parameters, in particular of hemoglobin or hematocrit concentrations or oxygen saturations. This means that the transformation method can be used in numerous applications.
A method described thus can be used for direct and indirect transformations.
For example, direct transformation can be used in this context as a term for transformations where for each data point (x,y) a new point (x′,y′) is directly determined, where y′=f(x,y) and x′=x.
Indirect transformation can be used in this context, for example, as a term for transformations where for each data point (x,y) one or more parameters Alpha(x,y) are obtained, which can then be used for the transformation on the data point (x,y) in order to obtain a new data point (x′,y′).
In order to achieve the above-mentioned object, in the case of a transformation device, according to the invention the features of the stand-alone claim directed to a transformation device are provided. In particular, in order to achieve the stated object, it is proposed according to the invention that in a transformation device of the type mentioned that the data field is divided into segments, that means are implemented for testing, for each data point of the data field to be transformed, the segment in which the data point is arranged, and that means are implemented for selecting a transformation rule depending on the segment found and that the means for transforming the data field access the selected transformation rule for the transformation of the data point.
In an advantageous design, it can be provided that means are implemented for carrying out a method according to the invention, in particular as described above and/or according to any one of the claims directed to a method. Thus, the advantages already mentioned are realized.
The invention will now be explained in more detail by reference to a small number of exemplary embodiments, without being limited to these few exemplary embodiments. Further variants of the invention and exemplary embodiments result from the combination of the features of individual or multiple protective claims with one another and/or with individual or multiple features of the exemplary embodiments and/or the previously described variants of devices and methods according to the invention.
In the drawings:
A simple solution to this problem, which is not according to the invention, would be to store a DeltaY value for each coordinate point (x,y), which represents, for example, the vertical displacement to the new value y′. An image at 1080p resolution (1920×1080 pixels) would require more than 2 million values to be stored. An image at 4K-UHD resolution would require even more storage. Therefore, usually only a portion of these values is stored and the rest interpolated, which is nevertheless very memory intensive in relation to the hardware resources, for example on an FPGA chip.
In the present solution approach, shown in
In this example, the transformation is represented as a polynomial function in this way:
y
0
′=P
0(x)
y
1
′=P
1(x)
y
2
′=P
2(x)
Interpolation is used to transform data points that lie between the polynomial boundaries yn. For example, the interpolation can be linear, bicubic, or more complex.
In this case, for each data point (x,y), where yn-1<y<yn, an interpolation of a new value y′ takes place between Pn(x) and Pn-1(x).
The individual steps, as given in
In step 1, the data field (26) and the data point (x,y)(24) to be transformed are loaded. n data values yn are then selected, which divide the data field into (n−1) segments (25). In step 2, the index k is determined, where yk<y<yk+1. In step 3, the limits of the polynomials are calculated, where ymin=Pk(x) and ymax=Pk+1(x). In step 4, the new value y′ is transformed using an interpolation and y′ is obtained as a function of ymin, ymax, y, yk, and yk+1.
The method shown in
A first approach to this problem would be to define three values alphaR, alphaG and alphaB for each point to be transformed (e.g.: RGB pixel), which can act on this point as a multiplication factor, offset or the like, and to store them discretely. This generally requires a large amount of memory in the chip.
A solution according to the invention would be to divide the data field (27) into circular segments (29). Each circle with a different radius defines a transformation rule which is given by Alpha, preferably represented as a polynomial. Data points to be transformed, which lie between these circles with different Alpha, can be interpolated. A value Alpha(x,y) can now be assigned to each data point (x,y) (28). For the sake of simplification, Alpha(x,y) is used here, but this can also be substituted by AlphaR(x,y), AlphaG(x,y) and AlphaB(x,y).
The individual steps, as given in
R=(x{circumflex over ( )}2+y{circumflex over ( )}2){circumflex over ( )}(½) or R{circumflex over ( )}2=x{circumflex over ( )}2+y{circumflex over ( )}2.
In step 7, the index k is determined, where Rk<R<Rk+1. This means that the position of the data point (x,y) (28) and the corresponding boundaries (30) of the segment (29) are determined. In step 8 the values Alphamin and Alphamax are determined, where Alphamin=Pk(f(x,y)) and Alphamax=Pk+1 (f(x,y)) and where P is a polynomial and f(x,y) denotes an image parameter/characteristic at position x,y, for example Hue, Saturation, Brightness, or individual color values such as red, green, and blue. In step 9 a new value for Alpha is interpolated, where Alpha(x,y) is a function of Alphamin, Alphamax, R, Rk and Rk+1. In step 10, the value Alpha(x,y) is output.
In further exemplary embodiments, Alphamin, Alphamax and Alpha(x,y) can have multiple components. For example, Alphamin can have the components AlphaRmin=PR,k(Red(x,y)), AlphaGmin=PG,k(Green(x,y)), AlphaBmin=PB,k(Blue(x,y)), where Red, Green and Blue are the intensities in the respective color channels red, green and blue. The same applies to Alphamax and Alpha(x,y).
In the example shown graphically in
The example shown graphically in
The method illustrated in
The individual steps, as given in
The method illustrated in
A method that accelerates the interpolation and reduces the hardware requirements can be effected by dividing the segment with interpolation points. The example given in
Assume that the data point (u0,v0) is between the curves representing, for example, a hemoglobin concentration and given by the polynomials P3(u) and P4(u), which represent a hemoglobin concentration of 30% and 40%.
In the case of a linear interpolation, the ratio β is determined, which is given by the following expression:
β=(v0−P4(u0))/(P3(u0)−P4(u0))
The hemoglobin concentration τ (in %) of the data point (u0,v0) is now given by:
τ(u0,v0)=40%−β×10%
However, a division as defined in the formula for β is relatively complex in the hardware domain. Therefore, an approach using interpolation points is proposed. (n−1) interpolation points are inserted between the polynomial boundaries, where n is an integer. The approach with interpolation points is relatively simple to implement in the hardware domain. The following applies:
The value of v0 is then compared with the value of the interpolation point, wherein the value of the next interpolation point is selected. This is possible using a simple difference query, where Difference(k)=|v0−interpolation-pointk| for k=0, 1, . . . , n. The value of the interpolation point that has the smallest absolute difference is then selected. The greater the number of interpolation points (n−1), the more accurate this method becomes. Other selection criteria than that of the “nearest neighbor” are also conceivable.
The invention relates to a method and a device for applying a transformation to a data field, wherein data points are transformed using at least one transformation rule, characterized in that the data field is divided into segments, that for each data point to be transformed of the data field a test is performed to identify the segment in which the data point is arranged, and that a transformation rule is subsequently selected depending on the segment found and the rule is applied to said data point.
Number | Date | Country | Kind |
---|---|---|---|
102021113909.0 | May 2021 | DE | national |