Image processing method, device, equipment and storage medium
By acquiring all pixel information of the image, distinguishing the foreground and background, and only enhancing the foreground image, the problem of simultaneously enhancing the foreground and background in the prior art is solved, and the image quality is improved.
Patent Information
- Application Number
- CN202210277814.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-21
- Publication Date
- 2025-01-10
- Estimated Expiration
- 2042-03-21
AI Technical Summary
When processing images, existing image enhancement algorithms will enhance both the foreground and background images, resulting in unclear themes and affect image quality.
By obtaining color information for all pixel points of the image to be processed, the foreground and background images are determined, and image enhancement processing is performed on the foreground image only, avoiding processing of the background image, thereby clarifying the subject and improving image quality.
Only enhancement processing for the foreground image is achieved, the background image is avoided, the theme in the image is clarified, and the image quality is improved.
Smart Images

Figure CN114612336B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of network technology, and in particular to an image processing method, device, equipment and storage medium. Background Art
[0002] With the development of network technology, users have higher and higher requirements on the image quality of multimedia resources such as images or videos. At present, the image quality of multimedia resources can be improved through image enhancement algorithms (such as denoising algorithms, sharpening algorithms, super-resolution algorithms, etc.).
[0003] However, when processing an image through an image enhancement algorithm, not only the display effect of the foreground image of the image is enhanced, but also the display effect of the background image of the image may be enhanced, thus causing the subject in the image to be unclear and affecting the image quality. Summary of the invention
[0004] The present disclosure provides an image processing method, device, equipment and storage medium, which can only enhance the display effect of the foreground image and improve the image quality. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of the present disclosure, a method for processing an image is provided, the method comprising:
[0006] Obtain the color information of all pixels of the image to be processed. According to the color information of all pixels, determine the foreground image and background image of the image to be processed. The background image is the image other than the foreground image in the image to be processed. The prominence of the pixels in the foreground image is higher than the prominence of the pixels in the background image. The prominence is used to reflect the degree of difference between the color information of a pixel and the color information of all pixels. Perform image enhancement processing on the foreground image in the image to be processed to obtain the processed image to be processed. The processed image to be processed includes: the processed foreground image and the background image.
[0007] Optionally, the image processing method further includes: determining the prominence of each pixel among all the pixels according to the color information of all the pixels. Determining the foreground image and the background image according to the prominence of each pixel and a preset prominence threshold, the prominence of the pixel in the foreground image is greater than the preset prominence threshold, and the prominence of the pixel in the background image is less than the preset prominence threshold.
[0008] Optionally, the image processing method further includes: determining a plurality of sub-images from the image to be processed according to the saliency of each pixel, each of the plurality of sub-images includes at least one pixel, and the saliency intervals of the pixels in different sub-images are different. Determining a plurality of target sub-images from the plurality of sub-images according to the number of pixels in each sub-image, the number of pixels in the target sub-images being greater than a preset number threshold. Determining a foreground image and a background image according to the saliency of the pixels in the plurality of target sub-images.
[0009] Optionally, the multiple target sub-images include first-category pixels and second-category pixels, the significance of the first-category pixels is greater than a preset significance threshold, and the significance of the second-category pixels is less than a preset significance threshold. The image processing method also includes: binarizing the multiple target sub-images according to the significance of the pixels of the multiple target sub-images to obtain a mask map, the pixels in the mask map include: processed first-category pixels and processed second-category pixels, the color information of the processed first-category pixels is the first preset information, the color information of the processed second-category pixels is the second preset information, and the first preset information is greater than the second preset information. According to the mask map and the image to be processed, the foreground image and the background image are determined, the foreground image is an image composed of the first-category pixels, and the background image is an image composed of the second-category pixels.
[0010] Optionally, the image processing method further includes: converting the current color space of the image to be processed into a target color space, wherein the target color space includes multiple dimensional information, and the multiple dimensional information are all used to reflect the color information of the pixel points. Obtaining the target dimensional information of all the pixels, wherein the target dimensional information is any dimensional information of the multiple dimensional information.
[0011] Optionally, the image processing method further includes: performing image filtering processing on the foreground image to obtain a high-frequency image of the foreground image and a low-frequency image of the foreground image. Performing image enhancement processing on the high-frequency image in the foreground image of the image to be processed to obtain a processed image to be processed, wherein the processed image to be processed includes: a processed high-frequency image, a low-frequency image and a background image.
[0012] According to a second aspect of the present disclosure, there is provided an image processing device, the image processing device comprising: an acquisition unit and a processing unit.
[0013] The acquisition unit is configured to acquire the color information of all pixels of the image to be processed. The processing unit is configured to determine the foreground image and the background image of the image to be processed based on the color information of all pixels. The background image is the image other than the foreground image in the image to be processed. The prominence of the pixels in the foreground image is higher than the prominence of the pixels in the background image. The prominence is used to reflect the degree of difference between the color information of a pixel and the color information of all pixels. The processing unit is also configured to perform image enhancement processing on the foreground image in the image to be processed to obtain a processed image to be processed. The processed image to be processed includes: a processed foreground image and a background image.
[0014] Optionally, the processing unit is further configured to determine the saliency of each pixel among all the pixels based on the color information of all the pixels. The processing unit is further configured to determine the foreground image and the background image based on the saliency of each pixel and a preset saliency threshold, the saliency of the pixel in the foreground image being greater than the preset saliency threshold, and the saliency of the pixel in the background image being less than the preset saliency threshold.
[0015] Optionally, the processing unit is further configured to determine multiple sub-images from the image to be processed based on the saliency of each pixel, each of the multiple sub-images includes at least one pixel, and the saliency intervals of the pixels in different sub-images are different. The processing unit is further configured to determine multiple target sub-images from the multiple sub-images based on the number of pixels in each sub-image, and the number of pixels in the target sub-image is greater than a preset number threshold. The processing unit is further configured to determine the foreground image and the background image based on the saliency of the pixels in the multiple target sub-images.
[0016] Optionally, the multiple target sub-images include a first type of pixel points and a second type of pixel points, the saliency of the first type of pixel points is greater than a preset saliency threshold, and the saliency of the second type of pixel points is less than a preset saliency threshold. The processing unit is further configured to perform binarization processing on the multiple target sub-images according to the saliency of the pixel points of the multiple target sub-images to obtain a mask map, the pixels in the mask map include: processed first type of pixel points and processed second type of pixel points, the color information of the processed first type of pixel points is the first preset information, the color information of the processed second type of pixel points is the second preset information, and the first preset information is greater than the second preset information. The processing unit is further configured to determine the foreground image and the background image according to the mask map and the image to be processed, the foreground image is an image composed of the first type of pixel points, and the background image is an image composed of the second type of pixel points.
[0017] Optionally, the processing unit is further configured to convert the current color space of the image to be processed into a target color space, wherein the target color space includes multiple dimensional information, and the multiple dimensional information are all used to reflect the color information of the pixel points. The acquisition unit is further configured to acquire the target dimensional information of all the pixels, wherein the target dimensional information is any dimensional information of the multiple dimensional information.
[0018] Optionally, the processing unit is further configured to perform image filtering processing on the foreground image to obtain a high-frequency image of the foreground image and a low-frequency image of the foreground image. The processing unit is further configured to perform image enhancement processing on the high-frequency image in the foreground image of the image to be processed to obtain a processed image to be processed, wherein the processed image to be processed includes: a processed high-frequency image, a low-frequency image and a background image.
[0019] According to a third aspect of the present disclosure, a server is provided, the server comprising:
[0020] A processor. A memory for storing processor executable instructions. The processor is configured to execute the instructions to implement any one of the optional image processing methods in the first aspect above.
[0021] According to a fourth aspect of the present disclosure, a computer-readable storage medium is provided, on which instructions are stored. When the instructions in the computer-readable storage medium are executed by a processor of a server, the server is enabled to execute any one of the optional image processing methods in the above-mentioned first aspect.
[0022] According to a fifth aspect of the present disclosure, a computer program product is provided, comprising a computer program. When the computer program is executed by a processor, the server executes any one of the optional image processing methods in the first aspect.
[0023] According to a sixth aspect of the present disclosure, the present disclosure provides a chip, the chip including a processor and a communication interface, the communication interface and the processor are coupled, and the processor is used to run a computer program or instructions to implement the image processing method described in the first aspect and any possible implementation method of the first aspect.
[0024] The technical solution provided by the present disclosure brings at least the following beneficial effects: the color information of all pixels of the image to be processed is obtained. Afterwards, the foreground image and the background image of the image to be processed are determined based on the color information of all pixels, and the prominence of the pixels in the foreground image is higher than the prominence of the pixels in the background image, and the prominence is used to reflect the degree of difference between the color information of a pixel and the color information of all pixels. In other words, through the color information of the pixels, the image of the area where the pixels with higher prominence are located can be used as the foreground image. Then, the foreground image in the image to be processed is subjected to image enhancement processing to obtain a processed image to be processed, and the processed image to be processed includes: a processed foreground image and a background image. In this way, in the process of processing the image to be processed, image enhancement processing can be performed only on the foreground image, avoiding image enhancement processing on the background image, clarifying the subject in the image, and improving the image quality.
[0025] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0027] Figure 1 is a schematic diagram of the structure of a terminal device according to an exemplary embodiment;
[0028] Figure 2 is a flowchart of a method for processing an image according to an exemplary embodiment;
[0029] Figure 3 is an example diagram of a foreground image and a background image according to an exemplary embodiment;
[0030] Figure 4 is a flowchart of another image processing method according to an exemplary embodiment;
[0031] Figure 5 is an example diagram showing a pixel distribution according to an exemplary embodiment;
[0032] Figure 6 is a flowchart of another image processing method according to an exemplary embodiment;
[0033] Figure 7 is an example diagram showing another pixel distribution according to an exemplary embodiment;
[0034] Figure 8is an example diagram of a mask diagram according to an exemplary embodiment;
[0035] Fig. 9 is a flowchart of another image processing method according to an exemplary embodiment;
[0036] Fig.10 is a schematic structural diagram of an image processing device according to an exemplary embodiment;
[0037] Fig.11 It is a schematic structural diagram of another image processing device according to an exemplary embodiment. DETAILED DESCRIPTION
[0038] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0039] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0040] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to the number of pixels, thresholds, etc.) involved in this disclosure are all information and data authorized by the user or fully authorized by all parties.
[0041] First, the application scenarios of the embodiments of the present disclosure are introduced.
[0042] The image processing method of the disclosed embodiment is applied to the scenario of a user making an appointment for a service window. In the related art, the image can be first processed by a denoising algorithm, such as a three-dimensional block matching algorithm (Block Matching 3D, BM3D), to obtain a denoised image. Afterwards, a high-frequency image and a low-frequency image in the image can be obtained by filtering. Then, the high-frequency image of the image can be sharpened (such as increasing the color information of the pixels in the high-frequency image). In this way, the probability of enhancing the background image can be reduced and the image quality can be improved. However, in the current technical solution, the complexity of processing the image by the denoising algorithm is relatively high. In addition, the denoising algorithm may filter part of the foreground image of the image, resulting in part of the foreground image being unable to be sharpened, affecting the quality of the processed image.
[0043] In order to solve the above problems, the embodiments of the present disclosure provide an image processing method, which obtains the color information of all pixels of the image to be processed, and determines the foreground image and background image of the image to be processed, wherein the background image is the image other than the foreground image in the image to be processed, and the prominence of the pixels in the foreground image is higher than the prominence of the pixels in the background image. Image enhancement processing is performed on the foreground image in the image to be processed to obtain a processed image to be processed, and the processed image to be processed includes: a processed foreground image and a background image. In this way, image enhancement processing is only performed on the foreground image of the image to be processed, and the background image is not processed, so that the subject in the image can be clarified and the image quality can be improved.
[0044] Figure 1 The present invention provides a schematic diagram of a terminal device for applying the method provided by the present invention. The terminal device 10 includes a processor 101 and a memory 102.
[0045] The processor 101 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 101 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0046] The memory 102 may include one or more computer-readable storage media, which may be non-transitory. The memory 102 may also include a high-speed random access memory, and a non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In some embodiments, the non-transitory computer-readable storage medium in the memory 102 is used to store at least one instruction, which is used to be executed by the processor 101 to implement the group communication method provided by the method embodiment of the present disclosure.
[0047] It should be noted that, in some embodiments, the terminal device 10 may also be a server.
[0048] In some embodiments, the terminal device 10 may further optionally include: a peripheral device interface 103 and at least one peripheral device. The processor 101, the memory 102 and the peripheral device interface 103 may be connected via a bus or a signal line. Each peripheral device may be connected to the peripheral device interface 103 via a bus, a signal line or a circuit board. Specifically, the peripheral device includes: at least one of a radio frequency circuit 104, a display screen 105, a camera assembly 106, an audio circuit 107, a positioning assembly 108 and a power supply 109.
[0049] The peripheral device interface 103 may be used to connect at least one peripheral device related to I / O (Input / Output) to the processor 101 and the memory 102. In some embodiments, the processor 101, the memory 102, and the peripheral device interface 103 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 101, the memory 102, and the peripheral device interface 103 may be implemented on a separate chip or circuit board, which is not limited in this embodiment.
[0050] The radio frequency circuit 104 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The radio frequency circuit 104 communicates with communication networks and other communication devices through electromagnetic signals. The radio frequency circuit 104 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals into electrical signals. Optionally, the radio frequency circuit 104 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, a user identity module card, and the like. The radio frequency circuit 104 can communicate with other terminal devices through at least one wireless communication protocol. The wireless communication protocol includes, but is not limited to: a metropolitan area network, various generations of mobile communication networks (2G, 3G, 4G and 5G), a wireless local area network and / or a Wi-Fi (Wireless Fidelity) network. In some embodiments, the radio frequency circuit 104 may also include circuits related to NFC (Near Field Communication), which is not limited in the present disclosure.
[0051] The display screen 105 is used to display the UI (User Interface). The UI may include graphics, text, icons, videos and any combination thereof. When the display screen 105 is a touch display screen, the display screen 105 also has the ability to collect touch signals on the surface or above the surface of the display screen 105. The touch signal can be input to the processor 101 as a control signal for processing. At this time, the display screen 105 can also be used to provide virtual buttons and / or virtual keyboards, also known as soft buttons and / or soft keyboards. In some embodiments, the display screen 105 can be one, and the front panel of the terminal device 10 is set; the display screen 105 can be made of materials such as LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode) and the like.
[0052] The camera assembly 106 is used to collect images or videos. Optionally, the camera assembly 106 includes a front camera and a rear camera. Usually, the front camera is set on the front panel of the terminal device, and the rear camera is set on the back of the terminal device. The audio circuit 107 may include a microphone and a speaker. The microphone is used to collect sound waves from the user and the environment, and convert the sound waves into electrical signals and input them into the processor 101 for processing, or input them into the radio frequency circuit 104 to achieve voice communication. For the purpose of stereo acquisition or noise reduction, there can be multiple microphones, which are respectively arranged at different parts of the terminal device 10. The microphone can also be an array microphone or an omnidirectional acquisition microphone. The speaker is used to convert the electrical signal from the processor 101 or the radio frequency circuit 104 into sound waves. The speaker can be a traditional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can not only convert the electrical signal into a sound wave audible to humans, but also convert the electrical signal into a sound wave inaudible to humans for purposes such as ranging. In some embodiments, the audio circuit 107 may also include a headphone jack.
[0053] The positioning component 108 is used to locate the current geographical location of the terminal device 10 to implement navigation or LBS (Location Based Service). The positioning component 108 can be a positioning component based on the US GPS (Global Positioning System), China's Beidou system, Russia's Grenas system or the European Union's Galileo system.
[0054] The power supply 109 is used to power various components in the terminal device 10. The power supply 109 can be an alternating current, a direct current, a disposable battery, or a rechargeable battery. When the power supply 109 includes a rechargeable battery, the rechargeable battery can support wired charging or wireless charging. The rechargeable battery can also be used to support fast charging technology.
[0055] In some embodiments, the terminal device 10 further includes one or more sensors 1010. The one or more sensors 1010 include but are not limited to: an acceleration sensor, a gyroscope sensor, a pressure sensor, a fingerprint sensor, an optical sensor, and a proximity sensor.
[0056] The acceleration sensor can detect the magnitude of acceleration on the three coordinate axes of the coordinate system established with the terminal device 10. The gyroscope sensor can detect the body direction and rotation angle of the terminal device 10, and the gyroscope sensor can cooperate with the acceleration sensor to collect the user's 3D actions on the terminal device 10. The pressure sensor can be set on the side frame of the terminal device 10 and / or the lower layer of the display screen 105. When the pressure sensor is set on the side frame of the terminal device 10, the user's holding signal of the terminal device 10 can be detected. The fingerprint sensor is used to collect the user's fingerprint. The optical sensor is used to collect the ambient light intensity. The proximity sensor, also known as the distance sensor, is usually set on the front panel of the terminal device 10. The proximity sensor is used to collect the distance between the user and the front of the terminal device 10.
[0057] In one practicable manner, the terminal device is used to provide voice and / or data connectivity services to users. The terminal device may have different names, such as UE, terminal unit, terminal station, mobile station, mobile station, remote station, remote terminal, mobile device, wireless communication device, vehicle user equipment, terminal agent or terminal device, etc.
[0058] Optionally, the terminal device may be any handheld device, vehicle-mounted device, wearable device, or computer with communication functions, and the embodiments of the present disclosure do not limit this. For example, the handheld device may be a smart phone. The vehicle-mounted device may be a vehicle-mounted navigation system. The wearable device may be a smart bracelet. The computer may be a personal digital assistant (PDA), a tablet computer, or a laptop computer.
[0059] After introducing the application scenarios and execution subjects of the embodiments of the present disclosure, an image processing method provided by the embodiments of the present disclosure is described in detail below.
[0060] Figure 2 FIG. 1 is a flowchart of a method for processing an image according to an exemplary embodiment. Figure 2 As shown, the method may include steps 201 to 203.
[0061] 201. Obtain color information of all pixels of the image to be processed.
[0062] For example, if the pixel size of the image to be processed is 4224*2376, then all the pixel points of the image to be processed include 4224*2376 pixel points. If the pixel size of the image to be processed is 1024×768, then all the pixel points of the image to be processed include 1024×768 pixel points.
[0063] In one possible design, the color information may include red, green, and blue (RGB) information.
[0064] For example, if the image to be processed includes pixel A, the color information of pixel A is (25, 122, 15), that is, R is 25, G is 122, and B is 15.
[0065] In another possible design, the color information may include luminosity color (Luminosity ab, Lab) information.
[0066] For example, if the image to be processed includes pixel A, the color information of pixel A is (50, 100, 80), that is, L is 50, a is 100, and b is 80.
[0067] In a possible implementation, each pixel of all the pixels of the image to be processed is traversed to obtain RGB information of each pixel.
[0068] In another possible implementation, each pixel of all the pixels of the image to be processed is traversed to obtain Lab information of each pixel.
[0069] In another possible implementation, all pixels of the image to be processed are traversed to obtain RGB information of each pixel, and then the RGB information of each pixel is converted into Lab information.
[0070] In one practicable manner, before obtaining the color information of all pixels of the image to be processed, the current color space of the image to be processed is converted into a target color space, wherein the target color space includes multiple dimensional information, and the multiple dimensional information are all used to reflect the color information of the pixels.
[0071] For example, if the current color space is an RGB color space, the RGB color space can be converted into a Lab color space, which includes three dimensional information: L, a, and b.
[0072] In an embodiment of the present disclosure, obtaining color information of all pixels of an image to be processed may include: obtaining target dimension information of all pixels, where the target dimension information is any dimension information among multiple dimension information.
[0073] For example, if the target color space is a Lab color space, the target dimension information may be L dimension information (L is used to reflect the brightness of the pixel). All pixels include: pixel A, pixel B, and pixel C, then the L dimension information of pixel A, the L dimension information of pixel B, and the L dimension information of pixel C may be obtained.
[0074] It can be understood that after the current color space of the image to be processed is converted into the target color space, the multiple dimensional information of the target color space is used to reflect the color information of the pixel. In this way, the color information of the pixel can be obtained through any dimensional information (i.e., the target dimensional information). In this way, the amount of calculation for obtaining the saliency through the color information of the pixel can be reduced, thereby improving the speed of processing the image.
[0075] 202. Determine a foreground image and a background image of the image to be processed according to color information of all pixels.
[0076] The background image is an image other than the foreground image in the image to be processed, and the prominence of the pixel points in the foreground image is higher than the prominence of the pixel points in the background image.
[0077] It should be noted that the saliency of a pixel refers to the degree of prominence (or prominence) of the pixel in the image. The foreground image includes the main object in the image to be processed.
[0078] For example, Figure 3 As shown, image 301 includes image 302 and image 303. Image 302 includes a city area, and image 303 includes a rainbow. Image 302 and image 303 are foreground images, and the city area in image 302 and the rainbow in image 303 are the main objects of the image to be processed. The saliency of image 302 and image 303 is higher than the saliency of the background image (i.e., the image other than image 302 and image 303 in image 301).
[0079] In a possible implementation, the foreground image of the image to be processed is determined based on the color information of all pixels and a foreground detection algorithm. Then, the image other than the foreground image in the image to be processed is used as the background image. The foreground detection algorithm is used to detect the foreground image in the image.
[0080] Another possible implementation is Figure 4 As shown, step 202 may also include steps 401 and 402.
[0081] 401. Determine the saliency of each pixel among all the pixels according to the color information of all the pixels.
[0082] The saliency is used to reflect the difference between the color information of a pixel and the color information of all pixels.
[0083] In a possible implementation, a first operation is performed on each pixel of all pixels to determine the saliency of each pixel. The first operation includes: determining a target difference of a first pixel, the target difference includes a difference between color information of the first pixel and color information of each pixel of all pixels, the first pixel is any pixel of all pixels. Then, determining the saliency of the first pixel, the saliency of the first pixel being the sum of the target differences of the first pixel.
[0084] In a possible design, the saliency of the first pixel can be obtained by formula 1:
[0085] M(I k )=D(I k ,I1)+D(I k ,I2)+…+D(I k , I n ) Formula 1.
[0086] The image to be processed includes n pixels, I is used to represent the pixels in the image to be processed, and M(I k ) is used to represent the saliency of the kth pixel (i.e., the first pixel), D(I k , I1) is used to represent the difference between the color information of the kth pixel and the color information of the first pixel, D(I k , I2) is used to represent the difference between the color information of the kth pixel and the color information of the second pixel, D(I k , I n ) is used to represent the degree of difference between the color information of the k-th pixel and the color information of the n-th pixel, k is greater than 0, and k is less than n+1, and k and n are both integers.
[0087] It should be noted that D(I k , I n ) is a positive number.
[0088] For example, if the image to be processed includes 3 pixels, namely pixel A, pixel B and pixel C. The color information of pixel A is 25, the color information of pixel B is 20, and the color information of pixel C is 100. Then the saliency of pixel A is:
[0089] (25-25)+(25-20)+(100-25)=0+5+75
[0090] =80.
[0091] Similarly, the saliency of pixel B is 85, and the saliency of pixel C is 155.
[0092] 402. Determine a foreground image and a background image according to the saliency of each pixel and a preset saliency threshold.
[0093] The saliency of the pixel points in the foreground image is greater than a preset saliency threshold, and the saliency of the pixel points in the background image is less than the preset saliency threshold.
[0094] It should be noted that the embodiments of the present disclosure do not limit the preset significance threshold. For example, the preset significance threshold may be 0.1. For another example, the preset significance threshold may be 2. For another example, the preset significance threshold may be 50.
[0095] In a possible implementation, the saliency of each pixel is compared with a preset saliency threshold. Then, the pixels whose saliency is greater than the preset saliency threshold are regarded as first-category pixels, and the pixels whose saliency is less than the preset saliency threshold are regarded as second-category pixels. The saliency of the first-category pixels is greater than the preset saliency threshold, and the saliency of the second-category pixels is less than the preset saliency threshold. Then, the image composed of the first-category pixels is determined as the foreground image, and the image composed of the second-category pixels is determined as the background image.
[0096] For example, Figure 5 As shown, all pixels of the image to be processed are pixels in region 502. If the significance of the pixels in region 501 is greater than a preset significance threshold, and the significance of the pixels in region 503 other than region 501 in region 502 is less than the preset significance threshold, then the image composed of the pixels in region 501 is the foreground image, and the image composed of the pixels in region 503 is the background image.
[0097] The technical solution provided by the above embodiment brings at least the following beneficial effects: according to the color information of all the pixels, the prominence of each pixel among all the pixels is determined. Afterwards, according to the prominence of each pixel and the preset prominence threshold, the foreground image and the background image are determined, the prominence of the pixel in the foreground image is greater than the preset prominence threshold, and the prominence of the pixel in the background image is less than the preset prominence threshold. In this way, the foreground image and the background image of the image to be processed can be distinguished in combination with the prominence of the pixel, and the image of the area where the pixel with higher prominence is located is used as the foreground image, and the image of the area where the pixel with lower prominence is located is used as the background image. In this way, image enhancement processing can be performed only on the foreground image to improve the image quality.
[0098] 203. Perform image enhancement processing on the foreground image in the image to be processed to obtain a processed image to be processed.
[0099] The processed image to be processed includes: a processed foreground image and a processed background image.
[0100] It should be noted that the processed foreground image refers to an image processed by image enhancement. The disclosed embodiment does not limit the image enhancement processing. For example, the image enhancement processing may be a denoising process. For another example, the image enhancement processing may be a sharpening process. For another example, the image enhancement processing may be a super-resolution reconstruction.
[0101] As a possible implementation method, the foreground image is enhanced, and then the processed foreground image is fused with the background image to obtain a processed image to be processed.
[0102] The technical solution provided by the above embodiment brings at least the following beneficial effects: the color information of all pixels of the image to be processed is obtained. Afterwards, the foreground image and the background image of the image to be processed are determined based on the color information of all pixels, and the significance of the pixels in the foreground image is higher than that in the background image, and the significance is used to reflect the degree of difference between the color information of a pixel and the color information of all pixels. In other words, through the color information of the pixels, the image of the area where the pixels with higher significance are located can be used as the foreground image. Then, the foreground image in the image to be processed is subjected to image enhancement processing to obtain the processed image to be processed, and the processed image to be processed includes: the processed foreground image and the background image. In this way, in the process of processing the image to be processed, only the foreground image can be subjected to image enhancement processing, and the background image can be avoided from being subjected to image enhancement processing, thereby clarifying the subject in the image and improving the image quality.
[0103] In one practicable manner, if Figure 6 As shown, step 402 may include steps 601 to 603.
[0104] 601. Determine a plurality of sub-images from the image to be processed according to the saliency of each pixel.
[0105] Each of the multiple sub-images includes at least one pixel, and the saliency intervals of the pixel points in different sub-images are different.
[0106] It should be noted that, in the embodiment of the present disclosure, multiple sub-images may constitute the image to be processed. There is no intersection between the pixels in the multiple sub-images.
[0107] In the embodiment of the present disclosure, the saliency of a pixel in a sub-image is within a saliency range.
[0108] For example, Figure 7As shown, the image to be processed 706 includes: sub-image 701, sub-image 702, sub-image 703, sub-image 704 and sub-image 705. The saliency interval of the pixel points in sub-image 701 is [0, 0.03), the saliency interval of the pixel points in sub-image 702 is [0.1, 1), the saliency interval of the pixel points in sub-image 703 is [0.03, 0.05), the saliency interval of the pixel points in sub-image 704 is [0.05, 0.08), and the saliency interval of the pixel points in sub-image 705 is [0.08, 0.1).
[0109] It can be understood that if the saliency of the pixels in each sub-image is within a saliency range, it means that the saliency of the pixels in the sub-images are similar.
[0110] In a possible implementation, all pixels are clustered according to the saliency of each pixel, the clustered pixels include multiple types of pixels, and each pixel corresponds to a saliency interval. Then, multiple sub-images are determined according to the clustered pixels.
[0111] For example, if all pixels include: pixel A, pixel B, pixel C, pixel D, pixel E, pixel F and pixel G. The significance of pixel A is 0.1, the significance of pixel B is 0.5, the significance of pixel C is 0.11, the significance of pixel D is 0.01, the significance of pixel E is 0.2, the significance of pixel F is 0.02, and the significance of pixel G is 0.45. Then the significance of pixel A, pixel C and pixel E are in significance interval A (such as 0.09-0.21), the significance of pixel B and pixel G are in the same significance interval B (such as 0.4-0.51), and the significance of pixel D and pixel F are in the same significance interval C (such as 0-0.09). The multiple sub-images may be: sub-image A, sub-image B and sub-image C, where sub-image A is composed of pixel points A, pixel points C and pixel points E, sub-image B is composed of pixel points B and pixel points G, and sub-image C is composed of pixel points D and pixel points F.
[0112] 602. Determine a plurality of target sub-images from the plurality of sub-images according to the number of pixels of each sub-image.
[0113] The number of pixels of the target sub-image is greater than a preset number threshold.
[0114] In a possible design, the preset number threshold can be determined by the number of all pixels in the image to be processed. The preset number threshold is determined based on the number of all pixels and a preset ratio.
[0115] For example, if the number of all pixels is 10000, if the preset ratio is 1%, the preset number threshold is 100. If the preset ratio is 5%, the preset number threshold is 500. If the preset ratio is 10%, the preset number threshold is 1000.
[0116] It should be noted that the preset ratio can be set by the developer. Alternatively, the preset quantity threshold can be set by the developer (such as 5, 100, 500, etc.).
[0117] In a possible implementation, the number of pixels of each sub-image is compared with a preset number threshold. If the number of pixels of the sub-image is greater than the preset number threshold, the sub-image is determined to be a target sub-image. If the number of pixels of the sub-image is less than the preset number threshold, the sub-image is determined not to be a target sub-image.
[0118] For example, if the multiple sub-images include: sub-image A, sub-image B and sub-image C, the number of pixels of sub-image A is 500, the number of pixels of sub-image B is 1000, and the number of pixels of sub-image C is 2000. If the preset number threshold is 800, sub-image B and sub-image C are determined to be target sub-images.
[0119] In another possible implementation, the pixel ratio of each sub-image is determined according to the number of pixels of each sub-image and the number of all pixels, and the pixel ratio is used to indicate the ratio between the number of pixels of a sub-image and the number of all pixels. Then, according to the pixel ratio of each sub-image and the preset ratio, multiple target sub-images are determined from the multiple sub-images.
[0120] For example, if the total number of pixels is 10,000, the multiple sub-images include: sub-image A, sub-image B, and sub-image C, the number of pixels of sub-image A is 1,000, the number of pixels of sub-image B is 4,000, and the number of pixels of sub-image C is 5,000. The pixel ratio of sub-image A is 0.1, the pixel ratio of sub-image B is 0.4, and the pixel ratio of sub-image C is 0.5. If the preset ratio is 0.11, sub-image B and sub-image C are determined to be target sub-images.
[0121] 603. Determine a foreground image and a background image according to the saliency of the pixels of the plurality of target sub-images.
[0122] In a possible implementation, the saliency of each pixel in the plurality of target sub-images is compared with a preset saliency threshold. Then, the pixels whose saliency is greater than the preset saliency threshold are regarded as first-category pixels, and the pixels whose saliency is less than the preset saliency threshold are regarded as second-category pixels. Then, the image composed of the first-category pixels is determined as a foreground image, and the image composed of the second-category pixels is determined as a background image.
[0123] Exemplary, combined Figure 7 , assuming that the image to be processed 706 includes: sub-image 701, sub-image 702, sub-image 703, sub-image 704 and sub-image 705. If sub-image 701, sub-image 702, sub-image 704 and sub-image 705 are target sub-images, and sub-image 703 is not a target sub-image. Then, according to the saliency of the pixels of sub-image 701, sub-image 702, sub-image 704 and sub-image 705, the foreground image and the background image are determined.
[0124] It is understandable that, usually, the number of pixels in the foreground image accounts for a higher proportion of the total number of pixels in the image to be processed, that is, the number of pixels in the foreground image is relatively large. Therefore, excluding the sub-image with a small number of pixels can reduce the amount of data to be processed and increase the speed of image processing.
[0125] In another possible implementation, multiple target sub-images are binarized according to the prominence of their pixel points to obtain a mask image, wherein the pixel points in the mask image include: processed first-category pixel points and processed second-category pixel points, wherein the color information of the processed first-category pixel points is first preset information, the color information of the processed second-category pixel points is second preset information, and the first preset information is greater than the second preset information.
[0126] It should be noted that the color information of the pixels in the images other than the target sub-image in the multiple sub-images are all adjusted to the second preset information.
[0127] It should be noted that the first preset information and the second preset information are not limited in the embodiments of the present disclosure. For example, the first preset information may be 1, and the second preset information may be 0. For another example, the first preset information may be 255, and the second preset information may be 0. In the following embodiments, the first preset information is 1, and the second preset information is 0 as an example to introduce the present disclosure.
[0128] Exemplarily, suppose that the pixels of multiple target sub-images include: pixel A, pixel B, pixel C, pixel D, pixel E, pixel F and pixel G. Among them, pixel A, pixel B, pixel C and pixel D are first-category pixels, that is, the significance of pixel A, pixel B, pixel C and pixel D is greater than the preset significance threshold, and pixel E, pixel F and pixel G are second-category pixels, that is, the significance of pixel E, pixel F and pixel G is less than the preset significance threshold. Afterwards, the color information of pixel A, pixel B, pixel C and pixel D is set to 1, and the color information of pixel E, pixel F and pixel G is set to 0. Combined with Figure 3 ,like Figure 8 As shown, the mask image 801 is Figure 3 Mask image for the shown image.
[0129] Afterwards, a foreground image and a background image are determined according to the mask image and the image to be processed, wherein the foreground image is an image composed of the first type of pixels, and the background image is an image composed of the second type of pixels.
[0130] In a possible implementation, a foreground image is determined according to the mask image and the image to be processed. Then, a background image is determined according to the image to be processed and the foreground image.
[0131] Exemplarily, the foreground image may be determined by Formula 2.
[0132] F=M×I Formula 2.
[0133] Among them, F is used to represent the foreground image, M is used to represent the mask image, and I is used to represent the image to be processed.
[0134] For example, the pixels of the image to be processed include: pixel A, pixel B and pixel C, pixel A and pixel C are first-class pixels, and pixel B is second-class pixel. Then the color information of pixel A and pixel C in M is 1, and the color information of pixel B is 0. Afterwards, pixel B can be filtered in F (the color information of pixel B is 0), and pixel A and pixel C are retained.
[0135] Correspondingly, the foreground image can be determined by Formula 2.
[0136] B=IF Formula 3.
[0137] Among them, B is used to represent the background image.
[0138] It can be understood that the mask image of the image to be processed is obtained by the saliency of the pixels of the multiple target sub-images. Afterwards, the image to be processed can be filtered by the mask image to obtain a foreground image and a background image. In this way, image enhancement processing can be performed only on the foreground image, thereby improving the image quality.
[0139] The technical solution provided by the above embodiment brings at least the following beneficial effects: according to the saliency of each pixel point, multiple sub-images are determined from the image to be processed, and the saliency intervals of the pixel points in different sub-images are different, that is, the saliency of the pixel points in a sub-image is similar. Afterwards, according to the number of pixels in each sub-image, multiple target sub-images are determined from the multiple sub-images, and the number of pixels in the target sub-image is greater than a preset number threshold. According to the saliency of the pixels of the multiple target sub-images, the foreground image and the background image are determined. In this way, the foreground image and the background image can be determined only by the saliency of some pixels in the image to be processed, which reduces the amount of data to be processed and improves the processing speed.
[0140] In one practicable manner, if Fig. 9 As shown, before step 203 , the method may include step 901 .
[0141] 901. Perform image filtering processing on the foreground image to obtain a high-frequency image of the foreground image and a low-frequency image of the foreground image.
[0142] In a possible implementation, after the foreground image and the background image are determined, the foreground image is processed by a filtering algorithm to obtain a high-frequency image of the foreground image. Then, a low-frequency image of the foreground image is obtained based on the foreground image and the high-frequency image.
[0143] Exemplarily, the filtering algorithm may be an edge-preserving filtering algorithm. A high-frequency image is obtained by using Formula 4, and a low-frequency image is obtained by using Formula 5.
[0144] L=W(F) Formula 4.
[0145] Among them, L is used to represent the high-frequency image of the foreground image, and W is used to represent the filtering algorithm.
[0146] H=I–L Formula 5.
[0147] Among them, H is used to represent the low-frequency image of the foreground image.
[0148] In one practicable manner, step 203 may include step 902 .
[0149] 902. Perform image enhancement processing on a high-frequency image in a foreground image of an image to be processed to obtain a processed image to be processed.
[0150] The processed image to be processed includes: a processed high-frequency image, a processed low-frequency image and a background image.
[0151] In a possible implementation, the high-frequency image in the foreground image of the image to be processed is subjected to image enhancement processing to obtain a processed high-frequency image. Thereafter, the processed high-frequency image, the low-frequency image and the background image are subjected to image fusion processing to obtain a processed image to be processed.
[0152] In a possible design, the high frequency image can be processed by sharpening. The processed foreground image can be obtained by formula six.
[0153] F'=A*H+L Formula 6.
[0154] Among them, F' is used to represent the processed foreground image, and A is used to represent the weight.
[0155] It should be noted that the weight can usually be set by the user. The embodiment of the present disclosure does not limit the weight. For example, the weight can be 1. For another example, the weight can be 2. For another example, the weight can be 10.
[0156] Correspondingly, the processed image to be processed can be obtained by formula seven.
[0157] I'=F'+B Formula 7.
[0158] Wherein, I' is used to represent the processed image to be processed.
[0159] The technical solution provided by the above embodiment brings at least the following beneficial effects: performing image filtering processing on the foreground image to obtain a high-frequency image of the foreground image and a low-frequency image of the foreground image. Afterwards, performing image enhancement processing on the high-frequency image in the foreground image of the image to be processed to obtain a processed image to be processed, and the processed image to be processed includes: a processed high-frequency image, a low-frequency image and a background image. Since the high-frequency image can more accurately reflect the theme of the image. Therefore, accurately performing image enhancement processing on the high-frequency image can avoid image enhancement of other images. In this way, the image theme can be clarified and the image quality can be improved.
[0160] It is understandable that the above method can be implemented by an image processing device. In order to implement the above functions, the image processing device includes hardware structures and / or software modules corresponding to the execution of each function. Those skilled in the art should easily realize that, in combination with the modules and algorithm steps of each example described in the embodiments disclosed herein, the embodiments of the present disclosure can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of the present disclosure.
[0161] The embodiments of the present disclosure may divide the functional modules of the image processing device and the like according to the above method examples. For example, each functional module may be divided according to each function, or two or more functions may be integrated into one processing module. The above integrated modules may be implemented in the form of hardware or in the form of software functional modules. It should be noted that the division of modules in the embodiments of the present disclosure is schematic and is only a logical functional division. There may be other division methods in actual implementation.
[0162] Fig.10 is a structural block diagram of an image processing device according to an exemplary embodiment. Figure 5 The image processing device 1000 includes an acquisition unit 1001 and a processing unit 1002.
[0163] The acquisition unit 1001 is configured to acquire the color information of all pixels of the image to be processed. The processing unit 1002 is configured to determine the foreground image and the background image of the image to be processed based on the color information of all pixels. The background image is the image other than the foreground image in the image to be processed. The prominence of the pixels in the foreground image is higher than the prominence of the pixels in the background image. The prominence is used to reflect the degree of difference between the color information of a pixel and the color information of all pixels. The processing unit 1002 is also configured to perform image enhancement processing on the foreground image in the image to be processed to obtain a processed image to be processed. The processed image to be processed includes: a processed foreground image and a background image.
[0164] Optionally, the processing unit 1002 is further configured to determine the saliency of each pixel among all the pixels according to the color information of all the pixels. The processing unit 1002 is further configured to determine the foreground image and the background image according to the saliency of each pixel and a preset saliency threshold, the saliency of the pixel in the foreground image is greater than the preset saliency threshold, and the saliency of the pixel in the background image is less than the preset saliency threshold.
[0165] Optionally, the processing unit 1002 is further configured to determine a plurality of sub-images from the image to be processed according to the saliency of each pixel, each of the plurality of sub-images includes at least one pixel, and the saliency intervals of the pixels in different sub-images are different. The processing unit 1002 is further configured to determine a plurality of target sub-images from the plurality of sub-images according to the number of pixels in each sub-image, and the number of pixels in the target sub-image is greater than a preset number threshold. The processing unit 1002 is further configured to determine a foreground image and a background image according to the saliency of the pixels in the plurality of target sub-images.
[0166] Optionally, the multiple target sub-images include first-category pixels and second-category pixels, the saliency of the first-category pixels is greater than a preset saliency threshold, and the saliency of the second-category pixels is less than a preset saliency threshold. The processing unit 1002 is further configured to perform binarization processing on the multiple target sub-images according to the saliency of the pixels of the multiple target sub-images to obtain a mask map, wherein the pixels in the mask map include: processed first-category pixels and processed second-category pixels, the color information of the processed first-category pixels is the first preset information, the color information of the processed second-category pixels is the second preset information, and the first preset information is greater than the second preset information. The processing unit 1002 is further configured to determine a foreground image and a background image according to the mask map and the image to be processed, wherein the foreground image is an image composed of the first-category pixels, and the background image is an image composed of the second-category pixels.
[0167] Optionally, the processing unit 1002 is further configured to convert the current color space of the image to be processed into a target color space, wherein the target color space includes multiple dimensional information, and the multiple dimensional information are all used to reflect the color information of the pixel. The acquisition unit 1001 is further configured to acquire the target dimensional information of all pixels, wherein the target dimensional information is any dimensional information of the multiple dimensional information.
[0168] Optionally, the processing unit 1002 is further configured to perform image filtering processing on the foreground image to obtain a high-frequency image of the foreground image and a low-frequency image of the foreground image. The processing unit 1002 is further configured to perform image enhancement processing on the high-frequency image in the foreground image of the image to be processed to obtain a processed image to be processed, wherein the processed image to be processed includes: a processed high-frequency image, a low-frequency image and a background image.
[0169] Regarding the image processing device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0170] Fig.11FIG. 1 is a schematic diagram of the structure of an image processing device 110 provided by the present disclosure. Fig.11 The image processing device 110 may include at least one processor 1101 and a memory 1103 for storing executable instructions of the processor 1101. The processor 1101 is configured to execute the instructions in the memory 1103 to implement the image processing method in the above embodiment.
[0171] In addition, the image processing device 110 may further include a communication bus 1102 and at least one communication interface 1104 .
[0172] The processor 1101 may be a GPU, a microprocessing unit, an ASIC, or one or more integrated circuits for controlling the execution of the program of the disclosed solution.
[0173] The communication bus 1102 may include a pathway for transmitting information between the above-mentioned components.
[0174] The communication interface 1104 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, radio access network (RAN), wireless local area networks (WLAN), etc.
[0175] The memory 1103 may be a read-only memory (ROM) or other types of static storage devices that can store static information and instructions, a random access memory (RAM) or other types of dynamic storage devices that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, optical disc storage (including compressed optical disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may exist independently and be connected to the processing unit through a bus. The memory may also be integrated with the processing unit and be a volatile storage medium in the GPU.
[0176] The memory 1103 is used to store instructions for executing the solution of the present disclosure, and the execution is controlled by the processor 1101. The processor 1101 is used to execute the instructions stored in the memory 1103, thereby realizing the functions in the method of the present disclosure.
[0177] In a specific implementation, as an embodiment, the processor 1101 may include one or more GPUs, such as Fig.11 GPU0 and GPU1 in .
[0178] In a specific implementation, as an embodiment, the image processing device 110 may include multiple processors, such as Fig.11 1101 and processor 1107 in the embodiment. Each of these processors can be a single-core (single-CPU) processor or a multi-core (multi-GPU) processor. The processor here can refer to one or more devices, circuits, and / or processing cores for processing data (such as computer program instructions).
[0179] In a specific implementation, as an embodiment, the image processing device 110 may further include an output device 1105 and an input device 1106. The output device 1105 communicates with the processor 1101 and may display information in a variety of ways. For example, the output device 1105 may be a liquid crystal display (LCD), a light emitting diode (LED) display device, a cathode ray tube (CRT) display device, or a projector. The input device 1106 communicates with the processor 1101 and may receive user input in a variety of ways. For example, the input device 1106 may be a mouse, a keyboard, a touch screen device, or a sensor device.
[0180] Those skilled in the art will understand that Fig.11 The structure shown in the figure does not constitute a limitation on the image processing device 110, and may include more or less components than those shown in the figure, or combine certain components, or adopt a different component arrangement.
[0181] The present disclosure also provides a computer-readable storage medium having instructions stored thereon. When the instructions in the storage medium are executed by a processor of a server, the server is enabled to execute the group communication method provided by the above-mentioned embodiment of the present disclosure.
[0182] The embodiment of the present disclosure also provides a computer program product including instructions, which, when executed on a server, enables the server to execute the image processing method provided by the embodiment of the present disclosure.
[0183] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0184] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A method for processing an image, characterized in that: The method comprises: Obtain the color information of all pixels of the image to be processed; Determining, according to the color information of all the pixels, the saliency of each pixel in the all the pixels, the saliency being used to reflect the degree of difference between the color information of one pixel and the color information of all the pixels; Determining a plurality of sub-images from the image to be processed according to the saliency of each pixel, each of the plurality of sub-images comprising at least one pixel, and saliency intervals of the pixels in different sub-images being different; Determining a plurality of target sub-images from the plurality of sub-images according to the number of pixels of each sub-image, wherein the number of pixels of the target sub-images is greater than a preset number threshold; Determine a foreground image and a background image according to the prominence of the pixels of the multiple target sub-images, wherein the prominence of the pixels in the foreground image is greater than a preset prominence threshold, and the prominence of the pixels in the background image is less than the preset prominence threshold, and the background image is an image other than the foreground image in the image to be processed; Performing image enhancement processing on the foreground image in the image to be processed to obtain a processed image to be processed, wherein the processed image to be processed includes: the processed foreground image and the background image.
2. The method according to claim 1, characterized in that The multiple target sub-images include a first type of pixel points and a second type of pixel points, the saliency of the first type of pixel points is greater than the preset saliency threshold, and the saliency of the second type of pixel points is less than the preset saliency threshold; Determining the foreground image and the background image according to the saliency of the pixels of the plurality of target sub-images includes: Binarizing the multiple target sub-images according to the saliency of the pixel points of the multiple target sub-images to obtain a mask image, wherein the pixel points in the mask image include: processed first-category pixel points and processed second-category pixel points, color information of the processed first-category pixel points is first preset information, color information of the processed second-category pixel points is second preset information, and the first preset information is greater than the second preset information; The foreground image and the background image are determined according to the mask image and the image to be processed, wherein the foreground image is an image composed of the first type of pixel points, and the background image is an image composed of the second type of pixel points.
3. The method according to claim 1 or 2, characterized in that: Before obtaining the color information of all pixels of the image to be processed, the method further includes: Converting the current color space of the image to be processed into a target color space, wherein the target color space includes multiple dimensional information, and the multiple dimensional information are all used to reflect the color information of the pixel points; The step of obtaining color information of all pixels of the image to be processed includes: The target dimension information of all the pixels is obtained, where the target dimension information is any one of the multiple dimension information.
4. The method according to claim 1 or 2, characterized in that: Before performing image enhancement processing on the foreground image in the image to be processed to obtain the processed image to be processed, the method further includes: Performing image filtering processing on the foreground image to obtain a high-frequency image of the foreground image and a low-frequency image of the foreground image; Performing image enhancement processing on the foreground image in the image to be processed to obtain a processed image to be processed, including: The image enhancement process is performed on the high-frequency image in the foreground image of the image to be processed to obtain the processed image to be processed, wherein the processed image to be processed includes: the processed high-frequency image, the low-frequency image and the background image.
5. An image processing device, characterized in that: include: An acquisition unit is configured to acquire color information of all pixels of the image to be processed; A processing unit is configured to determine, based on the color information of all the pixels, a saliency of each pixel among all the pixels, wherein the saliency is used to reflect the degree of difference between the color information of one pixel and the color information of all the pixels; The processing unit is further configured to determine a plurality of sub-images from the image to be processed according to the saliency of each pixel, each of the plurality of sub-images comprising at least one pixel, and the saliency of the pixels in different sub-images being in different saliency intervals; The processing unit is further configured to determine a plurality of target sub-images from the plurality of sub-images according to the number of pixels of each sub-image, wherein the number of pixels of the target sub-images is greater than a preset number threshold; The processing unit is further configured to determine a foreground image and a background image according to the prominence of the pixels of the multiple target sub-images, wherein the prominence of the pixels in the foreground image is greater than a preset prominence threshold, and the prominence of the pixels in the background image is less than the preset prominence threshold; The processing unit is further configured to perform image enhancement processing on the foreground image in the image to be processed to obtain a processed image to be processed, wherein the processed image to be processed includes: a processed foreground image and the background image.
6. The image processing device according to claim 5, characterized in that: The multiple target sub-images include a first type of pixel points and a second type of pixel points, the saliency of the first type of pixel points is greater than the preset saliency threshold, and the saliency of the second type of pixel points is less than the preset saliency threshold; The processing unit is further configured to perform binarization processing on the multiple target sub-images according to the saliency of the pixel points of the multiple target sub-images to obtain a mask image, wherein the pixel points in the mask image include: processed first-category pixel points and processed second-category pixel points, the color information of the processed first-category pixel points is first preset information, the color information of the processed second-category pixel points is second preset information, and the first preset information is greater than the second preset information; The processing unit is further configured to determine the foreground image and the background image according to the mask image and the image to be processed, wherein the foreground image is an image composed of the first type of pixels, and the background image is an image composed of the second type of pixels.
7. The image processing device according to claim 5 or 6, characterized in that: The processing unit is further configured to convert the current color space of the image to be processed into a target color space, wherein the target color space includes a plurality of dimensional information, and the plurality of dimensional information are all used to reflect the color information of the pixel point; The acquisition unit is further configured to acquire target dimension information of all the pixels, where the target dimension information is any one of the multiple dimension information.
8. The image processing device according to claim 5 or 6, characterized in that: The processing unit is further configured to perform image filtering processing on the foreground image to obtain a high-frequency image of the foreground image and a low-frequency image of the foreground image; The processing unit is further configured to perform the image enhancement processing on the high-frequency image in the foreground image of the image to be processed to obtain the processed image to be processed, wherein the processed image to be processed includes: the processed high-frequency image, the low-frequency image and the background image.
9. A server, characterized in that: The server comprises: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the image processing method as described in any one of claims 1 to 4.
10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of a server, the server is enabled to execute the image processing method according to any one of claims 1 to 4.
11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the image processing method according to any one of claims 1 to 4 is implemented.
Citation Information
Patent Citations
Image segmentation method and device, computer readable storage medium and electronic equipment
CN111724396A
Image enhancement method, device and equipment, and storage medium
CN113379649A