Disclosure of Invention
In view of the above, the present application provides a method, an apparatus, a device and a readable storage medium for correcting a pixel in an image, so as to achieve the purpose of eliminating an edge in the image. The following were used:
a method of modifying a pixel, comprising:
acquiring an original value of a pixel set to be corrected, wherein the pixel set to be corrected comprises edge pixel points and target pixel points, and the target pixel points are pixel points which are positioned on two sides of the edge pixel points and are positioned in the same row with the edge pixel points;
acquiring Gaussian parameters of the pixel set to be corrected, wherein the Gaussian parameters comprise a pixel mean value and a pixel standard deviation of pixels to be corrected in the pixel set to be corrected;
acquiring a cumulative distribution vector of the pixel set to be corrected according to the Gaussian parameters, wherein the cumulative distribution vector is composed of cumulative distribution probabilities of all pixels to be corrected in the pixel set to be corrected, and the cumulative distribution probability of any pixel to be corrected is the sum of the Gaussian distribution probabilities of all pixels to be corrected which are sequenced before the pixel to be corrected;
calculating the correction value of each pixel to be corrected in the pixel set to be corrected according to the maximum transition value and the accumulated distribution vector; the maximum transition value is a difference value between a first reference value and a second reference value, the first reference value is determined according to the original value of the edge pixel and the original value of the target pixel located at the first side of the edge pixel, and the second reference value is determined according to the original value of the target pixel located at the second side of the edge pixel;
and correcting each pixel to be corrected in the pixel set to be corrected based on the original value and the correction value of each pixel to be corrected in the pixel set to be corrected.
Optionally, the method for calculating the maximum transition value includes:
acquiring the pixel mean values of the edge pixel points and the target pixel points on the first side as the first reference value, and calculating the pixel mean value of the target pixel points on the second side as the second reference value;
and calculating the difference value between the first reference value and the second reference value to obtain the maximum transition value.
Optionally, calculating a correction value of each pixel to be corrected in the pixel set to be corrected according to the maximum transition value and the cumulative distribution vector, including:
calculating the product of the cumulative distribution probability of the pixel to be corrected and the maximum transition value to obtain the transition value of the pixel to be corrected;
and adding the transition value of the pixel to be corrected and the first reference value or the second reference value to obtain a correction value of the pixel to be corrected.
Optionally, modifying each pixel to be modified in the pixel set to be modified based on the original value and the modified value of each pixel to be modified in the pixel set to be modified includes:
acquiring a Gaussian distribution vector of the pixel to be corrected according to the Gaussian parameter, wherein the Gaussian distribution vector is composed of Gaussian distribution probabilities of the pixel to be corrected;
for any pixel to be corrected, taking the Gaussian distribution probability of the pixel to be corrected in the Gaussian distribution vector as the correction proportion of the pixel to be corrected;
and taking the correction proportion as the weight of the correction value, and carrying out weighted summation on the correction value and the original value to obtain the pixel value of the pixel to be corrected after correction.
A correction device for a pixel, comprising:
the device comprises an original value acquisition unit, a correction unit and a correction unit, wherein the original value acquisition unit is used for acquiring an original value of a pixel set to be corrected, the pixel set to be corrected comprises edge pixel points and target pixel points, and the target pixel points are pixel points which are positioned on two sides of the edge pixel points and are positioned in the same line with the edge pixel points;
a gaussian parameter obtaining unit, configured to obtain a gaussian parameter of the pixel set to be corrected, where the gaussian parameter includes a pixel mean value and a pixel standard deviation of a pixel to be corrected in the pixel set to be corrected;
an accumulated distribution vector obtaining unit, configured to obtain an accumulated distribution vector of the pixel set to be corrected according to the gaussian parameter, where the accumulated distribution vector is composed of an accumulated distribution probability of each pixel to be corrected in the pixel set to be corrected, and the accumulated distribution probability of any pixel to be corrected is a sum of gaussian distribution probabilities of all pixels to be corrected that are sorted before the pixel to be corrected;
the correction value calculation unit is used for calculating the correction value of each pixel to be corrected in the pixel set to be corrected according to the maximum transition value and the accumulated distribution vector; the maximum transition value is a difference value between a first reference value and a second reference value, the first reference value is determined according to the original value of the edge pixel and the original value of the target pixel located at the first side of the edge pixel, and the second reference value is determined according to the original value of the target pixel located at the second side of the edge pixel;
and the pixel correction unit is used for correcting each pixel to be corrected in the pixel set to be corrected based on the original value and the correction value of each pixel to be corrected in the pixel set to be corrected.
Optionally, the apparatus further comprises: a maximum transition value calculation unit; the maximum transition value calculating unit is configured to calculate the maximum transition value, and includes:
the maximum transition value calculation unit is specifically configured to:
acquiring the pixel mean values of the edge pixel points and the target pixel points on the first side as the first reference value, and calculating the pixel mean value of the target pixel points on the second side as the second reference value;
and calculating the difference value between the first reference value and the second reference value to obtain the maximum transition value.
Optionally, the correction value calculating unit is configured to calculate the correction value of each pixel to be corrected in the pixel set to be corrected according to the maximum transition value and the cumulative distribution vector, and includes: the correction value calculation unit is specifically configured to:
calculating the product of the cumulative distribution probability of the pixel to be corrected and the maximum transition value to obtain the transition value of the pixel to be corrected;
and adding the transition value of the pixel to be corrected and the first reference value or the second reference value to obtain a correction value of the pixel to be corrected.
Optionally, the pixel correction unit is configured to correct each pixel to be corrected in the pixel set to be corrected based on the original value and the correction value of each pixel to be corrected in the pixel set to be corrected, and includes: the pixel correction unit is specifically configured to:
acquiring a Gaussian distribution vector of the pixel to be corrected according to the Gaussian parameter, wherein the Gaussian distribution vector is composed of Gaussian distribution probabilities of the pixel to be corrected;
for any pixel to be corrected, taking the Gaussian distribution probability of the pixel to be corrected in the Gaussian distribution vector as the correction proportion of the pixel to be corrected;
and taking the correction proportion as the weight of the correction value, and carrying out weighted summation on the correction value and the original value to obtain the pixel value of the pixel to be corrected after correction.
A pixel modification apparatus comprising: a memory and a processor;
the memory is used for storing programs;
the processor is configured to execute the program to implement the steps of the pixel correction method described above.
A readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of correction of pixels as described above.
According to the above technical solution, the pixel correction method, the pixel correction device, the pixel correction apparatus, and the readable storage medium provided in the present application determine, for each pixel set to be corrected, a correction value of each pixel to be corrected according to a maximum transition value and a cumulative distribution vector, where the maximum transition value represents a correction range in which each pixel to be corrected should be corrected on the basis of a reference value, and a cumulative distribution probability in the cumulative distribution vector represents a correction degree of each pixel to be corrected in the pixel set to be corrected, so that the correction value can ensure that the pixels in the pixel set to be corrected transit naturally. Further, the correction proportion of the correction value is obtained, and the pixel is corrected according to the correction value and the original value, so that the edge in the image is eliminated, and the transition of the pixel is natural.
Detailed Description
The pixel correction method disclosed by the application is suitable for scenes in which pixels need to be corrected so as to eliminate edges in the images. Reasons for edge generation in an image may include: the image edge caused by the overlarge light and shade difference or the edge caused by the overlarge pixel color difference at the two sides of the sub-image splicing line in the spliced image.
For example, fig. 1 is a schematic diagram of a stitched image (denoted as P) obtained by stitching four sub-images (i.e., P1, P2, P3, and P4 identified in fig. 1), and it can be seen that since the pixel color difference on both sides of the stitching line of P1, P2, P3, and P4 is large, an edge is generated between two adjacent sub-images, such as the edge L1 in the vertical direction and the edge L2 in the horizontal direction shown in fig. 1. As shown in fig. 1, the edge of the stitched image P is a straight line, and in alternative scenarios, the color difference boundary may be an irregular polygonal line or a curved line. And the edges may or may not be continuous.
In the prior art, in order to eliminate an edge in an image and achieve a smooth transition of pixels, image processing software (such as Photoshop) can be used to correct pixels on two sides of the edge, but researchers find that only one image can be processed by correcting the pixels by using the image processing software at a time, and the transition effect of the pixels on two sides of the edge is unnatural.
It should be noted that the digital image data can be represented by a pixel matrix, and the digital image can be analyzed and processed by using matrix theory and matrix algorithm. Since digital images can be represented in the form of a matrix of pixels, it is common in computer digital image processing programs to store image data in arrays where each element of the matrix of pixels corresponds to a pixel in the image. For a color image, each pixel in the image includes three color channels, namely the red R, green G, and blue B channels. Therefore, each element in the pixel matrix of the color image includes pixel values of three colors of RGB. For grayscale images, the elements of each array contain the pixel value of one pixel, i.e., the grayscale value. When correcting the pixels, the pixel values of each channel may be corrected separately.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Fig. 2 is a flowchart illustrating a pixel correction method according to an embodiment of the present application, and as shown in fig. 2, the method may specifically include the following steps:
s201, acquiring an original value of a pixel to be corrected.
Specifically, the pixels to be modified include edge pixels and target pixels, where the target pixels are pixels located on both sides of the edge pixels and located in the same row as the edge pixels. The original value of each pixel to be corrected comprises the pixel value of any color channel of the pixel to be corrected.
Taking fig. 1 as an example, assume that L1 is an edge and has a length of L, that is, L edge pixels are included along the direction L1. Then, L sets of pixels to be corrected may be obtained, where each set of pixels to be corrected is a set of pixels to be corrected, and includes an edge pixel and a preset number of target pixels, and the preset number may be set according to a difference between two sides of the edge pixel. Optionally, the number of the target pixel points selected on both sides of any one edge pixel point may be the same or different, and this embodiment is not limited.
S202, Gaussian parameters of the pixel set to be corrected are obtained.
Specifically, the pixel set to be modified is composed of any edge pixel and a target pixel thereof, and the gaussian parameter of any pixel set to be modified includes a pixel mean value and a pixel standard deviation of a pixel to be modified in the pixel set to be modified.
In practical application, the pixel to be corrected may include a plurality of pixel sets to be corrected, and a pixel matrix to be corrected may be formed by the plurality of pixel sets to be corrected. For example, the pixel matrix M to be modified includes L rows and 2w columns, each row corresponding to the original value of one pixel set to be modified. The method may use an algorithm to calculate the gaussian parameter for each set of pixels to be corrected. The embodiment of the present application does not limit this.
S203, acquiring the cumulative distribution vector of the pixel set to be corrected according to the Gaussian parameters.
Specifically, the cumulative distribution vector is composed of cumulative distribution probabilities of each pixel to be corrected in the pixel set to be corrected. The cumulative distribution probability of each pixel to be corrected can be calculated according to the gaussian distribution probability of each pixel to be corrected in the pixel set to be corrected. For example, the cumulative distribution probability of any pixel to be corrected is the sum of the gaussian distribution probabilities of all pixels to be corrected that are ordered before the pixel to be corrected. And for any pixel to be corrected, the Gaussian distribution probability of the pixel to be corrected is determined by the Gaussian parameter of the pixel set to be corrected.
It should be noted that, in this embodiment, the cumulative distribution vector is further normalized to obtain the normalized cumulative distribution probability of each pixel to be corrected.
And S204, calculating a correction value of the pixel to be corrected according to the maximum transition value and the accumulated distribution vector.
Optionally, the maximum transition value of the pixel may be a difference between a reference value (i.e., a first reference value) of an edge pixel point and a target pixel point located on a first side of the edge pixel point in the pixel set to be corrected and a reference value (i.e., a second reference value) of a target pixel point on a second side. The reference value may be a mean value or a median value of the original values of the pixels, for example, the first reference value is a mean value of the edge pixel and a target pixel located on a first side of the edge pixel. The second reference value is a pixel mean value or a median value of the target pixel point located on the second side of the edge pixel point.
It will be appreciated that since the reference value represents the average level, the maximum transition value is the maximum value that each pixel to be corrected should correct on the basis of the reference value. The cumulative distribution probability in the cumulative distribution vector characterizes the correction degree of the pixels in the pixel set to be corrected. Therefore, the present embodiment can obtain the correction value of each pixel to be corrected according to the maximum transition value and the cumulative distribution probability of each pixel to be corrected.
And S205, correcting each pixel to be corrected based on the correction value and the original value.
It can be understood that the pixel to be corrected needs to be corrected on the basis of the original pixel of the image to be corrected in order to make the transition of the pixels on both sides of the edge natural, so that the correction value and the original value of the pixel to be corrected need to be referred to simultaneously for each pixel to be corrected during the correction process. Therefore, the present embodiment first determines the correction ratio of the correction value, which may be the weight of the correction value to the corrected pixel value.
Optionally, the modification ratio may be a preset fixed ratio value, and the method for determining the modified pixel value of the pixel to be modified includes:
and for any pixel to be corrected, taking the preset proportional value as a weight of the correction value, and carrying out weighted summation on the correction value and the original value to obtain a pixel value of the pixel to be corrected after correction.
Optionally, the correction ratio may be a gaussian distribution probability of the pixel to be corrected in the gaussian distribution vector, and the method for determining the pixel value of the corrected pixel to be corrected includes:
and taking the correction proportion as the weight of the correction value, and carrying out weighted summation on the correction value and the original value to obtain the pixel value of the pixel to be corrected after the pixel is corrected.
Based on the foregoing technical solution, an embodiment of the present application provides a pixel correction method, where for each pixel set to be corrected, a correction value of each pixel to be corrected is determined according to a maximum transition value and a cumulative distribution vector, where the maximum transition value represents a correction range in which each pixel to be corrected should be corrected on the basis of a reference value, and a cumulative distribution probability in the cumulative distribution vector represents a correction degree of each pixel to be corrected in the pixel set to be corrected, so that the correction value can ensure that the pixels in the pixel set to be corrected transit naturally. Further, the correction proportion of the correction value is obtained, and the pixel is corrected according to the correction value and the original value, so that the edge in the image is eliminated, and the transition of the pixel is natural.
Furthermore, the correction proportion of each pixel to be corrected can be preset as the Gaussian distribution probability of the pixel to be corrected, so that the correction proportion of the pixel to be corrected close to the edge is ensured to be larger, the correction proportion of the pixel to be corrected far from the edge is ensured to be smaller, and the transition of the pixel is further ensured to be natural.
As can be seen from the above flow, the correction process of any group of pixels to be corrected is the same, that is, the steps of the pixel correction method performed on any group of pixels to be corrected in the present embodiment are as follows:
the method comprises the steps of obtaining an original value of a pixel to be corrected, wherein the pixel to be corrected comprises an edge pixel point and a target pixel point, and the target pixel point is a pixel point which is located on two sides of the edge pixel point and located on the same line with the edge pixel point.
And acquiring Gaussian parameters of the pixel to be corrected, wherein the Gaussian parameters comprise a pixel mean value and a pixel standard deviation of the pixel to be corrected.
And acquiring a cumulative distribution vector of the pixels to be corrected according to the Gaussian parameters, wherein the cumulative distribution vector is composed of the cumulative distribution probability of each pixel to be corrected.
Calculating a correction value of the pixel to be corrected according to the maximum transition value and the accumulated distribution vector; the maximum transition value is a difference value between a first reference value and a second reference value, the first reference value is determined according to the original values of the edge pixel and the target pixel located on the first side of the edge pixel, and the second reference value is determined according to the original value of the target pixel located on the second side of the edge pixel.
And correcting the pixel to be corrected based on the original value and the corrected value of the pixel to be corrected.
The embodiment of the present application takes the stitched image shown in fig. 1 as an example, and introduces an optional specific implementation manner of obtaining an original value of a pixel to be corrected, which includes:
firstly, edge detection is carried out on an image to be corrected, and the coordinates of the edge are obtained.
Specifically, an image to be corrected is converted into a grayscale image, and a pixel matrix of the grayscale image is obtained, it can be understood that elements in the pixel matrix of the grayscale image correspond to pixels in the grayscale image one to one, and a value of each element is a grayscale value of the corresponding pixel.
And calculating the absolute value of the gray difference between adjacent rows in the horizontal direction to obtain a gray difference matrix in the horizontal direction, performing vertical projection on the gray difference matrix in the horizontal direction, and taking the horizontal coordinate of the highest point of the projection to obtain the horizontal coordinate x of the vertical edge (L1) of the image to be corrected.
And calculating the absolute value of the gray difference between the adjacent columns in the vertical direction to obtain a gray difference matrix in the vertical direction. And projecting the gray level difference matrix in the vertical direction in the horizontal direction, and taking the vertical coordinate of the highest point of the projection to obtain the vertical coordinate y of the edge (L2) of the image to be corrected.
Fig. 3 is a schematic diagram of a horizontal gray scale difference matrix projection, and as shown in fig. 3, the horizontal coordinate of the highest point o of the projection is the horizontal coordinate x of the vertical edge L1.
Further, for any edge pixel point (x, y1) on the edge, a preset number of pixel points on both sides of the edge pixel point are respectively taken to form a pixel set V to be corrected. For example, the set V of pixels to be modified includes 2w pixels, let V ═ V1,...,vw,vw+1,...,v2wIn which v iswThe edge pixel point (x, y1) is located at vwAny point v on the first sidei1(1. ltoreq. i 1. ltoreq. w) has a coordinate (x-i1+1, y1) at vwAny point v on the first sidei2(w<i2≤2w,y1)。
Alternatively, the vertical edge L1 shown in fig. 1 includes L pixels, so L sets of pixels to be corrected may be obtained, each set of pixels to be corrected includes 2w pixels, and the 2w pixels are arranged in order according to the positions of the pixels in the image to be corrected. The step obtains an original value of the pixel to be corrected, that is, a pixel value before correction of each pixel in each pixel set to be corrected, where the original value may include a pixel value of an R channel, a pixel value of a G channel, or a pixel value of a B channel before correction. Based on this, each channel can obtain a pixel matrix to be corrected with a size L × 2w, taking the pixel matrix M to be corrected of the R channel as an example, and any element in M is the original value of the R channel of the pixel at the position. It will be appreciated that M is a sub-matrix of the pixel matrix of the R channel of the image to be modified.
In this embodiment, an optional implementation manner of the pixel correction method provided in this embodiment is described with reference to the obtained pixel set V to be corrected as an example. Taking R channel in color image as an example, the set of pixels to be modified V ═ V1,...,vw,vw+1,...,v2wAny pixel v to be modified ini(1 ≦ i ≦ 2w) for R channel original value RiThe original value number of the pixel set to be modified is R ═ R { (R)1,...,Rw,Rw+1,...,R2wAnd then the gaussian parameters include:
pixel mean value Iu:
And pixel standard deviation Is:
Further, according to IuAnd IsA cumulative distribution vector for the set of pixels to be modified may be determined, the cumulative distribution vector Q comprising 2w elements, Q ═ Q1,...,qw,qw+1,...,q2wWherein q isiIndicating the cumulative distribution probability corresponding to the ith pixel.
Alternatively, the cumulative distribution vector Q may be determined from the gaussian distribution vector G. Regarding 2w pixel values in the pixel set to be modified as discrete random variables, subjecting the pixel values to a mathematical expectation as a pixel mean value IuStandard deviation is pixel standard deviation IsIs normally distributed.
The gaussian function formula f (x) is as follows.
Since the original values in the embodiment of the present application are discrete data, a function value corresponding to each original value on the gaussian distribution curve is taken to form a gaussian distribution vector G ═ G1,...,gw,gw+1,...,g2wDefine gi(i ═ 1, 2.., 2w) is any pixel viCorresponding gaussian distribution probability, then:
optionally, since the original values of the pixels in the pixel set to be modified are discrete data, let any pixel viCorresponding cumulative distribution probability of ordering at viThe sum of the gaussian distribution probabilities of the previous pixels. Namely:
qi=g1+g2+...+gi
based on the above, the cumulative distribution probability of all the original values in the pixel set to be modified is obtained, and the cumulative distribution vector Q ═ Q is formed in sequence1,...,qw,qw+1,...,q2w}。
Further, for the gaussian distribution vector G ═ G1,...,gw,gw+1,...,g2wAnd the cumulative distribution vector Q ═ Q1,...,qw,qw+1,...,q2wNormalizing to make the Gaussian distribution probability value and the cumulative distribution probability value fall in [0, 1 }]The above.
Optionally, the normalization method may be:
g’i=(gi-min(G))/(max(G)-min(G))
q’i=(qi-min(Q))/(max(Q)-min(Q))
wherein, g'
iIs normalized pixel v
iAnd G ', G ═ G'
1,...,g’
w,g’
w+1,...,g’
2w},q’
iIs normalized pixel v
iCumulative distribution probability, then, the cumulative distribution vector of the pixel set V to be modified is
min () denotes taking the minimum value, and max () denotes taking the maximum value.
Fig. 4a shows a normalized gaussian distribution curve, fig. 4b shows a normalized cumulative distribution curve, and it should be noted that the gaussian distribution curve and the cumulative distribution curve are graphs after vectors are serialized.
Further, if the maximum transition value is D, then: d ═ I2-I1Wherein, I1Image-taking pixel point { v1,v2,...,vwPixel mean (i.e., first reference value), I of }2Image-taking pixel point { vw+1,vw+2,...,v2wPixel mean (i.e. the second reference value) of (1), take the R-channel pixel value as an example:
further, in this embodiment, the transition value of the pixel to be corrected is calculated according to the maximum transition value and the cumulative distribution vector, and the calculation method may be to multiply the cumulative distribution probability of any pixel with the maximum transition value to obtain the transition value of the pixel. For example:
ΔRi=D*qi
wherein, Δ RiIs a pixel viD is the maximum transition value, qiIs v isiThe cumulative distribution probability of (c).
Further, the transition value is a value to be corrected on the basis of the first reference value for each pixel, and therefore, the correction value may be determined based on the transition value and the first reference value.
Then, pixel viThe correction value of (d) can be obtained according to the following formula:
R’i=I1+ΔRi
based on this, a correction value sequence of the pixel set V to be corrected, i.e., R '═ R'1,...,R’w,R’w+1,...,R’2w}。
Further, if the gaussian distribution probability of any pixel to be corrected is taken as the correction proportion of the pixel to be corrected, the method for determining the pixel value of the pixel to be corrected after correction comprises the following steps:
firstly, determining a Gaussian distribution vector of each pixel set to be corrected according to the Gaussian parameters, wherein the Gaussian distribution vector is composed of Gaussian distribution probabilities of each pixel in the pixel set to be corrected.
Then, for any pixel to be corrected, the gaussian distribution probability of the pixel to be corrected in the gaussian distribution vector is taken as the correction proportion of the pixel to be corrected, and as can be seen from fig. 4a, the higher the correction proportion of the pixel closer to the color difference boundary is, the lower the correction proportion of the pixel farther from the color difference boundary is, and transition nature is further ensured.
Further, the correction proportion is used as a weight of the correction value, the correction value and the original value are subjected to weighted summation, and a pixel value of the pixel to be corrected is obtained after correction. Then, any pixel viCorrected pixel value F ofiCan be calculated as follows with reference to the formula:
Fi=g’i*R’i+(1-g’i)*Ri
wherein R'iIs a pixel viCorrection value of (1), g'iIs a pixel viCorrection ratio of (1), RiIs a pixel viThe original value of (a).
Based on this, a corrected pixel value sequence F ═ F is obtained for the pixel set V to be corrected1,...,Fw,Fw+1,...,F2wAnd correcting the pixel in the V according to the corrected pixel value. Fig. 5 is a schematic diagram of images on both sides of the boundary between the color differences before and after correction, and as shown in fig. 5, the image pixel transition after pixel correction is natural and has no obvious edge.
The following describes the correction device for a pixel provided in the embodiments of the present application, and the correction device for a pixel described below and the correction method for a pixel described above may be referred to correspondingly.
Referring to fig. 6, a schematic structural diagram of a pixel correction apparatus according to an embodiment of the present disclosure is shown, and as shown in fig. 6, the apparatus may include:
a correction device for a pixel, comprising:
an original value obtaining unit 601, configured to obtain an original value of a pixel to be corrected, where the pixel to be corrected includes an edge pixel and a target pixel, and the target pixel is a pixel located on both sides of the edge pixel and located in the same row as the edge pixel;
a gaussian parameter obtaining unit 602, configured to obtain a gaussian parameter of the pixel to be corrected, where the gaussian parameter includes a pixel mean value and a pixel standard deviation of the pixel to be corrected;
an accumulated distribution vector obtaining unit 603, configured to obtain an accumulated distribution vector of the pixels to be corrected according to the gaussian parameter, where the accumulated distribution vector is composed of an accumulated distribution probability of each pixel to be corrected;
a correction value calculating unit 604, configured to calculate a correction value of the pixel to be corrected according to the maximum transition value and the cumulative distribution vector; the maximum transition value is a difference value between a first reference value and a second reference value, the first reference value is determined according to the original value of the edge pixel and the original value of the target pixel located at the first side of the edge pixel, and the second reference value is determined according to the original value of the target pixel located at the second side of the edge pixel;
a pixel correction unit 605, configured to correct the pixel to be corrected based on the original value of the pixel to be corrected and the correction value.
Optionally, the apparatus further comprises: a maximum transition value calculation unit; the maximum transition value calculating unit is configured to calculate the maximum transition value, and includes:
the maximum transition value calculation unit is specifically configured to:
acquiring the pixel mean values of the edge pixel points and the target pixel points on the first side as the first reference value, and calculating the pixel mean value of the target pixel points on the second side as the second reference value;
and calculating the difference value between the first reference value and the second reference value to obtain the maximum transition value.
Optionally, the correction value calculating unit is configured to calculate the correction value of the pixel to be corrected according to the maximum transition value and the cumulative distribution vector, and includes: the correction value calculation unit is specifically configured to:
calculating the product of the cumulative distribution probability of the pixel to be corrected and the maximum transition value to obtain the transition value of the pixel to be corrected;
and adding the transition value of the pixel to be corrected and the first reference value or the second reference value to obtain a correction value of the pixel to be corrected.
Optionally, the pixel correction unit is configured to correct the pixel to be corrected based on the original value and the correction value of each pixel to be corrected, and includes: the pixel correction unit is specifically configured to:
acquiring a Gaussian distribution vector of the pixel to be corrected according to the Gaussian parameter, wherein the Gaussian distribution vector is composed of Gaussian distribution probabilities of the pixel to be corrected;
for any pixel to be corrected, taking the Gaussian distribution probability of the pixel to be corrected in the Gaussian distribution vector as the correction proportion of the pixel to be corrected;
and taking the correction proportion as the weight of the correction value, and carrying out weighted summation on the correction value and the original value to obtain the pixel value of the pixel to be corrected after correction.
An embodiment of the present application further provides a pixel correction device, please refer to fig. 7, which shows a schematic structural diagram of the pixel correction device, where the pixel correction device may include: at least one processor 701, at least one communication interface 702, at least one memory 703 and at least one communication bus 704;
in the embodiment of the present application, the number of the processor 701, the communication interface 702, the memory 703 and the communication bus 704 is at least one, and the processor 701, the communication interface 702 and the memory 703 complete mutual communication through the communication bus 704;
the processor 701 may be a central processing unit CPU, or an application Specific Integrated circuit (asic), or one or more Integrated circuits configured to implement embodiments of the present invention, or the like;
the memory 703 may include a high-speed RAM memory, and may further include a non-volatile memory (non-volatile memory) or the like, such as at least one disk memory;
wherein the memory stores a program and the processor can call the program stored in the memory, the program for:
acquiring an original value of a pixel to be corrected, wherein the pixel to be corrected comprises an edge pixel point and a target pixel point, and the target pixel point is a pixel point which is positioned on two sides of the edge pixel point and is positioned in the same line with the edge pixel point;
acquiring Gaussian parameters of the pixel to be corrected, wherein the Gaussian parameters comprise a pixel mean value and a pixel standard deviation of the pixel to be corrected;
acquiring a cumulative distribution vector of the pixels to be corrected according to the Gaussian parameters, wherein the cumulative distribution vector is composed of the cumulative distribution probability of each pixel to be corrected;
calculating a correction value of the pixel to be corrected according to the maximum transition value and the accumulated distribution vector; the maximum transition value is a difference value between a first reference value and a second reference value, the first reference value is determined according to the original value of the edge pixel and the original value of the target pixel located at the first side of the edge pixel, and the second reference value is determined according to the original value of the target pixel located at the second side of the edge pixel;
correcting the pixel to be corrected based on the original value of the pixel to be corrected and the correction value.
Alternatively, the detailed function and the extended function of the program may be as described above.
Embodiments of the present application further provide a readable storage medium, where a program suitable for being executed by a processor may be stored, where the program is configured to:
acquiring an original value of a pixel to be corrected, wherein the pixel to be corrected comprises an edge pixel point and a target pixel point, and the target pixel point is a pixel point which is positioned on two sides of the edge pixel point and is positioned in the same line with the edge pixel point;
acquiring Gaussian parameters of the pixel to be corrected, wherein the Gaussian parameters comprise a pixel mean value and a pixel standard deviation of the pixel to be corrected;
acquiring a cumulative distribution vector of the pixels to be corrected according to the Gaussian parameters, wherein the cumulative distribution vector is composed of the cumulative distribution probability of each pixel to be corrected;
calculating a correction value of the pixel to be corrected according to the maximum transition value and the accumulated distribution vector; the maximum transition value is a difference value between a first reference value and a second reference value, the first reference value is determined according to the original value of the edge pixel and the original value of the target pixel located at the first side of the edge pixel, and the second reference value is determined according to the original value of the target pixel located at the second side of the edge pixel;
correcting the pixel to be corrected based on the original value of the pixel to be corrected and the correction value.
Alternatively, the detailed function and the extended function of the program may be as described above.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.