An image processing method, apparatus, device, and storage medium
Image fusion technology, which combines edge extraction and blurring, solves the problem of jagged edges in electronic device images, improves image quality, alleviates resource constraints, and enhances user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-27
- Publication Date
- 2026-03-13
AI Technical Summary
The jagged edges in the images output by electronic devices affect the image quality, especially after keystone correction on projectors, which exacerbates the jagged edges and leads to a decline in the user's viewing experience.
By acquiring the image to be processed, edge extraction is performed to obtain pixel gradients, and the image to be processed and the blurred image are fused based on the pixel gradients to reduce the jagged effect and improve image quality.
To a certain extent, it reduces image jaggedness, improves image quality, alleviates GPU resource strain on the projector, and avoids screen stuttering.
Smart Images

Figure CN117197167B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to an image processing method, apparatus, device and storage medium. Background Technology
[0002] Anti-aliasing, also known as anti-aliasing or anti-image folding loss, is a technique to eliminate jagged edges in images output by electronic devices.
[0003] For example, when an electronic device displays images, if the image has jagged edges, it will affect the image quality and consequently the user's viewing experience. Taking a projection device as an example, after keystone correction, the lines of the original image are stretched, resulting in jagged edges in the corrected image. Moreover, these jagged edges increase with the degree of keystone correction, severely impacting the user's viewing experience.
[0004] Therefore, it is necessary to perform anti-aliasing on the image before playing a certain scene in order to reduce the jagged edges produced by the image and improve the image quality.
[0005] Application content
[0006] This application provides an image processing method, apparatus, device, and storage medium that can reduce jagged edges in images and improve image quality.
[0007] In a first aspect, embodiments of this application provide an image processing method, including:
[0008] Obtain the image to be processed;
[0009] Edge extraction is performed on the image to be processed to obtain the first pixel gradient of the image to be processed.
[0010] Based on the first pixel gradient, the image to be processed and the first image are fused to obtain the first target image. The first image is an image obtained by blurring the image to be processed according to a preset method.
[0011] Secondly, embodiments of this application provide an image processing apparatus, including:
[0012] The acquisition module is used to acquire the image to be processed;
[0013] The edge extraction module is used to extract edges based on the image to be processed, and obtain the first pixel gradient of the image to be processed.
[0014] The fusion module is used to fuse the image to be processed and the first image according to the first pixel gradient to obtain the first target image. The first image is an image obtained by blurring the image to be processed according to a preset method.
[0015] Thirdly, embodiments of this application provide an electronic device, including:
[0016] processor;
[0017] Memory is used to store computer program instructions;
[0018] When computer program instructions are executed by the processor, the method described in the first aspect is implemented.
[0019] Fourthly, embodiments of this application provide a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implement the method described in the first aspect.
[0020] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform the method described in the first aspect.
[0021] In this embodiment, an image to be processed is acquired; edge extraction is performed on the image to be processed to obtain a first pixel gradient corresponding to the image to be processed; and the image to be processed and a first image are fused according to the first pixel gradient to obtain a first target image. The first image is obtained by blurring the image to be processed according to a preset method. That is, this embodiment determines the pixel gradient of the image to be processed and then fuses the image to be processed and the blurred image to be processed according to the pixel gradient. This can weaken the jagged edges generated by the image to be processed to a certain extent, achieving an anti-aliasing effect and thus improving image quality. Attached Figure Description
[0022] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 A flowchart illustrating an image processing method provided in an embodiment of this application;
[0024] Figure 2 This is a schematic diagram of a preset neural network structure provided in an embodiment of this application;
[0025] Figure 3 A structural diagram of an image processing apparatus provided in an embodiment of this application;
[0026] Figure 4 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0027] The features and exemplary embodiments of various aspects of this application will now be described in detail. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only configured to explain this application and are not configured to limit this application. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples of this application.
[0028] 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..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.
[0029] As mentioned above, some images output by electronic devices may have jagged edges for various reasons, resulting in a poor image quality experience for users.
[0030] Therefore, embodiments of this application provide an image processing method, apparatus, device, and storage medium that can reduce jagged edges in images to a certain extent and improve image quality.
[0031] Figure 1 The flowchart illustrates an image processing method provided in this application embodiment. This method can be applied to electronic devices with image processing capabilities. For example, the electronic device may be a projection device, a tablet computer, a laptop computer, etc.
[0032] like Figure 1 As shown, the image processing method may include the following steps:
[0033] S110. Obtain the image to be processed.
[0034] S120. Based on the image to be processed, perform edge extraction to obtain the first pixel gradient corresponding to the image to be processed.
[0035] S130. Based on the first pixel gradient, fuse the image to be processed and the first image to obtain the first target image.
[0036] The first image is obtained by blurring the image to be processed according to a preset method.
[0037] In this embodiment, an image to be processed is acquired; edge extraction is performed on the image to be processed to obtain a first pixel gradient corresponding to the image to be processed; and the image to be processed and a first image are fused according to the first pixel gradient to obtain a first target image. The first image is obtained by blurring the image to be processed according to a preset method. That is, this embodiment determines the pixel gradient of the image to be processed and then fuses the image to be processed and the blurred image to be processed according to the pixel gradient. This can weaken the jagged edges generated by the image to be processed to a certain extent, achieving an anti-aliasing effect and thus improving image quality.
[0038] The above steps are explained in detail below:
[0039] In S110, the image to be processed is the image without anti-aliasing processing, that is, an image containing jagged edges. For example, when the electronic device is a projection device, the image to be processed can be the image after keystone correction by the projection device. For example, the size of the image to be processed is 1920*1080*3.
[0040] In S120, the first pixel gradient is the gradient of the pixel in the image to be processed. For example, edge extraction can be performed based on the image to be processed to obtain the second pixel gradient corresponding to the image to be processed; the second pixel gradient is normalized to obtain the first pixel gradient corresponding to the image to be processed.
[0041] In practical applications, the second pixel gradient may be greater than 1. If the second pixel gradient is directly used for subsequent image fusion processes, the fused image may not be able to be displayed. To avoid this phenomenon, in this embodiment, after obtaining the second pixel gradient based on edge extraction, the second pixel gradient is normalized, and the normalized result is used as the pixel gradient corresponding to the image to be processed, that is, the first pixel gradient.
[0042] The embodiments of this application do not limit the method of determining the second pixel gradient. For example, the second pixel gradient can be obtained by edge extraction of the image to be processed using conventional image processing methods.
[0043] For example, the image to be processed can be processed into a grayscale image to obtain the grayscale image of the image to be processed; edge extraction can be performed on the grayscale image to obtain the second pixel gradient corresponding to the image to be processed.
[0044] Grayscale processing is a technique that converts an image to grayscale, which means unifying the RGB values of each pixel in the image to the same value. After grayscale processing, the image changes from three channels to a single channel, thus simplifying the subsequent image processing.
[0045] The embodiments of this application do not limit the specific method of grayscale processing. For example, the maximum value method, the average value method, or the weighted average method can be used.
[0046] After obtaining the grayscale image, edge extraction operators can be used to extract edges from the grayscale image to obtain the second pixel gradient corresponding to the image to be processed. These edge extraction operators can include, but are not limited to, first-order and second-order operators. First-order operators can include, but are not limited to, the Roberts operator, Sobel operator, Prewitt operator, Kirsch operator, and Robinson operator. Second-order operators can include, but are not limited to, the Laplacian operator, the Canny operator, and the Marr-Hildreth operator.
[0047] Taking the Sobel operator as an example, the gradient of the second pixel can be obtained in the following way:
[0048] Second pixel gradient in, and These are the Sobel operators in the horizontal and vertical directions, respectively, and A is a grayscale image.
[0049] In this embodiment, the image to be processed is subjected to grayscale processing to obtain a grayscale image, and then the grayscale image is subjected to edge extraction to obtain the second pixel gradient. This method is not only simple to operate but also easy to implement, providing a basis for subsequent anti-aliasing processing.
[0050] In some embodiments, the above image processing method can be applied to an electronic device, which includes an embedded neural network processing unit (NPU). Based on this, in some embodiments, a neural network can also be used to extract edges from the image to be processed to obtain a second pixel gradient.
[0051] For example, the above-mentioned edge extraction based on the image to be processed to obtain the second pixel gradient corresponding to the image to be processed may include the following steps:
[0052] Edge extraction of the image to be processed is performed by a preset neural network to obtain the second pixel gradient of the image to be processed. The preset neural network is integrated into the embedded neural network processor.
[0053] A pre-built neural network is a pre-constructed network capable of extracting image features. For example, refer to... Figure 2 The preset neural network may include an input module, a first convolution module, a second convolution module, a third convolution module, a fourth convolution module, and an output module, wherein the input module is used to input the image to be processed.
[0054] The first convolution module and the second convolution module are respectively used to determine the pixel gradient of the image to be processed in a preset direction. For example, in the embodiments of this application, the first convolution module can be used to determine the pixel gradient of the image to be processed in the horizontal direction, and the second convolution module can be used to determine the pixel gradient of the image to be processed in the vertical direction.
[0055] The convolution kernels of the first and second convolutional modules can be set according to actual needs. For example, the convolution kernels of both the first and second convolutional modules can be 3*3 matrices. For instance, the convolution kernel of the first convolutional module can be... The convolution kernel of the second convolution module can be By convolving the image to be processed with the above convolution kernels, the pixel gradients of the image to be processed in different directions can be obtained.
[0056] The third convolutional module blurs the image to be processed for subsequent image processing. The fourth convolutional module smooths the outputs of the first and second convolutional modules. For example, the third and fourth convolutional modules can be Gaussian convolutional modules, with the kernel window size initialized to 3x3. The weights of each convolutional module can be initialized to 0.9.
[0057] The output module is used to output the anti-aliased image of the image to be processed, which is also the first target image.
[0058] Taking a projector as an example, this projector includes an NPU. Because the graphics processing unit (GPU) of a projector has limited resources such as computing power and bandwidth, when a user is playing a video or an application has many drawing elements, the already limited resources can become even more strained, potentially causing system lag. Furthermore, improving image quality (i.e., anti-aliasing) often requires a significant amount of image processing operations, which means that under resource constraints, the potential for image quality improvement is also relatively limited.
[0059] The embodiments of this application utilize the convolutional neural network algorithm built into the hardware architecture (NPU) of the projector to perform anti-aliasing processing on the image to be processed. This not only achieves the anti-aliasing effect but also frees up some GPU resources, thereby alleviating the GPU strain on the projector and even preventing stuttering during playback.
[0060] To avoid the occurrence of tortuosity in the subsequently obtained anti-aliased image (i.e., the first target image), in some embodiments, after obtaining the first pixel gradient, the first pixel gradient can also be smoothed. The embodiments of this application do not limit the method of smoothing.
[0061] For example, the gradient of the first pixel can be smoothed using methods such as Gaussian blur kernel, median filtering, or mean filtering.
[0062] Taking the Gaussian blur kernel as an example, the smoothed gradient of the first pixel grad'(x,y) is: grad(x-1,y-1)*gkernel(0,0)+grad(x,y-1)*gkernel(1,0)+grad(x+1,y-1)*gkernel(2,0)+grad(x-1,y)*gkernel(0,1)+grad(x,y)*gkernel(1,1)+grad(x+1,y)*gkernel(2,1)+grad(x-1,y+1)*gkernel(0,2)+gra d(x,y+1)*gkernel(1,2)+grad(x+1,y+1)*gkernel(2,2) represents the first pixel gradient of each pixel and the first pixel gradients of its eight neighboring pixels. These are multiplied by gkernel and summed to obtain the smoothed first pixel gradient of each pixel. Here, gkernel is a Gaussian blur kernel. In this embodiment, a k*k (k is usually 3) Gaussian blur kernel with σ = 0.9 is used as an example. gkernel is a 3*3 matrix, and the values at each position in the matrix can be calculated from k and σ. This embodiment does not limit the specific calculation process.
[0063] grad(x-1,y-1), grad(x,y-1), grad(x+1,y-1), grad(x-1,y), grad(x+1,y), grad(x-1,y+1), grad(x,y+1), and grad(x+1,y+1) are the gradients of the first pixel corresponding to the 8 neighboring pixels of pixel (x,y). (0,0), (2,0), (0,1), (1,1), (2,1), (0,2), (1,2), and (2,2) are the values at each position in the Gaussian blur kernel gkernel.
[0064] In S130, the first image is an image obtained by blurring the image to be processed according to a preset method. The preset method can be a way to blur the image to be processed. By blurring the image to be processed, the jaggedness of the image to be processed can be weakened, and the image processing effect can be improved.
[0065] For example, the image to be processed can be blurred using a Gaussian blur kernel, a Gaussian convolution module, etc., to obtain the first image. Here, the Gaussian blur kernel can be a k*k (k is usually 3) Gaussian blur kernel with σ = 0.9, and the processing is similar to the smoothing process of the first pixel gradient; the Gaussian convolution module can be... Figure 2 The fourth convolution module in it.
[0066] Based on the first pixel gradient, the image to be processed and the blurred image to be processed (i.e., the first image) are fused to obtain the first target image. Compared with the image to be processed, the jagged edges of the first target image are reduced, and the user's image quality experience is effectively improved.
[0067] For example, S130 above may include the following steps:
[0068] The first image to be fused is determined based on the first pixel gradient and the first image;
[0069] The second image to be fused is determined based on the third pixel gradient and the image to be processed. The third pixel gradient is determined based on the first pixel gradient.
[0070] The first image to be fused and the second image to be fused are fused to obtain the first target image.
[0071] For example, the product of the first pixel gradient and the first image can be used as the first image to be fused, and the product of the third pixel gradient and the image to be processed can be used as the second image to be fused. The third pixel gradient can be determined based on the first pixel gradient. For example, the third pixel gradient = 1 - the first pixel gradient.
[0072] By fusing the first image to be fused and the second image to be fused, the anti-aliased image, also known as the first target image, can be obtained. For example, the first target image can be obtained through the following relationship:
[0073] MergeImg(x,y)=M1(x,y)+M2(x,y)
[0074] Where MergeImg(x,y) is the first target image, M1(x,y) is the first image to be fused, M1(x,y)=grad(x,y)*G(x,y), grad(x,y) is the first pixel gradient, G(x,y) is the first image, M2(x,y) is the second image to be fused, M2(x,y)=grad1(x,y)*O(x,y), grad1(x,y) is the third pixel gradient, grad1(x,y)=1-grad(x,y), and O(x,y) is the image to be processed.
[0075] In some embodiments, in order to improve the image processing effect, the first pixel gradient can also be the smoothed first pixel gradient mentioned above, i.e., grad'(x,y), and the third pixel gradient also needs to be adaptively adjusted.
[0076] In practical applications, considering that the anti-aliased image (first target image) obtained through the above operations may be blurry, in order to improve the clarity of the anti-aliased image, in some embodiments, the image processing method may further include the following steps after S130:
[0077] The first target image is sharpened to obtain the second target image;
[0078] Based on the gradient of the first pixel, the second target image and the first target image are fused to obtain the third target image.
[0079] Sharpening can compensate for image sharpness to some extent, making the second target image sharper than the first target image, thus improving the image processing effect. By further fusing the second and first target images, the goal of individually sharpening the different areas of sharpness can be achieved.
[0080] For example, FinalImg(x,y) = grad(x,y)*sharpenImg(x,y) + [1-grad(x,y)]*MergeImg(x,y), where sharpenImg(x,y) is the second target image and FinalImg(x,y) is the third target image. In practical applications, grad(x,y) can also be replaced with the smoothed result, i.e., grad'(x,y).
[0081] The embodiments of this application fuse the image to be processed and the blurred image to be processed according to the gradient ratio, which reduces the jagged edges in the image to be processed to a certain extent, achieves the effect of anti-aliasing, and improves the user's image quality experience.
[0082] Based on the same inventive concept, this application also provides an image processing apparatus, which is described below in conjunction with... Figure 3 The image processing apparatus provided in the embodiments of this application will be described in detail.
[0083] Figure 3 This is a structural diagram of an image processing apparatus provided in an embodiment of this application.
[0084] like Figure 3 As shown, the image processing apparatus may include:
[0085] The acquisition module 310 is used to acquire the image to be processed;
[0086] The edge extraction module 320 is used to perform edge extraction based on the image to be processed, and obtain the first pixel gradient corresponding to the image to be processed.
[0087] The fusion module 330 is used to fuse the image to be processed and the first image according to the first pixel gradient to obtain the first target image. The first image is an image obtained by blurring the image to be processed according to a preset method.
[0088] In this embodiment, an image to be processed is acquired; edge extraction is performed on the image to be processed to obtain a first pixel gradient corresponding to the image to be processed; and the image to be processed and a first image are fused according to the first pixel gradient to obtain a first target image. The first image is obtained by blurring the image to be processed according to a preset method. That is, this embodiment determines the pixel gradient of the image to be processed and then fuses the image to be processed and the blurred image to be processed according to the pixel gradient. This can weaken the jagged edges generated by the image to be processed to a certain extent, achieving an anti-aliasing effect and thus improving image quality.
[0089] In some embodiments, the edge extraction module 320 includes:
[0090] The edge extraction unit is used to extract edges based on the image to be processed, and obtain the second pixel gradient corresponding to the image to be processed.
[0091] The normalization unit is used to normalize the gradient of the second pixel to obtain the gradient of the first pixel corresponding to the image to be processed.
[0092] In some embodiments, the edge extraction unit is specifically used for:
[0093] The image to be processed is processed into a grayscale image.
[0094] Edge extraction is performed on the grayscale image to obtain the second pixel gradient of the image to be processed.
[0095] In some embodiments, the image processing apparatus is applied to an electronic device, the electronic device including an embedded neural network processor and an edge extraction unit, specifically for:
[0096] Edge extraction of the image to be processed is performed by a preset neural network to obtain the second pixel gradient of the image to be processed. The preset neural network is integrated into the embedded neural network processor.
[0097] In some embodiments, the fusion module 330 includes a determining unit and a fusion unit;
[0098] The determining unit is used to determine the first image to be fused based on the first pixel gradient and the first image.
[0099] The determining unit is also used to determine the second image to be fused based on the third pixel gradient and the image to be processed, wherein the third pixel gradient is determined based on the first pixel gradient;
[0100] The fusion unit is used to fuse the first image to be fused and the second image to be fused to obtain the first target image.
[0101] In some embodiments, the fusion unit is specifically used for:
[0102] The first target image is obtained through the following relationship:
[0103] MergeImg(x,y)=M1(x,y)+M2(x,y)
[0104] Where MergeImg(x,y) is the first target image, M1(x,y) is the first image to be fused, M1(x,y)=grad(x,y)*G(x,y), grad(x,y) is the first pixel gradient, G(x,y) is the first image, M2(x,y) is the second image to be fused, M2(x,y)=grad1(x,y)*O(x,y), grad1(x,y) is the third pixel gradient, grad1(x,y)=1-grad(x,y), and O(x,y) is the image to be processed.
[0105] In some embodiments, the image processing apparatus may further include:
[0106] The sharpening module is used to perform a sharpening operation on the first target image after the fusion module 330 fuses the image to be processed and the first image according to the first pixel gradient to obtain the first target image, thereby obtaining the second target image.
[0107] The fusion module 330 is also used to fuse the second target image and the first target image according to the first pixel gradient to obtain the third target image.
[0108] Figure 3 Each module in the illustrated device has the ability to implement Figure 1 The functions of each step and the corresponding technical effects are described in detail here for the sake of brevity.
[0109] Based on the same inventive concept, embodiments of this application also provide an electronic device, such as a projection device, tablet computer, laptop computer, handheld computer, etc. The following describes... Figure 4 The electronic devices provided in the embodiments of this application will be described in detail.
[0110] like Figure 4As shown, the electronic device may include a processor 41 and a memory 42 for storing computer program instructions.
[0111] Processor 41 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that may be configured to implement the embodiments of this application.
[0112] Memory 42 may include mass storage for data or instructions. For example, and not limitingly, memory 42 may include a hard disk drive (HDD), a floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or a Universal Serial Bus (USB) drive, or a combination of two or more of these. In one instance, memory 42 may include removable or non-removable (or fixed) media, or memory 42 may be non-volatile solid-state memory. In one instance, memory 42 may be read-only memory (ROM). In one instance, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or flash memory, or a combination of two or more of these.
[0113] The processor 41 reads and executes the computer program instructions stored in the memory 42 to achieve... Figure 1 The method in the illustrated embodiment achieves... Figure 1 The corresponding technical effects achieved by the methods in the illustrated embodiments are described briefly and will not be elaborated further here.
[0114] In one example, the electronic device may also include a communication interface 43 and a bus 44. Wherein, as... Figure 4 As shown, the processor 41, memory 42, and communication interface 43 are connected through bus 44 and complete communication with each other.
[0115] Communication interface 43 is mainly used to realize communication between various modules, devices and / or equipment in the embodiments of this application.
[0116] Bus 44 includes hardware, software, or both, that couples the components of an electronic device together. For example, and not as a limitation, bus 44 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 Industry 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 (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 44 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, this application contemplates any suitable bus or interconnect.
[0117] After acquiring the image to be processed, the electronic device can execute the image processing method in the embodiments of this application, thereby achieving a combination of... Figure 1 The image processing methods described and Figure 3 The image processing apparatus described.
[0118] Furthermore, in conjunction with the image processing methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the image processing methods in the above embodiments.
[0119] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.
[0120] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.
[0121] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.
[0122] The aspects of embodiments of this application have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to create a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by dedicated hardware performing the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.
[0123] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.
Claims
1. An image processing method, characterized by, The method comprises the following steps: acquiring a to-be-processed image; performing edge extraction based on the to-be-processed image to obtain a first pixel gradient corresponding to the to-be-processed image; fusing the to-be-processed image and a first image according to the first pixel gradient to obtain a first target image, the first image being an image obtained by performing blurring processing on the to-be-processed image in a preset manner; the step of fusing the to-be-processed image and the first image according to the first pixel gradient to obtain the first target image comprises the following steps: determining a first to-be-fused image according to the first pixel gradient and the first image; determining a second to-be-fused image according to a third pixel gradient and the to-be-processed image, the third pixel gradient being determined according to the first pixel gradient; fusing the first to-be-fused image and the second to-be-fused image to obtain the first target image.
2. The method of claim 1, wherein, The step of performing edge extraction based on the to-be-processed image to obtain the first pixel gradient corresponding to the to-be-processed image comprises the following steps: performing edge extraction based on the to-be-processed image to obtain a second pixel gradient corresponding to the to-be-processed image; performing normalization processing on the second pixel gradient to obtain the first pixel gradient corresponding to the to-be-processed image.
3. The method of claim 2, wherein, The step of performing edge extraction based on the to-be-processed image to obtain the second pixel gradient corresponding to the to-be-processed image comprises the following steps: performing gray processing on the to-be-processed image to obtain a gray image of the to-be-processed image; performing edge extraction on the gray image to obtain the second pixel gradient corresponding to the to-be-processed image.
4. The method of claim 1, wherein, The method is applied to an electronic device, the electronic device comprising an embedded neural network processor, and the step of performing edge extraction based on the to-be-processed image to obtain the second pixel gradient corresponding to the to-be-processed image comprises the following step: performing edge extraction on the to-be-processed image by using a preset neural network to obtain the second pixel gradient corresponding to the to-be-processed image, the preset neural network being integrated in the embedded neural network processor.
5. The method of claim 1, wherein, The step of fusing the first to-be-fused image and the second to-be-fused image to obtain the first target image comprises the following step: obtaining the first target image by using the following relationship: MergeImg(x, y) = M1(x, y) + M2(x, y) wherein, MergeImg(x, y) is the first target image, M1(x, y) is the first to-be-fused image, M1(x, y) = grad(x, y) * G(x, y), grad(x, y) is the first pixel gradient, G(x, y) is the first image, M2(x, y) is the second to-be-fused image, M2(x, y) = grad1(x, y) * O(x, y), grad1(x, y) is the third pixel gradient, grad1(x, y) = 1-grad(x, y), and O(x, y) is the to-be-processed image.
6. The method of claim 1, wherein, After the step of fusing the to-be-processed image and the first image according to the first pixel gradient to obtain the first target image, the method further comprises the following steps: performing a sharpening operation on the first target image to obtain a second target image; fusing the second target image and the first target image according to the first pixel gradient to obtain a third target image.
7. An image processing apparatus characterized by comprising: The method comprises the following steps: An acquisition module is configured to acquire a to-be-processed image; An edge extraction module is configured to perform edge extraction based on the to-be-processed image to obtain a first pixel gradient corresponding to the to-be-processed image; A fusion module is configured to fuse the to-be-processed image and a first image according to the first pixel gradient to obtain a first target image, the first image being an image obtained by performing blurring processing on the to-be-processed image in a preset manner; The fusion module comprises: A determination unit is configured to determine a first to-be-fused image according to the first pixel gradient and the first image, and determine a second to-be-fused image according to a third pixel gradient and the to-be-processed image, the third pixel gradient being determined according to the first pixel gradient; A fusion unit is configured to fuse the first to-be-fused image and the second to-be-fused image to obtain the first target image.
8. An electronic device, comprising: comprise: a processor; a memory configured to store computer program instructions; when the computer program instructions are executed by the processor, the method of any one of claims 1-6 is implemented.
9. A computer-readable storage medium having stored thereon computer program instructions, wherein, when the computer program instructions are executed by the processor, the method of any one of claims 1-6 is implemented.
10. A computer program product, characterised in that, The instructions in the computer program product are executed by the processor of the electronic device, so that the electronic device executes the method of any one of claims 1-6.
Citation Information
Patent Citations
Image processing method and device and equipment
CN108428215A