Image sharpening method, apparatus, device, medium, and program product
Patent Information
- Application Number
- CN202510350328.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-24
- Publication Date
- 2026-09-25
AI Technical Summary
[0003]现有的针对小卷积核如3×3卷积核的图像锐化主要包括提取边缘的锐化和非提取边缘的锐化两种,提取边缘的锐化是利用算法先提取视频图像的边缘,然后再进行锐化处理,存在速度较慢的问题;非提取边缘的锐化是利用3×3内周围的像素点的均值和中心点比较,然后再进行锐化处理,这样存在图像画面模糊的问题
[0021]本公开实施例提供的技术方案与现有技术相比具有如下优点:
Smart Images

Figure CN122820489A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of image processing technology, and in particular to an image sharpening method, apparatus, device, medium, and program product. Background Technology
[0002] Image sharpening refers to the process of enhancing an image's edges and areas of abrupt grayscale changes to compensate for its contours, thereby making the image clearer. It is primarily used to highlight the edges and contours of objects or certain linear target features in an image, increasing the contrast between the edges of ground features and surrounding pixels.
[0003] Existing image sharpening methods for small convolutional kernels, such as 3×3 convolutional kernels, mainly include two types: edge-extracting sharpening and non-edge-extracting sharpening. Edge-extracting sharpening uses algorithms to first extract the edges of the video image and then performs sharpening processing, which has the problem of slow speed. Non-edge-extracting sharpening compares the mean of the surrounding pixels within the 3×3 area with the center point and then performs sharpening processing, which results in image blurring. Summary of the Invention
[0004] To address the aforementioned technical problems, this disclosure provides an image sharpening method, apparatus, device, medium, and program product.
[0005] A first aspect of this disclosure provides an image sharpening method, comprising:
[0006] Obtain the target image. For any non-edge pixel in the target image, construct the neighborhood pixel matrix corresponding to the non-edge pixel. The convolution kernel size of the neighborhood pixel matrix is 3×3.
[0007] Determine the maximum and minimum pixel values in the neighborhood pixel matrix;
[0008] Calculate the contrast amplitude corresponding to non-edge pixels based on the maximum and minimum pixel values;
[0009] The pixel values of non-edge pixels are adjusted based on the contrast amplitude and preset intensity value to obtain the target pixel value corresponding to the adjusted non-edge pixels. The target image is then sharpened based on the target pixel value.
[0010] A second aspect of this disclosure provides an image sharpening apparatus, comprising:
[0011] The matrix construction module is used to acquire the target image. For any non-edge pixel in the target image, it constructs the neighborhood pixel matrix corresponding to the non-edge pixel. The convolution kernel size of the neighborhood pixel matrix is 3×3.
[0012] The pixel value determination module is used to determine the maximum and minimum pixel values in the neighborhood pixel matrix;
[0013] The contrast amplitude calculation module is used to calculate the contrast amplitude corresponding to non-edge pixels based on the maximum and minimum pixel values.
[0014] The sharpening module is used to adjust the pixel values of non-edge pixels based on the contrast amplitude and preset intensity value, to obtain the target pixel value corresponding to the adjusted non-edge pixels, and to sharpen the target image based on the target pixel value.
[0015] A third aspect of this disclosure provides an electronic device, including:
[0016] processor;
[0017] Memory, used to store executable instructions;
[0018] The processor is used to read executable instructions from memory and execute the executable instructions to implement the image sharpening method provided in the first aspect above.
[0019] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, causes the processor to implement the image sharpening method provided in the first aspect.
[0020] A fifth aspect of this disclosure provides a computer program product comprising a computer program or instructions that, when executed by a processor, implement the image sharpening method of the first aspect described above.
[0021] The technical solution provided in this disclosure has the following advantages compared with the prior art:
[0022] The image sharpening method, apparatus, device, medium, and program products provided in this disclosure can acquire a target image, construct a neighborhood pixel matrix corresponding to any non-edge pixel in the target image, with a convolution kernel size of 3×3 for the neighborhood pixel matrix, determine the maximum and minimum pixel values in the neighborhood pixel matrix after obtaining the neighborhood pixel matrix, calculate the contrast amplitude corresponding to the non-edge pixel based on the maximum and minimum pixel values, adjust the pixel value of the non-edge pixel based on the contrast amplitude and a preset intensity value to obtain the target pixel value corresponding to the adjusted non-edge pixel, and perform sharpening processing on the target image based on the target pixel value. Thus, by calculating the pixel value in the neighborhood with a convolution kernel of 3×3 and combining the contrast difference between the pixel and its surrounding neighboring pixels to adjust the pixel value, and then performing image sharpening processing based on the adjusted target pixel value, the image sharpening effect and processing speed are improved. Attached Figure Description
[0023] The accompanying drawings, which are incorporated in and form a part of this specification, illustrate embodiments consistent with this disclosure and, together with the description, serve to explain the principles of this disclosure.
[0024] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0025] Figure 1 This is a flowchart of an image sharpening method provided in an embodiment of this disclosure;
[0026] Figure 2 This is a flowchart of another image sharpening method provided in this embodiment of the disclosure;
[0027] Figure 3 This is a schematic diagram of the structure of an image sharpening device provided in an embodiment of this disclosure;
[0028] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation
[0029] To better understand the above-mentioned objectives, features, and advantages of this disclosure, the solutions disclosed herein will be further described below. It should be noted that, unless otherwise specified, the embodiments and features described herein can be combined with each other.
[0030] Numerous specific details are set forth in the following description in order to provide a full understanding of this disclosure, but this disclosure may also be implemented in other ways different from those described herein; obviously, the embodiments in the specification are only some, and not all, of the embodiments of this disclosure.
[0031] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0032] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0033] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0034] Typically, existing image sharpening methods for small convolutional kernels, such as 3×3 kernels, mainly include two types: edge-extracting sharpening and non-edge-extracting sharpening. Edge-extracting sharpening uses algorithms to first extract the edges of the video image and then performs sharpening processing, which is relatively slow. Non-edge-extracting sharpening compares the mean of the surrounding pixels within the 3×3 area with the center point before sharpening processing, which results in image blurring. To address this issue, this disclosure provides an image sharpening method, which will be described below with reference to specific embodiments.
[0035] Figure 1 This is a flowchart of an image sharpening method provided in an embodiment of the present disclosure. The method can be executed by an image sharpening device, which can be implemented in software and / or hardware. The image sharpening device can be configured in an electronic device, such as a server or terminal, wherein the terminal specifically includes a mobile phone, computer or tablet computer, etc.
[0036] like Figure 1 As shown, the image sharpening method provided in this embodiment can be applied to the sharpening processing of game images during live streaming transcoding to enhance the sharpening effect of game images and thereby improve the player's visual experience. It can also be applied to other application scenarios, which are not limited here. The image sharpening method includes the following steps.
[0037] S110. Obtain the target image. For any non-edge pixel in the target image, construct the neighborhood pixel matrix corresponding to the non-edge pixel. The convolution kernel size of the neighborhood pixel matrix is 3×3.
[0038] In this embodiment of the disclosure, the target image can be understood as any image that needs to be sharpened.
[0039] Non-edge pixels refer to pixels in the target image that are not edge pixels.
[0040] In some embodiments of this disclosure, when an electronic device receives an image sharpening instruction, the image sharpening instruction contains a target image to be sharpened. The image sharpening instruction is parsed to obtain the target image. The image sharpening instruction can be understood as an instruction to instruct the electronic device to perform image sharpening processing.
[0041] In some other embodiments of this disclosure, when the electronic device receives an image sharpening instruction, the image sharpening instruction contains identification information of the target image to be sharpened, and then the image sharpening instruction is parsed, and the target image is obtained from a preset database based on the identification information obtained after parsing.
[0042] Furthermore, after acquiring the target image, the electronic device determines the non-edge pixels and edge pixels in the target image based on the position information of each pixel in the target image. For any non-edge pixel, it determines the other 8 neighboring pixels in its neighborhood based on the position information of the non-edge pixel, and then constructs a neighborhood pixel matrix with the non-edge pixel as the center pixel and the 8 neighboring pixels.
[0043] For example, the neighborhood pixel matrix can be:
[0044]
[0045] Where e is any non-edge pixel, i.e., the center pixel, and a, b, c, d, f, g, h, i are the 8 neighboring pixels around the non-edge pixel.
[0046] S120. Determine the maximum and minimum pixel values in the neighborhood pixel matrix.
[0047] Specifically, after constructing the neighborhood pixel matrix, the electronic device obtains the pixel value of each pixel in the neighboring pixel matrix, and determines the maximum and minimum pixel values in the horizontal, vertical, and diagonal directions respectively based on the size of the pixel value and the relationship between the pixel and non-edge pixels.
[0048] S130. Calculate the contrast amplitude corresponding to non-edge pixels based on the maximum and minimum pixel values.
[0049] In this embodiment of the disclosure, the contrast amplitude is used to characterize the difference in brightness change corresponding to non-edge pixels.
[0050] Specifically, after determining the maximum and minimum pixel values, the electronic device acquires the target bit position, determines the preset maximum pixel value based on the relationship between the bit position and the pixel, and calculates the contrast amplitude corresponding to the non-edge pixel based on the maximum and minimum pixel values and the preset maximum pixel value. The target bit position can be 8 bits, 10 bits, etc.
[0051] S140. Adjust the pixel values of non-edge pixels based on contrast amplitude and preset intensity value to obtain the target pixel values corresponding to the adjusted non-edge pixels, and sharpen the target image based on the target pixel values.
[0052] In this embodiment, the preset intensity value is a pre-configured value used to characterize the brightness attribute of a pixel. It can be set according to the actual usage scenario and user needs, and is not limited herein.
[0053] Specifically, after determining the contrast amplitude corresponding to a non-edge pixel, the electronic device acquires a preset intensity value. Based on the preset intensity value and the contrast amplitude, it calculates the weight corresponding to the non-edge pixel. The weight can be understood as the influence of neighboring pixels on the non-edge pixel; the larger the weight, the greater the influence. Then, based on the weight and the pixel values of neighboring pixels, the pixel values of the non-edge pixels are adjusted to obtain the target pixel value corresponding to the adjusted non-edge pixel. The target image is then sharpened based on the target pixel. The specific sharpening process is similar to existing sharpening implementations and will not be elaborated upon here.
[0054] In this embodiment, a target image can be acquired. For any non-edge pixel in the target image, a neighborhood pixel matrix corresponding to the non-edge pixel is constructed. The convolution kernel size of the neighborhood pixel matrix is 3×3. After obtaining the neighborhood pixel matrix, the maximum and minimum pixel values in the neighborhood pixel matrix are determined. The contrast amplitude corresponding to the non-edge pixel is calculated based on the maximum and minimum pixel values. Then, the pixel value of the non-edge pixel is adjusted based on the contrast amplitude and a preset intensity value to obtain the target pixel value corresponding to the adjusted non-edge pixel. The target image is then sharpened based on the target pixel value. Thus, by calculating the pixel value in the neighborhood with a convolution kernel of 3×3 and combining the contrast difference between the pixel and its surrounding neighboring pixels, the pixel value of the pixel is adjusted. Then, the image is sharpened based on the adjusted target pixel value, which improves the image sharpening effect and processing speed.
[0055] Based on the above embodiments of this disclosure, for edge pixels, zero-padding can be performed on the positions in the neighboring pixel matrix corresponding to the edge pixel that have no neighboring pixels. Alternatively, the processing can be performed using a 2×2 matrix or a 2×3 matrix, depending on the specific position of the edge pixel and the number of neighboring pixels. The processing method is similar to the implementation method using a 3×3 matrix in the above embodiments of this disclosure, and will not be described in detail here. Since edge pixels have little impact on the human eye and the human eye does not pay much attention to edge pixels, the adjustment of the pixel value of the edge pixels can also be ignored.
[0056] In this embodiment of the disclosure, determining the maximum and minimum pixel values in the neighborhood pixel matrix may specifically include: obtaining multiple first pixel points corresponding to non-edge pixel points in the horizontal and vertical directions, and multiple second pixel points corresponding to non-edge pixel points in the neighborhood pixel matrix; determining the first minimum pixel value and the first maximum pixel value among the pixel values corresponding to the multiple first pixel points, and the second minimum pixel value and the second maximum pixel value among the pixel values corresponding to the multiple second pixel points; determining the first minimum pixel value and the second minimum pixel value as the minimum pixel value, and determining the first maximum pixel value and the second maximum pixel value as the maximum pixel value.
[0057] Taking the neighborhood pixel matrix in the example above as an example, the multiple first pixels in the horizontal and vertical directions are pixels b, d, e, f, and h, and the multiple second pixels in the diagonal direction are pixels a, c, e, g, and i. For the horizontal and vertical directions, the minimum and maximum pixel values corresponding to pixels b, d, e, f, and h are determined and respectively defined as the first minimum pixel value min1 and the first maximum pixel value max1. Similarly, for the diagonal direction, the minimum and maximum pixel values corresponding to pixels a, c, e, g, and i are determined and respectively defined as the second minimum pixel value min2 and the second maximum pixel value max2.
[0058] Furthermore, calculating the contrast amplitude corresponding to non-edge pixels based on the maximum and minimum pixel values can specifically include: calculating the sum of the first minimum pixel value and the second minimum pixel value to obtain a first value; calculating the sum of the first maximum pixel value and the second maximum pixel value to obtain a second value; obtaining a preset maximum pixel value; and determining the ratio of the difference between the second value and the first value to the preset maximum pixel value as the contrast amplitude.
[0059] Specifically, the sum of min1 and min2, min, is determined as the first value, and the sum of max1 and max2, max, is determined as the second value; the ratio obtained by dividing the difference between max and min by the preset maximum pixel value is determined as the contrast amplitude corresponding to the non-edge pixel.
[0060] In this embodiment of the disclosure, dividing by a preset maximum pixel value can be understood as performing normalization processing.
[0061] In this embodiment, not only can the information of adjacent pixels in the horizontal and vertical directions be fully utilized, but the influence of pixels in the diagonal direction on the sharpness of the center pixel, i.e., non-edge pixels, is also considered, ensuring the comprehensiveness and accuracy of the sharpening effect.
[0062] In this embodiment of the disclosure, the pixel value of non-edge pixels is adjusted based on the contrast amplitude and a preset intensity value to obtain the target pixel value corresponding to the adjusted non-edge pixels. Specifically, this may include: determining the weight corresponding to the non-edge pixels based on the contrast amplitude and the preset intensity value; and calculating the target pixel value based on the weight and a preset pixel value calculation formula.
[0063] Specifically, determining the weights of non-edge pixels based on contrast amplitude and preset intensity value can include: determining the weights of non-edge pixels by multiplying the contrast amplitude by the preset intensity value.
[0064] The target pixel value is calculated based on the weights and a preset pixel value calculation formula, including: obtaining the pixel values corresponding to multiple first pixel points in the horizontal and vertical directions of non-edge pixel points in the neighborhood pixel matrix; and substituting the weights and the pixel values corresponding to the multiple first pixel points into the preset pixel value calculation formula to calculate the target pixel value.
[0065] The preset formula for calculating pixel values is as follows:
[0066]
[0067] Wherein, new_value is the adjusted target pixel value of the non-edge pixel; b, d, f, and h are the pixel values of the corresponding pixels b, d, f, and h in the horizontal and vertical directions (above, below, left, and right) of the non-edge pixel (i.e., the center pixel); weight is the weight corresponding to the non-edge pixel; e is the initial pixel value of the non-edge pixel; 4.0·weight+1.0 is used as the denominator to normalize the weight, ensuring that the adjusted target pixel value is within a reasonable range.
[0068] In this embodiment of the disclosure, when calculating the target pixel value, the pixels closest to the edge pixels in the neighborhood pixel matrix are considered, namely the pixels in the horizontal and vertical directions, which reduces the amount of calculation while ensuring the sharpening effect.
[0069] In practical applications, such as game live streaming, when using a preset intensity value like 0.5 for light sharpening, the measured video quality assessment value is improved to around 95, which is a significant effect.
[0070] Figure 2 This is a flowchart of another image sharpening method provided in this disclosure embodiment, such as... Figure 2 As shown, this image sharpening method may include the following steps:
[0071] S210. Obtain the target image. For any non-edge pixel in the target image, construct the neighborhood pixel matrix corresponding to the non-edge pixel. The convolution kernel size of the neighborhood pixel matrix is 3×3.
[0072] S220. Obtain multiple first pixel points corresponding to non-edge pixel points in the horizontal and vertical directions, and multiple second pixel points corresponding to non-edge pixel points in the neighborhood pixel matrix; determine the first minimum pixel value and the first maximum pixel value among the pixel values corresponding to the multiple first pixel points, and the second minimum pixel value and the second maximum pixel value among the pixel values corresponding to the multiple second pixel points.
[0073] S230. Calculate the sum of the first minimum pixel value and the second minimum pixel value to obtain the first value. Calculate the sum of the first maximum pixel value and the second maximum pixel value to obtain the second value.
[0074] S240. Obtain the preset maximum pixel value; determine the ratio of the difference between the second value and the first value to the preset maximum pixel value as the contrast amplitude.
[0075] S250, The product of the contrast amplitude and the preset intensity value is determined as the weight corresponding to the non-edge pixel.
[0076] S260. Substitute the weights and the pixel values corresponding to the multiple first pixel points into the preset pixel value calculation formula to calculate the target pixel value, and then sharpen the target image based on the target pixel value.
[0077] It should be noted that the specific implementation of steps S210-S260 is similar to the implementation of the relevant steps in the above embodiments of this disclosure, and will not be repeated here.
[0078] In this embodiment, by calculating the pixel values within a 3×3 neighborhood of the convolution kernel, the contrast amplitude calculation process not only fully utilizes the information of adjacent pixels in the horizontal and vertical directions but also considers the influence of diagonal pixels on the sharpness of the center pixel (i.e., non-edge pixels), ensuring the comprehensiveness and accuracy of the sharpening effect. Furthermore, during pixel value adjustment, the adjustment is based on the pixels closest to the edge pixels in the neighborhood pixel matrix (i.e., pixels in the horizontal and vertical directions), reducing computational load and thus improving the image sharpening processing speed.
[0079] Figure 3 This is a schematic diagram of the structure of an image sharpening device provided in an embodiment of this disclosure.
[0080] In this embodiment, the image sharpening device can be disposed within an electronic device and is understood as a functional module within the aforementioned electronic device. Specifically, the electronic device can be a server or a terminal, wherein the terminal specifically includes mobile phones, computers, or tablet computers, etc., without limitation.
[0081] like Figure 3 As shown, the image sharpening device 300 may include a matrix construction module 310, a pixel value determination module 320, a contrast amplitude calculation module 330, and a sharpening processing module 340.
[0082] The matrix construction module 310 can be used to acquire a target image and, for any non-edge pixel in the target image, construct a neighborhood pixel matrix corresponding to the non-edge pixel. The convolution kernel size of the neighborhood pixel matrix is 3×3.
[0083] The pixel value determination module 320 can be used to determine the maximum and minimum pixel values in the neighborhood pixel matrix.
[0084] The contrast amplitude calculation module 330 can be used to calculate the contrast amplitude corresponding to non-edge pixels based on the maximum and minimum pixel values.
[0085] The sharpening module 340 can be used to adjust the pixel values of non-edge pixels based on the contrast amplitude and preset intensity value, obtain the target pixel value corresponding to the adjusted non-edge pixels, and perform sharpening processing on the target image based on the target pixel value.
[0086] In this embodiment, a target image can be acquired. For any non-edge pixel in the target image, a neighborhood pixel matrix corresponding to the non-edge pixel is constructed. The convolution kernel size of the neighborhood pixel matrix is 3×3. After obtaining the neighborhood pixel matrix, the maximum and minimum pixel values in the neighborhood pixel matrix are determined. The contrast amplitude corresponding to the non-edge pixel is calculated based on the maximum and minimum pixel values. Then, the pixel value of the non-edge pixel is adjusted based on the contrast amplitude and a preset intensity value to obtain the target pixel value corresponding to the adjusted non-edge pixel. The target image is then sharpened based on the target pixel value. Thus, by calculating the pixel value in the neighborhood with a convolution kernel of 3×3 and combining the contrast difference between the pixel and its surrounding neighboring pixels, the pixel value of the pixel is adjusted. Then, the image is sharpened based on the adjusted target pixel value, which improves the image sharpening effect and processing speed.
[0087] In some embodiments of this disclosure, the pixel value determination module 320 can be specifically used to obtain multiple first pixel points corresponding to non-edge pixel points in the horizontal and vertical directions, and multiple second pixel points corresponding to non-edge pixel points in the neighborhood pixel matrix in the diagonal direction.
[0088] Determine the first minimum pixel value and the first maximum pixel value among the pixel values corresponding to multiple first pixel points, and the second minimum pixel value and the second maximum pixel value among the pixel values corresponding to multiple second pixel points;
[0089] The first minimum pixel value and the second minimum pixel value are determined as minimum pixel values, and the first maximum pixel value and the second maximum pixel value are determined as maximum pixel values.
[0090] In some embodiments of this disclosure, the contrast amplitude calculation module 330 can be specifically used to calculate the sum of the first minimum pixel value and the second minimum pixel value to obtain a first value, and to calculate the sum of the first maximum pixel value and the second maximum pixel value to obtain a second value;
[0091] Get the preset maximum pixel value;
[0092] The ratio of the difference between the second value and the first value to the preset maximum pixel value is determined as the contrast amplitude.
[0093] In some embodiments of this disclosure, the sharpening module 340 can be specifically used to determine the weights corresponding to non-edge pixels based on the contrast amplitude and a preset intensity value;
[0094] The target pixel value is calculated based on the weights and a preset pixel value calculation formula.
[0095] In some embodiments of this disclosure, the sharpening module 340 may also be specifically used to determine the weight corresponding to non-edge pixels by multiplying the contrast amplitude by a preset intensity value.
[0096] In some embodiments of this disclosure, the sharpening module 340 may also be specifically used to obtain the pixel values corresponding to multiple first pixel points in the horizontal and vertical directions of non-edge pixel points in the neighborhood pixel matrix.
[0097] The target pixel value is obtained by substituting the weight and the pixel values corresponding to the multiple first pixel points into the preset pixel value calculation formula.
[0098] It should be noted that, Figure 3 The image sharpening device 300 shown can perform the various steps in the above method embodiments and achieve the various processes and effects in the above method embodiments, which will not be elaborated here.
[0099] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure.
[0100] In this embodiment of the disclosure, Figure 4 The electronic devices shown can be servers or terminals, and terminals specifically include mobile phones, computers, or tablets, etc., without limitation.
[0101] like Figure 4 As shown, the electronic device may include a processor 410 and a memory 420 storing computer program instructions.
[0102] Specifically, the processor 410 may include a central processing unit (CPU), an application specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this disclosure.
[0103] Memory 420 may include mass storage for information or instructions. For example, and not limitingly, memory 420 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 420 may include removable or non-removable (or fixed) media. Where appropriate, memory 420 may be internal or external to the integrated gateway device. In a particular embodiment, memory 420 is non-volatile solid-state memory. In a particular embodiment, memory 420 includes read-only memory (ROM). Where appropriate, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (Electrically Programmable ROM, EPROM), an electrically erasable programmable PROM (EEPROM), an electrically alterable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0104] The processor 410 reads and executes computer program instructions stored in the memory 420 to perform the steps of the image sharpening method provided in the embodiments of this disclosure.
[0105] In one example, the electronic device may also include a transceiver 430 and a bus 440. Wherein, as... Figure 4 As shown, the processor 410, memory 420 and transceiver 430 are connected via bus 440 and communicate with each other.
[0106] Bus 440 may include hardware, software, or both. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Extended Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a Hyper Transport (HT) interconnect, an Industrial Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a MicroChannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local Bus (VLB) bus, or other suitable buses, or a combination of two or more of these. Where appropriate, bus 440 may include one or more buses.
[0107] This disclosure also provides a computer-readable storage medium that can store a computer program that, when executed by a processor, causes the processor to implement the image sharpening method provided in this disclosure.
[0108] The aforementioned storage medium may, for example, include a memory 420 containing computer program instructions, which can be executed by a processor 410 of an electronic device to perform the image sharpening method provided in the embodiments of this disclosure. Optionally, the storage medium may be a non-transitory computer-readable storage medium, such as a ROM, random access memory (RAM), compact disc-only memory (CD-ROM), magnetic tape, floppy disk, and optical data storage device.
[0109] This disclosure also provides a computer program product, which includes a computer program or instructions. When the computer program or instructions are executed by a processor, they implement the image sharpening method provided in this disclosure and can achieve the various processes and effects described in the above embodiments of this disclosure, which will not be elaborated here.
[0110] The above description is merely a specific embodiment of this disclosure, enabling those skilled in the art to understand or implement it. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this disclosure. Therefore, this disclosure is not to be limited to the embodiments described herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. An image sharpening method, characterized in that, include: Obtain the target image, and for any non-edge pixel in the target image, construct the neighborhood pixel matrix corresponding to the non-edge pixel, wherein the convolution kernel size of the neighborhood pixel matrix is 3×3; Determine the maximum and minimum pixel values in the neighborhood pixel matrix; Calculate the contrast amplitude corresponding to the non-edge pixel based on the maximum pixel value and the minimum pixel value; The pixel values of the non-edge pixels are adjusted based on the contrast amplitude and the preset intensity value to obtain the target pixel values corresponding to the non-edge pixels after adjustment. The target image is then sharpened based on the target pixel values.
2. The method according to claim 1, characterized in that, Determining the maximum and minimum pixel values in the neighborhood pixel matrix includes: Obtain multiple first pixels corresponding to the non-edge pixels in the neighborhood pixel matrix in the horizontal and vertical directions, and multiple second pixels corresponding to the non-edge pixels in the diagonal direction; Determine the first minimum pixel value and the first maximum pixel value among the pixel values corresponding to the plurality of first pixels, and the second minimum pixel value and the second maximum pixel value among the pixel values corresponding to the plurality of second pixels; The first minimum pixel value and the second minimum pixel value are determined as the minimum pixel value, and the first maximum pixel value and the second maximum pixel value are determined as the maximum pixel value.
3. The method according to claim 2, characterized in that, The step of calculating the contrast amplitude corresponding to the non-edge pixel based on the maximum pixel value and the minimum pixel value includes: Calculate the sum of the first minimum pixel value and the second minimum pixel value to obtain a first value; calculate the sum of the first maximum pixel value and the second maximum pixel value to obtain a second value. Get the preset maximum pixel value; The ratio of the difference between the second value and the first value to the preset maximum pixel value is determined as the contrast amplitude.
4. The method according to claim 1, characterized in that, The step of adjusting the pixel values of the non-edge pixels based on the contrast amplitude and a preset intensity value to obtain the adjusted target pixel values corresponding to the non-edge pixels includes: The weights corresponding to the non-edge pixels are determined based on the contrast amplitude and the preset intensity value. The target pixel value is calculated based on the weight and the preset pixel value calculation formula.
5. The method according to claim 4, characterized in that, The step of determining the weight corresponding to the non-edge pixel based on the contrast amplitude and the preset intensity value includes: The product of the contrast amplitude and the preset intensity value is determined as the weight corresponding to the non-edge pixel.
6. The method according to claim 4, characterized in that, The calculation of the target pixel value based on the weight and a preset pixel value calculation formula includes: Obtain the pixel values corresponding to multiple first pixels in the horizontal and vertical directions of the non-edge pixel points in the neighborhood pixel matrix; The target pixel value is obtained by substituting the weight and the pixel values corresponding to the plurality of first pixel points into the preset pixel value calculation formula.
7. An image sharpening device, characterized in that, include: The matrix construction module is used to acquire the target image and, for any non-edge pixel in the target image, construct the neighborhood pixel matrix corresponding to the non-edge pixel, wherein the convolution kernel size of the neighborhood pixel matrix is 3×3. A pixel value determination module is used to determine the maximum and minimum pixel values in the neighborhood pixel matrix; A contrast amplitude calculation module is used to calculate the contrast amplitude corresponding to the non-edge pixel based on the maximum pixel value and the minimum pixel value; The sharpening module is used to adjust the pixel values of the non-edge pixels based on the contrast amplitude and a preset intensity value, to obtain the target pixel values corresponding to the adjusted non-edge pixels, and to perform sharpening processing on the target image based on the target pixel values.
8. An electronic device, characterized in that, include: processor; Memory, used to store executable instructions; The processor is configured to read the executable instructions from the memory and execute the executable instructions to implement the image sharpening method according to any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program that, when executed by a processor, causes the processor to implement the image sharpening method according to any one of claims 1-6.
10. A computer program product, the computer program product comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by the processor, they implement the image sharpening method as described in any one of claims 1-6.