CN111383183B - Image edge enhancement method and device and computer storage medium - Google Patents

Image edge enhancement method and device and computer storage medium Download PDF

Info

Publication number
CN111383183B
CN111383183B CN201811624126.0A CN201811624126A CN111383183B CN 111383183 B CN111383183 B CN 111383183B CN 201811624126 A CN201811624126 A CN 201811624126A CN 111383183 B CN111383183 B CN 111383183B
Authority
CN
China
Prior art keywords
pixel
image edge
neighborhood
brightness
value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811624126.0A
Other languages
Chinese (zh)
Other versions
CN111383183A (en
Inventor
马维维
陈欢
杨傲
蒋彬
张晓盟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Spreadtrum Communications Shanghai Co Ltd
Original Assignee
Spreadtrum Communications Shanghai Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Spreadtrum Communications Shanghai Co Ltd filed Critical Spreadtrum Communications Shanghai Co Ltd
Priority to CN201811624126.0A priority Critical patent/CN111383183B/en
Publication of CN111383183A publication Critical patent/CN111383183A/en
Application granted granted Critical
Publication of CN111383183B publication Critical patent/CN111383183B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • G06T5/73

Abstract

An image edge enhancement method, apparatus and computer storage medium, the method comprising: determining a pixel neighborhood taking an original pixel point as a central pixel point; in the pixel neighborhood, calculating the similarity between the brightness values of all preset pixel points passing through the central pixel point in all directions; determining the image edge of the pixel neighborhood according to the regional brightness and the similarity of the pixel neighborhood; carrying out weighted average calculation on the brightness value of each pixel point on the image edge of the pixel neighborhood to obtain an enhanced brightness value; and taking the enhanced brightness value as the brightness value of the central pixel point. By adopting the scheme, the image edge enhancement effect can be improved.

Description

Image edge enhancement method and device and computer storage medium
Technical Field
The present invention relates to the field of image processing, and in particular, to a method and an apparatus for enhancing image edges, and a computer storage medium.
Background
The image edge is a junction between the image region and another attribute region, where the region attribute changes abruptly, and where the image information is most concentrated. In the imaging process, the image display device is affected by noise and a denoising algorithm, and the continuity of the obtained image in the edge area may be poor, and noise exists in the edge area.
In the prior art, in order to enhance the edge of an image and further enhance the continuity of the edge of the image, a method is usually adopted to calculate a difference value between adjacent pixel points or a difference value between spaced pixel points in some specific directions, take a direction in which a maximum difference value is located as an image edge direction, and then retain edge information in the direction.
However, the above scheme is greatly affected by noise, and the effect of image edge enhancement is not ideal.
Disclosure of Invention
The invention solves the technical problem of poor image edge enhancement effect.
To solve the foregoing technical problem, an embodiment of the present invention provides an image edge enhancement method, including: determining a pixel neighborhood taking an original pixel point as a central pixel point; in the pixel neighborhood, calculating the similarity between the brightness values of all preset pixels passing through the central pixel in all directions; determining the image edge of the pixel neighborhood according to the region brightness and the similarity of the pixel neighborhood; carrying out weighted average calculation on the brightness value of each pixel point on the image edge of the pixel neighborhood to obtain an enhanced brightness value; and taking the enhanced brightness value as the brightness value of the central pixel point.
Optionally, the rows and columns of the pixel neighborhood have the same odd number of pixel points, and the position of the central pixel point in the pixel neighborhood is ((m +1)/2, (n +1)/2), where m is the number of pixel points in the row of the pixel neighborhood and n is the number of pixel points in the column of the pixel neighborhood.
Optionally, the dispersion degree of the brightness values of m preset pixels passing through the center pixel in each direction is calculated, and the similarity is determined according to the dispersion degree.
Optionally, the number of the pixels in the rows and columns of the pixel neighborhood is 5.
Optionally, the preset direction passing through the central pixel point is 0 degree, 45 degrees, 90 degrees and 135 degrees; the positions of the pixel points passing through 0 DEG are (1, 3), (2, 3), (3, 3), (4, 3) and (5, 3) respectively; positions of pixel points passing through 45 degrees are (1, 1), (2, 2), (3, 3), (4, 4) and (5, 5) respectively; the positions of the pixel points passing through 90 degrees are (3, 1), (3, 2), (3, 3), (3, 4) or (3, 5) respectively; the positions of the pixel points passing through 135 ° are (1, 5), (2, 4), (3, 3), (4, 2) and (5, 1), respectively.
Optionally, the dispersion degree diff is calculated by using the following formula:
Figure BDA0001927606410000021
wherein i is the direction passing through the central pixel point; direction _ ave (i) is the average value of the brightness values of all the pixel points in the direction i; pixel (j, i) is the brightness value of the jth pixel point in the i direction, and diff (i) is the discrete degree of the brightness value of each pixel point in the i direction.
Optionally, the degree of dispersion is inversely related to the degree of similarity.
Optionally, the direction of the image edge in the pixel neighborhood is determined in each preset direction passing through the central pixel point according to the regional brightness and the similarity of the pixel neighborhood.
Optionally, determining a first threshold and a second threshold according to the region brightness of the pixel neighborhood; when the minimum value in diff (i) is smaller than the first threshold, calculating difference values between the rest values of diff (i) and the minimum value in diff (i), and if the three calculated difference values are all larger than the second threshold, determining the direction corresponding to the minimum value in diff (i) as an image edge.
Optionally, the area brightness lum is calculated by using the following formula:
Figure BDA0001927606410000022
wherein in _ data _5 × 5[ x ]][y]The brightness value of a pixel point with (x, y) in the pixel neighborhood is obtained, the filter _ lum is a Gaussian matrix,
Figure BDA0001927606410000023
filter_lum[x][y]the value of (x, y) in the filter _ lum is shown.
Optionally, according to a preset first threshold conversion curve, obtaining the first threshold from the region brightness of the pixel neighborhood; and obtaining the second threshold value according to the region brightness of the pixel neighborhood and a preset second threshold value conversion curve.
Optionally, the weighted average is calculated by using the following formula:
cur_pixel=(pixel(1,b)+2*pixel(2,b)+2*pixel(3,b)+2*pixel(4,b)+pixel(5,b))/8,
wherein cur _ pixel is the enhanced luminance value and b is the image edge.
The present invention also provides an image edge enhancement apparatus, comprising: the selecting unit is used for determining a pixel neighborhood taking an original pixel point as a central pixel point; the first calculation unit is used for calculating the similarity between the brightness values of all the preset pixel points in all directions passing through the central pixel point in the pixel neighborhood; an edge determining unit, configured to determine an image edge of the pixel neighborhood according to the region brightness and the similarity of the pixel neighborhood; the second calculation unit is used for carrying out weighted average calculation on the brightness value of each pixel point on the image edge of the pixel neighborhood to obtain an enhanced brightness value; and the processing unit is used for taking the enhanced brightness value as the brightness value of the central pixel point.
Optionally, the rows and columns of the pixel neighborhood have the same odd number of pixels, and the position of the central pixel in the pixel neighborhood is ((m +1)/2, (n +1)/2), where m is the number of pixels in the row of the pixel neighborhood and n is the number of pixels in the column of the pixel neighborhood.
Optionally, the first calculating unit is further configured to calculate a discrete degree of brightness values of m pixels passing through the center pixel in each direction, and determine the similarity according to the discrete degree.
Optionally, the number of the pixels in the rows and columns of the pixel neighborhood is 5.
Optionally, the preset direction passing through the central pixel point is 0 degree, 45 degrees, 90 degrees and 135 degrees; the positions of the pixel points passing through 0 degrees are (1, 3), (2, 3), (3, 3), (4, 3) and (5, 3) respectively; positions of pixel points passing through 45 degrees are (1, 1), (2, 2), (3, 3), (4, 4) and (5, 5) respectively; the positions of the pixels passing through 90 degrees are (3, 1), (3, 2), (3, 3), (3, 4) or (3, 5) respectively; the positions of the pixel points passing through 135 ° are (1, 5), (2, 4), (3, 3), (4, 2) and (5, 1), respectively.
Optionally, the first calculating unit is further configured to calculate the discrete degree diff by using the following formula:
Figure BDA0001927606410000041
wherein i is the direction passing through the central pixel point; direction _ ave (i) is the average value of the brightness values of all the pixel points in the direction i; pixel (j, i) is the brightness value of the j-th pixel point in the i direction, and diff (i) is the discrete degree of the brightness value of each pixel point in the i direction.
Optionally, the degree of dispersion is inversely related to the degree of similarity.
Optionally, the edge determining unit is further configured to determine, according to the regional brightness of the pixel neighborhood and the similarity, a direction serving as an image edge in the pixel neighborhood in each preset direction passing through the central pixel.
Optionally, the edge determining unit is further configured to determine a first threshold and a second threshold according to the region brightness of the pixel neighborhood; when the minimum value in diff (i) is smaller than the first threshold, calculating difference values between the rest values of diff (i) and the minimum value in diff (i), and if the three calculated difference values are all larger than the second threshold, determining the direction corresponding to the minimum value in diff (i) as an image edge.
Optionally, the edge determining unit is further configured to calculate the area luminance lum by using the following formula:
Figure BDA0001927606410000042
wherein in _ data _5 × 5[ x ]][y]The brightness value of the pixel point with (x, y) in the pixel neighborhood, the filter _ lum is a Gaussian matrix,
Figure BDA0001927606410000043
filter_lum[x][y]is the value of (x, y) in the filter _ lum.
Optionally, the edge determining unit is further configured to obtain the first threshold value from the region brightness of the pixel neighborhood according to a preset first threshold value conversion curve; and obtaining the second threshold value according to the region brightness of the pixel neighborhood according to a preset second threshold value conversion curve.
Optionally, the second calculating unit is further configured to perform the weighted average calculation by using the following formula:
cur_pixel=(pixel(1,b)+2*pixel(2,b)+2*pixel(3,b)+2*pixel(4,b)+pixel(5,b))/8,
wherein cur _ pixel is the enhanced luminance value and b is the image edge.
The present invention further provides a computer-readable storage medium, on which computer instructions are stored, where the computer instructions are a non-volatile storage medium or a non-transitory storage medium, and when executed, perform the steps of any one of the image edge enhancement methods.
The invention also provides an image edge enhancement device, which comprises a memory and a processor, wherein the memory is stored with computer instructions, and the processor executes the steps of any one of the image edge enhancement methods when the computer instructions are executed.
Compared with the prior art, the technical scheme of the embodiment of the invention has the following beneficial effects:
in the pixel neighborhood, according to the similarity between the brightness values of all the preset pixel points in all directions passing through the central pixel point; determining the image edge of the pixel neighborhood according to the regional brightness and the similarity of the pixel neighborhood; carrying out weighted average calculation on the brightness value of each pixel point on the image edge of the pixel neighborhood to obtain an enhanced brightness value; and taking the enhanced brightness value as the brightness value of the central pixel point. By adopting the scheme, the image edge is determined according to the region brightness value of each pixel neighborhood, the image edge is determined accurately, and the image edge enhancement effect is improved.
Further, obtaining a first threshold value according to the region brightness of the pixel neighborhood and the first threshold value conversion curve; and obtaining a second threshold value according to the area brightness of the pixel neighborhood and the second threshold value conversion curve. Because the brightness of the corresponding region in each pixel neighborhood is different, the judgment of the image edge is more accurate according to the first threshold value and the second threshold value which are obtained dynamically, and the image edge enhancement effect is better.
Drawings
FIG. 1 is a schematic flowchart of an image edge enhancement method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an image edge enhancement apparatus according to an embodiment of the present invention.
Detailed Description
In the prior art, in order to enhance the image edge, a method is usually adopted to calculate a difference between adjacent pixels or a difference between spaced pixels in some specific directions, take the direction of the largest difference as the image edge direction, and then retain the edge information in the direction.
However, the above scheme is greatly affected by noise, and the effect of image edge enhancement is not ideal.
In the embodiment of the invention, in the pixel neighborhood, according to the similarity between the brightness values of all the preset pixel points passing through the central pixel point in all directions; determining the image edge of the pixel neighborhood according to the regional brightness and the similarity of the pixel neighborhood; carrying out weighted average calculation on the brightness value of each pixel point on the image edge of the pixel neighborhood to obtain an enhanced brightness value; and taking the enhanced brightness value as the brightness value of the central pixel point. By adopting the scheme, the image edge is determined according to the region brightness value of each pixel neighborhood, the image edge is determined accurately, and the image edge enhancement effect is improved.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in detail below.
Referring to fig. 1, which is a schematic flow chart of an image edge enhancement method according to an embodiment of the present invention, the method includes the following specific steps:
step S101, determining a pixel neighborhood taking an original pixel point as a central pixel point.
In specific implementation, the image edge enhancement method provided by the invention implements the effect of enhancing the image edge by performing corresponding processing on each pixel point on the image one by one.
In a specific implementation, an existing image processing method may be adopted to select and process the pixel points on the image. Specifically, the pixel points on the image can be selected in the order from left to right and from top to bottom. It can be understood that the user can also set the sequence of selecting the pixel points on the image according to the actual application scene.
In a specific implementation, the selected pixel point to be processed may be used as the original pixel point. In the pixel neighborhood determined in the embodiment of the invention, the selected original pixel point is taken as a central pixel point.
In an embodiment of the present invention, the rows and columns of the pixel neighborhood have the same odd number of pixel points, and the position of the central pixel point in the pixel neighborhood is ((m +1)/2, (n +1)/2), where m is the number of pixel points in the row of the pixel neighborhood and n is the number of pixel points in the column of the pixel neighborhood.
In a specific implementation, the size of the pixel neighborhood may be 5 × 5, or 3 × 3, 7 × 7, and the like, and the specific size may be set by a user according to an actual application scenario.
In a specific implementation, the central pixel point is located in the center of the pixel neighborhood, that is, when a coordinate axis is established, the number of the pixel points is taken as a unit on a horizontal axis and a vertical axis, the horizontal coordinates of all the pixel points on the leftmost column of the pixel neighborhood are 1, and the vertical coordinates of all the pixel points on the lowermost column of the pixel neighborhood are 1 (the coordinate axis is taken as a standard in the following description), then the position of the central pixel point in the pixel neighborhood is ((m +1)/2, (n + 1)/2).
And step S102, calculating the similarity between the brightness values of all the preset pixel points passing through the central pixel point in all directions in the pixel neighborhood.
In specific implementation, the direction of passing through the center pixel point can be set by a user according to an actual application scene.
In a specific implementation, the similarity between the brightness values of the pixels in a certain direction may be used as one of the factors for determining whether the direction is an image edge. The image edge is a joint of the image region and another attribute region, and the image edge has certain continuity, so that the similarity between the brightness values of the pixel points on the image edge is higher than that in other directions.
In the embodiment of the invention, the dispersion degree of the brightness values of m preset pixels passing through the central pixel in each direction is calculated, and the similarity is determined according to the dispersion degree.
In the embodiment of the invention, the discrete degree is inversely related to the similarity.
In specific implementation, the dispersion degree represents the difference degree between the brightness values of the pixel points in each direction, and the higher the dispersion degree is, the higher the difference degree is, the lower the similarity is; conversely, the lower the degree of dispersion and the lower the degree of difference, the higher the degree of similarity. Therefore, the lower the dispersion degree of the brightness values of all the pixels in each direction passing through the central pixel, the higher the probability that the direction is the edge of the image.
In the embodiment of the present invention, the number of pixels in the rows and columns of the pixel neighborhood may be 5.
In this embodiment of the present invention, the preset directions passing through the center pixel may be 0 °, 45 °, 90 ° and 135 °, and when the number of pixels in a row and a column is 5, the positions of the pixels passing through 0 ° are (1, 3), (2, 3), (3, 3), (4, 3) and (5, 3), respectively; positions of pixel points passing through 45 degrees are (1, 1), (2, 2), (3, 3), (4, 4) and (5, 5) respectively; the positions of the pixels passing through 90 degrees are (3, 1), (3, 2), (3, 3), (3, 4) or (3, 5) respectively; the positions of the pixel points passing through 135 ° are (1, 5), (2, 4), (3, 3), (4, 2) and (5, 1), respectively.
In the embodiment of the present invention, under the condition that the number of the pixel points on the rows and the columns is 5, the dispersion degree diff may be calculated by using the following formula:
Figure BDA0001927606410000081
wherein i is the direction passing through the central pixel point; direction _ ave (i) is the average value of the brightness values of all the pixel points in the direction i; pixel (j, i) is the brightness value of the jth pixel point in the i direction, and diff (i) is the discrete degree of the brightness value of each pixel point in the i direction.
In specific implementation, the formula (1) can be applied to the case that the number of pixel points on the pixel neighborhood row and column is not 5.
Step S103, determining the image edge of the pixel neighborhood according to the regional brightness and the similarity of the pixel neighborhood.
In the embodiment of the present invention, the direction of the image edge in the pixel neighborhood is determined in each preset direction passing through the central pixel point according to the region brightness and the similarity of the pixel neighborhood.
In specific implementation, the determined directions of the image edges are different according to the difference between the central pixel point and the corresponding pixel neighborhood, so that the accuracy of the determined directions of the image edges can be improved, and the effect of enhancing the image edges is further improved.
In the embodiment of the invention, a first threshold value and a second threshold value are determined according to the regional brightness of the pixel neighborhood; when the minimum value in diff (i) is smaller than the first threshold, calculating difference values between the rest values of diff (i) and the minimum value in diff (i), and if the three calculated difference values are all larger than the second threshold, determining the direction corresponding to the minimum value in diff (i) as an image edge.
In specific implementation, the first threshold is used for evaluating whether the brightness values of the pixel points in a certain direction in the pixel neighborhood have similarity, and the second threshold is used for evaluating whether the similarity of the brightness values of the pixel points in the certain direction in the pixel neighborhood is obviously stronger than that of the brightness values in other directions.
In specific implementation, the direction in which the value of the degree of dispersion is minimum and the value of the degree of dispersion is smaller than the first threshold indicates that the similarity between the brightness values of the pixel points in the direction is highest, so that the probability of becoming an image edge is highest; the direction with the smallest value of the degree of dispersion is excluded, and the value of the degree of dispersion in the remaining directions is larger than the second threshold value, indicating that the degree of similarity in the remaining directions is greatly different from the degree of similarity in the direction with the smallest value of the degree of dispersion, and thus the direction with the smallest value of the degree of dispersion can be regarded as the image edge.
In a specific implementation, when a certain direction is considered to be an image edge, the following two conditions may be satisfied simultaneously: (1) the value of the degree of dispersion in the direction is smaller than a first threshold value compared with the smallest value of the dispersion in other directions; (2) the values of the discrete degrees in the other directions are all larger than the second threshold value.
In the embodiment of the present invention, when the number of pixels in rows and columns is 5, the area brightness lum may be calculated by using the following formula:
Figure BDA0001927606410000091
wherein in _ data _5 × 5[ x ]][y]The brightness value of a pixel point with (x, y) in the pixel neighborhood is obtained, the filter _ lum is a Gaussian matrix,
Figure BDA0001927606410000092
filter_lum[x][y]is the value of (x, y) in the filter _ lum.
In specific implementation, the formula (2) can be applied to the case that the number of pixel points on the pixel neighborhood row and column is not 5.
In the embodiment of the invention, according to a preset first threshold value conversion curve, the first threshold value is obtained according to the regional brightness of the pixel neighborhood; and obtaining the second threshold value according to the region brightness of the pixel neighborhood according to a preset second threshold value conversion curve.
In specific implementation, the first threshold conversion curve and the second threshold conversion curve can be applied to the processing process of all pixel points on an image, under the condition that the pixel points and the corresponding pixel neighborhoods are different, the obtained first threshold and second threshold are different, dynamic setting of the first threshold and the second threshold is achieved, according to the first threshold and the second threshold which are obtained dynamically, judgment of the image edge is more accurate, and further the image edge enhancement effect is better.
And step S104, carrying out weighted average calculation on the brightness value of each pixel point on the image edge of the pixel neighborhood to obtain an enhanced brightness value.
In the embodiment of the present invention, the weighted average calculation may use the following formula:
cur_pixel=(pixel(1,b)+2*pixel(2,b)+2*pixel(3,b)+2*pixel(4,b)+pixel(5,b))/8 (3)
where cur _ pixel is the enhanced luminance value and b is the image edge.
In specific implementation, the formula (3) can be applied to the case that the number of pixel points on the pixel neighborhood row and column is not 5.
In a specific implementation, the weight of the brightness value of the pixel point is approximately reduced from the central pixel point to the two end pixel points in the direction.
Therefore, the image edge is determined according to the region brightness value of each pixel neighborhood, the image edge is determined accurately, and the image edge enhancement effect is improved.
And step S105, taking the enhanced brightness value as the brightness value of the central pixel point.
Referring to fig. 2, a schematic structural diagram of an image edge enhancement apparatus 20 according to an embodiment of the present invention is shown, which specifically includes:
a selecting unit 201, configured to determine a pixel neighborhood with an original pixel point as a central pixel point;
a first calculating unit 202, configured to calculate, in the pixel neighborhood, similarity between brightness values of preset pixels in each direction passing through the central pixel;
an edge determining unit 203, configured to determine an image edge of the pixel neighborhood according to the region brightness of the pixel neighborhood and the similarity;
a second calculating unit 204, configured to perform weighted average calculation on brightness values of all pixel points on the image edge of the pixel neighborhood to obtain an enhanced brightness value;
and the processing unit 205 is configured to use the enhanced luminance value as a luminance value of the central pixel.
In this embodiment of the present invention, the rows and columns of the pixel neighborhood may have the same odd number of pixel points, and the position of the central pixel point in the pixel neighborhood is ((m +1)/2, (n +1)/2), where m is the number of pixel points in the row of the pixel neighborhood and n is the number of pixel points in the column of the pixel neighborhood.
In this embodiment of the present invention, the first calculating unit 202 may be further configured to calculate a discrete degree of brightness values of m pixels passing through the center pixel in each preset direction, and determine the similarity according to the discrete degree.
In the embodiment of the present invention, the number of the pixel points in the rows and the columns of the pixel neighborhood may be 5.
In the embodiment of the invention, the preset directions passing through the central pixel point are 0 degree, 45 degrees, 90 degrees and 135 degrees; the positions of the pixel points passing through 0 degrees are (1, 3), (2, 3), (3, 3), (4, 3) and (5, 3) respectively; positions of pixel points passing through 45 degrees are (1, 1), (2, 2), (3, 3), (4, 4) and (5, 5) respectively; the positions of the pixels passing through 90 degrees are (3, 1), (3, 2), (3, 3), (3, 4) or (3, 5) respectively; the positions of the pixel points passing through 135 ° are (1, 5), (2, 4), (3, 3), (4, 2) and (5, 1), respectively.
In this embodiment of the present invention, the first calculating unit 202 may be further configured to calculate the discrete degree diff by using the following formula:
Figure BDA0001927606410000111
wherein i is the direction passing through the central pixel point; direction _ ave (i) is the average value of the brightness values of all the pixel points in the direction i; pixel (j, i) is the brightness value of the jth pixel point in the i direction, and diff (i) is the discrete degree of the brightness value of each pixel point in the i direction.
In the embodiment of the present invention, the degree of dispersion may be inversely related to the degree of similarity.
In this embodiment of the present invention, the edge determining unit 203 may be further configured to determine, according to the regional brightness of the pixel neighborhood and the similarity, a direction serving as an image edge in the pixel neighborhood in each preset direction passing through the central pixel.
In this embodiment of the present invention, the edge determining unit 203 may be further configured to determine a first threshold and a second threshold according to the brightness of the region in the pixel neighborhood; when the minimum value in diff (i) is smaller than the first threshold, calculating difference values between the rest values of diff (i) and the minimum value in diff (i), and if the three calculated difference values are all larger than the second threshold, determining the direction corresponding to the minimum value in diff (i) as an image edge.
In this embodiment of the present invention, the edge determining unit 203 may be further configured to calculate the area brightness lum by using the following formula:
Figure BDA0001927606410000112
wherein in _ data _5 × 5[ x ]][y]The brightness value of the pixel point with (x, y) in the pixel neighborhood, the filter _ lum is a Gaussian matrix,
Figure BDA0001927606410000121
filter_lum[x][y]is the value of (x, y) in the filter _ lum.
In this embodiment of the present invention, the edge determining unit 203 may be further configured to obtain the first threshold according to a preset first threshold conversion curve and the region brightness of the pixel neighborhood; and obtaining the second threshold value according to the region brightness of the pixel neighborhood and a preset second threshold value conversion curve.
In this embodiment of the present invention, the second calculating unit 204 may be further configured to perform the weighted average calculation by using the following formula:
cur_pixel=(pixel(1,b)+2*pixel(2,b)+2*pixel(3,b)+2*pixel(4,b)+pixel(5,b))/8 (3)
wherein cur _ pixel is the enhanced luminance value and b is the image edge.
The present invention further provides a computer-readable storage medium, on which a computer instruction is stored, where the computer instruction is a non-volatile storage medium or a non-transitory storage medium, and when executed, performs the steps of the image edge enhancement method provided in the embodiment of the present invention.
The invention further provides an image edge enhancement device, which comprises a memory and a processor, wherein the memory stores computer instructions, and the processor executes the steps of the image edge enhancement method provided by the embodiment of the invention when the computer instructions are executed.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by instructing the relevant hardware by a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: ROM, RAM, magnetic or optical disks, and the like.
Although the present invention is disclosed above, the present invention is not limited thereto. Various changes and modifications may be effected by one skilled in the art without departing from the spirit and scope of the invention, as defined in the appended claims.

