CN115953315A - Image processing method, intelligent terminal and storage medium - Google Patents
Image processing method, intelligent terminal and storage medium Download PDFInfo
- Publication number
- CN115953315A CN115953315A CN202211698223.0A CN202211698223A CN115953315A CN 115953315 A CN115953315 A CN 115953315A CN 202211698223 A CN202211698223 A CN 202211698223A CN 115953315 A CN115953315 A CN 115953315A
- Authority
- CN
- China
- Prior art keywords
- image
- target image
- foreground
- background
- region
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Landscapes
- Image Processing (AREA)
Abstract
The application provides an image processing method, an intelligent terminal and a storage medium, wherein the image processing method comprises the following steps: s1, acquiring a target image, and distinguishing a foreground area and a background area in the target image; s2, performing first noise processing on the foreground area and performing second noise processing on the background area; and S3, fusing the foreground region and the background region after the denoising treatment to obtain a denoised image of the target image. The method and the device have the advantages that the denoising effect can be pertinently achieved after the foreground and the background are distinguished, the definition of the basic image quality is better improved, and the user experience is improved.
Description
Technical Field
The present application relates to the field of image denoising technology, and in particular, to an image processing method, an intelligent terminal, and a storage medium.
Background
When a user takes a picture in a complicated background, in order to acquire a clear portrait, the definition of the image can be improved through background blurring, multi-frame fusion and a High Dynamic Range (HDR) mode.
In the course of conceiving and implementing the present application, the inventors found that at least the following problems existed: the background blurring mode completely blurs the background for the portrait, but the portrait and the background are compatible with each other. The multi-frame fusion mode can keep more detail definition of the image, the denoising effect is better, but the portrait and the background can only be compatible, the effect parameter can be the distinguishing condition of the face, but the effect of the background can only be sacrificed when the face is recognized, and the portrait is taken as the main part. The HDR approach has luminance suppression on the background, but is not optimized mainly for human images and background.
The foregoing description is provided for general background information and is not admitted to be prior art.
Disclosure of Invention
In view of the above technical problems, the present application provides an image processing method, an intelligent terminal and a storage medium, which can perform a targeted denoising effect after distinguishing a foreground and a background, so as to better improve the definition of a basic image quality and improve user experience.
In order to solve the above technical problem, the present application provides an image processing method, which can be applied to an intelligent terminal, and includes the steps of:
s1, acquiring a target image, and distinguishing a foreground area and a background area in the target image;
s2, performing first noise processing on the foreground area, and performing second noise processing on the background area;
s3, fusing the foreground area and the background area after denoising processing to obtain a denoised image of the target image.
Optionally, the step of acquiring the target image comprises at least one of:
acquiring a target image, and eliminating color cast and dead spots of the target image;
acquiring a target image, and carrying out optical black correction on the target image;
acquiring a target image, and adjusting the image size of the target image;
acquiring a target image, and assigning values to three channels of the target image;
acquiring a target image, and carrying out noise pretreatment on the target image;
and acquiring a target image, and removing mosaic from the target image.
Optionally, the step S1 includes:
acquiring a target image;
and loading a matting model, and carrying out matting processing on the target image to obtain a foreground region and a background region of the target image.
Optionally, the step S2 includes:
and carrying out image denoising on the foreground region through a first high-pass filter and a first low-pass filter, and carrying out image denoising on the background region through a second high-pass filter and a second low-pass filter.
Optionally, a difference between the thresholds of the first high-pass filter and the first low-pass filter is taken as a first threshold difference.
Optionally, the difference between the thresholds of the second high-pass filter and the second low-pass filter is taken as the second threshold difference.
Optionally, the first threshold difference is greater than the second threshold difference.
Optionally, the step S3 includes:
the foreground area is subjected to size amplification according to a preset proportion and then is superposed at a corresponding position of the background area;
in an overlapping region of the foreground region and the background region, pixel values of the overlapping region are calculated most according to the following expression:
A=D*B+(1-D)*C
wherein, a is the final pixel value of the overlap region, B is the pixel value of the foreground region in the overlap region, C is the pixel value of the background region in the overlap region, and D is the weight of the foreground region.
Optionally, after the step S3, the method further comprises at least one of:
carrying out noise reduction processing on the de-noised image through a noise reduction model;
and carrying out edge correction on the denoised image through an edge enhancement model.
Optionally, the method further comprises:
acquiring a preset background image;
and fusing the foreground area subjected to denoising processing and the preset background image to obtain a new image.
Optionally, the method further comprises:
editing the foreground region after denoising processing to obtain a foreground deformation image;
the fusing the foreground region subjected to denoising processing with the preset background image to obtain a new image, including:
and fusing the foreground deformation image and the preset background image to obtain a new image.
The application further provides an intelligent terminal, which comprises a processor and a storage medium, wherein:
the storage medium is used for storing a computer program;
the processor is used for reading the computer program and running so as to realize the image processing method.
The present application also provides a storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the image processing method as set forth in any one of the above.
As described above, the image processing method of the present application includes the steps of: s1, acquiring a target image, and distinguishing a foreground area and a background area in the target image; s2, performing first noise processing on the foreground area and performing second noise processing on the background area; and S3, fusing the foreground region and the background region after the denoising treatment to obtain a denoised image of the target image. Through the technical scheme, the denoising effect can be pertinently achieved after the foreground and the background are distinguished, the definition of the basic image quality is better improved, the noise of the background of the portrait removed in the photographing process is solved, the existing short plate in the airspace denoising process is avoided, the loss problem of the definition of the portrait is avoided, and the user experience is further improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and, together with the description, serve to explain the principles of the application. In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments will be briefly described below, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic hardware structure diagram of a mobile terminal implementing various embodiments of the present application;
fig. 2 is a communication network system architecture diagram according to an embodiment of the present application;
fig. 3 is a flowchart illustrating an image processing method according to the first embodiment.
Fig. 4 is a schematic processing flow diagram of an intelligent terminal according to an embodiment of the present application.
The implementation, functional features and advantages of the objectives of the present application will be further explained with reference to the accompanying drawings. With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. The drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the concepts of the application by those skilled in the art with reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising a … …" does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element, and further, components, features, elements, and/or steps that may be similarly named in various embodiments of the application may or may not have the same meaning, unless otherwise specified by its interpretation in the embodiment or by context with further embodiments.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope herein. The word "if," as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination," depending on the context. Also, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context indicates otherwise. It will be further understood that the terms "comprises," "comprising," "includes" and/or "including," when used in this specification, specify the presence of stated features, steps, operations, elements, components, items, species, and/or groups, but do not preclude the presence, or addition of one or more other features, steps, operations, elements, components, items, species, and/or groups thereof. The terms "or," "and/or," "including at least one of the following," and the like, as used herein, are to be construed as inclusive or mean any one or any combination. For example, "includes at least one of: A. b, C "means" any of the following: a; b; c; a and B; a and C; b and C; a and B and C ", further for example," A, B or C "or" A, B and/or C "means" any of the following: a; b; c; a and B; a and C; b and C; a and B and C'. An exception to this definition will occur only when a combination of elements, functions, steps or operations are inherently mutually exclusive in some way.
It should be understood that, although the steps in the flowcharts in the embodiments of the present application are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless otherwise indicated herein. Moreover, at least some of the steps in the figures may include multiple sub-steps or multiple stages that are not necessarily performed at the same time, but may be performed at different times, in different orders, and may be performed alternately or at least partially with respect to other steps or sub-steps of other steps.
The words "if", as used herein, may be interpreted as "at … …" or "at … …" or "in response to a determination" or "in response to a detection", depending on the context. Similarly, the phrases "if determined" or "if detected (a stated condition or event)" may be interpreted as "when determined" or "in response to a determination" or "when detected (a stated condition or event)" or "in response to a detection (a stated condition or event)", depending on the context.
It should be noted that step numbers such as S1 and S2 are used herein for the purpose of more clearly and briefly describing the corresponding contents, and do not constitute a substantial limitation on the sequence, and those skilled in the art may perform S2 first and then S1 in the specific implementation, but these should be within the scope of the present application.
It should be understood that the specific embodiments described herein are merely illustrative of and not restrictive on the broad application.
In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for the convenience of description of the present application, and have no specific meaning in themselves. Thus, "module", "component" or "unit" may be used mixedly.
The smart terminal may be implemented in various forms. For example, the smart terminal described in the present application may include smart terminals such as a mobile phone, a tablet computer, a notebook computer, a palmtop computer, a Personal Digital Assistant (PDA), a Portable Media Player (PMP), a navigation device, a wearable device, a smart band, a pedometer, and the like, and fixed terminals such as a Digital TV, a desktop computer, and the like.
The following description will be given by way of example of a mobile terminal, and it will be understood by those skilled in the art that the configuration according to the embodiment of the present application can be applied to a fixed type terminal, in addition to elements particularly used for mobile purposes.
Referring to fig. 1, which is a schematic diagram of a hardware structure of a mobile terminal for implementing various embodiments of the present application, the mobile terminal 100 may include: RF (Radio Frequency) unit 101, wiFi module 102, audio output unit 103, a/V (audio/video) input unit 104, sensor 105, display unit 106, user input unit 107, interface unit 108, memory 109, processor 110, and power supply 111. Those skilled in the art will appreciate that the mobile terminal architecture shown in fig. 1 is not intended to be limiting of mobile terminals, which may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
The following describes each component of the mobile terminal in detail with reference to fig. 1:
the radio frequency unit 101 may be configured to receive and transmit signals during information transmission and reception or during a call, and specifically, receive downlink information of a base station and then process the downlink information to the processor 110; in addition, uplink data is transmitted to the base station. Typically, radio frequency unit 101 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. In addition, the radio frequency unit 101 can also communicate with a network and other devices through wireless communication. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System for Mobile communications), GPRS (General Packet Radio Service), CDMA2000 (Code Division Multiple Access 2000 ), WCDMA (Wideband Code Division Multiple Access), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access), FDD-LTE (Frequency Division duplex-Long Term Evolution), TDD-LTE (Time Division duplex-Long Term Evolution, time Division Long Term Evolution), 5G, and so on.
WiFi belongs to short-distance wireless transmission technology, and the mobile terminal can help a user to receive and send e-mails, browse webpages, access streaming media and the like through the WiFi module 102, and provides wireless broadband internet access for the user. Although fig. 1 shows the WiFi module 102, it is understood that it does not belong to the essential constitution of the mobile terminal, and can be omitted entirely as needed within the scope not changing the essence of the invention.
The audio output unit 103 may convert audio data received by the radio frequency unit 101 or the WiFi module 102 or stored in the memory 109 into an audio signal and output as sound when the mobile terminal 100 is in a call signal reception mode, a call mode, a recording mode, a voice recognition mode, a broadcast reception mode, or the like. Also, the audio output unit 103 may also provide audio output related to a specific function performed by the mobile terminal 100 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit 103 may include a speaker, a buzzer, and the like.
The a/V input unit 104 is used to receive audio or video signals. The a/V input Unit 104 may include a Graphics Processing Unit (GPU) 1041 and a microphone 1042, the Graphics processor 1041 Processing image data of still pictures or video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display unit 106. The image frames processed by the graphic processor 1041 may be stored in the memory 109 (or other storage medium) or transmitted via the radio frequency unit 101 or the WiFi module 102. The microphone 1042 can receive sounds (audio data) via the microphone 1042 in a phone call mode, a recording mode, a voice recognition mode, or the like, and can process such sounds into audio data. The processed audio (voice) data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 101 in case of a phone call mode. The microphone 1042 may implement various types of noise cancellation (or suppression) algorithms to cancel (or suppress) noise or interference generated in the course of receiving and transmitting audio signals.
The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Optionally, the light sensor includes an ambient light sensor and a proximity sensor, the ambient light sensor may adjust the brightness of the display panel 1061 according to the brightness of ambient light, and the proximity sensor may turn off the display panel 1061 and/or the backlight when the mobile terminal 100 moves to the ear. As one of the motion sensors, the accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), detect the magnitude and direction of gravity when stationary, and can be used for applications of recognizing gestures of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometers and taps), and the like; as for other sensors such as a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured on the mobile phone, further description is omitted here.
The display unit 106 is used to display information input by a user or information provided to the user. The Display unit 106 may include a Display panel 1061, and the Display panel 1061 may be configured in the form of a Liquid Crystal Display (LCD), an Organic Light-Emitting Diode (OLED), or the like.
The user input unit 107 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the mobile terminal. Alternatively, the user input unit 107 may include a touch panel 1071 and other input devices 1072. The touch panel 1071, also referred to as a touch screen, can collect touch operations of a user (e.g., operations of a user on the touch panel 1071 or near the touch panel 1071 using a finger, a stylus, or any other suitable object or accessory) thereon or nearby and drive the corresponding connection device according to a predetermined program. The touch panel 1071 may include two parts of a touch detection device and a touch controller. Optionally, the touch detection device detects a touch direction of a user, detects a signal caused by a touch operation, and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 110, and can receive and execute commands sent by the processor 110. In addition, the touch panel 1071 may be implemented in various types, such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The user input unit 107 may include other input devices 1072 in addition to the touch panel 1071. Optionally, other input devices 1072 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc., and the like, without limitation.
Alternatively, the touch panel 1071 may cover the display panel 1061, and when the touch panel 1071 detects a touch operation thereon or nearby, the touch panel 1071 transmits the touch operation to the processor 110 to determine the type of the touch event, and then the processor 110 provides a corresponding visual output on the display panel 1061 according to the type of the touch event. Although the touch panel 1071 and the display panel 1061 are shown in fig. 1 as two separate components to implement the input and output functions of the mobile terminal, in some embodiments, the touch panel 1071 and the display panel 1061 may be integrated to implement the input and output functions of the mobile terminal, and is not limited herein.
The interface unit 108 serves as an interface through which at least one external device is connected to the mobile terminal 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 108 may be used to receive input (e.g., data information, power, etc.) from external devices and transmit the received input to one or more elements within the mobile terminal 100 or may be used to transmit data between the mobile terminal 100 and external devices.
The memory 109 may be used to store software programs as well as various data. The memory 109 may mainly include a program storage area and a data storage area, and optionally, the program storage area may store an operating system, an application program (such as a sound playing function, an image playing function, and the like) required by at least one function, and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 109 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The processor 110 is a control center of the mobile terminal, connects various parts of the entire mobile terminal using various interfaces and lines, performs various functions of the mobile terminal and processes data by operating or executing software programs and/or modules stored in the memory 109 and calling data stored in the memory 109, thereby integrally monitoring the mobile terminal. Processor 110 may include one or more processing units; preferably, the processor 110 may integrate an application processor and a modem processor, optionally the application processor primarily handles operating systems, user interfaces, application programs, etc., and the modem processor primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 110.
The mobile terminal 100 may further include a power supply 111 (e.g., a battery) for supplying power to various components, and preferably, the power supply 111 may be logically connected to the processor 110 via a power management system, so as to manage charging, discharging, and power consumption management functions via the power management system.
Although not shown in fig. 1, the mobile terminal 100 may further include a bluetooth module and the like, which will not be described in detail herein.
In order to facilitate understanding of the embodiments of the present application, a communication network system on which the mobile terminal of the present application is based is described below.
Referring to fig. 2, fig. 2 is an architecture diagram of a communication Network system according to an embodiment of the present disclosure, where the communication Network system is an LTE system of a universal mobile telecommunications technology, and the LTE system includes a UE (User Equipment) 201, an e-UTRAN (Evolved UMTS Terrestrial Radio Access Network) 202, an epc (Evolved Packet Core) 203, and an IP service 204 of an operator, which are in communication connection in sequence.
Optionally, the UE201 may be the terminal 100 described above, and is not described herein again.
The E-UTRAN202 includes eNodeB2021 and other eNodeBs 2022, among others. Alternatively, the eNodeB2021 may be connected with other enodebs 2022 through a backhaul (e.g., X2 interface), the eNodeB2021 is connected to the EPC203, and the eNodeB2021 may provide the UE201 access to the EPC 203.
The EPC203 may include an MME (Mobility Management Entity) 2031, an hss (Home Subscriber Server) 2032, other MMEs 2033, an SGW (Serving gateway) 2034, a pgw (PDN gateway) 2035, and a PCRF (Policy and Charging Rules Function) 2036, and the like. Optionally, the MME2031 is a control node that handles signaling between the UE201 and the EPC203, providing bearer and connection management. HSS2032 is used to provide registers to manage functions such as home location register (not shown) and holds subscriber specific information about service characteristics, data rates, etc. All user data may be sent through SGW2034, PGW2035 may provide IP address allocation and other functions for UE201, PCRF2036 is a policy and charging control policy decision point for traffic data flow and IP bearer resources, which selects and provides available policy and charging control decisions for policy and charging enforcement function (not shown).
The IP services 204 may include the internet, intranets, IMS (IP Multimedia Subsystem), or other IP services, among others.
Although the LTE system is described as an example, it should be understood by those skilled in the art that the present application is not limited to the LTE system, but may also be applied to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA, 5G, and future new network systems (e.g. 6G), and the like.
Based on the above mobile terminal hardware structure and communication network system, various embodiments of the present application are provided.
First embodiment
The present application provides an image processing method, and fig. 3 is a flowchart illustrating the image processing method according to the first embodiment.
Referring to fig. 3, in an embodiment, an image processing method includes the steps of:
s1, obtaining a target image, and distinguishing a foreground area and a background area in the target image.
The target image is an image to be subjected to background denoising processing. The target image may be an image temporarily acquired by the camera or an image pre-stored in the memory in advance. In a subject image including a foreground region and a background region, a photographer often selects a specific target to compose and focus. For example, when taking a photo of a portrait, the portrait is generally used as a foreground region, and other environmental decorations and the like are used as background regions.
And S2, carrying out first noise processing on the foreground area, and carrying out second noise processing on the background area.
Illustratively, the foreground region and the background region are subjected to different degrees of noise reduction processing, more details are reserved for the foreground region, and the noise reduction strength is increased for the background region. The method has the advantages that targeted image processing is performed according to the effects of different areas, so that the definition of the basic image quality of the processed image can be better improved, and the user experience is improved.
And S3, fusing the foreground region and the background region after the denoising treatment to obtain a denoising image of the target image.
In this embodiment, the image processing method distinguishes a foreground from a background of a target image, performs targeted denoising, and then fuses the foreground and the background, thereby obtaining an image with noise removed and better definition retained.
Optionally, the step of acquiring the target image may include:
and acquiring a target image, and eliminating color cast and dead spots of the target image.
When the digital device is used for imaging, under the influence of self configuration, physical properties of photosensitive components, surface colors of a shot object and ambient lighting environment, a certain degree of error exists between colors of a digital image shot by the imaging device and real colors of the surface of the shot object, namely color cast. Since the human eye has a permanent color change, human vision may not be able to distinguish the difference in color caused by color cast, but for an image recording medium, reflected light from a target object under a given light source will be recorded, which causes trouble in subsequent image processing. Alternatively, the color of all or part of the image cannot fall within a certain preset range, and the color of the image can be considered to have a color cast problem.
Dead pixels are pixels which do not change with the light sensitivity and always present in one color (for example, white, black or colored), so that the definition and integrity of a high-definition image are damaged. The presence of the defective dot is one of the causes of the deterioration of the image quality. Illustratively, the appearance of a dead pixel not only degrades the visual effect of the image, but the appearance of multiple dead pixels may even lose a portion of important image information.
Therefore, in order to improve the image display quality, the color cast and the dead pixel processing can be firstly carried out on the target image.
Optionally, the step of acquiring the target image may include:
and acquiring a target image, and carrying out optical black correction on the target image.
Each pixel in the image is converted from an electrical signal to a digital signal by a diode. The pixel values of the image are therefore related to the electrical signal strength. The photoelectric sensor has a certain voltage to work. Even when no light is externally applied, the photo sensor has a certain voltage, called black level, to form a dark current. In imaging, dark current is superimposed on the electrical signal, which affects the imaging quality.
Alternatively, this part of the dark current is subtracted, called black level correction, when processing the target image. Alternatively, in order that high contrast can be stably achieved in a high luminance region, the analog luminance signal or the digital luminance signal may be subjected to optical black correction processing based on information on the average luminance level of the digital luminance signal.
Optionally, the step of acquiring the target image may include:
and acquiring a target image, and adjusting the image size of the target image.
A digital image is a representation of two-dimensional (2D) digital data on a regular grid. Generally, a digital image has a rectangular or square shape and includes a plurality of pixels. Each pixel may be represented by a color p representing the data value and coordinates (x, y) representing the grid. In order to match the size of the target image to the size of the screen display area, digital images often need to be resized for use with display devices having different aspect ratios or different resolutions to avoid problems of image distortion or partial occlusion of the target.
Optionally, the step of acquiring the target image may include:
and acquiring a target image, and assigning values to three channels of the target image.
The digital image is generally composed of three gray image channel parts of gray _ r, gray _ g and gray _ b. Binarization is a basic operation of image processing, which is used to convert an image to be processed into a binary image containing only two colors, namely black and white, so that the amount of image data is reduced to highlight the outline of an object of interest. With the rapid development of digital image processing technology, the application range of binarization is more and more extensive and more important. Alternatively, to display the hyperspectral image in image space, it is first transformed into a low-dimensional space. Optionally, the visualization method is to directly transform the original hyperspectral image into three bands by using the transformation methods such as band selection, PCA dimension reduction, band fusion and the like, and then assign the three bands to three channels of the color space for display.
Optionally, the step of acquiring the target image may include:
and acquiring a target image, and performing noise pretreatment on the target image.
Image noise has an important restriction on improvement of accuracy and precision of image segmentation, image measurement, image recognition and the like. The image denoising algorithm is an important link in image preprocessing and has a significant meaning for improving the image quality. Illustratively, a salt-pepper noise preprocessor is adopted to detect image edges through a predefined image edge template and perform preliminary noise reduction processing on a noise image according to the detection result.
Optionally, the step of acquiring the target image may include:
and acquiring a target image, and removing mosaic of the target image.
Mosaic mainly refers to the appearance of many small square-like images in a picture, resulting in the mosaic effect of some areas of the picture. Mosaics in an image severely affect the quality of the image. During image formation, distortion of block-based encoding and quantization may cause mosaics to occur in certain regions, especially where the compression rate is high. Therefore, the final image quality can be effectively improved by removing the mosaic, and the user experience is improved.
Illustratively, a target image of the YUV domain after target image processing is acquired, wherein Y represents Luminance (Luminance), i.e. gray scale value, and UV represents Chrominance (Chroma) and density (Chroma), respectively. And (3) processing the target image by DBS and BPC (color cast and dead pixel elimination), OBC (optical black correction for the target image), RRZ (adjustment of the image size of the target image), PGN (assignment of three channels of the target image), RNR (noise preprocessing for the target image), DM (mosaic elimination for the target image) and the like to obtain the target image in the YUV domain.
In one embodiment, step S1 includes:
acquiring a target image;
and loading a matting model, and carrying out matting processing on the target image to obtain a foreground region and a background region of the target image.
The digital matting technique is an image processing technique for separating one part of an image from other parts, and is called matting for short. The matte includes a blue screen matte with a known background and a natural image matte with an unknown background. Alternatively, natural image matting employs a Knockout method, a Poisson method, matting based on perceptual color space and a Bayes (Bayes) method, etc. Illustratively, when the Bayes method is adopted for matting, firstly, a foreground, a background and an unknown region of an image are manually divided, and then the image is segmented based on the divided foreground region, background region and unknown region, so as to realize matting. In this embodiment, the target image is segmented into a foreground image and a background image by a matting algorithm in the matting model.
In one embodiment, step S2 includes:
and carrying out image denoising on the foreground region through a first high-pass filter and a first low-pass filter, and carrying out image denoising on the background region through a second high-pass filter and a second low-pass filter.
Optionally, a difference between the threshold values of the first high pass filter and the first low pass filter is taken as the first threshold difference.
Optionally, the difference between the thresholds of the second high-pass filter and the second low-pass filter is taken as the second threshold difference.
Optionally, the first threshold difference is greater than the second threshold difference.
For example, both the foreground region and the background region may be image denoised by a high pass filter and a low pass filter. The method and the device have the advantages that the foreground area and the background area are subjected to targeted denoising, the filtering of the foreground area is looser to keep details, the filtering of the background area is stricter to realize denoising enhancement, and the basic image definition is better prompted.
In one embodiment, step S3 includes:
and amplifying the size of the foreground area according to a preset proportion and then overlapping the foreground area at the corresponding position of the background area.
And after the foreground area and the background area are respectively removed from noise, the foreground area and the background area are overlapped together again to restore the original view visual angle.
Optionally, in the overlapping area of the foreground area and the background area, the pixel value of the overlapping area is calculated most according to the following expression:
A=D*B+(1-D)*C
wherein, a is the final pixel value of the overlapping area, B is the pixel value of the foreground area in the overlapping area, C is the pixel value of the background area in the overlapping area, and D is the weight of the foreground area.
Illustratively, the foreground area and the background area are fused and spliced through the expression so as to reduce splicing overlapping problems such as image ghosting and the like and improve image definition. The weight D may be obtained in a linear manner or a nonlinear manner, which is not limited in this application. Optionally, the weight D is related to the position of the pixel in the overlap region. Illustratively, D may be calculated by the expression (W1-W2)/W1, where W1 may be the width of the current overlap region and W2 may be the distance of the current pixel from the right side of the overlap region.
In an embodiment, after step S3, at least one of the following is further included:
carrying out noise reduction processing on the denoised image through a noise reduction model;
and carrying out edge correction on the denoised image through an edge enhancement model.
Exemplarily, the fused target image is further processed by the denoising module and the edge enhancement module without removing clean noise, and the lost noise is edge-enhanced again, so that the overall effect of the fused image is improved.
In an embodiment, the image processing method may further include:
s4: acquiring a preset background image;
s5: and fusing the foreground area subjected to denoising processing with a preset background image to obtain a new image.
Exemplarily, the background replacement is performed on the processed foreground region, the original background image is replaced by the preset background image, a new effect image is obtained, the effect of transferring the image main body to a new environment in space and time can be realized, and the user experience is improved.
In an embodiment, the method further comprises:
editing the foreground area after the denoising processing to obtain a foreground deformation image.
Illustratively, the foreground region editing may be zooming in, zooming out, rotating, mirroring, changing colors, changing dressings, beautifying, and the like, which is not limited in this application.
Optionally, step S4: fusing the foreground region subjected to denoising processing with a preset background image to obtain a new image, which may include:
and fusing the foreground deformation image and a preset background image to obtain a new image.
In order to meet different shooting requirements of users, the image processing method can carry out multiple editing modes on the foreground area so as to meet the fusion requirements of different preset background images. Illustratively, the beautified foreground image of the person is fused with the mediterranean aerial image to obtain an beautified image of the person over the mediterranean sea.
The image processing method obtains the foreground and the background in an algorithm image matting mode, better solves the problem of background noise removal of the portrait in the photographing process, avoids the existing short slab of airspace denoising, and avoids the loss of the definition of the portrait. Resulting in an image with noise removed and better sharpness preserved.
Second embodiment
The embodiment of the application also provides an intelligent terminal, which comprises a memory and a processor, wherein the storage medium is used for storing the computer program; the processor is used for reading the computer program and running so as to realize the steps of the image processing method in any one of the above embodiments.
In an embodiment, the intelligent terminal in the step of implementing the background denoising method for the portrait picture may include:
1. acquiring a photo: and obtaining the processed picture in the YUV domain.
2. Distinguishing background and portrait: and obtaining YUV pictures with different backgrounds and portraits.
3. And respectively carrying out noise reduction processing of different degrees on the background and the portrait, reserving more details for the character, and enhancing the background noise reduction strength.
4. And fusing the character YUV and the background YUV to obtain a final effect.
5. The processed picture can be subjected to background replacement to obtain a new effect picture.
Exemplarily, after distinguishing the foreground and the background, the image processing method can perform a denoising effect in a targeted manner, so that the definition of the basic image quality is improved better; the built-in algorithm does not need a user to further set a corresponding switch, and user experience is improved.
Fig. 4 is a schematic processing flow diagram of an intelligent terminal according to an embodiment of the present application. The designations in FIG. 4 mean as follows:
DBS: de _ bias (for eliminating color cast in dark place).
BPC, bad pixel correction (elimination of dead spots and Impulse noise).
RRZ Raw Resizer (commonly used to change the size of video).
Pre Gain (for three channel Gain values).
RNR Raw Noise Reduction (Raw domain denoising process).
DM, domesaic (demosaic).
EE Edge enhancement.
NR1, NR2 (for luminance and color noise reduction).
Referring to fig. 4, the intelligent terminal obtains yuv from raw through bpc ob mapping rrz pgn rnr dm ccm lce gamma csc and other modules.
The target image is an image to be subjected to background denoising processing. The target image may be an image temporarily acquired by the camera or an image pre-stored in the memory in advance. In a subject image including a foreground region and a background region, a photographer often selects a specific target to compose and focus. For example, when taking a photo of a portrait, the portrait is generally used as a foreground region, and other environmental decorations and the like are used as background regions.
Illustratively, the foreground region and the background region are subjected to different degrees of noise reduction processing, more details are reserved for the foreground region, and the noise reduction strength is increased for the background region. And the image processing is carried out in a targeted manner according to the functions of different areas, so that the definition of the basic image quality of the processed image can be better improved. The target image is distinguished from the foreground and the background, and after targeted denoising is carried out, the foreground and the background are fused, so that an image with noise removed and better definition is reserved, and user experience is improved.
Then, through a matting algorithm, yuv of the foreground is obtained, where Y represents Luminance (luminence), i.e., a gray value, and UV represents chromaticity (chromance) and concentration (Chroma), respectively. The main principle is to divide the image a into a foreground image B and a background image C, and an algorithm is needed to obtain the weight D of the image foreground, wherein a = D × B + C (1-D). The basic algorithm flow is the module import-loading model-obtaining image file-calling the module cutout to obtain the image data P1. Specific program code examples are as follows:
import paddle
import paddlehub as hub
humanseg=hub.Module(name="deeplabv3p_xcecption65_humanseg")
image='xxx.yuv'
results=humanseg.segmentation(image=[cv2.imread(image)],
visualiation=True)
the digital matting technique is an image processing technique for separating one part of an image from other parts, and is called matting for short. The matting includes a background known blue screen matting and a background unknown natural image matting. Alternatively, natural image matting employs a Knockout method, a Poisson method, matting based on perceptual color space and a Bayes (Bayes) method, etc. Exemplarily, when the Bayes method is adopted for matting, firstly, a foreground, a background and an unknown region of an image are manually divided, and then the image is segmented based on the divided foreground region, background region and unknown region, so as to realize matting. In this embodiment, the target image is segmented into a foreground image and a background image by a matting algorithm in the matting model.
Optionally, the image denoising is performed on the background yuv picture in the obtained image data P1 through a high-pass filter and a low-pass filter, and the image denoising is performed on the foreground yuv picture in the obtained image data P1 through a high-pass filter and a low-pass filter.
Image noise has an important restriction on improvement of accuracy and precision of image segmentation, image measurement, image recognition and the like. The image denoising algorithm is an important link in image preprocessing and has a significant meaning for improving the image quality. Illustratively, a salt-pepper noise preprocessor is adopted to detect image edges through a predefined image edge template and perform preliminary noise reduction processing on a noise image according to the detection result. Illustratively, both foreground and background regions require image denoising through a high-pass filter and a low-pass filter.
Optionally, the foreground and background yuv pictures are combined into a yuv picture, and then the denoising module and the edge enhancement module wholly erase the noise which is not removed completely, and enhance the lost noise back at EE (noise processing). Specific program code examples are as follows:
from PIL import Image
import numpy as np
def blend_images(for_image,base_image,save_image):
base_image=Image.open(base_image).convert(RGB)
for_image=Image.open(for_image).resize(base_image.size)
scope_map=np.array(for_image)[:,:,-1]/125
scope_map=scope_map[:,:,np]
scope_map=scope_map[:,:,np.newaxis]
scope_map=np.repeat(scope_map,repeats=3,axis=2)
res_image=np.multiply(scope_map,np.array(fore_image)[:,:,:3])+np.multiply((1-scope_map),np.array(base_image))
res_image=Image.fromarray(np.uint8(res_image))
res_image.save(save_image)
and after the noise of the foreground area and the background area is removed respectively, the foreground area and the background area are overlapped together again to restore the original view visual angle. Optionally, the fused target image is further processed by the denoising module and the edge enhancement module without removing clean noise, and the lost noise is edge enhanced again, so that the overall effect of the fused image is improved. Optionally, the background of the processed foreground region is replaced, the original background image is replaced by the preset background image, a new effect image is obtained, the effect of transferring the image main body to a new environment in space and time can be achieved, and user experience is improved.
In order to meet different shooting requirements of users, the image processing method can carry out various editing modes on the foreground region so as to meet the fusion requirements of different preset background images. Illustratively, the beautified foreground image of the person is fused with the mediterranean aerial image to obtain an beautified image of the person over the mediterranean sea.
The image processing method obtains the foreground and the background in an algorithm image matting mode, better solves the problem of background noise removal of the portrait in the photographing process, avoids the existing short slab of airspace denoising, and avoids the loss of the definition of the portrait. Resulting in an image with noise removed and better sharpness preserved.
The above lists are only reference examples, and in order to avoid redundancy, they are not listed here, and in actual development or application, they may be flexibly combined according to actual needs, but any combination belongs to the technical solution of the present application, and is covered by the protection scope of the present application.
The embodiment of the present application further provides a storage medium, where a computer program is stored on the storage medium, and the computer program, when executed by a processor, implements the steps of the image processing method in any of the above embodiments.
In the embodiments of the intelligent terminal and the storage medium provided in the present application, all technical features of any one of the embodiments of the image processing method may be included, and the expanding and explaining contents of the specification are basically the same as those of the embodiments of the method, and are not described herein again.
Embodiments of the present application further provide a computer program product, which includes computer program code, when the computer program code runs on a computer, the computer is caused to execute the method as in the above various possible embodiments.
Embodiments of the present application further provide a chip, which includes a memory and a processor, where the memory is used to store a computer program, and the processor is used to call and run the computer program from the memory, so that a device in which the chip is installed executes the method in the above various possible embodiments.
It should be understood that the foregoing scenarios are only examples, and do not constitute a limitation on application scenarios of the technical solutions provided in the embodiments of the present application, and the technical solutions of the present application may also be applied to other scenarios. For example, as can be known by those skilled in the art, with the evolution of system architecture and the emergence of new service scenarios, the technical solution provided in the embodiments of the present application is also applicable to similar technical problems.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
The steps in the method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs.
The units in the device in the embodiment of the application can be merged, divided and deleted according to actual needs.
In the present application, the same or similar term concepts, technical solutions and/or application scenario descriptions will be generally described only in detail at the first occurrence, and when the description is repeated later, the detailed description will not be repeated in general for brevity, and when understanding the technical solutions and the like of the present application, reference may be made to the related detailed description before the description for the same or similar term concepts, technical solutions and/or application scenario descriptions and the like which are not described in detail later.
In the present application, each embodiment is described with emphasis, and reference may be made to the description of other embodiments for parts that are not described or illustrated in any embodiment.
The technical features of the technical solution of the present application may be arbitrarily combined, and for brevity of description, all possible combinations of the technical features in the embodiments are not described, however, as long as there is no contradiction between the combinations of the technical features, the scope of the present application should be considered as being described in the present application.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, a controlled terminal, or a network device) to execute the method of each embodiment of the present application.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the present application are all or partially generated when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a storage medium or transmitted from one storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, digital subscriber line) or wirelessly (e.g., infrared, wireless, microwave, etc.). The storage medium may be any available medium that can be accessed by a computer or a data storage device including one or more available media integrated servers, data centers, and the like. The usable medium may be a magnetic medium (e.g., floppy Disk, memory Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
The above description is only a preferred embodiment of the present application, and not intended to limit the scope of the present application, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the specification and the drawings of the present application, or which are directly or indirectly applied to other related technical fields, are included in the scope of the present application.
Claims (10)
1. An image processing method, comprising:
s1, acquiring a target image, and distinguishing a foreground area and a background area in the target image;
s2, performing first noise processing on the foreground area, and performing second noise processing on the background area;
and S3, fusing the foreground region and the background region after the denoising treatment to obtain a denoised image of the target image.
2. The image processing method according to claim 1, wherein the step of acquiring the target image comprises at least one of:
acquiring a target image, and eliminating color cast and dead spots of the target image;
acquiring a target image, and carrying out optical black correction on the target image;
acquiring a target image, and adjusting the image size of the target image;
acquiring a target image, and assigning values to three channels of the target image;
acquiring a target image, and carrying out noise pretreatment on the target image;
and acquiring a target image, and removing mosaic from the target image.
3. The image processing method according to claim 1, wherein step S1 comprises:
acquiring a target image;
and loading a matting model, and carrying out matting processing on the target image to obtain a foreground region and a background region of the target image.
4. The image processing method according to claim 1, wherein step S2 comprises:
and carrying out image denoising on the foreground region through a first high-pass filter and a first low-pass filter, and carrying out image denoising on the background region through a second high-pass filter and a second low-pass filter.
5. The image processing method according to claim 1, wherein step S3 comprises:
the foreground area is subjected to size amplification according to a preset proportion and then is superposed at a corresponding position of the background area;
in an overlapping region of the foreground region and the background region, calculating a pixel value of the overlapping region according to the following expression:
A=D*B+(1-D)*C
wherein, a is the final pixel value of the overlapping area, B is the pixel value of the foreground area in the overlapping area, C is the pixel value of the background area in the overlapping area, and D is the weight of the foreground area.
6. The image processing method according to any of claims 1-5, characterized in that after step S3, the method further comprises at least one of:
carrying out noise reduction processing on the de-noised image through a noise reduction model;
and carrying out edge correction on the denoised image through an edge enhancement model.
7. The image processing method according to any one of claims 1 to 5, characterized in that the method further comprises:
acquiring a preset background image;
and fusing the foreground area subjected to denoising processing and the preset background image to obtain a new image.
8. The image processing method according to claim 7, further comprising:
editing the foreground region after denoising processing to obtain a foreground deformation image;
the fusing the foreground region subjected to denoising processing with the preset background image to obtain a new image, including:
and fusing the foreground deformation image and the preset background image to obtain a new image.
9. An intelligent terminal, comprising a processor and a storage medium, wherein:
the storage medium is used for storing a computer program;
the processor is configured to read the computer program and operate to implement the image processing method according to any one of claims 1 to 8.
10. A storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the image processing method according to any one of claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211698223.0A CN115953315A (en) | 2022-12-28 | 2022-12-28 | Image processing method, intelligent terminal and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211698223.0A CN115953315A (en) | 2022-12-28 | 2022-12-28 | Image processing method, intelligent terminal and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115953315A true CN115953315A (en) | 2023-04-11 |
Family
ID=87287386
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211698223.0A Pending CN115953315A (en) | 2022-12-28 | 2022-12-28 | Image processing method, intelligent terminal and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115953315A (en) |
-
2022
- 2022-12-28 CN CN202211698223.0A patent/CN115953315A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
EP3410390B1 (en) | Image processing method and device, computer readable storage medium and electronic device | |
US10810720B2 (en) | Optical imaging method and apparatus | |
US10827140B2 (en) | Photographing method for terminal and terminal | |
CN108024065B (en) | Terminal shooting method, terminal and computer readable storage medium | |
CN111064895B (en) | Virtual shooting method and electronic equipment | |
CN112995467A (en) | Image processing method, mobile terminal and storage medium | |
CN107172349B (en) | Mobile terminal shooting method, mobile terminal and computer readable storage medium | |
CN104380727A (en) | Image processing device and image processing method | |
CN108182668B (en) | Amplified image processing method, terminal and computer readable storage medium | |
CN111885307A (en) | Depth-of-field shooting method and device and computer readable storage medium | |
CN108022227B (en) | Black and white background picture acquisition method and device and computer readable storage medium | |
CN112135053A (en) | Image processing method, mobile terminal and computer readable storage medium | |
CN108320265B (en) | Image processing method, terminal and computer readable storage medium | |
CN113393398A (en) | Image noise reduction processing method and device and computer readable storage medium | |
CN113222850A (en) | Image processing method, device and computer readable storage medium | |
CN112598678A (en) | Image processing method, terminal and computer readable storage medium | |
CN111953906A (en) | Image processing method, image processing apparatus, and computer-readable storage medium | |
CN114143471B (en) | Image processing method, system, mobile terminal and computer readable storage medium | |
CN114723645A (en) | Image processing method, intelligent terminal and storage medium | |
CN115953315A (en) | Image processing method, intelligent terminal and storage medium | |
CN114333001A (en) | Image processing method, intelligent terminal and storage medium | |
CN113473029A (en) | Lightning image shooting method and device and computer readable storage medium | |
CN112967298A (en) | Image segmentation method, terminal and computer readable medium | |
CN108335301B (en) | Photographing method and mobile terminal | |
CN108154534B (en) | Picture definition calibration method, terminal and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication |