Image interpolation processing method, image processing equipment and storage device
During the demosaicing process, the interpolation direction area is divided based on the inter-channel color difference and intra-channel difference of the original image, and the interpolation of the primary color channel and the secondary color channel is performed, thereby solving the false color problem and improving the delicacy and authenticity of the image.
Patent Information
- Application Number
- CN202110943463.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-17
- Publication Date
- 2024-10-22
- Estimated Expiration
- 2041-08-17
AI Technical Summary
During the demosaicing process, the false color problem occurs due to inaccurate judgment of the interpolation direction.
By obtaining the color channel corresponding to each pixel in the original image, based on the color difference between the first channel and the difference within the channel, the pixels of the secondary color channel are divided into the corresponding interpolation direction areas, and the primary color channel and the secondary color channel are divided. Interpolation, considering multi-channel texture details, improves false color problems.
It improves the accuracy of the interpolation direction, enhances the detail of the image, improves the false color problem, and obtains a more realistic target color image.
Smart Images

Figure CN113870106B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to an image interpolation processing method, an image processing device and a storage device. Background Art
[0002] When acquiring color images, a single sensor is usually used to acquire the three primary colors. Before light enters the sensor array, a color filter array is used to filter the main color components of green, red, and blue. The image formed in this case is called a mosaic image. In a mosaic image, each pixel contains only one color, usually green, red, or blue. The main color components of green, red, and blue can be used to synthesize a full-color image. The process of converting this mosaic image into a full-color image is called "demosaicing." However, in the process of demosaicing, the false color problem is caused due to inaccurate judgment of the interpolation direction. Summary of the invention
[0003] The main technical problem solved by the present application is to provide an image interpolation processing method, an image processing device and a storage device, which can improve the false color problem.
[0004] In order to solve the above problems, the first aspect of the present application provides an image interpolation processing method, which includes: obtaining an original image, wherein each pixel in the original image corresponds to a color channel, the color channel with the most corresponding pixels in the original image is the primary color channel, and the remaining color channels are secondary color channels; based on the first inter-channel color difference and intra-channel difference of the original image, the pixel points corresponding to the secondary color channel are divided into corresponding interpolation direction areas, wherein the first inter-channel color difference represents the pixel value difference between the primary color channel and the secondary color channel, and the intra-channel difference represents the pixel value difference of the primary color channel; based on the divided interpolation direction areas, interpolating the primary color channel of the original image to obtain an interpolated image; interpolating the secondary color channel of the interpolated image to obtain a target color image.
[0005] In order to solve the above problems, the second aspect of the present application provides an image processing device, which includes a memory and a processor coupled to each other, the memory stores program data, and the processor is used to execute the program data to implement any step in the above image interpolation processing method.
[0006] In order to solve the above problem, the third aspect of the present application provides a storage device, which stores program data that can be executed by a processor, and the program data is used to implement any step in the above image interpolation processing method.
[0007] The above scheme divides the pixel points corresponding to the secondary color channel into corresponding interpolation direction areas based on the first inter-channel color difference and intra-channel difference of the original image, wherein the first inter-channel color difference represents the pixel value difference between the primary color channel and the secondary color channel, and the intra-channel difference represents the pixel value difference of the primary color channel. The interpolation direction areas divided based on the first inter-channel color difference and intra-channel difference of the original image consider the texture details of multiple channels, so that the interpolation direction is judged more accurately, the primary color channel of the original image is interpolated to obtain an interpolated image, and the secondary color channel of the interpolated image is interpolated to obtain a target color image, which can improve the false color problem and enhance the degree of delicacy. BRIEF DESCRIPTION OF THE DRAWINGS
[0008] In order to more clearly illustrate the technical solutions in this application, the following briefly introduces the drawings required in the description of the embodiments. Obviously, the drawings described below are only some embodiments of this application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:
[0009] Figure 1 It is a flowchart of the first embodiment of the image interpolation processing method of the present application;
[0010] Figure 2 It is a schematic diagram of an example of an original image of the present application;
[0011] Figure 3 This application Figure 1 A schematic diagram of a flow chart of an embodiment of step S12;
[0012] Figure 4 This application Figure 3 A schematic diagram of a flow chart of an embodiment of step S124;
[0013] Figure 5 This application Figure 1 A schematic diagram of another embodiment of step S12;
[0014] Figure 6 This application Figure 5 A schematic diagram of a flow chart of an embodiment of step S126;
[0015] Figure 7 This application Figure 1 A schematic diagram of a flow chart of an embodiment of step S13;
[0016] Figure 8 This application Figure 1 A schematic diagram of a flow chart of an embodiment of step S14;
[0017] Fig. 9It is a structural schematic diagram of an embodiment of an image interpolation processing device of the present application;
[0018] Fig.10 It is a structural schematic diagram of an embodiment of an image processing device of the present application;
[0019] Fig.11 It is a structural diagram of an embodiment of a storage device of the present application. DETAILED DESCRIPTION
[0020] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0021] The terms "first" and "second" in this application are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of indicated technical features. Thus, the features defined as "first" and "second" can explicitly or implicitly include at least one of the features. In the description of this application, the meaning of "multiple" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally also includes steps or units that are not listed, or optionally also includes other steps or units inherent to these processes, methods, products or devices.
[0022] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0023] The present application provides the following embodiments, and each embodiment is described in detail below.
[0024] See also Figure 1 , Figure 1 1 is a flow chart of the first embodiment of the image interpolation processing method of the present application. The method may include the following steps:
[0025] S11: Acquire an original image, wherein each pixel in the original image corresponds to a color channel, the color channel with the most corresponding pixels in the original image is the primary color channel, and the remaining color channels are secondary color channels.
[0026] See also Figure 2 , the original image can be acquired using a color filter array, for example, the original image can be a Bayer format image acquired using a color filter array. Among them, each pixel in the original image corresponds to a color channel, the color channel with the most corresponding pixels in the original image is the primary color channel, and the remaining color channels are secondary color channels. The color channels corresponding to the original image include a green channel, a red channel, and a blue channel. For example, if the green channel has the most pixels and the information of the green channel is relatively rich, the green channel can be used as the primary color channel, and the red channel and the blue channel can be used as secondary color channels. The present application is described by taking the green channel as the primary color channel as an example, but the present application is not limited to this.
[0027] S12: Based on the first inter-channel color difference and intra-channel difference of the original image, pixel points corresponding to the secondary color channel are divided into corresponding interpolation direction areas.
[0028] The first inter-channel color difference indicates the difference in pixel values between the primary color channel and the secondary color channel, for example, the first inter-channel color difference may indicate the difference in pixel values between the green channel and the red channel or the blue channel. The intra-channel difference indicates the difference in pixel values of the primary color channel, for example, the inter-channel difference may indicate the difference in pixel values between different pixels of the green channel.
[0029] By utilizing the color difference between the first channels and the difference within the channels of the original image, the pixel points corresponding to the secondary color channel can be divided into corresponding interpolation direction areas, that is, the pixel points corresponding to the red channel and the blue channel can be divided into corresponding interpolation direction areas, wherein the interpolation direction areas can include horizontal direction areas, vertical direction areas, and no direction areas.
[0030] S13: Based on the divided interpolation direction areas, interpolate the main color channels of the original image to obtain an interpolated image.
[0031] Based on the interpolation direction area divided for the pixels corresponding to the secondary color channel, the primary color channel is interpolated for the pixels corresponding to the secondary color channel of the original image according to the interpolation direction area. For example, the green channel can be interpolated for the red channel and the blue channel respectively according to the color difference between the inter-channel pixels of the red channel, the blue channel and the green channel, thereby obtaining an interpolated image for the green channel interpolation.
[0032] S14: performing interpolation of the secondary color channels on the interpolated image to obtain a target color image.
[0033] After interpolating the primary color channel of the original image, the secondary color channel of the interpolated image may be interpolated again, for example, the red channel and the blue channel of the interpolated image may be interpolated in sequence to obtain a target color image.
[0034] In this embodiment, the pixel points corresponding to the secondary color channel are divided into corresponding interpolation direction areas based on the first inter-channel color difference and the intra-channel difference of the original image, wherein the first inter-channel color difference represents the pixel value difference between the primary color channel and the secondary color channel, and the intra-channel difference represents the pixel value difference of the primary color channel. The interpolation direction areas divided based on the first inter-channel color difference and the intra-channel difference of the original image take into account the texture details of multiple channels, so that the interpolation direction is judged more accurately, the primary color channel of the original image is interpolated to obtain an interpolated image, and the secondary color channel of the interpolated image is interpolated to obtain a target color image, which can improve the false color problem and enhance the degree of fineness.
[0035] In some embodiments, see Figure 3 , the above step S12 may further include the following steps:
[0036] S121: taking each pixel point corresponding to the secondary color channel as a first target pixel point.
[0037] See also Figure 2 , taking each pixel corresponding to the secondary color channel as the first target pixel, so as to divide the pixel corresponding to the secondary color channel into the interpolation direction area. For example, taking each pixel corresponding to the blue channel and the red channel as the first target pixel, the first target pixel can be recorded as X(i, j).
[0038] S122: Based on the pixel value difference between the secondary color channel and the primary color channel corresponding to the first target pixel point in at least one preset direction within the first neighborhood, obtain the first channel color difference of the first target pixel point in at least one preset direction.
[0039] The preset direction may include a vertical direction and a horizontal direction, wherein the preset direction includes a first sub-direction and a second sub-direction in opposite directions, and when the preset direction is a vertical direction, the first sub-direction and the second sub-direction included in the preset direction may be vertically upward and vertically downward, respectively; when the preset direction is a horizontal direction, the first sub-direction and the second sub-direction included in the preset direction may be horizontally left and horizontally right. The first inter-channel color difference may be represented as a pixel value difference between a first target pixel and a pixel in a first neighborhood in the first sub-direction thereof.
[0040] The color difference between the first channel of the first target pixel in the vertical direction can be expressed as:
[0041] D n(i,j)=X(i-1,j)-X(i,j)
[0042] Among them, D n (i, j) represents the first inter-channel color difference of the first target pixel in the vertical direction; X(i, j) represents the first target pixel; X(i-1, j) represents the pixel in the vertical direction within the first area of the first target pixel.
[0043] Similarly, the color difference between the first channels vertically downward, horizontally to the right, and horizontally to the left in the first area of the first target pixel can be expressed as:
[0044] D s (i,j)=X(i+1,j)-X(i,j)
[0045] D e (i,j)=X(i,j+1)-X(i,j)
[0046] D w (i,j)=X(i,j-1)-X(i,j)
[0047] Where X(i,j) represents the first target pixel; D s (i, j) represents the first channel color difference of the first target pixel point vertically downward, and X(i+1, j) represents the pixel point vertically downward in the first area of the first target pixel point; D e (i, j) represents the first channel color difference of the first target pixel horizontally to the right, and X(i, j+1) represents the pixel horizontally to the right in the first area of the first target pixel; D w (i, j) represents the first channel color difference of the first target pixel horizontally to the left, and X(i, j-1) represents the pixel horizontally to the left in the first area of the first target pixel.
[0048] S123: Based on the pixel value difference in the main color channel in at least one preset direction within the first neighborhood of the first target pixel, a corresponding channel difference of the first target pixel in at least one preset direction is obtained.
[0049] For each preset direction, a first pixel value difference between a first neighborhood pixel point in the first sub-direction and a first neighborhood pixel point in the second sub-direction in the first neighborhood is obtained.
[0050] For the horizontal direction, the first pixel value difference between the first target pixel in the first area to the left horizontally and the pixel in the second area to the right horizontally is obtained. The first pixel value difference in the horizontal direction can represent the horizontal gradient of the green channel corresponding to the first target pixel. The first pixel value difference in the horizontal direction can be represented as:
[0051] DG h (i,j)=|X(i,j-1)-X(i,j+1)|
[0052] Among them, DG h (i, j) represents the first pixel value difference of the first target pixel in the horizontal direction, X(i, j-1) represents the pixel in the first area to the left horizontally, and X(i, j+1) represents the pixel in the second area to the right horizontally.
[0053] For the vertical direction, the first pixel value difference between the first target pixel in the first vertically upward field and the first pixel in the second vertically downward field is obtained, and the first pixel value difference in the vertical direction can represent the vertical gradient of the green channel corresponding to the first target pixel. The first pixel value difference in the vertical direction can be represented as:
[0054] DG v (i,j)=|X(i-1,j)-X(i+1,j)|
[0055] Among them, DG v (i, j) represents the first pixel value difference in the vertical direction of the first target pixel point, X(i-1, j) represents the pixel point in the first vertical area, and X(i+1, j) represents the pixel point in the second vertical area.
[0056] The first pixel value difference is used to obtain the intra-channel difference of the first target pixel in the preset direction. For each preset direction, the first pixel value of the pixel in the preset area of the first target pixel corresponding to the preset direction is obtained, and the sum of the first pixel values of multiple pixels in the preset area corresponding to the preset direction is used to obtain the intra-channel difference of the first target pixel in the preset direction. That is, the change amount of a single channel is obtained according to the gradient calculation of the green channel.
[0057] The difference of the first target pixel in each channel of the preset direction can be expressed by the following formulas:
[0058] N={(k,l)|{±2,0}}
[0059] N={(k,l)|{±2,0}}
[0060] Among them, ρ h Indicates the intra-channel difference of the first target pixel in the horizontal direction, DG h (i+k,j+l) represents the first pixel value difference of the pixel point at (i+k,j+l) in the horizontal direction; ρ v Indicates the intra-channel difference of the first target pixel in the vertical direction, DGv (i+k,j+l) represents the first pixel value difference in the vertical direction of the pixel point located at (i+k,j+l).
[0061] S124: Divide the first target pixel point into corresponding interpolation direction areas by using the first inter-channel color difference and the intra-channel difference corresponding to the first target pixel point.
[0062] The first target pixel point obtained in the above steps is divided into corresponding interpolation direction areas using the first inter-channel color difference and intra-channel difference corresponding to each preset direction, wherein the interpolation direction area may include a horizontal direction area, a vertical direction area, and a non-directional area. The non-directional area may represent a platform area of the image.
[0063] Specifically, see Figure 4 , step S124 may include the following steps:
[0064] S1241: For each preset direction, using a first change amount of a first inter-channel color difference in a preset direction within a second neighborhood of a first target pixel, obtain a change color difference of the first target pixel in the preset direction.
[0065] For each preset direction, the first change amount of the first channel color difference of the pixel points in the second area of the first target pixel point in the preset direction can be used. Among them, the first change amount of the first channel color difference in two sub-directions of the preset direction in the second neighborhood can be obtained. Among them, the first change amount of the first channel color difference in the preset direction can be expressed by the following formula:
[0066] N={(k,l)|{±2,0},(k,l)≠(0,0)}
[0067] Among them, V1 p (i, j) represents the first change amount of the first inter-channel color difference of the first target pixel in the preset direction, wherein the sub-directions of the preset direction may include vertical upward, vertical downward, horizontal left and horizontal right, D p (i+k,j+l) represents the first channel color difference of the pixel at (i+k,j+l) in the preset direction, D p (i, j) represents the first inter-channel color difference of the first target pixel in the preset direction. For example, when the preset direction includes vertically upward, the first change amount of the first inter-channel color difference of the first target pixel in the vertical direction can be expressed as:
[0068] N={(k,l)|{±2,0},(k,l)≠(0,0)}
[0069] Among them, V1n (i, j) represents the first change in the first channel color difference of the first target pixel in the vertical direction, D n (i+k,j+l) represents the color difference between the first channels of the pixel at (i+k,j+l) in the vertical direction, D n (i, j) represents the first channel color difference of the first target pixel in the vertical direction.
[0070] The maximum value and the minimum value of the first variation corresponding to the two sub-directions are respectively used as the maximum variation color difference and the minimum variation color difference of the first target pixel in the preset direction, and the maximum variation color difference and the minimum variation color difference of the first target pixel in the preset direction are used as the variation color difference of the first target pixel in the preset direction. Among them, the variation color difference corresponding to the horizontal direction includes the maximum horizontal variation color difference and the minimum horizontal variation color difference, and the variation color difference corresponding to the vertical direction includes the maximum vertical variation color difference and the minimum vertical variation color difference. Specifically, the variation color difference of each preset direction can be expressed as:
[0071] Vh_max=max(V1 w ,V1 e )
[0072] Vh_min=min(V1 w ,V1 e )
[0073] Vv_max=max(V1 n ,V1 s )
[0074] Vv_min=min(V1 n ,V1 s )
[0075] Wherein, Vh_max and Vh_min represent the maximum horizontal change color difference and the minimum horizontal change color difference of the first target pixel respectively; Vv_max and Vv_min represent the maximum vertical change color difference and the minimum vertical change color difference of the first target pixel respectively; V1 w 、V1 e 、V1 n 、V1 s Respectively represent the first change amount of the first channel color difference of the first target pixel point horizontally to the left, horizontally to the right, vertically upward, and vertically downward.
[0076] S1242: Divide the first target pixel point into corresponding interpolation direction areas by using the change color difference in at least one preset direction and the intra-channel difference in at least one preset direction.
[0077] At least one preset direction includes a horizontal direction and a vertical direction. If the color difference of the change in at least one preset direction and the difference in the channel of at least one preset direction meet the first horizontal preset condition, the first target pixel point is divided into a horizontal direction area. Among them, the first horizontal preset condition includes: the sum of the product of the first preset threshold and the maximum horizontal change color difference and the second preset threshold is less than the minimum vertical change color difference, and the change in the horizontal channel is less than the change in the vertical channel. That is to say, compared with the horizontal direction, the color difference change in the vertical direction is large, and the change in the single channel in the vertical direction is large, then the first target pixel point can be divided into a horizontal direction area. Among them, the first horizontal preset condition corresponding to the horizontal direction area can be expressed as:
[0078] maskH=((param_th2+param_th1*Vh_max) <Vv_min)&(ρ h < v )&(~Gmask)
[0079] Wherein, maskH represents the mask corresponding to the pixel points in the horizontal area; Gmask represents the mask corresponding to the pixel points in the green channel; param_th1 and param_th2 represent the first preset threshold and the second preset threshold respectively. In addition, "*" represents multiplication, "~" represents logical "not", and "&" represents logical "and".
[0080] If the color difference of at least one preset direction and the difference within the channel of at least one preset direction meet the first vertical preset condition, the first target pixel point is divided into the vertical direction area. Among them, the first vertical preset condition includes: the sum of the product of the first preset threshold and the maximum vertical change color difference and the second preset threshold is less than the minimum horizontal change color difference, and the change within the vertical channel is less than the change within the horizontal channel. That is to say, compared with the vertical direction, the color difference change in the horizontal direction is large, and the change in the single channel in the horizontal direction is large, then the target pixel point can be divided into the vertical direction area. Among them, the first vertical preset condition corresponding to the vertical direction area can be expressed as:
[0081] maskV=((param_th2+param_th1*Vv_max) <Vh_min)&(ρ v < h )&(~Gmask)
[0082] Among them, maskV represents the mask corresponding to the pixel points in the vertical area.
[0083] If the color difference of at least one preset direction and the intra-channel difference of at least one preset direction do not meet the first horizontal preset condition and the first vertical preset condition, the first target pixel point is divided into the non-directional area. That is, if the color difference of at least one preset direction and the intra-channel difference of at least one preset direction do not meet the first horizontal preset condition and the first vertical preset condition, and do not belong to the horizontal direction area or the vertical direction area, the first target pixel point can be divided into the non-directional area. Among them, the non-directional area can be correspondingly expressed as:
[0084] maskNone=(~(maskH|maskV))&(~Gmask)
[0085] Among them, maskNone represents the mask corresponding to the pixels in the non-directional area, and “|” represents the logical “or”.
[0086] In this embodiment, the first target pixel point is divided into the corresponding interpolation direction area by using the color difference of at least one preset direction and the difference within the channel of at least one preset direction, and the first preset threshold and the second threshold are added to the first horizontal preset condition and the first vertical preset condition, so that the first preset threshold and the second preset threshold can be adjusted to control the interpolation direction area of the pixel points in the secondary color channel. In addition, since the first preset threshold and the second preset threshold are added to the first horizontal preset condition and the first vertical preset condition, the division of the horizontal direction area and the vertical direction area is more conservative, and more pixels with inaccurate interpolation direction area judgment are divided into non-directional areas, which is more robust.
[0087] In some embodiments, see Figure 5 After the first target pixel point is divided into corresponding interpolation direction areas in the above step S124, the following steps may also be included:
[0088] S125: If the first target pixel point is divided into the non-directional area, a discrimination coefficient of the first target pixel point is obtained based on the pixel values in the third neighborhood of the first target pixel point.
[0089] If the first target pixel is divided into a directionless area in step S124, the discrimination coefficient of the first target pixel is obtained based on the pixel values in the third neighborhood of the first target pixel, and the at least one preset direction includes a horizontal direction and a vertical direction. The third neighborhood includes a number of vertical neighborhood pixels located in the vertical direction of the first target pixel and corresponding to the primary color channel, a number of horizontal neighborhood pixels located in the horizontal direction of the first target pixel and corresponding to the primary color channel, and a number of other neighborhood pixels corresponding to different secondary color channels of the first target pixel.
[0090] Specifically, the first sub-coefficient is obtained by using the difference between the sum of the pixel values of several vertical neighboring pixels and the sum of the pixel values of several horizontal neighboring pixels. The first sub-coefficient μ1(i, j) corresponding to the first target pixel can be expressed as:
[0091] μ1(i,j)=|X(i-1,j)+X(i+1,j)-X(i,j+1)-X(i,j-1)|
[0092] The second sub-coefficient is obtained by using the difference between the sum of the pixel values of some vertical neighboring pixels and some horizontal neighboring pixels and the sum of the pixel values of the remaining vertical neighboring pixels and the remaining horizontal neighboring pixels, which can provide the ability to detect the texture of the first pixel in the oblique direction. Among them, the second sub-coefficient corresponding to the first target pixel can be expressed as:
[0093] μ2(i,j)=|X(i-1,j)-X(i+1,j)+X(i,j+1)-X(i,j-1)|
[0094] μ3(i,j)=|X(i-1,j)-X(i+1,j)-X(i,j+1)+X(i,j-1)|
[0095] Among them, μ2(i,j) and μ3(i,j) represent the second sub-coefficients corresponding to the first target pixel.
[0096] The third sub-coefficient is obtained by using the difference in pixel values of some other neighboring pixels. The third sub-coefficient can be obtained by using the difference in pixel values between the pixels of the secondary color channel in the domain of the first target pixel. For example, if the first target pixel is a pixel of the blue channel, the third sub-coefficient can be obtained by using the difference in pixel values of the pixels of the red channel in the domain. The detection capability of the secondary color channel texture can be provided. Among them, the third sub-coefficient corresponding to the first target pixel can be expressed as:
[0097] μ4(i,j)=|X(i-1,j-1)-X(i+1,j-1)|
[0098] μ5(i,j)=|X(i-1,j+1)-X(i+1,j+1)|
[0099] μ6(i,j)=|X(i-1,j-1)-X(i-1,j+1)|
[0100] μ7(i,j)=|X(i+1,j+1)-X(i+1,j-1)|
[0101] Among them, μ4(i,j), μ5(i,j), μ6(i,j), and μ7(i,j) represent the third sub-coefficients corresponding to the first target pixel.
[0102] The first sub-coefficient, the second sub-coefficient and the third sub-coefficient are used to sum the first sub-coefficient, the second sub-coefficient and the third sub-coefficient to obtain the discrimination coefficient of the first target pixel. Among them, the discrimination coefficient μ(i, j) of the first target pixel can be expressed as:
[0103] μ(i,j)=μ1(i,j)+μ2(i,j)+μ3(i,j)+μ4(i,j)+μ5(i,j)+μ6(i,j)+μ7(i,j)
[0104] S126: If the discrimination coefficient of the first target pixel point is greater than a third preset threshold, re-dividing the first target pixel point into a corresponding interpolation direction area.
[0105] If the discrimination coefficient μ(i,j) of the first target pixel is greater than the third preset threshold value param_th3, it can be determined that the first target pixel is not a flat area, that is, a pseudo-flat area, and in fact the first target pixel has a direction, which is a horizontal direction or a vertical direction. Then the corresponding interpolation direction area can be re-divided for the first target pixel.
[0106] In some embodiments, see Figure 6 In step S126, the corresponding interpolation direction area is re-divided for the first target pixel point, and the following steps may also be included:
[0107] S1261: For each preset direction, the composite change color difference of the first target pixel in the preset direction is obtained by using the second change amount of the first channel color difference in each preset direction in the fourth neighborhood of the first target pixel and the third change amount of the second channel color difference in the preset direction in the fourth neighborhood.
[0108] The fourth neighborhood is greater than or equal to the second neighborhood. The first inter-channel color difference can be expressed as the color difference between the color channel where the first target pixel is located and the primary color channel, and the second inter-channel color difference represents the difference in pixel values between the secondary color channel that does not correspond to the first target pixel and the other color channels, where the other color channels can be the primary color channels. For example, if the color channel where the first target pixel is located is the blue channel, the first inter-channel color difference is the color difference between the pixels of the blue channel and the green channel, and the second inter-channel color difference is the color difference between the pixels of the red channel and the green channel.
[0109] For each preset direction, the composite change color difference of the first target pixel in the preset direction is obtained by using the second change amount of the first channel color difference in each preset direction in the fourth neighborhood of the first target pixel and the third change amount of the second channel color difference in the preset direction in the fourth neighborhood.
[0110] The preset direction includes two sub-directions with opposite directions. For each sub-direction of the preset direction, the second variation and the third variation of the second inter-channel color difference in the sub-direction in the fourth neighborhood are obtained, and the color difference parameter of the sub-direction is obtained by using the inter-channel color difference of the first target pixel in the sub-direction and the second variation and the third variation. For each sub-direction, the color difference parameter of the sub-direction can be expressed as:
[0111] V2 p (i,j)=|D p (i,j)|+|D p (i-2,j)-D p (i,j)|+|D p (i+2,j)-D p (i,j)|+
[0112] |D p (i,j-2)-D p (i,j)|+|D p (i,j+2)-D p (i,j)|+
[0113] |D p (i-4,j)-D p (i,j)|+|D p (i+4,j)-D p (i,j)|+
[0114] |D p (i,j-4)-D p (i,j)|+|D p (i,j+4)-D p (i,j)|+
[0115] |D p (i-1,j-1)-D p (i+1,j-1)|+|D p (i-1,j+1)-D p (i+1,j+1)|
[0116] Among them, V2 p (i, j) represents the color difference parameter of the sub-direction, wherein the color difference parameter of the sub-direction may include the color difference parameter V2 of the preset direction including the vertical upward direction n (i, j), vertical downward color difference parameter V2 s (i, j), horizontal left color difference parameter V2 w (i, j) and the horizontal right color difference parameter V2 e (i,j);|D p(i, j)| represents the inter-channel color difference of the first target pixel in the sub-direction; it may include the first inter-channel color difference D of the first target pixel in the vertical direction n (i, j), the color difference D between the first channels in the vertical direction s (i, j), the color difference D between the first channels horizontally to the right e (i, j), the color difference D between the first channels horizontally to the left w (i,j);|D p (i-1,j-1)-D p (i+1,j-1)|+|D p (i-1,j+1)-D p (i+1,j+1)| represents the third change of the second channel color difference in the sub-direction within the fourth neighborhood. It can be understood that the third change and the second change may also include the third change vertically upward, vertically downward, horizontally left, and horizontally right change respectively.
[0117] For example, for the vertical upward sub-direction, the vertical upward color difference parameter can be expressed as:
[0118] V2 n (i,j)=|D n (i,j)|+|D n (i-2,j)-D n (i,j)|+|D n (i+2,j)-D n (i,j)|+
[0119] |D n (i,j-2)-D n (i,j)|+|D n (i,j+2)-D n (i,j)|+
[0120] |D n (i-4,j)-D n (i,j)|+|D n (i+4,j)-D n (i,j)|+
[0121] |D n (i,j-4)-D n (i,j)|+|D n (i,j+4)-D n (i,j)|+
[0122] |D n (i-1,j-1)-D n (i+1,j-1)|+|D n(i-1,j+1)-D n (i+1,j+1)|
[0123] Similarly, the expressions of the chromatic aberration parameters in other sub-directions can be obtained by referring to the expressions of the chromatic aberration parameters in the vertical direction, which will not be described in detail in this application.
[0124] The color difference parameters corresponding to each sub-direction are filtered. The color difference parameters corresponding to each direction can be filtered using a filter kernel, and the filtering process can be expressed as:
[0125] V2 p (i,j)=imfilter(V2 p ,kernel)
[0126] The imfilter function is used to filter any type of array or multidimensional image. kernel represents the filter kernel. For example, the filter kernel can be:
[0127] kernel=[1 2 4 2 1]′*[1 2 4 2 1]
[0128] Due to the possible presence of noise or other influences, the direction of a certain pixel may change abruptly, and the neighborhoods of the image are correlated. Based on the local similarity of the image, that is, the direction of the image texture should not change dramatically in a small range. Therefore, the color difference parameters corresponding to each sub-direction are filtered to enhance the robustness of the pixel interpolation direction area determination.
[0129] After filtering the color difference parameters corresponding to each sub-direction, the maximum value and the minimum value of the color difference parameters of the two sub-directions of the preset direction can be used as the maximum compound change color difference and the minimum compound change color difference of the first target pixel in the preset direction, respectively. The compound change color difference corresponding to the horizontal direction includes the maximum horizontal compound change color difference and the minimum horizontal compound change color difference, and the compound change color difference corresponding to the vertical direction includes the maximum vertical compound change color difference and the minimum vertical compound change color difference. Specifically, the maximum compound change color difference and the minimum compound change color difference of each preset direction can be expressed as:
[0130] vh_max=max(V2 w ,V2 e )
[0131] vh_min=min(V2 w ,V2 e )
[0132] vv_max=max(V2 n ,V2 s )
[0133] vv_min=min(V2 n ,V2 s )
[0134] Wherein, vh_max and vh_min represent the maximum horizontal composite change color difference and the minimum horizontal composite change color difference of the first target pixel respectively; vv_max and vv_min represent the maximum vertical composite change color difference and the minimum vertical composite change color difference of the first target pixel respectively; V2 w 、V2 e 、V2 n 、V2 s Respectively represent the color difference parameters of the first target pixel point horizontally to the left, horizontally to the right, vertically upward, and vertically downward.
[0135] S1262: Re-divide the first target pixel point into corresponding interpolation direction areas using the composite change color difference in at least one preset direction.
[0136] At least one preset direction includes a horizontal direction and a vertical direction. If the composite change color difference of at least one preset direction meets the second horizontal preset condition, the first target pixel point is divided into a horizontal direction area. Among them, the second horizontal preset condition includes: the sum of the maximum horizontal composite change color difference and the fourth preset threshold is less than or equal to the product of the minimum vertical composite change color difference and the fifth preset threshold. The second horizontal preset condition can be expressed as:
[0137] maskEdgeH=maskEdge&((vh_max+param_th4)≤(vv_min*param_th5))
[0138] Among them, maskEdge represents the pixel points in the area where the discrimination coefficient of the first target pixel point in the above-mentioned directionless area is greater than the third preset threshold; param_th4 represents the fourth preset threshold, and the fourth preset threshold can be a constant, for example, the fourth preset threshold is 1; param_th5 represents the fifth preset threshold.
[0139] If the composite change color difference in at least one preset direction satisfies the second vertical preset condition, the first target pixel point is divided into the vertical direction area. The second vertical preset condition includes: the sum of the maximum vertical composite change color difference and the fourth preset threshold is less than or equal to the product of the minimum horizontal composite change color difference and the fifth preset threshold. The second vertical preset condition can be expressed as:
[0140] maskEdgeV=maskEdge&((vv_max+param_th4)≤(vh_min*param_th5))
[0141] If the composite color difference of at least one preset direction does not satisfy the second horizontal preset condition and the second vertical preset condition, the first target pixel point is reserved in the non-directional area.
[0142] In this embodiment, when calculating the composite change color difference of the first target pixel in the preset direction, the color difference parameter is calculated by the color difference between the channels of the first target pixel in the sub-direction, so that the interpolation is performed along the direction with smaller color difference; in addition, the second change amount of the color difference between the first channels in each preset direction in the fourth neighborhood of the first target pixel and the third change amount of the color difference between the second channels in the preset direction in the fourth neighborhood are used, so that when the blue channel is divided into interpolation direction areas, the texture features of the pixels of the red channel are taken into consideration, and when the red channel is divided into interpolation direction areas, the texture features of the pixels of the blue channel are taken into consideration, so that the divided interpolation direction areas can be obtained more accurately. In addition, the fourth preset threshold and the fifth preset threshold are added to the second horizontal preset condition and the second vertical preset condition, so that the horizontal direction area and the vertical direction area are judged more stably and the robustness is increased.
[0143] In some embodiments, see Figure 7 , the above step S13 may further include the following steps:
[0144] S131: performing a first interpolation of a main color channel on each pixel point in a preset interpolation direction area.
[0145] Among them, the preset interpolation direction area includes a vertical direction area and a horizontal direction area. The first interpolation of the main color channel is performed on each pixel point. Specifically, the pixel point to be interpolated is used as the second target pixel point, the secondary color channel corresponding to the second target pixel point is the target secondary color channel, and the direction corresponding to the interpolation direction area where the second target pixel point is located is the first target direction. Among them, if the interpolation direction area where the second target pixel point is located is a horizontal direction area, then its first target direction is the horizontal direction. If the interpolation direction area where the second target pixel point is located is a vertical direction area, then its first target direction is the vertical direction. If the interpolation direction area where the second target pixel point is located is a non-directional area, then the first target direction corresponding to the interpolation direction area where the second target pixel point is located includes a horizontal direction and a vertical direction, that is, horizontally to the left, horizontally to the right, vertically upward, and vertically downward.
[0146] Based on the pixel value difference between the target secondary color channel and the primary color channel in the fifth neighborhood of the second target pixel in the first target direction, a first interpolated color difference of the second target pixel is obtained. The first interpolated color difference of the second target pixel in the first target direction can be expressed as:
[0147] K1 n=(-X(i-2,j)+2*X(i-1,j)-X(i,j)) / 2
[0148] K1 e =(-X(i,j+2)+2*X(i,j+1)-X(i,j)) / 2
[0149] K1 w =(-X(i,j-2)+2*X(i,j-1)-X(i,j)) / 2
[0150] K1 s =(-X(i+2,j)+2*X(i+1,j)-X(i,j)) / 2
[0151] Among them, K1 n 、K1 e 、K1 w 、K1 s Respectively represent the first interpolated color difference of the second target pixel point vertically upward, horizontally rightward, horizontally leftward, and vertically downward.
[0152] An interpolation weight of the second target pixel is obtained based on a difference in pixel values in each color channel in a sixth neighborhood of the second target pixel in the first target direction.
[0153] Among them, the vertical interpolation weight w1 of the second target pixel is n It can be expressed as:
[0154] w1 n =1 / (1+|X(i-2,j)-X(i,j)|+|X(i-3,j)-X(i-1,j))|+
[0155] |X(i-1,j)-X(i+1,j)|+|X(i-2,j-1)-X(i,j-1)|+
[0156] |X(i-2,j+1)-X(i,j+1)|)
[0157] The interpolation weight w1 of the second target pixel horizontally to the right e It can be expressed as:
[0158] w1 e =1 / (1+|X(i,j+2)-X(i,j)|+|X(i,j+3)-X(i,j+1))|+
[0159] |X(i,j-1)-X(i,j+1)|+|X(i-1,j+2)-X(i-1,j)|+
[0160] |X(i+1,j+2)-X(i+1,j)|)
[0161] The interpolation weight w1 of the second target pixel horizontally to the left w It can be expressed as:
[0162] w1 w =1 / (1+|X(i,j-2)-X(i,j)|+|X(i,j-3)-X(i,j-1))|+
[0163] |X(i,j-1)-X(i,j+1)|+|X(i-1,j-2)-X(i-1,j)|+
[0164] |X(i+1,j-2)-X(i+1,j)|)
[0165] The interpolation weight w1 of the second target pixel in the vertical direction s It can be expressed as:
[0166] w1 s =1 / (1+|X(i+2,j)-X(i,j)|+|X(i+3,j)-X(i-1,j))|+
[0167] |X(i-1,j)-X(i+1,j)|+|X(i+2,j-1)-X(i,j-1)|+
[0168] |X(i+2,j+1)-X(i,j+1)|)
[0169] The main color channel of the second target pixel is interpolated using the first interpolation color difference and the interpolation weight of the second target pixel. The main color channel of the second target pixel can be interpolated according to the interpolation direction area where the second target pixel is located, the first interpolation color difference of the corresponding first target direction, and the interpolation weight. The interpolation method of the main color channel of the second target pixel can be expressed by the following formula:
[0170]
[0171]
[0172]
[0173] Wherein, X represents the pixel value of the second target pixel; G_H, G_V, and G_None represent the interpolation of the main color channel of the second target pixel in the horizontal direction area, the vertical direction area, and the non-directional area, respectively.
[0174] Therefore, if the primary color channel is the green channel, after interpolating the pixels of the secondary color channel using the primary color channel, the interpolation result G1 obtained can be expressed as:
[0175] G1=G_H+G_V+G_None+X.*Gmask
[0176] Among them, Gmask represents the mask corresponding to the green channel.
[0177] S132: Based on the pixel values in the third neighborhood of the pixel points in the non-directional area, select to perform the first interpolation of the main color channel or the second interpolation of the main color channel on the pixel points in the non-directional area.
[0178] Based on the pixel values in the third neighborhood of the pixel in the non-directional area, the discrimination coefficient of the pixel in the non-directional area is obtained. In this step, the method of obtaining the discrimination coefficient of the pixel in the non-directional area can refer to the specific implementation process of step S125 in the above embodiment, which will not be repeated here.
[0179] Among them, if the discrimination coefficient of the pixel points in the non-directional area is less than the sixth preset threshold, the second interpolation of the main color channel is performed on the pixel points in the non-directional area, otherwise the first interpolation of the main color channel is performed on the pixel points in the non-directional area. Among them, if the discrimination coefficient of the pixel points in the non-directional area is not less than the sixth preset threshold, the first interpolation of the main color channel can be performed on the pixel points in the non-directional area in step S131. The first interpolation of the main color channel for the pixel points in the non-directional area can refer to the above-mentioned step S131, which will not be repeated here.
[0180] When the discrimination coefficient of the pixel point in the directionless area is less than the sixth preset threshold, the second interpolation of the main color channel is performed. Specifically, the pixel point to be interpolated is used as the third target pixel point, and the direction corresponding to the interpolation direction area where the second target pixel point is located is the second target direction.
[0181] The first inter-channel color difference of the second target pixel in the first target direction is used as the second interpolation color difference of the third target pixel. The second interpolation color difference of the second target direction of the third target pixel can be expressed as:
[0182] K2 n =X(i-1,j)-X(i,j)
[0183] K2 e =X(i,j+1)-X(i,j)
[0184] K2 w =X(i,j-1)-X(i,j)
[0185] K2 s =X(i+1,j)-X(i,j)
[0186] Among them, K2 n, K2 e , K2 w , K2 s Respectively represent the second interpolated color difference of the third target pixel point vertically upward, horizontally rightward, horizontally leftward, and vertically downward.
[0187] Based on the pixel value differences in each color channel in the sixth neighborhood of the second target pixel in the first target direction, the interpolation weight of the third target pixel is obtained. The interpolation weight w2 of the third target pixel in the vertical direction can be obtained respectively. n , horizontal right interpolation weight w2 e , horizontal left interpolation weight w2 w , vertical downward interpolation weight w2 s The calculation method of the interpolation weight of the third target pixel point can refer to the above step S131, and specifically refer to the specific calculation method of the interpolation weight of the second target pixel point when the first interpolation of the main color channel is performed on each pixel point, which will not be repeated here.
[0188] The second interpolation color difference and the interpolation weight of the third target pixel are used to interpolate the main color channel for the third target pixel. The result G2 of the second interpolation of the third target pixel can be expressed as:
[0189]
[0190] Thus, an interpolation result combining the first interpolation of the primary color channel and the second interpolation of the secondary color channel can be obtained, that is, an interpolated image obtained after the primary color channel interpolation of the original image is obtained. The interpolation result G can be expressed as:
[0191] G=G1*(1-Mask)+G2*Mask
[0192] Wherein, Mask represents the pixel points in the region where the discrimination coefficient of the pixel points in the non-directional region is less than the sixth preset threshold.
[0193] In this embodiment, the first interpolation and the second interpolation of the primary color channel can be performed on each pixel of the secondary color channel in the original target image, so that the primary color channel is interpolated using color differences of different scales, which can effectively suppress pseudo textures.
[0194] In some embodiments, see Figure 8 , the above step S14 may further include the following steps:
[0195] S141: taking each sub-color channel as the current sub-color channel, and taking the sub-color channels other than the current sub-color channel as other sub-color channels.
[0196] After interpolating the primary color channel to obtain an interpolated image, the interpolated image is interpolated for the secondary color channel. Each secondary color channel can be used as the current secondary color channel, and the secondary color channels other than the current secondary color channel can be used as other secondary color channels. In this embodiment, the red channel is used as the current secondary color channel and the blue channel is used as other secondary color channels for illustration, but the present application is not limited thereto.
[0197] S142: Obtaining a first color difference of a pixel point corresponding to the current sub-color channel with respect to the current sub-color channel based on the pixel values with respect to the current sub-color channel in the interpolated image and the original image.
[0198] The pixel values of the interpolated image and the original image in the current sub-color channel are used to obtain the first color difference of the pixel corresponding to the current sub-color channel with respect to the current sub-color channel. Taking the red channel as the current sub-color channel as an example, the first color difference of the pixel corresponding to the current red channel with respect to the red channel is obtained. The first color difference can be expressed as:
[0199] Δ1 GR (i,j)=G(i,j)-X(i,j)
[0200] Among them, Δ1 GR (i, j) represents the first color difference of the pixel corresponding to the red channel with respect to the red channel; G(i, j) represents the pixel value of the interpolated image of the pixel of the red channel, and X(i, j) represents the pixel value of the pixel in the original red channel.
[0201] S143: Using the first color difference, obtain a second color difference of a pixel point corresponding to the primary color channel with respect to the current secondary color channel.
[0202] By using the first color difference, for example, based on the first color difference of the pixel points in the pixel point area in the green channel, the second color difference of the pixel points corresponding to the green channel with respect to the red channel can be obtained, wherein the second color difference can be expressed as:
[0203] Δ2 GR (i,j)=(Δ1 GR (i-1,j)+Δ1 GR (i+1,j)+Δ1 GR (i,j-1)+Δ1 GR (i,j+1)) / 2
[0204] Among them, Δ2 GR (i, j) represents the second color difference of the pixel corresponding to the green channel with respect to the red channel.
[0205] S144: Using the second color difference, obtain a third color difference of other secondary color channels with respect to the current secondary color channel.
[0206] For the pixel of the blue channel, the first color difference and the second color difference of the pixel in the pixel area can be used to obtain the third color difference of the pixel of the blue channel with respect to the red channel. Among them, the second color difference can be expressed as:
[0207] Δ3 GR (i,j)=(Δ1 GR (i-1,j)+Δ1 GR (i+1,j)+Δ1 GR (i,j-1)+Δ1 GR (i,j+1)) / 4
[0208] Among them, Δ3 GR (i, j) represents the third color difference of the pixel corresponding to the blue channel with respect to the red channel.
[0209] S145: interpolating the current color channel of the interpolated image using the second color difference and the third color difference.
[0210] Using the second color difference and the third color difference, the interpolation image is interpolated in the primary color channel and other secondary color channels. For example, the interpolation of the red channel is performed on the pixel point in the green channel of the interpolated image, and the first red interpolation color difference R1(i,j) of the pixel point in the green channel can be expressed as:
[0211] R1(i,j)=G(i,j)-Δ2 GR (i,j)
[0212] The interpolation of the red channel is performed on the pixel points in the blue channel of the interpolated image. The second red interpolation color difference R2(i,j) of the pixel points in the blue channel can be expressed as:
[0213] R2(i,j)=G(i,j)-Δ3 GR (i,j)
[0214] The first red interpolation color difference and the second red interpolation color difference may be used to interpolate the red channel of the interpolation image, and then the above-mentioned interpolation method for the red channel may be used to interpolate the blue channel to obtain a target color image.
[0215] In this embodiment, when interpolating the secondary color channels, the current secondary color channel is used to interpolate the current secondary color of the primary color channel, and then the current secondary color channel is interpolated for other secondary color channels. That is, the red channel can be used to interpolate the red channel of the green channel, and then the red channel of the blue channel can be interpolated, which can avoid the "zipper effect".
[0216] Optionally, the above method can be used to interpolate the blue channel of the interpolated image, and then interpolate the red channel to obtain the target color image. The specific details of this step can be referred to the above embodiment, and this application will not be repeated here.
[0217] For the above embodiment, the present application provides an image interpolation processing device, see Fig. 9 , Fig. 9 2 is a schematic diagram of the structure of an embodiment of an image interpolation processing device of the present application. The image interpolation processing device 200 comprises an acquisition module 201, a division module 202 and an interpolation module 203. The acquisition module 201, the division module 202 and the interpolation module 203 are connected.
[0218] The acquisition module 201 is used to acquire the original image, wherein each pixel in the original image corresponds to a color channel, the color channel with the most corresponding pixels in the original image is the primary color channel, and the remaining color channels are secondary color channels.
[0219] The division module 202 is used to divide the pixel points corresponding to the secondary color channel into corresponding interpolation direction areas based on the first inter-channel color difference and intra-channel difference of the original image, wherein the first inter-channel color difference represents the pixel value difference between the primary color channel and the secondary color channel, and the intra-channel difference represents the pixel value difference of the primary color channel.
[0220] The interpolation module 203 is used to interpolate the primary color channel of the original image based on the divided interpolation direction area to obtain an interpolated image, and to interpolate the secondary color channel of the interpolated image to obtain a target color image.
[0221] The specific implementation of this embodiment can refer to the implementation process of the above embodiment, which will not be repeated here.
[0222] For the above embodiment, the present application provides an image processing device, see Fig.10 , Fig.10 1 is a schematic diagram of the structure of an embodiment of an image processing device of the present application. The image processing device 300 includes a memory 301 and a processor 302, wherein the memory 301 and the processor 302 are coupled to each other, the memory 301 stores program data, and the processor 302 is used to execute the program data to implement the steps in any embodiment of the above method.
[0223] In this embodiment, the processor 302 may also be referred to as a CPU (Central Processing Unit). The processor 302 may be an integrated circuit chip having signal processing capabilities. The processor 302 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. A general-purpose processor may be a microprocessor or the processor 302 may also be any conventional processor, etc.
[0224] The specific implementation of this embodiment can refer to the implementation process of the above embodiment, which will not be repeated here.
[0225] The method of the above embodiment can be implemented in the form of a computer program, so the present application proposes a storage device, see Fig.11 , Fig.11 The storage device 400 stores program data 401 that can be run by a processor, and the program data can be executed by the processor to implement the steps of any embodiment of the above method.
[0226] The specific implementation of this embodiment can refer to the implementation process of the above embodiment, which will not be repeated here.
[0227] The storage device 400 of this embodiment can be a medium that can store program data, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, or it can also be a server that stores the program data. The server can send the stored program data to other devices for execution, or it can also execute the stored program data by itself.
[0228] In the several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0229] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0230] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0231] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage device, which is a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for an electronic device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform all or part of the steps of the various implementation methods of the present application.
[0232] Obviously, those skilled in the art should understand that the above modules or steps of the present application can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. In this way, the present application is not limited to any specific combination of hardware and software.
[0233] The above descriptions are merely embodiments of the present application and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. An image interpolation processing method, characterized in that: include: Acquire an original image, wherein each pixel in the original image corresponds to a color channel, the color channel with the most corresponding pixels in the original image is a primary color channel, and the remaining color channels are secondary color channels; Based on a first inter-channel color difference and an intra-channel difference of the original image, dividing the pixel points corresponding to the secondary color channel into corresponding interpolation direction areas, wherein the first inter-channel color difference represents a pixel value difference between the primary color channel and the secondary color channel, and the intra-channel difference represents a pixel value difference of the primary color channel; Based on the divided interpolation direction areas, interpolating the main color channels of the original image to obtain an interpolated image; Performing interpolation of the secondary color channels on the interpolated image to obtain a target color image; The dividing of the pixel points corresponding to the secondary color channel into corresponding interpolation direction areas based on the first inter-channel color difference and intra-channel difference of the original image includes: Taking each pixel point corresponding to the secondary color channel as a first target pixel point; Based on the pixel value difference in the main color channel in at least one preset direction within the first neighborhood of the first target pixel, a channel difference of the first target pixel in at least one preset direction is correspondingly obtained; and Based on the pixel value difference between the secondary color channel and the primary color channel corresponding to the first target pixel in at least one preset direction within the first neighborhood, a first inter-channel color difference of the first target pixel in at least one preset direction is obtained; The first target pixel point is divided into corresponding interpolation direction areas by using the first inter-channel color difference and the intra-channel difference corresponding to the first target pixel point.
2. The method according to claim 1, characterized in that: The preset direction includes a first sub-direction and a second sub-direction in opposite directions; the pixel value difference in the main color channel in at least one preset direction within the first neighborhood of the first target pixel point, corresponding to the channel difference of the first target pixel point in at least one preset direction, includes: For each of the preset directions, obtaining a first pixel value difference between a first neighborhood pixel point in the first sub-direction and a first neighborhood pixel point in the second sub-direction within the first neighborhood; The first pixel value difference is used to obtain the difference of the first target pixel point in the channel of the preset direction.
3. The method according to claim 1, characterized in that The method of dividing the first target pixel point into corresponding interpolation direction areas by using the first inter-channel color difference and the intra-channel difference corresponding to the first target pixel point includes: For each of the preset directions, using a first variation of the first inter-channel color difference in the preset direction within a second neighborhood of the first target pixel point, obtain a variation color difference of the first target pixel point in the preset direction; The first target pixel point is divided into corresponding interpolation direction areas by using the change color difference of the at least one preset direction and the intra-channel difference of the at least one preset direction.
4. The method according to claim 3, characterized in that The preset direction includes two sub-directions in opposite directions; and obtaining the changed color difference of the first target pixel in the preset direction by using the first change amount of the first inter-channel color difference in the second neighborhood of the first target pixel in the preset direction includes: Obtain a first change amount of the first inter-channel color difference in two sub-directions of the preset direction in the second neighborhood; The maximum value and the minimum value of the first changes corresponding to the two sub-directions are respectively used as the maximum change color difference and the minimum change color difference of the first target pixel point in the preset direction.
5. The method according to claim 3, characterized in that: The at least one preset direction includes a horizontal direction and a vertical direction; and the method of dividing the first target pixel point into corresponding interpolation direction areas by using the change color difference of the at least one preset direction and the intra-channel difference of the at least one preset direction includes: If the color difference of the change in the at least one preset direction and the intra-channel difference in the at least one preset direction meet the first horizontal preset condition, the first target pixel point is divided into a horizontal direction area; If the color difference of the change in the at least one preset direction and the intra-channel difference in the at least one preset direction meet the first vertical preset condition, the first target pixel point is divided into a vertical direction area; If the color difference of the change in the at least one preset direction and the intra-channel difference in the at least one preset direction do not satisfy the first horizontal preset condition and the first vertical preset condition, the first target pixel point is divided into a non-directional area.
6. The method according to claim 5, characterized in that The color difference change corresponding to the horizontal direction includes a maximum horizontal color difference change and a minimum horizontal color difference change, and the color difference change corresponding to the vertical direction includes a maximum vertical color difference change and a minimum vertical color difference change; The first horizontal preset condition includes: the sum of the product of the first preset threshold and the maximum horizontal change color difference and the second preset threshold is less than the minimum vertical change color difference, and the change in the horizontal channel is less than the change in the vertical channel; The first vertical preset condition includes: the sum of the product of the first preset threshold and the maximum vertical change color difference and the second preset threshold is less than the minimum horizontal change color difference, and the change in the vertical channel is less than the change in the horizontal channel.
7. The method according to claim 3, characterized in that After dividing the first target pixel point into corresponding interpolation direction areas, the method further includes: If the first target pixel point is classified into the non-directional area, obtaining a discrimination coefficient of the first target pixel point based on pixel values in a third neighborhood of the first target pixel point; If the discrimination coefficient of the first target pixel point is greater than a third preset threshold, the corresponding interpolation direction area is re-divided for the first target pixel point.
8. The method according to claim 7, characterized in that The at least one preset direction includes a horizontal direction and a vertical direction; the third neighborhood includes a plurality of vertical neighborhood pixels located in the vertical direction of the first target pixel and corresponding to the primary color channel, a plurality of horizontal neighborhood pixels located in the horizontal direction of the first target pixel and corresponding to the primary color channel, and a plurality of other neighborhood pixels corresponding to different secondary color channels of the first target pixel; The obtaining, based on the pixel value in the third neighborhood of the first target pixel, a discrimination coefficient of the first target pixel, comprises: Obtaining a first sub-coefficient using a difference between a sum of pixel values of a plurality of vertical neighboring pixel points and a sum of pixel values of the plurality of horizontal neighboring pixel points; Obtaining a second sub-coefficient using a difference between a sum of pixel values of some vertical neighborhood pixels and some horizontal neighborhood pixels and a sum of pixel values of remaining vertical neighborhood pixels and remaining horizontal neighborhood pixels; Using the difference between the pixel values of some of the other neighboring pixels, a third sub-coefficient is obtained; The first sub-coefficient, the second sub-coefficient and the third sub-coefficient are used to obtain a discrimination coefficient of the first target pixel.
9. The method according to claim 7, characterized in that: The re-dividing the corresponding interpolation direction area for the first target pixel point includes: For each of the preset directions, a composite change color difference of the first target pixel in the preset direction is obtained by using the second change amount of the first channel color difference in each preset direction in the fourth neighborhood of the first target pixel and the third change amount of the second channel color difference in the fourth neighborhood in the preset direction; Re-dividing the first target pixel point into corresponding interpolation direction areas by using the composite change color difference in the at least one preset direction; The fourth neighborhood is greater than or equal to the second neighborhood, and the second inter-channel color difference represents the difference in pixel values between the secondary color channel that does not correspond to the first target pixel and other color channels.
10. The method according to claim 9, characterized in that The preset direction includes two sub-directions in opposite directions; the second variation of the inter-channel color difference in each preset direction in the fourth neighborhood of the first target pixel and the third variation of the second inter-channel color difference in the preset direction in the fourth neighborhood are used to obtain the composite variation color difference of the first target pixel in the preset direction, including: For each sub-direction of the preset direction, the second variation and the third variation of the second inter-channel color difference in the sub-direction in the fourth neighborhood are obtained, and the color difference parameter of the sub-direction is obtained by using the inter-channel color difference of the first target pixel in the sub-direction and the second variation and the third variation; The maximum value and the minimum value of the color difference parameters in the two sub-directions of the preset direction are respectively used as the maximum compound change color difference and the minimum compound change color difference of the first target pixel point in the preset direction.
11. The method according to claim 10, characterized in that Before taking the maximum value and the minimum value of the color difference parameters of the two sub-directions of the preset direction as the maximum compound change color difference and the minimum compound change color difference of the first target pixel in the preset direction, respectively, the method further includes: The color difference parameters corresponding to each of the sub-directions are filtered.
12. The method according to claim 9, characterized in that The at least one preset direction includes a horizontal direction and a vertical direction; and the step of re-dividing the first target pixel point into corresponding interpolation direction areas by using the composite change color difference in the at least one preset direction includes: If the composite color difference of the at least one preset direction satisfies a second horizontal preset condition, dividing the first target pixel point into the horizontal direction area; If the composite color difference of the at least one preset direction satisfies a second vertical preset condition, dividing the first target pixel point into the vertical direction area; If the composite color difference of the at least one preset direction does not satisfy the second horizontal preset condition and the second vertical preset condition, the first target pixel point is reserved in the non-directional area.
13. The method according to claim 12, characterized in that The compound change color difference corresponding to the horizontal direction includes the maximum horizontal compound change color difference and the minimum horizontal compound change color difference, and the compound change color difference corresponding to the vertical direction includes the maximum vertical compound change color difference and the minimum vertical compound change color difference; The second horizontal preset condition includes: the sum of the maximum horizontal compound change color difference and the fourth preset threshold is less than or equal to the product of the minimum vertical compound change color difference and the fifth preset threshold; The second vertical preset condition includes: the sum of the maximum vertical compound change color difference and the fourth preset threshold is less than or equal to the product of the minimum horizontal compound change color difference and the fifth preset threshold.
14. The method according to claim 1, characterized in that The interpolation of the main color channel of the original image based on the divided interpolation direction area to obtain the interpolated image includes: Performing a first interpolation of a main color channel on each pixel point in a preset interpolation direction area, wherein the preset interpolation direction area includes a vertical direction area and a horizontal direction area; and Based on the pixel values in the third neighborhood of the pixel points in the non-directional area, it is selected to perform the first interpolation of the main color channel or the second interpolation of the main color channel on the pixel points in the non-directional area.
15. The method according to claim 14, characterized in that The step of selecting to perform a first interpolation of a main color channel or a second interpolation of a main color channel on a pixel point in the non-directional area based on a pixel value in a third neighborhood of the pixel point in the non-directional area comprises: Obtaining a discrimination coefficient of a pixel point in the non-directional area based on a pixel value in a third neighborhood of the pixel point in the non-directional area; If the discrimination coefficient of the pixel points in the directionless area is less than the sixth preset threshold, the second interpolation of the main color channel is performed on the pixel points in the directionless area, otherwise the first interpolation of the main color channel is performed on the pixel points in the directionless area.
16. The method according to claim 14, characterized in that The first interpolation of the primary color channel comprises: The pixel to be interpolated is used as the second target pixel, the secondary color channel corresponding to the second target pixel is used as the target secondary color channel, and the direction corresponding to the interpolation direction area where the second target pixel is located is used as the first target direction; Obtaining a first interpolated color difference of the second target pixel point based on a pixel value difference between a target secondary color channel and a primary color channel in a first target direction within a fifth neighborhood of the second target pixel point; and Obtaining an interpolation weight of the second target pixel based on a difference in pixel values in each color channel in a sixth neighborhood of the second target pixel in the first target direction; Interpolation of a main color channel is performed for the second target pixel by using the first interpolation color difference and the interpolation weight of the second target pixel.
17. The method according to claim 14, characterized in that The performing the second interpolation of the primary color channel comprises: The pixel point to be interpolated is taken as the third target pixel point, and the direction corresponding to the interpolation direction area where the second target pixel point is located is taken as the second target direction; Using the first inter-channel color difference of the second target pixel in the first target direction as the second interpolation color difference of the third target pixel; and Obtaining an interpolation weight of the third target pixel based on a difference in pixel values in each color channel in a sixth neighborhood of the second target pixel in the first target direction; The second interpolation color difference and the interpolation weight of the third target pixel are used to interpolate the main color channel for the third target pixel.
18. The method according to claim 1, characterized in that The interpolating the secondary color channel of the interpolated image comprises: Taking each secondary color channel as the current secondary color channel respectively, and taking the secondary color channels other than the current secondary color channel as other secondary color channels; Based on the pixel values of the interpolated image and the original image with respect to the current sub-color channel, obtaining a first color difference of a pixel point corresponding to the current sub-color channel with respect to the current sub-color channel; Using the first color difference, obtaining a second color difference of a pixel point corresponding to the primary color channel with respect to the current secondary color channel; Using the second color difference, obtaining a third color difference of the other secondary color channels with respect to the current secondary color channel; The current sub-color channel of the interpolated image is interpolated using the second color difference and the third color difference.
19. The method according to claim 1, characterized in that The original image is acquired by using a color filter array, and / or the color channels corresponding to the original image include a green channel, a red channel, and a blue channel.
20. An image processing device, characterized in that: The invention comprises a memory and a processor coupled to each other, wherein the memory stores program data, and the processor is used to execute the program data to implement the steps of the method according to any one of claims 1 to 19.
21. A storage device, characterized in that: Program data that can be executed by a processor are stored, and the program data is used to implement the steps of the method according to any one of claims 1 to 19.
Citation Information
Patent Citations
Edge-related and color-combined demosaicing and amplifying method
CN103347190A
Image interpolation method and device
CN104732561A
Image processing method and device
CN110430403A
Image interpolation method and device, storage medium and terminal
CN111263128A
Image processing method and device
CN111279389A