Claims (18)

1. An image edge enhancement method, comprising:
determining a pixel neighborhood taking an original pixel point as a central pixel point;
in the pixel neighborhood, calculating the similarity between the brightness values of the preset pixels passing through the center pixel in all directions, including: calculating the dispersion degree of the brightness values of m preset pixel points passing through the central pixel point in each direction, and determining the similarity according to the dispersion degree; the above-mentionedThe degree of dispersion is calculated using the following formula:
Figure FDA0003751593590000011
wherein i is the direction passing through the central pixel point; direction _ ave (i) is the average value of the brightness values of all the pixel points in the direction i; pixel (j, i) is the brightness value of the jth pixel point in the i direction, and diff (i) is the discrete degree of the brightness value of each pixel point in the i direction;
determining the image edge of the pixel neighborhood according to the region brightness and the similarity of the pixel neighborhood, comprising: determining the direction of the image edge in the pixel neighborhood in each preset direction passing through the central pixel point according to the regional brightness and the similarity of the pixel neighborhood; determining a direction as an image edge in the pixel neighborhood in each preset direction passing through the central pixel point, including: determining a first threshold value and a second threshold value according to the regional brightness of the pixel neighborhood; when the minimum value in diff (i) is smaller than the first threshold, calculating difference values between the rest values of diff (i) and the minimum value in diff (i), and if the three calculated difference values are larger than the second threshold, determining the direction corresponding to the minimum value in diff (i) as an image edge;
performing weighted average calculation on the brightness value of each pixel point on the image edge of the pixel neighborhood to obtain an enhanced brightness value;
and taking the enhanced brightness value as the brightness value of the central pixel point.
2. The image edge enhancement method of claim 1, wherein the rows and columns of the pixel neighborhood have the same odd number of pixels, and the position of the central pixel in the pixel neighborhood is ((m +1)/2, (n +1)/2), where m is the number of pixels on the rows of the pixel neighborhood and n is the number of pixels on the columns of the pixel neighborhood.
3. The image edge enhancement method of claim 1, wherein the number of pixels on the rows and columns of the pixel neighborhood is 5.
4. The image edge enhancement method according to claim 3, wherein the preset directions passing through the center pixel point are 0 °, 45 °, 90 ° and 135 °; the positions of the pixel points passing through 0 degrees are (1, 3), (2, 3), (3, 3), (4, 3) and (5, 3) respectively; the positions of pixel points passing through 45 degrees are (1, 1), (2, 2), (3, 3), (4, 4) and (5, 5) respectively; the positions of the pixels passing through 90 degrees are (3, 1), (3, 2), (3, 3), (3, 4) or (3, 5) respectively; the positions of the pixel points passing through 135 ° are (1, 5), (2, 4), (3, 3), (4, 2) and (5, 1), respectively.
5. The image edge enhancement method of claim 1 wherein the degree of dispersion is inversely related to the degree of similarity.
6. The image edge enhancement method of claim 1, wherein the region luminance lum is calculated by using the following formula:
Figure FDA0003751593590000021
wherein in _ data _5 × 5[ x ]][y]The brightness value of a pixel point with (x, y) in the pixel neighborhood is obtained, the filter _ lum is a Gaussian matrix,
Figure FDA0003751593590000022
filter_lum[x][y]is the value of (x, y) in the filter _ lum.
7. The method of claim 1, wherein determining the first threshold and the second threshold comprises:
obtaining the first threshold value according to the regional brightness of the pixel neighborhood according to a preset first threshold value conversion curve; and obtaining the second threshold value according to the region brightness of the pixel neighborhood and a preset second threshold value conversion curve.
8. The image edge enhancement method of claim 1, wherein the weighted average calculation uses the following formula:
cur_pixel=(pixel(1,b)+2*pixel(2,b)+2*pixel(3,b)+2*pixel(4,b)+pixel(5,b))/8,
wherein cur _ pixel is the enhanced luminance value and b is the image edge.
9. An image edge enhancement apparatus, comprising:
the selecting unit is used for determining a pixel neighborhood taking an original pixel point as a central pixel point;
a first calculating unit, configured to calculate, in the pixel neighborhood, a similarity between luminance values of each pixel point in each direction that passes through the center pixel point, where the similarity is preset, and the calculating unit includes: calculating the dispersion degree of the brightness values of m preset pixel points passing through the center pixel point in each direction, and determining the similarity according to the dispersion degree; the degree of dispersion is calculated using the following formula:
Figure FDA0003751593590000031
wherein i is the direction passing through the central pixel point; direction _ ave (i) is the average value of the brightness values of all the pixel points in the direction i; pixel (j, i) is the brightness value of the jth pixel point in the i direction, and diff (i) is the discrete degree of the brightness value of each pixel point in the i direction;
an edge determining unit, configured to determine an image edge of the pixel neighborhood according to the region brightness and the similarity of the pixel neighborhood, including: determining the direction of the image edge in the pixel neighborhood in each preset direction passing through the central pixel point according to the regional brightness and the similarity of the pixel neighborhood; determining a direction as an image edge in the pixel neighborhood in each preset direction passing through the central pixel point, including: determining a first threshold value and a second threshold value according to the region brightness of the pixel neighborhood; when the minimum value in diff (i) is smaller than the first threshold, calculating difference values between the rest values of diff (i) and the minimum value in diff (i), and if the three calculated difference values are larger than the second threshold, determining the direction corresponding to the minimum value in diff (i) as an image edge;
the second calculation unit is used for carrying out weighted average calculation on the brightness value of each pixel point on the image edge of the pixel neighborhood to obtain an enhanced brightness value;
and the processing unit is used for taking the enhanced brightness value as the brightness value of the central pixel point.
10. The image edge enhancement device of claim 9, wherein the rows and columns of the pixel neighborhood have the same odd number of pixels, and the position of the central pixel in the pixel neighborhood is ((m +1)/2, (n +1)/2), where m is the number of pixels on the rows of the pixel neighborhood and n is the number of pixels on the columns of the pixel neighborhood.
11. The image edge enhancement device of claim 9, wherein the number of pixels in the pixel neighborhood on both the row and the column is 5.
12. The image edge enhancement device according to claim 11, wherein the preset directions passing through the center pixel point are 0 °, 45 °, 90 ° and 135 °; the positions of the pixel points passing through 0 degrees are (1, 3), (2, 3), (3, 3), (4, 3) and (5, 3) respectively; positions of pixel points passing through 45 degrees are (1, 1), (2, 2), (3, 3), (4, 4) and (5, 5) respectively; the positions of the pixels passing through 90 degrees are (3, 1), (3, 2), (3, 3), (3, 4) or (3, 5) respectively; the positions of the pixel points passing through 135 ° are (1, 5), (2, 4), (3, 3), (4, 2) and (5, 1), respectively.
13. The image edge enhancement device of claim 9 wherein the degree of dispersion is inversely related to the degree of similarity.
14. The image edge enhancement device according to claim 9, wherein the edge determining unit is further configured to calculate the region luminance lum by using the following formula:
Figure FDA0003751593590000041
wherein in _ data _5 x 5[ x ]][y]The brightness value of a pixel point with (x, y) in the pixel neighborhood is obtained, the filter _ lum is a Gaussian matrix,
Figure FDA0003751593590000042
filter_lum[x][y]is the value of (x, y) in the filter _ lum.
15. The image edge enhancement device according to claim 9, wherein the edge determining unit is further configured to obtain the first threshold value from the region brightness of the pixel neighborhood according to a preset first threshold value conversion curve; and obtaining the second threshold value according to the region brightness of the pixel neighborhood according to a preset second threshold value conversion curve.
16. The image edge enhancement device of claim 9, wherein the second computing unit is further configured to perform the weighted average computation by using the following formula:
cur_pixel=(pixel(1,b)+2*pixel(2,b)+2*pixel(3,b)+2*pixel(4,b)+pixel(5,b))/8,
wherein cur _ pixel is the enhanced luminance value and b is the image edge.
17. A computer readable storage medium having stored thereon computer instructions, the computer readable storage medium being a non-volatile storage medium or a non-transitory storage medium, wherein the computer instructions, when executed by a processor, perform the steps of the image edge enhancement method according to any one of claims 1 to 8.
18. An image edge enhancement apparatus comprising a memory and a processor, wherein the memory has stored thereon computer instructions, and wherein when the computer instructions are executed, the processor performs the steps of the image edge enhancement method according to any one of claims 1 to 8.
CN201811624126.0A 2018-12-28 2018-12-28 Image edge enhancement method and device and computer storage medium Active CN111383183B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811624126.0A CN111383183B (en) 2018-12-28 2018-12-28 Image edge enhancement method and device and computer storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811624126.0A CN111383183B (en) 2018-12-28 2018-12-28 Image edge enhancement method and device and computer storage medium

