WO2017096820A1 - 基于梯度值及梯度方向的图像锐化方法及装置 - Google Patents
基于梯度值及梯度方向的图像锐化方法及装置 Download PDFInfo
- Publication number
- WO2017096820A1 WO2017096820A1 PCT/CN2016/088692 CN2016088692W WO2017096820A1 WO 2017096820 A1 WO2017096820 A1 WO 2017096820A1 CN 2016088692 W CN2016088692 W CN 2016088692W WO 2017096820 A1 WO2017096820 A1 WO 2017096820A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- pixel
- sharpening
- gradient
- pixel value
- 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.)
- Ceased
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/73—Deblurring; Sharpening
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T5/00—Image enhancement or restoration
- G06T5/20—Image enhancement or restoration using local operators
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T7/00—Image analysis
- G06T7/10—Segmentation; Edge detection
- G06T7/13—Edge detection
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20004—Adaptive image processing
- G06T2207/20012—Locally adaptive
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T2207/00—Indexing scheme for image analysis or image enhancement
- G06T2207/20—Special algorithmic details
- G06T2207/20172—Image enhancement details
- G06T2207/20192—Edge enhancement; Edge preservation
Definitions
- Embodiments of the present invention relate to the field of image processing, and in particular, to an image sharpening method and apparatus based on gradient values and gradient directions.
- Image sharpening is to compensate the contour of the image, enhance the edge of the image and the part of the grayscale transition, so that the image becomes clear, and it is divided into two types: spatial processing and frequency domain processing.
- the USM (Unsharp Mask) algorithm is a commonly used image sharpening algorithm that makes the blurry edges of an image relatively clear.
- the principle is that the difference between the original image and the further blurred image is used as a mask, and the edge of the image can be sharpened by adding the original image to the value in the mask image according to the set ratio.
- this algorithm has certain defects. The maximum and minimum values after sharpening will exceed the range of the original image, resulting in easy-to-detect grayscale mutations on both sides of the edge.
- Embodiments of the present invention provide an image sharpening method and apparatus based on gradient values and gradient directions, which are used to solve the problem that the maximum and minimum values of pixel values after image sharpening exceed the original value and the apparent gray level mutation occurs in the prior art. defect.
- Embodiments of the present invention provide an image sharpening method based on a gradient value and a gradient direction, including:
- the pixel When it is determined that the gradient is greater than a preset gradient threshold, the pixel is sharpened, and the pixel value of the pixel is updated by the pixel value obtained by the sharpening operation.
- An embodiment of the present invention provides an image sharpening device based on a gradient value and a gradient direction, including:
- a calculation module configured to scan pixel points in the image one by one and calculate a gradient of the pixel point
- a sharpening module configured to: when the gradient is greater than a preset gradient threshold, sharpen the pixel, and update a pixel value of the pixel with the pixel value obtained by the sharpening operation.
- the present application also discloses a video denoising device, including: a memory, a processor, wherein
- the memory is configured to store one or more instructions, wherein the one or more instructions are for execution by the processor;
- the processor is configured to scan pixel points in an image one by one and calculate a gradient of the pixel points
- the pixel When it is determined that the gradient is greater than a preset gradient threshold, the pixel is sharpened, and the pixel value of the pixel is updated by the pixel value obtained by the sharpening operation.
- the image sharpening method and device based on the gradient value and the gradient direction provided by the embodiment of the present invention change the pixel value after image sharpening in the prior art by automatically defining the sharpened pixel value range.
- the defect that the maximum and minimum values exceed the original value effectively eliminates the apparent visual gray-scale mutation.
- the degree of image sharpening can be adaptively adjusted.
- Embodiment 1 is a technical flowchart of Embodiment 1 of the present invention.
- FIG. 3 is a diagram showing an example of a gradient direction and neighboring pixel points according to an embodiment of the present invention
- FIG. 4 is a diagram showing an example of a Gaussian function according to an embodiment of the present invention.
- FIG. 5 is a schematic structural diagram of a device according to Embodiment 2 of the present invention.
- FIG. 6 is a schematic structural diagram of a device according to Embodiment 3 of the present invention.
- a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
- processors CPUs
- input/output interfaces network interfaces
- memory volatile and non-volatile memory
- the memory may include non-persistent memory, random access memory (RAM), and/or non-volatile memory in a computer readable medium, such as read only memory (ROM) or flash memory.
- RAM random access memory
- ROM read only memory
- Memory is an example of a computer readable medium.
- Computer readable media includes both permanent and non-persistent, removable and non-removable media.
- Information storage can be implemented by any method or technology.
- the information can be computer readable instructions, data structures, modules of programs, or other data.
- Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory. (ROM), electrically erasable programmable read only memory (EEPROM), flash memory or other memory technology, compact disk read only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, Magnetic tape cartridges, magnetic tape storage or other magnetic storage devices or any other non-transportable media can be used to store information that can be accessed by a computing device.
- computer readable media does not include non-transitory computer readable media, such as modulated data signals and carrier waves.
- a first device is coupled to a second device
- the first device is represented.
- the device can be directly electrically coupled to the second device, or electrically coupled to the second device indirectly through other devices or coupling means.
- Embodiment 1 is a technical flowchart of Embodiment 1 of the present invention.
- an image sharpening method based on gradient values and gradient directions according to an embodiment of the present invention is mainly implemented by two large steps:
- Step 110 Scan pixel points in an image one by one and calculate a gradient of the pixel points
- the meaning of the gradient in image processing is to indicate in which direction the pixel value changes the fastest, that is, the maximum rate of change of the image gradation. At the edge of the image, the fluctuation of the pixel value is more obvious, so the detection of such fluctuation can be realized by performing gradient operation on the image.
- Each pixel in the image to be processed is scanned line by line row by column, for which the gradient is first calculated. Since the image is stored in the form of a digital image in the computer, ie the image is a discrete digital signal, the gradient of the digital image is used in place of the differentiation in the continuous signal.
- Roberts Gradient The Roberts gradient operator is the simplest operator. It is an operator that uses the local difference operator to find the edge. The difference between the two pixels in the diagonal direction is used to approximate the gradient amplitude to detect the edge. The effect of detecting vertical edges is better than that of oblique edges, which has high positioning accuracy, is sensitive to noise, and cannot suppress the influence of noise.
- Sobel gradient operator There are two Sobel gradient operators, one for detecting horizontal edges and the other for detecting vertical edges. Compared with the Prewitt operator, the Sobel operator weights the influence of the position of the pixel, which can reduce the degree of edge blur, so the effect is better.
- the 3 ⁇ 3 template for the Sobel gradient operator is as follows:
- the left side is a 3 ⁇ 3 Sobel gradient template in the x direction
- the right side is a 3 ⁇ 3 Sobel gradient template in the y direction.
- Laplacian gradient is isotropic, that is, independent of the direction of the coordinate axis, and the gradient result does not change after the coordinate axis is rotated.
- the left side is the 4 neighborhood system template, and the right side is the 8 neighborhood system template.
- the left side is a 3 ⁇ 3 Scharr gradient template in the y direction
- the right side is a 3 ⁇ 3 Scharr gradient template in the x direction.
- the position of the sign in the operator has changed. It is more intuitive to satisfy the positional allocation of the quadrant in mathematics when calculating the gradient direction.
- the pixel values in a pixel and its 3 ⁇ 3 neighborhood are as follows:
- the gradient value can be calculated using the following formula:
- G is the gradient value corresponding to the pixel point P5
- the value range of G is P1 to P9 are pixel values of all pixels in the 3 ⁇ 3 neighborhood.
- the embodiment of the present invention does not limit which gradient operator is used to calculate the gradient value of the pixel. Any algorithm that can implement the gradient value calculation in the embodiment of the present invention is within the protection scope of the embodiment of the present invention.
- Step 120 When it is determined that the gradient is greater than a preset gradient threshold, the pixel is sharpened, and the pixel value of the pixel is updated by the pixel value obtained by the sharpening operation.
- this step it is first determined whether the gradient value of the pixel point exceeds a threshold value, and if the preset threshold value is exceeded, the pixel point is sharpened, thereby avoiding that the sharpened maximum value and the minimum value exceed the original picture.
- a threshold value e.g., a threshold value that is exceeded.
- step 120 sharpening the pixel points is implemented by steps 121-125.
- Step 121 Calculate a gradient direction of the pixel point according to the gradient
- the gradient direction ⁇ of the pixel is calculated by the following formula:
- p x is the gradient value of the pixel point in the x direction
- p y is the gradient value of the pixel point along the y direction
- arctan() is an arctangent function
- the calculation of the gradient direction may be performed before the determination of whether the sharpening is performed, or the first step of determining whether the sharpening operation is required, and then calculating the gradient direction, which is not limited in the embodiment of the present invention.
- Step 122 searching for the maximum pixel value and the minimum pixel value in the neighborhood of the pixel point along the forward direction and the reverse direction of the gradient direction;
- the pixel point is taken as a coordinate origin, the horizontal direction is the x-axis, and the vertical direction is the y-axis.
- the gradient direction of the pixel point and the reverse extension line are drawn in the neighborhood of the pixel point.
- the forward and reverse directions of the gradient direction are the regions where the pixel value of the image changes most obviously, so the maximum and minimum values of the pixel values are searched in the neighborhood along this direction, and the calculation amount is small and more accurate.
- the maximum pixel value is stated as p max
- the minimum pixel value is p min .
- Step 123 Calculate a mean value of pixel values in the neighborhood
- p mean is the average of the pixel values
- N*N is the total number of pixels in the neighborhood
- p x is the pixel value corresponding to each pixel in the neighborhood.
- Step 124 Calculate the sharpening coefficient according to the pixel value mean, the maximum pixel value, and the minimum pixel value;
- the embodiment of the present invention calculates the sharpening coefficient by using a Gaussian function.
- the Gaussian function is as follows:
- Step 125 Sharpen the pixel points according to the sharpening coefficient.
- the pixel points are sharpened according to the sharpening coefficient by using the following formula:
- p′ is a pixel value obtained by the sharpening operation of the pixel point
- p is a pixel value when the pixel point is not subjected to the sharpening operation
- p max is the maximum pixel value
- f is the sharpening coefficient
- the position of the gray level change in the image is detected by the gradient calculation, thereby realizing fast and accurate edge detection; and by automatically limiting the range of the pixel values after sharpening, it is ensured that after the image sharpening is performed, the image is sharpened.
- the maximum and minimum values of the pixel values are still within the original value range, effectively eliminating significant visual gray-scale abrupt changes.
- the Gaussian function is used to calculate the sharpening coefficient according to the pixel value in the neighborhood of the pixel, thereby adaptively adjusting the degree of image sharpening and improving the image quality.
- FIG. 5 is a schematic structural diagram of a device according to Embodiment 2 of the present invention.
- an image sharpening device based on gradient values and gradient directions mainly includes two large modules: a calculation module 510 and a sharpening module. 520.
- the calculating module 510 is configured to scan pixel points in an image one by one and calculate a gradient of the pixel points;
- the sharpening module 520 is configured to: when determining that the gradient is greater than a preset gradient threshold, sharpening the pixel, and updating a pixel value of the pixel by the pixel value obtained by the sharpening operation.
- the sharpening module 520 is further configured to: calculate a gradient direction of the pixel point according to the gradient; and search for a maximum pixel in a neighborhood of the pixel point along a forward direction and a reverse direction of the gradient direction The value and the minimum pixel value.
- the sharpening module 520 is further configured to: calculate a pixel value mean value in the neighborhood;
- the sharpening module 520 is further configured to: calculate the sharpening system by using the following formula: number:
- a, b, and c are empirical values, and b and c are calculated according to the maximum pixel value and the average pixel value.
- the sharpening module 520 is further configured to: sharpen the pixel according to the sharpening coefficient by using a formula:
- p′ is a pixel value obtained by the sharpening operation of the pixel point
- p is a pixel value when the pixel point is not subjected to the sharpening operation
- p max is the maximum pixel value
- f is the sharpening coefficient
- the apparatus shown in FIG. 5 can perform the method of the embodiment shown in FIG. 1 to FIG. 4, and the implementation principle and technical effects refer to the embodiment shown in FIG. 1 to FIG. 4, and details are not described herein again.
- the device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separate, and the components displayed as units may or may not be physical units, ie may be located A place, or it can be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment. Those of ordinary skill in the art can understand and implement without deliberate labor.
- FIG. 6 is a schematic structural diagram of a device according to Embodiment 3 of the present invention.
- an image sharpening device based on gradient values and gradient directions mainly includes a memory 601 and a processor 602.
- the memory 601 is configured to store one or more instructions, where the one or more instructions are for execution by the processor;
- the processor 602 is configured to scan pixel points in an image one by one and calculate a gradient of the pixel points;
- the pixel When it is determined that the gradient is greater than a preset gradient threshold, the pixel is sharpened, and the pixel value of the pixel is updated by the pixel value obtained by the sharpening operation.
- the processor 602 is configured to calculate a gradient direction of the pixel according to the gradient; a forward direction and a reverse direction along the gradient direction, at the pixel point Look for the largest pixel value and the smallest pixel value in the neighborhood.
- the processor 602 is configured to calculate a pixel value mean in the neighborhood; and calculate the sharp according to the pixel value mean, the maximum pixel value, and the minimum pixel value.
- the pixel is sharpened according to the sharpening coefficient.
- the processor 602 is configured to calculate the sharpening coefficient by using the following formula:
- a, b, and c are empirical values, and b and c are calculated according to the maximum pixel value and the average pixel value.
- the processor 602 is configured to sharpen the pixel according to the sharpening coefficient by using the following formula:
- p′ is a pixel value obtained by the sharpening operation of the pixel point
- p is a pixel value when the pixel point is not subjected to the sharpening operation
- p max is the maximum pixel value
- f is the sharpening coefficient
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Image Processing (AREA)
Abstract
一种基于梯度值及梯度方向的图像锐化方法及装置。逐个扫描图像中的像素点并计算所述像素点的梯度(110);当判定所述梯度大于预设的梯度阈值,则对所述像素点进行锐化,以所述锐化操作得到的像素值更新所述像素点的像素值(120)。有效消除了明显的视觉上的灰度突变,同时可以自适应地调节图像锐化的程度。
Description
交叉引用
本申请引用于2015年12月10日递交的名称为“基于梯度值及梯度方向的图像锐化方法及装置”的第201510918068.2号中国专利申请,其通过引用被全部并入本申请。
本发明实施例涉及图像处理领域,尤其涉及一种基于梯度值及梯度方向的图像锐化方法及装置。
图像锐化(image sharpening)就是补偿图像的轮廓,增强图像的边缘及灰度跳变的部分,使图像变得清晰,亦分空域处理和频域处理两类。
USM(非锐化掩膜)算法是常用的图像锐化算法,可将图像中较模糊的边缘变得相对清晰。其原理是将原图像与进一步模糊的图像的差作为掩膜,将原图像根据设定的比例加上掩膜图像中的值即可实现图像边缘的锐化。但是这种算法存在一定的缺陷,锐化后的最大最小值会超过原始图片的范围,造成在边缘的两侧出现易被察觉的灰度突变。
因此,一种新的锐化算法亟待提出。
发明内容
本发明实施例提供一种基于梯度值及梯度方向的图像锐化方法及装置,用以解决现有技术中图像锐化后像素值的最大值和最小值超过原始值而出现明显灰度突变的缺陷。
本发明实施例提供一种基于梯度值及梯度方向的图像锐化方法,包括:
逐个扫描图像中的像素点并计算所述像素点的梯度;
当判定所述梯度大于预设的梯度阈值,则对所述像素点进行锐化,以所述锐化操作得到的像素值更新所述像素点的像素值。
本发明实施例提供一种基于梯度值及梯度方向的图像锐化装置,包括:
计算模块,用于逐个扫描图像中的像素点并计算所述像素点的梯度;
锐化模块,用于,当判定所述梯度大于预设的梯度阈值,对所述像素点进行锐化,以所述锐化操作得到的像素值更新所述像素点的像素值。
本申请还揭示了一种视频去噪设备,包括:内存、处理器,其中,
所述内存,用于存储一条或多条指令,其中,所述一条或多条指令以供所述处理器调用执行;
所述处理器,用于逐个扫描图像中的像素点并计算所述像素点的梯度;
当判定所述梯度大于预设的梯度阈值,则对所述像素点进行锐化,以所述锐化操作得到的像素值更新所述像素点的像素值。
本发明实施例提供的基于梯度值及梯度方向的图像锐化方法及装置,通过自动限定锐化后的像素值范围,改变了现有技术中进行图像锐化时,图像锐化后像素值的最大值和最小值超过原始值的缺陷,有效消除了明显的视觉上的灰度突变。此外,还可以自适应地调节图像锐化的程度。
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:
图1为本发明实施例一的技术流程图;
图2为本发明实施例一的另一技术流程图;
图3为本发明实施例梯度方向与邻域像素点的示例图;
图4为本发明实施例高斯函数示例图;
图5为本发明实施例二的装置结构示意图;
图6为本发明实施例三的设备结构示意图。
为使本发明的目的、技术方案和优点更加清楚,以下结合附图及具体实施例,对本发明作进一步地详细说明。在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括非暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
如在说明书及权利要求当中使用了某些词汇来指称特定组件。本领域技术人员应可理解,硬件制造商可能会用不同名词来称呼同一个组件。本说明书及权利要求并不以名称的差异来作为区分组件的方式,而是以组件在功能上的差异来作为区分的准则。如在通篇说明书及权利要求当中所提及的“包含”为一开放式用语,故应解释成“包含但不限定于”。“大致”是指在可接收的误差范围内,本领域技术人员能够在一定误差范围内解决所述技术问题,基本达到所述技术效果。此外,“耦接”一词在此包含任何直接及间接的电性耦接手段。因此,若文中描述一第一装置耦接于一第二装置,则代表所述第一装
置可直接电性耦接于所述第二装置,或通过其他装置或耦接手段间接地电性耦接至所述第二装置。说明书后续描述为实施本申请的较佳实施方式,然所述描述乃以说明本申请的一般原则为目的,并非用以限定本申请的范围。本申请的保护范围当视所附权利要求所界定者为准。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的商品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种商品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的商品或者系统中还存在另外的相同要素。
实施例一
图1是本发明实施例一的技术流程图,结合图1,本发明实施例一种基于梯度值及梯度方向的图像锐化方法,主要由两个大的步骤实现:
步骤110:逐个扫描图像中的像素点并计算所述像素点的梯度;
梯度的在图像处理中的意义表征的是像素值在哪个方向上变化最快,即图像灰度的最大变化率。图像的边缘部分,像素值的波动较为明显,故这种波动的检测可以过对图像进行梯度运算来实现。
逐行逐列扫描待处理图像中的每一像点素,对于所述像素点,先计算其梯度。由于图像在计算机中以数字图像的形式进行存储,即图像是离散的数字信号,对数字图像的梯度使用差分来代替连续信号中的微分。
常见的图像梯度模板有以下几种:
1)Roberts梯度。Roberts梯度算子是一种最简单的算子,是一种利用局部差分算子寻找边缘的算子,采用对角线方向相邻两象素之差近似梯度幅值检测边缘。检测垂直边缘的效果好于斜向边缘,定位精度高,对噪声敏感,无法抑制噪声的影响。
2)Prewitt梯度。
左侧是x方向的3×3Prewitt梯度模板,右侧是y方向的3×3Prewitt梯度模板。
3)Sobel梯度。Sobel梯度算子有两个,一个是检测水平边缘的;另一个是检测垂直边缘的。与Prewitt算子相比,Sobel算子对于像素的位置的影响做了加权,可以降低边缘模糊程度,因此效果更好。Sobel梯度算子的3×3模板如下所示:
左侧是x方向的3×3Sobel梯度模板,右侧是y方向的3×3Sobel梯度模板。
4)Laplacian梯度。Laplacian梯度算子具有各向同性,即与坐标轴方向无关,坐标轴旋转后梯度结果不变。
左侧为4邻域系统模板,右侧为8邻域系统模板。
5)Scharr梯度。
左侧是y方向的3×3Scharr梯度模板,右侧是x方向的3×3Scharr梯度模板。算子中正负号的位置有所变化,为计算梯度方向时,满足数学中象限的位置分配,看起来更加直观。
以Sobel梯度模板计算为例,某一像素点及其3×3邻域内的像素值分布如下:
| P1 | P2 | P3 |
| P4 | P5 | P6 |
| P7 | P8 | P9 |
对于像素点P5,其梯度值可以采用如下公式进行计算:
本发明实施例并不限制采用何种梯度算子计算所述像素点的梯度值,凡是能实现本发明实施例中梯度值计算的算法都在本发明实施例的保护范围之内。
步骤120:当判定所述梯度大于预设的梯度阈值,则对所述像素点进行锐化,以所述锐化操作得到的像素值更新所述像素点的像素值。
本步骤中,首先判断所述像素点的梯度值是否超过阈值,若是超出预设的阈值,则对所述像素点进行锐化,从而避免了锐化后的最大值和最小值超出原图片的像素值范围,从而导致图像中边缘部分出现明显的灰度突变。
进一步地,结合图2,步骤120中,对所述像素点进行锐化由步骤121~步骤125实现。
步骤121:根据所述梯度,计算所述像素点的梯度方向;
根据梯度方向的定义,采用如下公式计算所述像素点的梯度方向θ:
其中,px为所述像素点沿x方向的梯度值,py为所述像素点沿y方向的梯度值,arctan()为反正切函数。
以Sobel算子为例,px及px的计算如下所示:
Px=(p3-p1)+2*(p6-p4)+(p9-p7)
Py=(p1-p7)+2*(p2-p8)+(p3-p9)
本发明实施例中,梯度方向的计算可以在判断是否进行锐化之前执行,也可以是先判断是否需要进行锐化操作,再计算所述梯度方向,本发明实施例并不做限制。
步骤122:沿所述梯度方向的正向及反向,在所述像素点的邻域内寻找最大像素值以及最小像素值;
如图3所示,以所述像素点为坐标原点,水平方向为x轴,垂直方向为y轴,在所述像素点的邻域内画出所述像素点的梯度方向及其反向延长线的示意图。
所述梯度方向的正向和反向,是图像的像素值变化最明显的区域,因此沿着这个方向在所述邻域内寻找像素值的最大值和最小值,计算量小,且更加准确。记所述最大像素值为pmax,所述最小像素值为pmin。
步骤123:计算所述邻域内的像素值均值;
所述像素值均值的计算公式如下所示:
其中,pmean为所述像素值均值,N*N为所述邻域内像素点的总数,px是所述邻域内的每一像素点对应的像素值。
步骤124:根据所述像素值均值、所述最大像素值以及所述最小像素值计算所述锐化系数;
当p5>pmean时,应当将p5的值向pmax靠拢,当p5处于pmean和pmax之间的时候,靠拢的程度应该最大。p5越靠近pmean和pmax,锐化的程度应该越小,避免出现锯齿和过度的灰度突变,参考图4所示。因此本发明实施例采用高斯函数计算所述锐化系数。
高斯函数如下所示:
f=a×exp[-(x-b)2/c2]
其中,a、b、c为经验数值。在理想状态下,a应该等于1.0,但是为了避免锯齿等情况,一般取a=0.85即可;b的值为b=(pmax+pmean)/2;c作为控制高斯宽度的参数,经过试验,把宽度映射到标准高斯函数的c为0.35的宽度最合适,因此c=(pmax-pmean)/0.35。
步骤125:根据所述锐化系数对所述像素点进行锐化。
采用如下公式根据所述锐化系数对所述像素点进行锐化:
p′=p+f×(pmax-p)
其中,p′为所述像素点经锐化操作得到的像素值,p为所述像素点未经所述锐化操作时像素值,pmax为所述最大像素值,f为所述锐化系数。
本实施例中,通过梯度计算检测图像中灰度变化较大的位置,从而实现快速精确的边缘检测;通过自动限定锐化后的像素值范围,确保了进行图像锐化时,图像锐化后像素值的最大值和最小值仍在原始值范围之内,有效消除了明显的视觉上的灰度突变。
此外,利用高斯函数根据所述像素点邻域内的像素值大小计算锐化系数,实现了自适应地调节图像锐化的程度,提升了图像质量。
实施例二
图5是本发明实施例二的装置结构示意图,结合图5,本发明实施例一种基于梯度值及梯度方向的图像锐化装置,主要包括两个大的模块:计算模块510以及锐化模块520。
所述计算模块510,用于逐个扫描图像中的像素点并计算所述像素点的梯度;
所述锐化模块520,用于,当判定所述梯度大于预设的梯度阈值,对所述像素点进行锐化,以所述锐化操作得到的像素值更新所述像素点的像素值。
具体地,所述锐化模块520进一步用于:根据所述梯度,计算所述像素点的梯度方向;沿所述梯度方向的正向及反向,在所述像素点的邻域内寻找最大像素值以及最小像素值。
具体地,所述锐化模块520进一步用于:计算所述邻域内的像素值均值;
根据所述像素值均值、所述最大像素值以及所述最小像素值计算所述锐化系数;根据所述锐化系数对所述像素点进行锐化。
具体地,所述锐化模块520进一步用于:采用如下公式计算所述锐化系
数:
f=a×exp[-(x-b)2/c2]
其中,a、b、c为经验数值,b、c根据所述最大像素值和所述平均像素值进行计算。
具体地,所述锐化模块520进一步用于:采用如下公式根据所述锐化系数对所述像素点进行锐化:
p′=p+f×(pmax-p)
其中,p′为所述像素点经锐化操作得到的像素值,p为所述像素点未经所述锐化操作时像素值,pmax为所述最大像素值,f为所述锐化系数。
图5所示装置可以执行图1~图4所示实施例的方法,实现原理和技术效果参考图1~图4所示实施例,不再赘述。
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性的劳动的情况下,即可以理解并实施。
实施例三
图6是本发明实施例三的设备结构示意图,结合图6,本发明实施例一种基于梯度值及梯度方向的图像锐化设备,主要包括内存601以及处理器602。
所述内存601,用于存储一条或多条指令,其中,所述一条或多条指令以供所述处理器调用执行;
所述处理器602,用于逐个扫描图像中的像素点并计算所述像素点的梯度;
当判定所述梯度大于预设的梯度阈值,则对所述像素点进行锐化,以所述锐化操作得到的像素值更新所述像素点的像素值。
对所述像素点进行锐化时,所述处理器602,用于根据所述梯度,计算所述像素点的梯度方向;沿所述梯度方向的正向及反向,在所述像素点的邻域内寻找最大像素值以及最小像素值。
对所述像素点进行锐化时,所述处理器602,用于计算所述邻域内的像素值均值;根据所述像素值均值、所述最大像素值以及所述最小像素值计算所述锐化系数;根据所述锐化系数对所述像素点进行锐化。
计算所述锐化系数时,所述处理器602,用于采用如下公式计算所述锐化系数:
f=a×exp[-(x-b)2/c2]
其中,a、b、c为经验数值,b、c根据所述最大像素值和所述平均像素值进行计算。
所述处理器602,用于采用如下公式根据所述锐化系数对所述像素点进行锐化:
p′=p+f×(pmax-p)
其中,p′为所述像素点经锐化操作得到的像素值,p为所述像素点未经所述锐化操作时像素值,pmax为所述最大像素值,f为所述锐化系数。
Claims (10)
- 一种基于梯度值及梯度方向的图像锐化方法,其特征在于,包括如下的步骤:逐个扫描图像中的像素点并计算所述像素点的梯度;当判定所述梯度大于预设的梯度阈值,则对所述像素点进行锐化,以所述锐化操作得到的像素值更新所述像素点的像素值。
- 根据权利要求1所述的方法,其特征在于,对所述像素点进行锐化,进一步包括:根据所述梯度,计算所述像素点的梯度方向;沿所述梯度方向的正向及反向,在所述像素点的邻域内寻找最大像素值以及最小像素值。
- 根据权利要求2所述的方法,其特征在于,对所述像素点进行锐化,进一步包括:计算所述邻域内的像素值均值;根据所述像素值均值、所述最大像素值以及所述最小像素值计算所述锐化系数;根据所述锐化系数对所述像素点进行锐化。
- 根据权利要求3所述的方法,其特征在于,计算所述锐化系数,进一步包括:采用如下公式计算所述锐化系数:f=a×exp[-(x-b)2/c2]其中,a、b、c为经验数值,b、c根据所述最大像素值和所述平均像素值进行计算。
- 根据权利要求3或4所述的方法,其特征在于,采用如下公式根据所述锐化系数对所述像素点进行锐化:p′=p+f×(pmax-p)其中,p′为所述像素点经锐化操作得到的像素值,p为所述像素点未经所述锐化操作时像素值,pmax为所述最大像素值,f为所述锐化系数。
- 一种基于梯度值及梯度方向的图像锐化装置,其特征在于,包括如下的模块:计算模块,用于逐个扫描图像中的像素点并计算所述像素点的梯度;锐化模块,用于,当判定所述梯度大于预设的梯度阈值,对所述像素点进行锐化,以所述锐化操作得到的像素值更新所述像素点的像素值。
- 根据权利要求6所述的装置,其特征在于,所述锐化模块进一步用于:根据所述梯度,计算所述像素点的梯度方向;沿所述梯度方向的正向及反向,在所述像素点的邻域内寻找最大像素值以及最小像素值。
- 根据权利要求7所述的装置,其特征在于,所述锐化模块进一步用于:计算所述邻域内的像素值均值;根据所述像素值均值、所述最大像素值以及所述最小像素值计算所述锐化系数;根据所述锐化系数对所述像素点进行锐化。
- 根据权利要求8所述的装置,其特征在于,所述锐化模块进一步用于:采用如下公式计算所述锐化系数:f=a×exp[-(x-b)2/c2]其中,a、b、c为经验数值,b、c根据所述最大像素值和所述平均像素值进行计算。
- 根据权利要求8或9所述的装置,其特征在于,所述锐化模块进一步用于:采用如下公式根据所述锐化系数对所述像素点进行锐化:p′=p+f×(pmax-p)其中,p′为所述像素点经锐化操作得到的像素值,p为所述像素点未经所 述锐化操作时像素值,pmax为所述最大像素值,f为所述锐化系数。
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US15/247,576 US20170169551A1 (en) | 2015-12-10 | 2016-08-25 | Image sharpening method based on gradient value and gradient direction and electronic apparatus thereof |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510918068.2A CN105894459A (zh) | 2015-12-10 | 2015-12-10 | 基于梯度值及梯度方向的图像锐化方法及装置 |
| CN201510918068.2 | 2015-12-10 |
Related Child Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| US15/247,576 Continuation US20170169551A1 (en) | 2015-12-10 | 2016-08-25 | Image sharpening method based on gradient value and gradient direction and electronic apparatus thereof |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| WO2017096820A1 true WO2017096820A1 (zh) | 2017-06-15 |
Family
ID=57002395
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| PCT/CN2016/088692 Ceased WO2017096820A1 (zh) | 2015-12-10 | 2016-07-05 | 基于梯度值及梯度方向的图像锐化方法及装置 |
Country Status (3)
| Country | Link |
|---|---|
| US (1) | US20170169551A1 (zh) |
| CN (1) | CN105894459A (zh) |
| WO (1) | WO2017096820A1 (zh) |
Families Citing this family (29)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108428215A (zh) * | 2017-02-15 | 2018-08-21 | 阿里巴巴集团控股有限公司 | 一种图像处理方法、装置和设备 |
| CN107016670B (zh) * | 2017-03-27 | 2019-06-28 | 福州瑞芯微电子股份有限公司 | 一种图像坏点检测方法和装置 |
| CN107295318A (zh) * | 2017-08-23 | 2017-10-24 | 无锡北斗星通信息科技有限公司 | 基于图像处理的彩色投影平台 |
| CN107371004A (zh) * | 2017-08-23 | 2017-11-21 | 无锡北斗星通信息科技有限公司 | 一种彩色图像投影的方法 |
| CN107742280A (zh) * | 2017-11-02 | 2018-02-27 | 浙江大华技术股份有限公司 | 一种图像锐化方法及装置 |
| CN108038833B (zh) * | 2017-12-28 | 2020-10-13 | 瑞芯微电子股份有限公司 | 一种梯度相关性检测的图像自适应锐化方法和存储介质 |
| JP6813004B2 (ja) * | 2018-06-28 | 2021-01-13 | Jfeスチール株式会社 | 鋼材非圧下部幅検出装置及びその検出方法 |
| CN110136196B (zh) * | 2019-01-30 | 2022-09-20 | 西安电子科技大学 | 一种桥梁裂缝宽度自动测量方法 |
| CN109934785B (zh) * | 2019-03-12 | 2021-03-12 | 湖南国科微电子股份有限公司 | 图像锐化方法及装置 |
| CN110111261B (zh) * | 2019-03-28 | 2021-05-28 | 瑞芯微电子股份有限公司 | 图像的自适应平衡处理方法、电子设备和计算机可读存储介质 |
| CN109978794B (zh) * | 2019-03-29 | 2021-03-23 | 中山爱瑞科技有限公司 | 一种乳腺双能图像的处理方法和系统 |
| CN110246227B (zh) * | 2019-05-21 | 2023-12-29 | 佛山科学技术学院 | 一种虚实融合仿真实验图像数据收集方法及系统 |
| CN110545414B (zh) * | 2019-08-28 | 2022-06-28 | 成都微光集电科技有限公司 | 一种图像锐化方法 |
| CN110636331B (zh) * | 2019-09-26 | 2022-08-09 | 北京百度网讯科技有限公司 | 用于处理视频的方法和装置 |
| CN111028182B (zh) * | 2019-12-24 | 2024-04-26 | 北京金山云网络技术有限公司 | 图像锐化方法、装置、电子设备及计算机可读存储介质 |
| CN113469971B (zh) * | 2021-06-30 | 2023-10-13 | 深圳中科飞测科技股份有限公司 | 一种图像匹配方法及检测装置、存储介质 |
| CN113555117B (zh) * | 2021-07-19 | 2022-04-01 | 江苏金海星导航科技有限公司 | 一种基于穿戴设备的驾驶员健康管理系统 |
| CN114331844B (zh) | 2021-12-28 | 2025-07-11 | Tcl华星光电技术有限公司 | 图像处理方法、装置、服务器及存储介质 |
| CN114782258B (zh) * | 2022-02-24 | 2024-09-06 | 珠海全志科技股份有限公司 | 图像的自适应锐化过冲控制方法及装置 |
| CN114782260B (zh) * | 2022-03-21 | 2025-10-21 | 浙江大华技术股份有限公司 | 图像增强方法、电子设备及计算机可读存储介质 |
| CN114627030B (zh) * | 2022-05-13 | 2022-09-20 | 深圳深知未来智能有限公司 | 一种自适应的图像锐化方法及系统 |
| CN115049564A (zh) * | 2022-08-11 | 2022-09-13 | 广州市保伦电子有限公司 | 一种图片锐化处理方法及处理终端 |
| CN115205162B (zh) * | 2022-08-19 | 2026-04-17 | 广州虎牙信息科技有限公司 | 一种图像处理方法、装置、电子设备及存储介质 |
| CN115439370A (zh) * | 2022-09-29 | 2022-12-06 | 上海哔哩哔哩科技有限公司 | 图像锐化方法及装置 |
| CN116563140B (zh) * | 2023-04-11 | 2026-03-13 | 电视电声研究所(中国电子科技集团公司第三研究所) | 一种基于目标保护的图像增强方法 |
| CN117876402B (zh) * | 2024-03-13 | 2024-05-07 | 中国人民解放军总医院第一医学中心 | 一种用于颞下颌关节紊乱病影像的智能分割方法 |
| CN118097676B (zh) * | 2024-04-24 | 2024-07-09 | 陕西正浩电力科技有限公司 | 基于图像处理的井下工具标签监测系统 |
| CN118628489B (zh) * | 2024-08-12 | 2024-11-05 | 宝鸡新华利机械科技有限公司 | 基于机器视觉的包装盒烙封质量检测方法 |
| CN120726077B (zh) * | 2025-09-04 | 2025-12-16 | 鲁东大学 | 一种用于动态场景下火源检测的图像特征处理方法 |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1892696A (zh) * | 2005-07-08 | 2007-01-10 | 深圳迈瑞生物医疗电子股份有限公司 | 超声图像边缘锐化与斑点抑制方法 |
| US20120093431A1 (en) * | 2010-10-15 | 2012-04-19 | Tessera Technologies Ireland, Ltd. | Image Sharpening Via Gradient Environment Detection |
| CN103489167A (zh) * | 2013-10-21 | 2014-01-01 | 厦门美图网科技有限公司 | 一种图像自动锐化方法 |
| CN104820976A (zh) * | 2015-05-21 | 2015-08-05 | 武汉比天科技有限责任公司 | 一种实时控制激光焊接功率的方法 |
Family Cites Families (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6667815B1 (en) * | 1998-09-30 | 2003-12-23 | Fuji Photo Film Co., Ltd. | Method and apparatus for processing images |
| US7747045B2 (en) * | 2006-06-30 | 2010-06-29 | Fujifilm Corporation | Method and apparatus for diffusion based illumination normalization |
| CN102800063B (zh) * | 2012-07-12 | 2014-10-01 | 中国科学院软件研究所 | 基于各向异性滤波的图像增强与抽象化方法 |
-
2015
- 2015-12-10 CN CN201510918068.2A patent/CN105894459A/zh active Pending
-
2016
- 2016-07-05 WO PCT/CN2016/088692 patent/WO2017096820A1/zh not_active Ceased
- 2016-08-25 US US15/247,576 patent/US20170169551A1/en not_active Abandoned
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1892696A (zh) * | 2005-07-08 | 2007-01-10 | 深圳迈瑞生物医疗电子股份有限公司 | 超声图像边缘锐化与斑点抑制方法 |
| US20120093431A1 (en) * | 2010-10-15 | 2012-04-19 | Tessera Technologies Ireland, Ltd. | Image Sharpening Via Gradient Environment Detection |
| CN103489167A (zh) * | 2013-10-21 | 2014-01-01 | 厦门美图网科技有限公司 | 一种图像自动锐化方法 |
| CN104820976A (zh) * | 2015-05-21 | 2015-08-05 | 武汉比天科技有限责任公司 | 一种实时控制激光焊接功率的方法 |
Non-Patent Citations (1)
| Title |
|---|
| JI, YONGWEI.: "Jilyu2 weilfen1 de shu4zi4tu2xiang4rui4hua4", ELECTRONICS WORLD, 30 June 2014 (2014-06-30), pages 288 * |
Also Published As
| Publication number | Publication date |
|---|---|
| US20170169551A1 (en) | 2017-06-15 |
| CN105894459A (zh) | 2016-08-24 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| WO2017096820A1 (zh) | 基于梯度值及梯度方向的图像锐化方法及装置 | |
| JP6934026B2 (ja) | ビジョンシステムでラインを検出するためのシステム及び方法 | |
| JP4955096B2 (ja) | 検出装置、検出方法、検出プログラム、および記録媒体 | |
| KR102649038B1 (ko) | 비전 시스템으로 이미지에서 라인을 찾기 위한 시스템 및 방법 | |
| US8811751B1 (en) | Method and system for correcting projective distortions with elimination steps on multiple levels | |
| US10909719B2 (en) | Image processing method and apparatus | |
| CN102196112B (zh) | 用于检测页边界的方法和装置 | |
| CN109741287B (zh) | 图像导向滤波方法及装置 | |
| WO2017100971A1 (zh) | 一种失焦模糊图像的去模糊方法和装置 | |
| US9092844B2 (en) | Method and apparatus for correcting corner point of image and image processing device | |
| CN112465707B (zh) | 红外图像条纹噪声的处理方法、装置、介质及电子设备 | |
| CN113487593A (zh) | 一种亚像素边缘检测方法、系统及介质 | |
| CN107368829A (zh) | 确定输入图像中的矩形目标区域的方法和设备 | |
| CN114596210A (zh) | 噪声估计方法、装置、终端设备及计算机可读存储介质 | |
| KR101377910B1 (ko) | 화상 처리 방법 및 화상 처리 장치 | |
| Kapuriya et al. | Detection and restoration of multi-directional motion blurred objects | |
| Dey et al. | e-PCP: A robust skew detection method for scanned document images | |
| US11134170B2 (en) | Correction of feed skewed images | |
| Liu et al. | Novel focus region detection method for multifocus image fusion using quaternion wavelet | |
| CN107862679B (zh) | 图像检测区域的确定方法及装置 | |
| CN101727668A (zh) | 一种图像边界检测的方法及装置 | |
| CN118887118A (zh) | 图像去噪方法和装置、电子设备、计算机可读介质 | |
| CN111435531B (zh) | 一种图像偏转角度检测方法、智能设备及存储介质 | |
| CN112200730A (zh) | 图像滤波处理方法、装置、设备及存储介质 | |
| Chen et al. | Nighttime lane detection and vehicle position determination based on OpenCV |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| 121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 16872023 Country of ref document: EP Kind code of ref document: A1 |
|
| NENP | Non-entry into the national phase |
Ref country code: DE |
|
| 122 | Ep: pct application non-entry in european phase |
Ref document number: 16872023 Country of ref document: EP Kind code of ref document: A1 |