Publications (2)

Publication Number Publication Date
CN111383183A CN111383183A (en) 2020-07-07
CN111383183B true CN111383183B (en) 2022-09-09

Family

ID=71222249

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811624126.0A Active CN111383183B (en) 2018-12-28 2018-12-28 Image edge enhancement method and device and computer storage medium

Country Status (1)

Country Link
CN (1) CN111383183B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112669227B (en) * 2020-12-16 2023-10-17 Tcl华星光电技术有限公司 Icon edge processing method, icon edge processing device and computer readable storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7289154B2 (en) * 2000-05-10 2007-10-30 Eastman Kodak Company Digital image processing method and apparatus for brightness adjustment of digital images
CN101727659B (en) * 2008-10-31 2012-06-20 比亚迪股份有限公司 Method and system for enhancing image edge
CN102306377B (en) * 2011-09-21 2013-10-16 深圳市理邦精密仪器股份有限公司 Method and device for reducing noise in ultrasound image
CN107292828B (en) * 2016-03-31 2020-02-11 展讯通信(上海)有限公司 Image edge processing method and device

Also Published As

Publication number Publication date
CN111383183A (en) 2020-07-07

Similar Documents

Publication Publication Date Title
CN109191395B (en) Image contrast enhancement method, device, equipment and storage medium
CN109791695B (en) Determining a variance of an image block based on a motion vector of the block
AU2017232186A1 (en) Fast and robust image alignment for burst mode
US9967516B2 (en) Stereo matching method and device for performing the method
KR101032446B1 (en) Apparatus and method for detecting a vertex on the screen of a mobile terminal
US9824267B2 (en) Writing board detection and correction
Hua et al. Extended guided filtering for depth map upsampling
JP6369150B2 (en) Filtering method and filtering apparatus for recovering anti-aliasing edge
CN108074237B (en) Image definition detection method and device, storage medium and electronic equipment
CN111368717A (en) Sight line determining method and device, electronic equipment and computer readable storage medium
US9286653B2 (en) System and method for increasing the bit depth of images
US20120320433A1 (en) Image processing method, image processing device and scanner
CN111105452A (en) High-low resolution fusion stereo matching method based on binocular vision
JP5091994B2 (en) Motion vector detection device
CN111383183B (en) Image edge enhancement method and device and computer storage medium
CN114674826A (en) Visual detection method and detection system based on cloth
US20150187051A1 (en) Method and apparatus for estimating image noise
WO2017096814A1 (en) Image processing method and apparatus
JP2009146150A (en) Method and device for detecting feature position
JP2017076240A (en) Image processing apparatus, image processing method, and program
US9679363B1 (en) System and method for reducing image noise
TW202008217A (en) Method and electronic apparatus for comparing tracking object
WO2022188102A1 (en) Depth image inpainting method and apparatus, camera assembly, and electronic device
US11495162B2 (en) Panel display optimization method, display panel, and storage medium
CN112200730B (en) Image filtering processing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant