WO2022247702A1 - Image processing method and apparatus, electronic device, and storage medium - Google Patents

Image processing method and apparatus, electronic device, and storage medium Download PDF

Info

Publication number
WO2022247702A1
WO2022247702A1 PCT/CN2022/093586 CN2022093586W WO2022247702A1 WO 2022247702 A1 WO2022247702 A1 WO 2022247702A1 CN 2022093586 W CN2022093586 W CN 2022093586W WO 2022247702 A1 WO2022247702 A1 WO 2022247702A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
processing
processed
neural network
network model
Prior art date
Application number
PCT/CN2022/093586
Other languages
French (fr)
Chinese (zh)
Inventor
徐青松
李青
Original Assignee
杭州睿胜软件有限公司
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by 杭州睿胜软件有限公司 filed Critical 杭州睿胜软件有限公司
Publication of WO2022247702A1 publication Critical patent/WO2022247702A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration by the use of more than one image, e.g. averaging, subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • G06T5/70
    • G06T5/92
    • G06T5/94
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Definitions

  • Embodiments of the present disclosure relate to an image processing method, an image processing apparatus, electronic equipment, and a non-transitory computer-readable storage medium.
  • At least one embodiment of the present disclosure provides an image processing method, including: acquiring an image to be processed, wherein the image to be processed includes a target area; performing a first sharpening process on the image to be processed by using a first neural network model, To obtain the first intermediate image corresponding to the image to be processed, wherein the definition of the first intermediate image is greater than the definition of the image to be processed; through the second neural network model in the first intermediate image and Performing a second sharpening process on the intermediate target area corresponding to the target area to obtain a second intermediate image corresponding to the intermediate target area; performing synthesis processing on the first intermediate image and the second intermediate image to obtain A composite image corresponding to the image to be processed.
  • the image processing method further includes: performing recognition processing on the first intermediate image through a third neural network model, so as to obtain the first intermediate image in the first intermediate image The intermediate target area corresponding to the target area.
  • the definition of the second intermediate image is greater than the definition of the intermediate target area.
  • performing composite processing on the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed includes : performing tone processing on the second intermediate image based on the tone of the first intermediate image to obtain a third intermediate image, wherein the tone of the third intermediate image tends to the tone of the first intermediate image; performing image combination processing on the first intermediate image and the third intermediate image to obtain the synthesized image.
  • the target area is a human face area.
  • the first neural network model is different from the second neural network model.
  • the image processing method before the first sharpening process is performed on the image to be processed through the first neural network model, the image processing method further includes: acquiring a sample image ; blurring the sample image to obtain an image to be trained, wherein the definition of the image to be trained is smaller than the definition of the sample image; based on the sample image and the image to be trained, the image to be trained The first neural network model and the second neural network model to be trained are trained to obtain the first neural network model and the second neural network model.
  • performing blurring processing on the sample image to obtain an image to be trained includes: obtaining a texture slice, wherein the size of the texture slice is the same as the The size of the sample images is the same; the first blurring process is performed on the sample images to obtain a first blurred image, wherein the definition of the first blurred image is smaller than the definition of the sample image; the first blurred performing color mixing processing on the image and the texture slice to obtain a second blurred image; performing second blurring processing on the second blurred image to obtain the image to be trained.
  • acquiring a texture slice includes: acquiring at least one preset texture image; randomly selecting a preset texture image from the at least one preset texture image A texture image, as a target texture image; in response to the size of the target texture image being the same as the size of the sample image, using the target texture image as the texture slice; in response to a size larger than the target texture image For the size of the sample image, randomly cut the target texture image based on the size of the sample image to obtain a slice area with the same size as the sample image, and use the slice area as the texture slice.
  • the first blurring includes Gaussian blurring, noise addition, or Gaussian blurring and noise addition in any order and in any number Combination processing composed of processing;
  • the second blur processing includes the Gaussian blur processing, the noise addition processing, or a combination processing based on any order and any number of the Gaussian blur processing and the noise addition processing.
  • performing a first blurring process on the sample image to obtain a first blurred image includes: performing the Gaussian blurring process on the sample image, to obtain the first blurred image; performing a second blurring process on the second blurred image to obtain the image to be trained, including: performing the noise addition process on the second blurred image to obtain an intermediate blur image; performing the Gaussian blur processing on the intermediate blurred image to obtain the image to be trained.
  • performing color mixing processing on the first blurred image and the texture slice to obtain a second blurred image includes: performing a color mixing process on the first blurred image The image and the texture slice are subjected to color filtering processing to obtain the second blurred image.
  • performing color mixing processing on the first blurred image and the texture slice to obtain a second blurred image includes: processing the texture slice and the texture slice The first blurred image is highlighted to obtain the second blurred image.
  • At least one embodiment of the present disclosure provides an image processing device, including: an image acquisition unit configured to acquire an image to be processed, wherein the image to be processed includes a target area; a first processing unit configured to use a first neural network model performing a first sharpening process on the image to be processed to obtain a first intermediate image corresponding to the image to be processed, wherein the definition of the first intermediate image is greater than that of the image to be processed; second A processing unit configured to perform a second sharpening process on an intermediate target area corresponding to the target area in the first intermediate image through a second neural network model, so as to obtain a second intermediate image corresponding to the intermediate target area; A compositing unit configured to composite the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed.
  • the composition unit includes a tone processing module and an image combination processing module, and the tone processing module is configured to, based on the tone of the first intermediate image, performing tone processing on the second intermediate image to obtain a third intermediate image, wherein the tone of the third intermediate image tends to the tone of the first intermediate image; the image combining processing module is configured to performing image combination processing on the first intermediate image and the third intermediate image to obtain the synthesized image.
  • At least one embodiment of the present disclosure provides an electronic device, including: a memory storing computer-executable instructions in a non-transitory manner; a processor configured to run the computer-executable instructions, wherein the computer-executable instructions are executed by the The processor implements the image processing method according to any embodiment of the present disclosure when running.
  • At least one embodiment of the present disclosure provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the computer-executable instructions according to The image processing method described in any embodiment of the present disclosure.
  • Fig. 1 is a schematic flowchart of an image processing method provided by at least one embodiment of the present disclosure
  • Fig. 2 is a schematic diagram of an image to be processed provided by at least one embodiment of the present disclosure
  • Fig. 3 is a schematic diagram of a first intermediate image provided by at least one embodiment of the present disclosure
  • FIG. 4A is a schematic diagram of an intermediate target area provided by at least one embodiment of the present disclosure.
  • Fig. 4B is a schematic diagram of a second intermediate image provided by at least one embodiment of the present disclosure.
  • Fig. 5A is a schematic diagram of a third intermediate image provided by at least one embodiment of the present disclosure.
  • FIG. 5B is a schematic diagram of a synthesized image provided by an embodiment of the present disclosure.
  • Fig. 6A shows a schematic flowchart of obfuscation processing provided by at least one embodiment of the present disclosure
  • Fig. 6B is a schematic diagram of a texture slice provided by at least one embodiment of the present disclosure.
  • Fig. 7A is a sample image provided by at least one embodiment of the present disclosure.
  • Fig. 7B is an image to be trained provided by at least one embodiment of the present disclosure.
  • Fig. 8 is a schematic block diagram of an image processing device provided by at least one embodiment of the present disclosure.
  • Fig. 9 is a schematic diagram of an electronic device provided by at least one embodiment of the present disclosure.
  • Fig. 10 is a schematic diagram of a non-transitory computer-readable storage medium provided by at least one embodiment of the present disclosure
  • Fig. 11 is a schematic diagram of a hardware environment provided by at least one embodiment of the present disclosure.
  • face images unlike other objects such as landscapes and objects, the details of face images are very rich, such as facial texture features, etc. Therefore, in the process of clearing images containing face images, the traditional method The obtained face image is not clear enough, the texture features are not clear enough, and image noise often appears.
  • At least one embodiment of the present disclosure provides an image processing method, an image processing device, an electronic device, and a non-transitory computer-readable storage medium.
  • the image processing method includes: acquiring an image to be processed, wherein the image to be processed includes a target area;
  • the first neural network model performs the first sharpening process on the image to be processed to obtain the first intermediate image corresponding to the image to be processed, wherein the definition of the first intermediate image is greater than the definition of the image to be processed; through the second neural network model Performing a second sharpening process on the intermediate target area corresponding to the target area in the first intermediate image to obtain a second intermediate image corresponding to the intermediate target area; performing composite processing on the first intermediate image and the second intermediate image to obtain a Composite image corresponding to the image to be processed.
  • the second clearing process is performed on the target area, and special optimization is performed on the target area, and then the optimized target area is synthesized with the first intermediate image, thereby It can improve the clarity of the synthesized image, and obtain a high-definition image with richer details.
  • the image processing method provided by the embodiment of the present disclosure can be applied in a mobile terminal (such as a mobile phone, a tablet computer, etc.), and on the basis of improving the processing speed, the definition of the synthesized image can be improved, and the image collected by the mobile terminal can also be processed. Real-time sharpening.
  • the image processing method provided in the embodiment of the present disclosure can be applied to the image processing device provided in the embodiment of the present disclosure, and the image processing device can be configured on an electronic device.
  • the electronic device may be a personal computer, a mobile terminal, etc.
  • the mobile terminal may be a hardware device with various operating systems, such as a mobile phone and a tablet computer.
  • Fig. 1 is a schematic flowchart of an image processing method provided by at least one embodiment of the present disclosure.
  • Fig. 2 is a schematic diagram of an initial image provided by at least one embodiment of the present disclosure.
  • the image processing method provided by at least one embodiment of the present disclosure includes steps S10 to S40.
  • Step S10 acquiring an image to be processed.
  • the image to be processed includes a target area.
  • step S20 the first sharpening process is performed on the image to be processed through the first neural network model to obtain a first intermediate image corresponding to the image to be processed.
  • the resolution of the first intermediate image is greater than the resolution of the image to be processed.
  • Step S30 performing a second sharpening process on the intermediate target area corresponding to the target area in the first intermediate image through the second neural network model, so as to obtain a second intermediate image corresponding to the intermediate target area.
  • Step S40 performing composite processing on the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed.
  • the images to be processed acquired in step S10 can be various types of images, such as landscape images, person images, item images, etc.
  • landscape images can include landscape objects such as mountains, rivers, plants, animals, and sky
  • a person image is an image including a person (for example, a human face, etc.).
  • a person image may include a human face area
  • an item image may include items such as vehicles and houses.
  • the person image may also include areas corresponding to landscape objects, object objects, and the like.
  • the image to be processed may be a person image, such as a person's ID photo.
  • the image to be processed may also be a person image with a landscape object or an article object.
  • the shape of the image to be processed may be a rectangle or the like.
  • the shape and size of the image to be processed can be set by the user according to the actual situation.
  • the image to be processed can be a blurred image with low definition. lower.
  • the image to be processed may be obtained by scanning or the like, for example, the image to be processed may be an image obtained by scanning or photographing an old photo with a long history.
  • the image to be processed may be an image obtained by performing image compression on a high-definition image to facilitate transmission.
  • the image to be processed can be a grayscale image or a color image.
  • the image processing method provided by at least one embodiment of the present disclosure may also include preprocessing the image to be processed operate. Preprocessing may include, for example, cropping, gamma (Gamma) correction, or noise reduction filtering on the image to be processed. Preprocessing can eliminate irrelevant information or noise information in the image to be processed, so as to facilitate subsequent image processing of the image to be processed.
  • the target area may be an area including the target, and the target may be a human face, so the target area may be a human face area.
  • other objects can be selected as targets, for example, animals, vehicles, etc. are selected as targets.
  • the target area is an area including animals (eg, cats) or an area including vehicles. There is no limit to this.
  • the image to be processed can be a person image and includes a human face
  • the target area is the face area that includes a human face in the image to be processed. It can be seen from Fig. 2 that the resolution of the image to be processed is low, the image details are missing, and there is image noise.
  • step S20 the image to be processed is first cleared through the trained first neural network model to obtain a first intermediate image with higher definition, that is, the definition of the first intermediate image is greater than that of the image to be processed clarity.
  • the first neural network model may adopt a pix2pixHD (pixel to pixel HD) model, which uses a multi-level generator (coarse-to-fine generator) and a multi-scale discriminator (multi-scale discriminator) to treat The first sharpening process is performed on the image to generate a high-resolution, high-definition first intermediate image.
  • the generator of the pix2pixHD model includes a global generator network (global generator network) and a local enhancer network (local enhancer network).
  • the global generator network part adopts the U-Net structure, and the features output by the global generator network part are extracted from the local enhancement network part.
  • the feature fusion of the local enhancement network is used as the input information of the local enhancement network part, and the local enhancement network part outputs high-resolution and high-definition images based on the fused information.
  • Fig. 3 is a schematic diagram of a first intermediate image obtained after performing a first sharpening process on the image to be processed shown in Fig. 2 according to at least one embodiment of the present disclosure.
  • the definition of the first intermediate image after the first sharpening process has been greatly improved, but this sharpening is aimed at the image to be processed
  • the global sharpening of the target area, such as the face area cannot be specially optimized, for example, the high-definition details of the target area cannot be provided, and the obtained first intermediate image will also have image noise such as variegated lines.
  • the intermediate target area is an area corresponding to the target area in the first intermediate image.
  • the size of the intermediate target area is the same as that of the target area, and the relative position of the intermediate target area in the first intermediate image is completely or substantially the same as the relative position of the target area in the image to be processed.
  • step S30 the second clearing process is performed on the intermediate target area corresponding to the target area obtained from the first intermediate image, so as to further enrich the image details of the intermediate target area on the basis of the first clearing process, and improve
  • the definition of the intermediate target area eliminates the image noise existing in the intermediate target area, and obtains a second intermediate image with higher definition and richer image details.
  • the resolution of the second intermediate image is greater than the resolution of the intermediate target area.
  • there is no image noise such as variegated lines and noise in the second intermediate image and the texture and lines of the second intermediate image are clearer and richer than the intermediate target area.
  • the intermediate target area is extracted through the second neural network model, and the second sharpening process is performed on the intermediate target area to obtain the second intermediate image.
  • the position of the target area in the image to be processed is relatively fixed.
  • the image to be processed is a ID photo
  • the target area is a face area
  • the face area is generally located in the center of the ID photo.
  • the position information of the target area in the image to be processed is used to extract the intermediate target area in the first intermediate image, and the second clearing process is performed on the intermediate target area through the second neural network model to obtain the second intermediate image.
  • the image processing method provided by at least one embodiment of the present disclosure may further include: using a third neural network model to identify and process the first intermediate image, so as to obtain The intermediate target region in the image corresponding to the target region.
  • the target area is a face area
  • the third neural network model can be a face recognition model
  • the third neural network model can be trained to recognize the face area in the first intermediate image to obtain the intermediate target area, that is, the first intermediate The region in the image that includes parts of the face.
  • the target area is other objects, such as a vehicle
  • the third neural network model can be trained to recognize the object (i.e., the vehicle) in the image to be recognized, so that the first intermediate The image is identified and processed to obtain an intermediate target area including the object (ie, the vehicle), which is not limited in the present disclosure.
  • the intermediate target area can also be extracted by means of manual extraction, and the intermediate target area can be subjected to the second sharpening process through the second neural network model to obtain the second intermediate image, which is not discussed in this disclosure. limit.
  • the first neural network model may be the same as the second neural network model, or the first neural network model may be different from the second neural network model.
  • the second neural network model can be a SPADE (Spatially-Adaptive Normalization) model, and the SPADE model can solve the problem that information in the input semantic image is easily lost in the traditional normalization layer.
  • one or more of the first neural network model, the second neural network model and the third neural network model may be a convolutional neural network model.
  • Fig. 4A is a schematic diagram of an intermediate target area provided by at least one embodiment of the present disclosure
  • Fig. 4B is a schematic diagram of a second intermediate image provided by at least one embodiment of the present disclosure.
  • the first intermediate image shown in Figure 3 is identified and processed by the third neural network model to obtain the intermediate target area shown in Figure 4A; then, the intermediate target area shown in Figure 4A is processed by the second neural network model A second sharpening process is performed to obtain a second intermediate image shown in FIG. 4B .
  • the second intermediate image after the second sharpening process has richer texture features and higher definition, and removes the black lines from the nose to the mouth of the face in the intermediate target area.
  • FIG. 4B in the second intermediate image, details such as wrinkles that originally existed on the human face are reflected, so that the human face is more in line with the characteristics of a real human face.
  • the hues of the first intermediate image obtained based on the first sharpening process and the second intermediate image obtained based on the second sharpening process may not be uniform. If the first intermediate image and the second intermediate image are directly synthesized, the resulting There may be multiple tones in the resulting composite image. Therefore, it is necessary to perform tone processing on the first intermediate image and the second intermediate image so that the tones of the two tend to be consistent. For example, the tones of the two are unified or consistent. At this time Then image merging is performed to obtain a composite image with uniform tone.
  • step S40 may include: based on the tone of the first intermediate image, performing tone processing on the second intermediate image to obtain a third intermediate image, for example, the tone of the third intermediate image tends to the tone of the first intermediate image;
  • the first intermediate image and the third intermediate image are combined to obtain a composite image.
  • any algorithm or tool capable of tone adjustment may be used to perform tone processing on the second intermediate image based on the tone of the first intermediate image, which is not limited in the present disclosure.
  • step S40 may include: performing tone processing on the first intermediate image based on the tone of the second intermediate image to obtain a fourth intermediate image, for example, the fourth intermediate image The tone tends to the tone of the second intermediate image; performing an image combination process on the second intermediate image and the fourth intermediate image to obtain a composite image.
  • step S40 image merging processing is performed on the first intermediate image and the third intermediate image to obtain the synthesized image, which may include: The pixels in the t1th row and the t2th column in the first intermediate image: in response to the pixel in the t1th row and the t2th column in the first intermediate image is not located in the intermediate target area, the t1th row and the t2th column in the first intermediate image The pixel value of the pixel is used as the pixel value of the pixel in the t1th row and the t2th column in the composite image; in response to the pixel in the t1th row and the t2th column in the first intermediate image is located in the intermediate target area, the third intermediate image is The pixel value of the second intermediate pixel is used as the pixel value of the pixel in the t1th row and the t2th column in the composite image, wherein the
  • the image combination processing process is the same as the above-mentioned process, and will not be repeated here.
  • image merging process may also use other merging methods, which is not limited in the present disclosure.
  • the composite image can be a color image, for example, the pixel values of the pixels in the color image can include a set of RGB pixel values, or the composite image can also be a monochrome image, for example, the pixel values of the pixels in the monochrome image can be is the pixel value of a color channel.
  • FIG. 5A is a schematic diagram of a third intermediate image provided by at least one embodiment of the present disclosure
  • FIG. 5B is a schematic diagram of a composite image provided by an embodiment of the present disclosure.
  • the tone of the third intermediate image after tone processing is consistent with the tone of the first intermediate image shown in FIG. 3 .
  • the image details of the synthesized image are richer and clearer than that of the unprocessed image, and there is only one tone in the synthesized image.
  • the image processing method before performing the first sharpening process on the image to be processed by using the first neural network model, further includes: acquiring a sample image; performing blurring processing on the sample image to obtain an image to be trained , for example, the clarity of the image to be trained is smaller than the clarity of the sample image; based on the sample image and the image to be trained, the first neural network model to be trained and the second neural network model to be trained are trained to obtain the first neural network model and the second neural network model.
  • the sample image may be an image with a sharpness greater than a sharpness threshold, and the sharpness threshold may be set by the user according to actual conditions.
  • the sample image includes a sample target area, for example, the sample target area is a face area.
  • the image to be trained can be used as the input of the neural network model
  • the sample image can be used as the target output of the neural network model
  • the image to be trained can be used as the target output of the neural network model.
  • the first neural network model and the second neural network model to be trained are trained.
  • the training process of the neural network model may include: using the neural network model to be trained to process the training image to obtain the training output image; based on the training output image and the sample image, calculating The loss value of the neural network model to be trained; and modifying the parameters of the neural network model to be trained based on the loss value; when the loss function corresponding to the neural network model to be trained satisfies a predetermined condition, the trained neural network model is obtained, When the loss function corresponding to the neural network model to be trained does not meet the predetermined condition, continue to input the image to be trained to repeat the above training process.
  • the neural network model to be trained may be the first neural network model to be trained or the second neural network model to be trained.
  • the predetermined condition corresponds to the minimization of the loss function of the neural network model to be trained under the input of a certain number of images to be trained.
  • the predetermined condition is that the number of training times or training cycles corresponding to the neural network model to be trained reaches a predetermined number, and the predetermined number may be millions, as long as the number of images to be trained is large enough.
  • the first neural network model and the second neural network model can be trained separately using the above training process.
  • the sample image corresponding to the second neural network model needs to include the sample target area, and the sample image corresponding to the first neural network model may not Include the sample target area.
  • the first neural network model and the second neural network model can be trained simultaneously based on the same sample image and the image to be trained.
  • the sample image needs to include the sample target area.
  • the first neural network model and the second neural network model adopt different structures.
  • the first neural network model is a pix2pixHD model
  • the second neural network model is a SPADE model
  • the first neural network model is based on the overall image of the sample image. Training, the second neural network model is only trained based on the sample target area in the sample image, so that the first neural network model can perform the first clearing process on the whole image to be processed, and the second neural network model can perform the second clearing process on the target area 2. Clarification treatment.
  • Fig. 6A shows a schematic flowchart of obfuscation processing provided by at least one embodiment of the present disclosure. As shown in FIG. 6A, the blurring process may include steps S501-S504.
  • Step S501 acquiring texture slices.
  • texture tiles are the same size as the sample image.
  • Step S502 performing a first blurring process on the sample image to obtain a first blurred image.
  • the sharpness of the first blurred image is smaller than that of the sample image.
  • Step S503 performing color mixing processing on the first blurred image and the texture slice to obtain a second blurred image.
  • Step S504 performing a second blurring process on the second blurred image to obtain an image to be trained.
  • step S501 may include: acquiring at least one preset texture image; randomly selecting a preset texture image from at least one preset texture image as the target texture image; responding to the size of the target texture image and the sample image The size is the same, and the target texture image is used as a texture slice; in response to the size of the target texture image being larger than the size of the sample image, based on the size of the sample image, the target texture image is randomly cut to obtain a slice area with the same size as the sample image, Treat sliced regions as texture slices.
  • texture tiles are the same size as the sample image.
  • Fig. 6B is a schematic diagram of a texture slice provided by at least one embodiment of the present disclosure.
  • the texture slice has noise spots imitating photo noise (eg, film grain) and noise lines imitating scratches.
  • the noise spots and noise lines can be randomly generated or preset. , which is not limited in the present disclosure.
  • multiple preset texture images can be generated in advance.
  • the preset texture images have randomly distributed mottled spots and mottled lines.
  • the size of the preset texture image can be set larger than the size of the sample image.
  • the size of the target texture image may also be smaller than the size of the sample image, and then based on the size of the sample image, the target texture image is enlarged so that the size of the target texture image is the same as that of the sample image. If the dimensions are the same, the expanded target texture image is a texture slice.
  • the first blur processing includes Gaussian blur processing, noise addition processing, or a combination of Gaussian blur processing and noise addition processing based on any order and any number;
  • the second blur processing includes Gaussian blur processing, noise addition processing, or based on any order And any number of combinations of Gaussian blur processing and noise addition processing.
  • Gaussian Blur (Gaussian Blur) processing includes Gaussian Blur processing with the same or different blur parameters
  • noise addition processing includes noise addition processing with the same or different noise parameters
  • any number of Gaussian Blur processing blur parameters in combination processing They can be the same or different, and can be set according to actual needs.
  • the noise parameters of any number of noise addition processes in the combination process can also be the same or different, which is not limited in the present disclosure.
  • Gaussian blur processing can adjust the pixel values of pixels according to a Gaussian curve to achieve image blur.
  • Noise addition processing can generate image noise, such as Gaussian white noise, etc., and image noise is synthesized with the image to achieve image blur.
  • image noise such as Gaussian white noise, etc.
  • image noise is synthesized with the image to achieve image blur.
  • the Gaussian blur processing and the noise adding processing may be implemented in any relevant technical means in image processing, which is not limited in the present disclosure.
  • step S502 may specifically include: performing Gaussian blur processing on the sample image to obtain a first blurred image.
  • step S504 may specifically include: performing a second blurring process on the second blurred image to obtain an image to be trained, including: performing noise addition processing on the second blurred image to obtain an intermediate blurred image; performing Gaussian blurring on the intermediate blurred image processed to obtain images to be trained.
  • the color mixing processing includes one or more processings such as Screen processing, Addition processing, and Lighten Only processing.
  • step S503 may include: performing color filtering (Screen) processing on the first blurred image and the texture slice to obtain a second blurred image.
  • Screen color filtering
  • the pixels of the first blurred image are arranged in p rows and q columns
  • the pixels of the texture slice are arranged in p rows and q columns
  • the pixels of the second blurred image are arranged in p rows and q columns
  • both p and q are positive integers.
  • the number of bits of the pixel value of the pixel is 8 bits, that is, the range of the pixel value of each channel of the pixel is (0-255).
  • the calculation formula of the pixel value of the pixel is as follows:
  • Result_pix 255-[(255-fig1_pix)*(255-slice_pix)]/255 (Formula 1)
  • Result_pix is the pixel value of the pixel located in row t3 and column t4 in the second blurred image
  • fig1_pix is the pixel value of the pixel located in row t3 and column t4 in the first blurred image
  • slice_pix is the pixel value in the texture slice The pixel value of the pixel located at row t3 and column t4.
  • step S503 may include: performing lightening (Lighten Only) processing on the texture slice and the first blurred image to obtain the second blurred image.
  • the calculation formula of the pixel value of the pixel is as follows:
  • max(x, y) means to take the maximum value of x and y, and the specific meanings of other parameters are the same as those in formula 1, and will not be repeated here.
  • step S503 may include: performing layer addition (Addition) processing on the texture slice and the first blurred image to obtain the second blurred image.
  • Layer addition Additional
  • the calculation formula of the pixel value of the pixel is as follows:
  • color mixing process may also adopt other blending modes (Blend Mode) as required, which is not limited in the present disclosure.
  • FIG. 7A is a sample image provided by at least one embodiment of the present disclosure
  • FIG. 7B is an image to be trained provided by at least one embodiment of the present disclosure.
  • the image to be trained shown in FIG. The resulting image after the first blurring, color blending, and second blurring.
  • the sample image is a high-definition image.
  • the image to be trained corresponding to the sample image obtained after the first blurring process, color mixing process, and second blurring process in the aforementioned steps is shown in FIG. 7B.
  • the sharpness of the training image is smaller than that of the sample image, and there are simulated noises and scratches in the training image.
  • FIG. 8 is a schematic block diagram of an image processing device provided by at least one embodiment of the present disclosure.
  • the image processing apparatus 800 may include: an image acquisition unit 801 , a first processing unit 802 , a second processing unit 803 and a synthesis unit 804 .
  • these modules may be implemented by hardware (such as circuit) modules, software modules, or any combination of the two, and the following embodiments are the same as this, and will not be repeated here.
  • a central processing unit CPU
  • GPU graphics processing unit
  • TPU tensor processing unit
  • FPGA field programmable logic gate array
  • the processing units and corresponding computer instructions implement these units.
  • the image acquiring unit 801 is configured to acquire an image to be processed, wherein the image to be processed includes a target area.
  • the first processing unit 802 is configured to perform first sharpening processing on the image to be processed through the first neural network model to obtain a first intermediate image corresponding to the image to be processed, wherein the definition of the first intermediate image is greater than that of the image to be processed. Image clarity.
  • the second processing unit 803 is configured to perform a second sharpening process on the intermediate target area corresponding to the target area in the first intermediate image through the second neural network model, so as to obtain a second intermediate image corresponding to the intermediate target area.
  • the compositing unit 804 is configured to composite the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed.
  • the image acquisition unit 801, the first processing unit 802, the second processing unit 803, and the synthesis unit 804 may include codes and programs stored in memory; the processor may execute the codes and programs to realize the image acquisition unit as described above 801 , some or all of the functions of the first processing unit 802 , the second processing unit 803 and the synthesis unit 804 .
  • the image acquisition unit 801, the first processing unit 802, the second processing unit 803, and the synthesis unit 804 may be dedicated hardware devices, which are used to implement the image acquisition unit 801, the first processing unit 802, and the second processing unit described above. 803 and some or all of the functions of the synthesis unit 804.
  • the image acquiring unit 801 , the first processing unit 802 , the second processing unit 803 and the compositing unit 804 may be a circuit board or a combination of multiple circuit boards for realizing the functions described above.
  • the circuit board or a combination of multiple circuit boards may include: (1) one or more processors; (2) one or more non-transitory memories connected to the processors; and (3) Processor-executable firmware stored in memory.
  • the image acquisition unit 801 can be used to realize the step S10 shown in FIG. 1
  • the first processing unit 802 can be used to realize the step S20 shown in FIG.
  • the combining unit 804 can be used to realize the step S40 shown in FIG. 1 . Therefore, for a specific description of the functions that can be realized by the image acquisition unit 801, the first processing unit 802, the second processing unit 803, and the synthesis unit 804, reference may be made to the relevant descriptions of steps S10 to S40 in the above-mentioned embodiment of the image processing method, and repeat The place will not be repeated.
  • the image processing apparatus 800 can achieve technical effects similar to those of the aforementioned image processing method, which will not be repeated here.
  • the image processing device 800 may include more or fewer circuits or units, and the connection relationship between the various circuits or units is not limited, and may be determined according to actual needs .
  • the specific configuration of each circuit or unit is not limited, and may be composed of analog devices according to circuit principles, or may be composed of digital chips, or in other suitable ways.
  • FIG. 9 is a schematic diagram of an electronic device provided by at least one embodiment of the present disclosure.
  • the electronic device includes a processor 901 , a communication interface 902 , a memory 903 and a communication bus 904 .
  • the processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904, and the processor 901, the communication interface 902, the memory 903 and other components may also communicate with each other through a network connection.
  • the present disclosure does not limit the type and function of the network here. It should be noted that the components of the electronic device shown in FIG. 9 are exemplary rather than limiting, and the electronic device may also have other components according to actual application requirements.
  • memory 903 is used to store computer readable instructions on a non-transitory basis.
  • processor 901 is configured to execute computer-readable instructions, implement the image processing method according to any one of the foregoing embodiments.
  • the specific implementation of each step of the image processing method and related explanations reference may be made to the above-mentioned embodiment of the image processing method, and details are not repeated here.
  • communication bus 904 may be a Peripheral Component Interconnect Standard (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like.
  • PCI Peripheral Component Interconnect Standard
  • EISA Extended Industry Standard Architecture
  • the communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
  • the communication interface 902 is used to implement communication between the electronic device and other devices.
  • the processor 901 and the memory 903 may be set at the server (or cloud).
  • the processor 901 can control other components in the electronic device to perform desired functions.
  • the processor 901 may be a device with data processing capability and/or program execution capability such as a central processing unit (CPU), a network processor (NP), a tensor processing unit (TPU) or a graphics processing unit (GPU); it may also be Digital Signal Processor (DSP), Application Specific Integrated Circuit (ASIC), Field Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
  • the central processing unit (CPU) may be an X86 or ARM architecture or the like.
  • memory 903 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory.
  • the volatile memory may include random access memory (RAM) and/or cache memory (cache), etc., for example.
  • Non-volatile memory may include, for example, read only memory (ROM), hard disks, erasable programmable read only memory (EPROM), compact disc read only memory (CD-ROM), USB memory, flash memory, and the like.
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • CD-ROM compact disc read only memory
  • USB memory flash memory
  • flash memory flash memory
  • the electronic device may further include an image acquisition component.
  • the image acquisition component is used to acquire images.
  • the memory 903 is also used to store acquired images.
  • the image acquisition component may be a camera of a smartphone, a camera of a tablet computer, a camera of a personal computer, a lens of a digital camera, or even a webcam.
  • Fig. 10 is a schematic diagram of a non-transitory computer-readable storage medium provided by at least one embodiment of the present disclosure.
  • the storage medium 1000 may be a non-transitory computer-readable storage medium, and one or more computer-readable instructions 1001 may be non-transitorily stored on the storage medium 1000 .
  • the computer-readable instructions 1001 are executed by the processor, one or more steps in the image processing method described above may be performed.
  • the storage medium 1000 may be applied to the above-mentioned electronic device, for example, the storage medium 1000 may include a memory in the electronic device.
  • the storage medium may include a memory card of a smartphone, a storage unit of a tablet computer, a hard disk of a personal computer, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM), Portable compact disc read-only memory (CD-ROM), flash memory, or any combination of the above-mentioned storage media may also be other applicable storage media.
  • RAM random access memory
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • CD-ROM Portable compact disc read-only memory
  • flash memory or any combination of the above-mentioned storage media may also be other applicable storage media.
  • Fig. 11 shows a schematic diagram of a hardware environment provided for at least one embodiment of the present disclosure.
  • the electronic device provided by the present disclosure can be applied in the Internet system.
  • the functions of the image processing apparatus and/or electronic equipment involved in the present disclosure can be realized by using the computer system provided in FIG. 11 .
  • Such computer systems can include personal computers, laptops, tablets, mobile phones, personal digital assistants, smart glasses, smart watches, smart rings, smart helmets, and any smart portable or wearable device.
  • the specific system in this embodiment illustrates a hardware platform including a user interface using functional block diagrams.
  • Such computer equipment may be a general purpose computer equipment or a special purpose computer equipment. Both computer devices can be used to realize the image processing device and/or electronic device in this embodiment.
  • the computer system may include any components that implement the presently described information needed to achieve image processing.
  • a computer system can be realized by a computer device through its hardware devices, software programs, firmware, and combinations thereof.
  • the relevant computer functions for realizing the information required for image processing described in this embodiment can be implemented by a group of similar platforms in a distributed manner, Distribute the processing load of a computer system.
  • the computer system can include a communication port 250, which is connected to a network for data communication, for example, the computer system can send and receive information and data through the communication port 250, that is, the communication port 250 can realize the communication between the computer system and the computer system.
  • Other electronic devices communicate wirelessly or by wire to exchange data.
  • the computer system may also include a processor group 220 (ie, the processor described above) for executing program instructions.
  • the processor group 220 may consist of at least one processor (eg, CPU).
  • the computer system may include an internal communication bus 210 .
  • a computer system may include different forms of program storage units and data storage units (i.e., memory or storage media described above), such as hard disk 270, read-only memory (ROM) 230, random access memory (RAM) 240, which can be used to store Various data files used by the computer for processing and/or communicating, and possibly program instructions executed by the processor group 220 .
  • the computer system may also include an input/output component 260 for enabling input/output data flow between the computer system and other components (eg, user interface 280, etc.).
  • the following devices can be connected to the input/output assembly 260: input devices including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibrator, etc. output devices; storage devices including, for example, magnetic tapes, hard disks, etc.; and communication interfaces.
  • input devices including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.
  • LCD liquid crystal display
  • speaker vibrator
  • storage devices including, for example, magnetic tapes, hard disks, etc.
  • communication interfaces for example, magnetic tapes, hard disks, etc.
  • FIG. 11 shows a computer system with various devices, it should be understood that the computer system is not required to have all of the devices shown and, instead, the computer system may have more or fewer devices.

Abstract

An image processing method, comprising: acquiring an image to be processed (S10), the image to be processed comprising a target region; by means of a first neural network model, performing first clarification processing on the image to be processed to obtain a first intermediate image corresponding to the image to be processed (S20), the clarity of the first intermediate image being greater than the clarity of the image to be processed; by means of a second neural network model, performing second clarification processing on an intermediate target region corresponding to the target region in the first intermediate image to obtain a second intermediate image corresponding to the intermediate target region (S30); and performing synthesis processing on the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed (S40). The image processing method optimises the target region, and then synthesises the optimised target area and the first intermediate image, increasing the clarity of the synthesised image, and obtaining an image with high clarity and richer detail. Also disclosed are an image processing apparatus, an electronic device, and a storage medium.

Description

图像处理方法及装置、电子设备和存储介质Image processing method and device, electronic device and storage medium 技术领域technical field
本公开的实施例涉及一种图像处理方法、图像处理装置、电子设备和非瞬时性计算机可读存储介质。Embodiments of the present disclosure relate to an image processing method, an image processing apparatus, electronic equipment, and a non-transitory computer-readable storage medium.
背景技术Background technique
得益于硬件的迅猛发展,短短几年间,手机已更新了数代,老手机拍下的照片在大分辨率的屏幕上变得模糊起来。此外,年代久远的老照片由于当时的拍摄技术受限,图像清晰度低,图像细节不够丰富。在这种情景下,需要将原有的清晰度较低的图像进行清晰化处理,以得到清晰度较高的图像。Thanks to the rapid development of hardware, several generations of mobile phones have been updated in just a few years, and the photos taken by old mobile phones become blurred on the large-resolution screen. In addition, due to the limited shooting technology at that time, the old photos with a long history have low image clarity and insufficient image details. In this situation, the original low-resolution image needs to be sharpened to obtain a high-resolution image.
发明内容Contents of the invention
本公开至少一实施例提供一种图像处理方法,包括:获取待处理图像,其中,所述待处理图像包括目标区域;通过第一神经网络模型对所述待处理图像进行第一清晰化处理,以得到所述待处理图像对应的第一中间图像,其中,所述第一中间图像的清晰度大于所述待处理图像的清晰度;通过第二神经网络模型对所述第一中间图像中与所述目标区域对应的中间目标区域进行第二清晰化处理,以得到所述中间目标区域对应的第二中间图像;对所述第一中间图像和所述第二中间图像进行合成处理,以得到与所述待处理图像对应的合成图像。At least one embodiment of the present disclosure provides an image processing method, including: acquiring an image to be processed, wherein the image to be processed includes a target area; performing a first sharpening process on the image to be processed by using a first neural network model, To obtain the first intermediate image corresponding to the image to be processed, wherein the definition of the first intermediate image is greater than the definition of the image to be processed; through the second neural network model in the first intermediate image and Performing a second sharpening process on the intermediate target area corresponding to the target area to obtain a second intermediate image corresponding to the intermediate target area; performing synthesis processing on the first intermediate image and the second intermediate image to obtain A composite image corresponding to the image to be processed.
可选的,在本公开至少一实施例提供的图像处理方法中,在通过第二神经网络模型对所述第一中间图像中与所述目标区域对应的中间目标区域进行第二清晰化处理,以得到与所述中间目标区域对应的第二中间图像之前,该图像处理方法还包括:通过第三神经网络模型对所述第一中间图像进行识别处理,以得到在所述第一中间图像中与所述目标区域对应的所述中间目标区域。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, after performing a second sharpening process on the intermediate target area corresponding to the target area in the first intermediate image through the second neural network model, Before obtaining the second intermediate image corresponding to the intermediate target area, the image processing method further includes: performing recognition processing on the first intermediate image through a third neural network model, so as to obtain the first intermediate image in the first intermediate image The intermediate target area corresponding to the target area.
可选的,在本公开至少一实施例提供的图像处理方法中,所述第二中间图像的清晰度大于所述中间目标区域的清晰度。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, the definition of the second intermediate image is greater than the definition of the intermediate target area.
可选的,在本公开至少一实施例提供的图像处理方法中,对所述第一中间图像和所述第二中间图像进行合成处理,以得到与所述待处理图像对应的合成图像,包括:基于所述第一中间图像的色调,对所述第二中间图像进行色调处理,以得到第三中间图像,其中,所述第三中间图像的色调趋于所述第一中间图像的色调;对所述第一中间图像和所述第三中间图像进行图像合并处理,以得到所述合成图像。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, performing composite processing on the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed includes : performing tone processing on the second intermediate image based on the tone of the first intermediate image to obtain a third intermediate image, wherein the tone of the third intermediate image tends to the tone of the first intermediate image; performing image combination processing on the first intermediate image and the third intermediate image to obtain the synthesized image.
可选的,在本公开至少一实施例提供的图像处理方法中,所述目标区域为人脸区域。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, the target area is a human face area.
可选的,在本公开至少一实施例提供的图像处理方法中,所述第一神经网络模型与所述第二神经网络模型不同。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, the first neural network model is different from the second neural network model.
可选的,在本公开至少一实施例提供的图像处理方法中,在通过第一神经网络模型对所述待处理图像进行第一清晰化处理之前,所述图像处理方法还包括:获取样本图像;对所述样本图像进行模糊处理,以得到待训练图像,其中,所述待训练图像的清晰度小于所述样本图像的清晰度;基于所述样本图像和所述待训练图像,对待训练的第一神经网络模型和待训练的第二神经网络模型进行训练,以得到所述第一神经网络模型和所述第二神经网络模型。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, before the first sharpening process is performed on the image to be processed through the first neural network model, the image processing method further includes: acquiring a sample image ; blurring the sample image to obtain an image to be trained, wherein the definition of the image to be trained is smaller than the definition of the sample image; based on the sample image and the image to be trained, the image to be trained The first neural network model and the second neural network model to be trained are trained to obtain the first neural network model and the second neural network model.
可选的,在本公开至少一实施例提供的图像处理方法中,对所述样本图像进行模糊处理,以得到待训练图像,包括:获取纹理切片,其中,所述纹理切片的尺寸与所述样本图像的尺寸相同;对所述样本图像进行第一模糊处理,以得到第一模糊图像,其中,所述第一模糊图像的清晰度小于所述样本图像的清晰度;将所述第一模糊图像与所述纹理切片进行颜色混合处理,以得到第二模糊图像;对所述第二模糊图像进行第二模糊处理,以得到所述待训练图像。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, performing blurring processing on the sample image to obtain an image to be trained includes: obtaining a texture slice, wherein the size of the texture slice is the same as the The size of the sample images is the same; the first blurring process is performed on the sample images to obtain a first blurred image, wherein the definition of the first blurred image is smaller than the definition of the sample image; the first blurred performing color mixing processing on the image and the texture slice to obtain a second blurred image; performing second blurring processing on the second blurred image to obtain the image to be trained.
可选的,在本公开至少一实施例提供的图像处理方法中,获取纹理切片,包括:获取至少一张预设纹理图像;从所述至少一张预设纹理图像中随机选择一张预设纹理图像,作为目标纹理图像;响应于所述目标纹理图像的尺寸与所述样本图像的尺寸相同,将所述目标纹理图像作为所述纹理切片;响应于所述目标纹理图像的尺寸大于所述样本图像的尺寸,基于所述样本图像的尺寸,对所述目标纹理图像进行随机切割,以得到与所述样本图像的尺寸相同的切片区域,将所述切片区域作为所述纹理切片。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, acquiring a texture slice includes: acquiring at least one preset texture image; randomly selecting a preset texture image from the at least one preset texture image A texture image, as a target texture image; in response to the size of the target texture image being the same as the size of the sample image, using the target texture image as the texture slice; in response to a size larger than the target texture image For the size of the sample image, randomly cut the target texture image based on the size of the sample image to obtain a slice area with the same size as the sample image, and use the slice area as the texture slice.
可选的,在本公开至少一实施例提供的图像处理方法中,所述第一模糊处理包括高斯模糊处理、噪声添加处理或基于任意顺序及任意数量的所述高斯模糊处理和所述噪声添加处理构成的组合处理;所述第二模糊处理包括所述高斯模糊处理、所述噪声添加处理或基于任意顺序及任意数量的所述高斯模糊处理和所述噪声添加处理构成的组合处理。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, the first blurring includes Gaussian blurring, noise addition, or Gaussian blurring and noise addition in any order and in any number Combination processing composed of processing; the second blur processing includes the Gaussian blur processing, the noise addition processing, or a combination processing based on any order and any number of the Gaussian blur processing and the noise addition processing.
可选的,在本公开至少一实施例提供的图像处理方法中,对所述样本图像进行第一模糊处理,以得到第一模糊图像,包括:对所述样本图像进行所述高斯模糊处理,以得到所述第一模糊图像;对所述第二模糊图像进行第二模糊处理,以得到所述待训练图像,包括:对所述第二模糊图像进行所述噪声添加处理,以得到中间模糊图像;对所述中间模糊图像进行所述高斯模糊处理,以得到所述待训练图像。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, performing a first blurring process on the sample image to obtain a first blurred image includes: performing the Gaussian blurring process on the sample image, to obtain the first blurred image; performing a second blurring process on the second blurred image to obtain the image to be trained, including: performing the noise addition process on the second blurred image to obtain an intermediate blur image; performing the Gaussian blur processing on the intermediate blurred image to obtain the image to be trained.
可选的,在本公开至少一实施例提供的图像处理方法中,将所述第一模糊图像与所述纹理切片进行颜色混合处理,以得到第二模糊图像,包括:对所述第一模糊图像和所述纹理切片进行滤色处理,以得到所述第二模糊图像。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, performing color mixing processing on the first blurred image and the texture slice to obtain a second blurred image includes: performing a color mixing process on the first blurred image The image and the texture slice are subjected to color filtering processing to obtain the second blurred image.
可选的,在本公开至少一实施例提供的图像处理方法中,将所述第一模糊图像与所述纹理切片进行颜色混合处理,以得到第二模糊图像,包括:对所述纹理切片和所述第一模糊图像进行加亮处理,以得到所述第二模糊图像。Optionally, in the image processing method provided in at least one embodiment of the present disclosure, performing color mixing processing on the first blurred image and the texture slice to obtain a second blurred image includes: processing the texture slice and the texture slice The first blurred image is highlighted to obtain the second blurred image.
本公开至少一实施例提供一种图像处理装置,包括:图像获取单元,配置为获取待处理图像,其中,所述待处理图像包括目标区域;第一处理单元,配置为通过第一神经网络 模型对所述待处理图像进行第一清晰化处理,以得到所述待处理图像对应的第一中间图像,其中,所述第一中间图像的清晰度大于所述待处理图像的清晰度;第二处理单元,配置为通过第二神经网络模型对所述第一中间图像中与所述目标区域对应的中间目标区域进行第二清晰化处理,以得到所述中间目标区域对应的第二中间图像;合成单元,配置为对所述第一中间图像和所述第二中间图像进行合成处理,以得到与所述待处理图像对应的合成图像。At least one embodiment of the present disclosure provides an image processing device, including: an image acquisition unit configured to acquire an image to be processed, wherein the image to be processed includes a target area; a first processing unit configured to use a first neural network model performing a first sharpening process on the image to be processed to obtain a first intermediate image corresponding to the image to be processed, wherein the definition of the first intermediate image is greater than that of the image to be processed; second A processing unit configured to perform a second sharpening process on an intermediate target area corresponding to the target area in the first intermediate image through a second neural network model, so as to obtain a second intermediate image corresponding to the intermediate target area; A compositing unit configured to composite the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed.
可选的,在本公开至少一实施例提供的图像处理装置中,所述合成单元包括色调处理模块和图像合并处理模块,所述色调处理模块被配置为基于所述第一中间图像的色调,对所述第二中间图像进行色调处理,以得到第三中间图像,其中,所述第三中间图像的色调趋于所述第一中间图像的色调;所述图像合并处理模块被配置为对所述第一中间图像和所述第三中间图像进行图像合并处理,以得到所述合成图像。Optionally, in the image processing device provided in at least one embodiment of the present disclosure, the composition unit includes a tone processing module and an image combination processing module, and the tone processing module is configured to, based on the tone of the first intermediate image, performing tone processing on the second intermediate image to obtain a third intermediate image, wherein the tone of the third intermediate image tends to the tone of the first intermediate image; the image combining processing module is configured to performing image combination processing on the first intermediate image and the third intermediate image to obtain the synthesized image.
本公开至少一实施例提供一种电子设备,包括:存储器,非瞬时性地存储有计算机可执行指令;处理器,配置为运行所述计算机可执行指令,其中,所述计算机可执行指令被所述处理器运行时实现根据本公开任一实施例所述的图像处理方法。At least one embodiment of the present disclosure provides an electronic device, including: a memory storing computer-executable instructions in a non-transitory manner; a processor configured to run the computer-executable instructions, wherein the computer-executable instructions are executed by the The processor implements the image processing method according to any embodiment of the present disclosure when running.
本公开至少一实施例提供一种非瞬时性计算机可读存储介质,其中,所述非瞬时性计算机可读存储介质存储有计算机可执行指令,所述计算机可执行指令被处理器执行时实现根据本公开任一实施例所述的图像处理方法。At least one embodiment of the present disclosure provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the computer-executable instructions according to The image processing method described in any embodiment of the present disclosure.
附图说明Description of drawings
为了更清楚地说明本公开实施例的技术方案,下面将对实施例的附图作简单地介绍,显而易见地,下面描述中的附图仅仅涉及本公开的一些实施例,而非对本公开的限制。In order to illustrate the technical solutions of the embodiments of the present disclosure more clearly, the accompanying drawings of the embodiments will be briefly introduced below. Obviously, the accompanying drawings in the following description only relate to some embodiments of the present disclosure, rather than limiting the present disclosure .
图1为本公开至少一实施例提供的一种图像处理方法的示意性流程图;Fig. 1 is a schematic flowchart of an image processing method provided by at least one embodiment of the present disclosure;
图2为本公开至少一实施例提供的待处理图像的示意图;Fig. 2 is a schematic diagram of an image to be processed provided by at least one embodiment of the present disclosure;
图3为本公开至少一实施例提供的第一中间图像的示意图;Fig. 3 is a schematic diagram of a first intermediate image provided by at least one embodiment of the present disclosure;
图4A为本公开至少一实施例提供的中间目标区域的示意图;FIG. 4A is a schematic diagram of an intermediate target area provided by at least one embodiment of the present disclosure;
图4B为本公开至少一实施例提供的第二中间图像的示意图;Fig. 4B is a schematic diagram of a second intermediate image provided by at least one embodiment of the present disclosure;
图5A为本公开至少一实施例提供的第三中间图像的示意图;Fig. 5A is a schematic diagram of a third intermediate image provided by at least one embodiment of the present disclosure;
图5B为本公开一实施例提供的一种合成图像的示意图;FIG. 5B is a schematic diagram of a synthesized image provided by an embodiment of the present disclosure;
图6A示出了本公开至少一实施例提供的模糊处理的示意性流程图;Fig. 6A shows a schematic flowchart of obfuscation processing provided by at least one embodiment of the present disclosure;
图6B为本公开至少一实施例提供的纹理切片的示意图;Fig. 6B is a schematic diagram of a texture slice provided by at least one embodiment of the present disclosure;
图7A为本公开至少一实施例提供的样本图像;Fig. 7A is a sample image provided by at least one embodiment of the present disclosure;
图7B为本公开至少一实施例提供的待训练图像;Fig. 7B is an image to be trained provided by at least one embodiment of the present disclosure;
图8为本公开至少一实施例提供的一种图像处理装置的示意性框图;Fig. 8 is a schematic block diagram of an image processing device provided by at least one embodiment of the present disclosure;
图9为本公开至少一实施例提供的一种电子设备的示意图;Fig. 9 is a schematic diagram of an electronic device provided by at least one embodiment of the present disclosure;
图10为本公开至少一实施例提供的一种非瞬时性计算机可读存储介质的示意图;Fig. 10 is a schematic diagram of a non-transitory computer-readable storage medium provided by at least one embodiment of the present disclosure;
图11为本公开至少一实施例提供的一种硬件环境的示意图。Fig. 11 is a schematic diagram of a hardware environment provided by at least one embodiment of the present disclosure.
具体实施方式Detailed ways
为了使得本公开实施例的目的、技术方案和优点更加清楚,下面将结合本公开实施例的附图,对本公开实施例的技术方案进行清楚、完整地描述。显然,所描述的实施例是本公开的一部分实施例,而不是全部的实施例。基于所描述的本公开的实施例,本领域普通技术人员在无需创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present disclosure clearer, the technical solutions of the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings of the embodiments of the present disclosure. Apparently, the described embodiments are some of the embodiments of the present disclosure, not all of them. Based on the described embodiments of the present disclosure, all other embodiments obtained by persons of ordinary skill in the art without creative effort fall within the protection scope of the present disclosure.
除非另外定义,本公开使用的技术术语或者科学术语应当为本公开所属领域内具有一般技能的人士所理解的通常意义。本公开中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。“包括”或者“包含”等类似的词语意指出现该词前面的元件或者物件涵盖出现在该词后面列举的元件或者物件及其等同,而不排除其他元件或者物件。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则该相对位置关系也可能相应地改变。为了保持本公开实施例的以下说明清楚且简明,本公开省略了部分已知功能和已知部件的详细说明。Unless otherwise defined, the technical terms or scientific terms used in the present disclosure shall have the usual meanings understood by those skilled in the art to which the present disclosure belongs. "First", "second" and similar words used in the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Comprising" or "comprising" and similar words mean that the elements or items appearing before the word include the elements or items listed after the word and their equivalents, without excluding other elements or items. Words such as "connected" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "Down", "Left", "Right" and so on are only used to indicate the relative positional relationship. When the absolute position of the described object changes, the relative positional relationship may also change accordingly. In order to keep the following description of the embodiments of the present disclosure clear and concise, the present disclosure omits detailed descriptions of some known functions and known components.
对于存放多年的老照片或者其他清晰度不够的图像,可以对其进行图像清晰化处理使得其细节栩栩如生,深度学习的出现使得对图像的语义级操作成为可能,从而可以利用例如卷积神经网络对图像进行语义级操作,以实现图像的高清细节重现。For old photos that have been stored for many years or other images that are not clear enough, they can be processed to make their details vivid. The emergence of deep learning makes it possible to operate on the semantic level of images, so that convolutional neural networks can be used, for example, to The image is manipulated at the semantic level to achieve high-definition detail reproduction of the image.
对于人脸图像,不同于例如风景、物体等其他对象,人脸图像的细节非常丰富,例如脸部纹路特征等,因此在对包含人脸图像的图像进行清晰化处理的过程中,采用传统方式所得到的人脸图像的清晰度不够,纹路特征不够明确,且经常会出现图像噪声。For face images, unlike other objects such as landscapes and objects, the details of face images are very rich, such as facial texture features, etc. Therefore, in the process of clearing images containing face images, the traditional method The obtained face image is not clear enough, the texture features are not clear enough, and image noise often appears.
本公开至少一实施例提供一种图像处理方法、图像处理装置、电子设备和非瞬时性计算机可读存储介质,该图像处理方法包括:获取待处理图像,其中,待处理图像包括目标区域;通过第一神经网络模型对待处理图像进行第一清晰化处理,以得到待处理图像对应的第一中间图像,其中,第一中间图像的清晰度大于待处理图像的清晰度;通过第二神经网络模型对第一中间图像中与目标区域对应的中间目标区域进行第二清晰化处理,以得到中间目标区域对应的第二中间图像;对第一中间图像和第二中间图像进行合成处理,以得到与待处理图像对应的合成图像。At least one embodiment of the present disclosure provides an image processing method, an image processing device, an electronic device, and a non-transitory computer-readable storage medium. The image processing method includes: acquiring an image to be processed, wherein the image to be processed includes a target area; The first neural network model performs the first sharpening process on the image to be processed to obtain the first intermediate image corresponding to the image to be processed, wherein the definition of the first intermediate image is greater than the definition of the image to be processed; through the second neural network model Performing a second sharpening process on the intermediate target area corresponding to the target area in the first intermediate image to obtain a second intermediate image corresponding to the intermediate target area; performing composite processing on the first intermediate image and the second intermediate image to obtain a Composite image corresponding to the image to be processed.
该图像处理方法在对待处理图像进行第一清晰化处理后,再对目标区域进行第二清晰化处理,针对目标区域进行特殊优化,再将优化后的目标区域与第一中间图像进行合成,从而可以提高合成图像的清晰度,得到高清晰度且细节更加丰富的图像。In this image processing method, after the first clearing process is performed on the image to be processed, the second clearing process is performed on the target area, and special optimization is performed on the target area, and then the optimized target area is synthesized with the first intermediate image, thereby It can improve the clarity of the synthesized image, and obtain a high-definition image with richer details.
本公开实施例提供的图像处理方法可以应用在移动终端(例如,手机、平板电脑等)中,在提高处理速度的基础上,提高合成图像的清晰度,还可以实现对移动终端采集的图 像进行实时的清晰化处理。The image processing method provided by the embodiment of the present disclosure can be applied in a mobile terminal (such as a mobile phone, a tablet computer, etc.), and on the basis of improving the processing speed, the definition of the synthesized image can be improved, and the image collected by the mobile terminal can also be processed. Real-time sharpening.
需要说明的是,本公开实施例提供的图像处理方法可应用于本公开实施例提供的图像处理装置,该图像处理装置可被配置于电子设备上。该电子设备可以是个人计算机、移动终端等,该移动终端可以是手机、平板电脑等具有各种操作系统的硬件设备。It should be noted that the image processing method provided in the embodiment of the present disclosure can be applied to the image processing device provided in the embodiment of the present disclosure, and the image processing device can be configured on an electronic device. The electronic device may be a personal computer, a mobile terminal, etc., and the mobile terminal may be a hardware device with various operating systems, such as a mobile phone and a tablet computer.
下面结合附图对本公开的实施例进行详细说明,但是本公开并不限于这些具体的实施例。Embodiments of the present disclosure will be described in detail below with reference to the accompanying drawings, but the present disclosure is not limited to these specific embodiments.
图1为本公开至少一实施例提供的一种图像处理方法的示意性流程图。图2为本公开至少一实施例提供的一种初始图像的示意图。Fig. 1 is a schematic flowchart of an image processing method provided by at least one embodiment of the present disclosure. Fig. 2 is a schematic diagram of an initial image provided by at least one embodiment of the present disclosure.
如图1所示,本公开至少一实施例提供的图像处理方法包括步骤S10至步骤S40。As shown in FIG. 1 , the image processing method provided by at least one embodiment of the present disclosure includes steps S10 to S40.
步骤S10,获取待处理图像。Step S10, acquiring an image to be processed.
例如,待处理图像包括目标区域。For example, the image to be processed includes a target area.
步骤S20,通过第一神经网络模型对待处理图像进行第一清晰化处理,以得到待处理图像对应的第一中间图像。In step S20, the first sharpening process is performed on the image to be processed through the first neural network model to obtain a first intermediate image corresponding to the image to be processed.
例如,第一中间图像的清晰度大于待处理图像的清晰度。For example, the resolution of the first intermediate image is greater than the resolution of the image to be processed.
步骤S30,通过第二神经网络模型对第一中间图像中与目标区域对应的中间目标区域进行第二清晰化处理,以得到中间目标区域对应的第二中间图像。Step S30 , performing a second sharpening process on the intermediate target area corresponding to the target area in the first intermediate image through the second neural network model, so as to obtain a second intermediate image corresponding to the intermediate target area.
步骤S40,对第一中间图像和第二中间图像进行合成处理,以得到与待处理图像对应的合成图像。Step S40, performing composite processing on the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed.
例如,在步骤S10中获取的待处理图像可以为各种类型的图像,例如可以为风景图像、人物图像、物品图像等,例如风景图像可以包括山川、河流、植物、动物、天空等风景对象,人物图像为包括人(例如,人脸等)的图像,例如人物图像可以包括人脸区域,物品图像可以包括车辆、房屋等物品对象。当然,人物图像除人脸区域外,也可以包括风景对象、物品对象等对应的区域。例如,在一些实施例中,待处理图像可以为人物图像,例如可以为人的证件照,例如,在另一些实施例中,待处理图像也可以为带有风景对象或物品对象的人物图像。For example, the images to be processed acquired in step S10 can be various types of images, such as landscape images, person images, item images, etc., for example, landscape images can include landscape objects such as mountains, rivers, plants, animals, and sky, A person image is an image including a person (for example, a human face, etc.). For example, a person image may include a human face area, and an item image may include items such as vehicles and houses. Of course, in addition to the face area, the person image may also include areas corresponding to landscape objects, object objects, and the like. For example, in some embodiments, the image to be processed may be a person image, such as a person's ID photo. For example, in some other embodiments, the image to be processed may also be a person image with a landscape object or an article object.
例如,待处理图像的形状可以为矩形等。待处理图像的形状和尺寸等可以由用户根据实际情况自行设定。For example, the shape of the image to be processed may be a rectangle or the like. The shape and size of the image to be processed can be set by the user according to the actual situation.
例如,待处理图像可以为清晰度较低的模糊图像,例如,待处理图像可以为通过图像采集装置(例如,数码相机或手机等)拍摄的图像,该图像在大分辨率的屏幕上清晰度较低。例如,待处理图像可以通过扫描等方式得到,例如,待处理图像可以为对年代久远的老照片进行扫描或拍摄所得到的图像。又例如,待处理图像可以为对高清图像进行图像压缩以便于传输所得到的图像。For example, the image to be processed can be a blurred image with low definition. lower. For example, the image to be processed may be obtained by scanning or the like, for example, the image to be processed may be an image obtained by scanning or photographing an old photo with a long history. For another example, the image to be processed may be an image obtained by performing image compression on a high-definition image to facilitate transmission.
待处理图像可以为灰度图像,也可以为彩色图像。例如,为了避免待处理图像的数据质量、数据不均衡等对图像处理的影响,在处理待处理图像前,本公开的至少一实施例提供的图像处理方法还可以包括对待处理图像进行预处理的操作。预处理例如可以包括对待 处理图像进行剪裁、伽玛(Gamma)校正或降噪滤波等处理。预处理可以消除待处理图像中的无关信息或噪声信息,以便于后续更好地对待处理图像进行图像处理。The image to be processed can be a grayscale image or a color image. For example, in order to avoid the influence of data quality and data imbalance of the image to be processed on the image processing, before processing the image to be processed, the image processing method provided by at least one embodiment of the present disclosure may also include preprocessing the image to be processed operate. Preprocessing may include, for example, cropping, gamma (Gamma) correction, or noise reduction filtering on the image to be processed. Preprocessing can eliminate irrelevant information or noise information in the image to be processed, so as to facilitate subsequent image processing of the image to be processed.
例如,目标区域可以为包括目标的区域,目标可以为人脸,从而目标区域可以为人脸区域。需要说明的是,根据图像处理需求,可以选择其他对象作为目标,例如,选择动物、车辆等作为目标,此时,目标区域为包括动物(例如,猫)的区域或包括车辆的区域,本公开对此不作限制。For example, the target area may be an area including the target, and the target may be a human face, so the target area may be a human face area. It should be noted that, according to image processing requirements, other objects can be selected as targets, for example, animals, vehicles, etc. are selected as targets. At this time, the target area is an area including animals (eg, cats) or an area including vehicles. There is no limit to this.
例如,如图2所示,待处理图像可以为人物图像且包括人脸,目标区域为待处理图像中包括人脸的人脸区域,该人物图像通过对年代较远的老照片进行扫描或拍摄得到,从图2可以看出,该待处理图像的清晰度较低,图像细节缺失,且存在图像噪声。For example, as shown in Figure 2, the image to be processed can be a person image and includes a human face, and the target area is the face area that includes a human face in the image to be processed. It can be seen from Fig. 2 that the resolution of the image to be processed is low, the image details are missing, and there is image noise.
例如,在步骤S20中,通过训练好的第一神经网络模型对待处理图像进行第一清晰化处理,获得清晰度更高的第一中间图像,也即第一中间图像的清晰度大于待处理图像的清晰度。For example, in step S20, the image to be processed is first cleared through the trained first neural network model to obtain a first intermediate image with higher definition, that is, the definition of the first intermediate image is greater than that of the image to be processed clarity.
例如,第一神经网络模型可以采用pix2pixHD(pixel to pixel HD)模型,该pix2pixHD模型利用多级生成器(coarse-to-fine generator)以及多尺度的判别器(multi-scale discriminator)等方式对待处理图像进行第一清晰化处理,生成高分辨率、高清晰度的第一中间图像。该pix2pixHD模型的生成器包括全局生成网络部分(global generator network)和局部增强网络部分(local enhancer network),全局生成网络部分采用U-Net结构,全局生成网络部分输出的特征与局部增强网络部分提取的特征融合,并作为局部增强网络部分的输入信息,由局部增强网络部分基于融合后信息输出高分辨率、高清晰度的图像。For example, the first neural network model may adopt a pix2pixHD (pixel to pixel HD) model, which uses a multi-level generator (coarse-to-fine generator) and a multi-scale discriminator (multi-scale discriminator) to treat The first sharpening process is performed on the image to generate a high-resolution, high-definition first intermediate image. The generator of the pix2pixHD model includes a global generator network (global generator network) and a local enhancer network (local enhancer network). The global generator network part adopts the U-Net structure, and the features output by the global generator network part are extracted from the local enhancement network part. The feature fusion of the local enhancement network is used as the input information of the local enhancement network part, and the local enhancement network part outputs high-resolution and high-definition images based on the fused information.
针对第一神经网络模型的训练过程如后文所述,这里不再赘述。The training process for the first neural network model is described later and will not be repeated here.
图3为本公开至少一实施例提供的对图2所示的待处理图像进行第一清晰化处理后所得到的第一中间图像的示意图。如图3所示,相比于图2所示的待处理图像,经过第一清晰化处理后的第一中间图像的清晰度得到了极大提高,但这种清晰化针对的是待处理图像的全局清晰化,无法针对目标区域,例如人脸区域,进行特殊优化,例如无法提供目标区域的高清细节,并且所得到的第一中间图像还会存在杂色线条等图像噪声。Fig. 3 is a schematic diagram of a first intermediate image obtained after performing a first sharpening process on the image to be processed shown in Fig. 2 according to at least one embodiment of the present disclosure. As shown in Figure 3, compared with the image to be processed shown in Figure 2, the definition of the first intermediate image after the first sharpening process has been greatly improved, but this sharpening is aimed at the image to be processed The global sharpening of the target area, such as the face area, cannot be specially optimized, for example, the high-definition details of the target area cannot be provided, and the obtained first intermediate image will also have image noise such as variegated lines.
例如,除了清晰度的差异,第一中间图像和待处理图像的其他性质(例如,尺寸等)均完全或基本相同。For example, except for the difference in sharpness, other properties (eg, size, etc.) of the first intermediate image and the image to be processed are completely or substantially the same.
例如,在步骤S30中,中间目标区域为第一中间图像中与目标区域对应的区域。中间目标区域的尺寸和目标区域的尺寸相同,中间目标区域在第一中间图像中的相对位置和目标区域在待处理图像中的相对位置完全或基本相同。For example, in step S30, the intermediate target area is an area corresponding to the target area in the first intermediate image. The size of the intermediate target area is the same as that of the target area, and the relative position of the intermediate target area in the first intermediate image is completely or substantially the same as the relative position of the target area in the image to be processed.
例如,在步骤S30中,对第一中间图像所得到的与目标区域对应的中间目标区域进行第二清晰化处理,以在第一清晰化处理的基础上进一步丰富中间目标区域的图像细节,提高中间目标区域的清晰度,消除中间目标区域中存在的图像噪声,得到清晰度更高、图像细节更加丰富的第二中间图像。For example, in step S30, the second clearing process is performed on the intermediate target area corresponding to the target area obtained from the first intermediate image, so as to further enrich the image details of the intermediate target area on the basis of the first clearing process, and improve The definition of the intermediate target area eliminates the image noise existing in the intermediate target area, and obtains a second intermediate image with higher definition and richer image details.
例如,第二中间图像的清晰度大于中间目标区域的清晰度。例如,第二中间图像不存 在杂色线条、噪点等图像噪声,第二中间图像的纹理、线条等较中间目标区域更加清晰、丰富。For example, the resolution of the second intermediate image is greater than the resolution of the intermediate target area. For example, there is no image noise such as variegated lines and noise in the second intermediate image, and the texture and lines of the second intermediate image are clearer and richer than the intermediate target area.
例如,在一些实施例中,通过第二神经网络模型提取中间目标区域,并对中间目标区域进行第二清晰化处理,以得到第二中间图像。For example, in some embodiments, the intermediate target area is extracted through the second neural network model, and the second sharpening process is performed on the intermediate target area to obtain the second intermediate image.
例如,在另一些实施例中,待处理图像中的目标区域的位置相对固定,例如,待处理图像为证件照,目标区域为人脸区域,人脸区域一般位于证件照的中心位置,因而可以根据目标区域在待处理图像中的位置信息提取第一中间图像中的中间目标区域,通过第二神经网络模型对中间目标区域进行第二清晰化处理,以得到第二中间图像。For example, in other embodiments, the position of the target area in the image to be processed is relatively fixed. For example, the image to be processed is a ID photo, and the target area is a face area, and the face area is generally located in the center of the ID photo. The position information of the target area in the image to be processed is used to extract the intermediate target area in the first intermediate image, and the second clearing process is performed on the intermediate target area through the second neural network model to obtain the second intermediate image.
例如,在另一些实施例中,在步骤S20之前,本公开至少一实施例提供的图像处理方法还可以包括:通过第三神经网络模型对第一中间图像进行识别处理,以得到在第一中间图像中与目标区域对应的中间目标区域。For example, in some other embodiments, before step S20, the image processing method provided by at least one embodiment of the present disclosure may further include: using a third neural network model to identify and process the first intermediate image, so as to obtain The intermediate target region in the image corresponding to the target region.
例如,目标区域为人脸区域,第三神经网络模型可以为人脸识别模型,第三神经网络模型可以被训练以识别第一中间图像中的人脸区域,以得到中间目标区域,也即第一中间图像中包括人脸部分的区域。需要说明的是,当目标区域为其他对象,例如,车辆时,第三神经网络模型可以训练为识别待识别图像中的该对象(即车辆),从而可以通过第三神经网络模型对第一中间图像进行识别处理,以得到包括该对象(即车辆)的中间目标区域,本公开对此不作限制。For example, the target area is a face area, the third neural network model can be a face recognition model, and the third neural network model can be trained to recognize the face area in the first intermediate image to obtain the intermediate target area, that is, the first intermediate The region in the image that includes parts of the face. It should be noted that, when the target area is other objects, such as a vehicle, the third neural network model can be trained to recognize the object (i.e., the vehicle) in the image to be recognized, so that the first intermediate The image is identified and processed to obtain an intermediate target area including the object (ie, the vehicle), which is not limited in the present disclosure.
例如,在另一些实施例中,还可以采用人工提取等方式提取中间目标区域,通过第二神经网络模型对中间目标区域进行第二清晰化处理,以得到第二中间图像,本公开对此不作限制。For example, in some other embodiments, the intermediate target area can also be extracted by means of manual extraction, and the intermediate target area can be subjected to the second sharpening process through the second neural network model to obtain the second intermediate image, which is not discussed in this disclosure. limit.
例如,第一神经网络模型与第二神经网络模型可以相同,或者,第一神经网络模型与第二神经网络模型可以不同。例如,第二神经网络模型可以为SPADE(Spatially-Adaptive Normalization)模型,该SPADE模型可以解决传统归一化层中容易丢失输入语义图像中的信息的问题。For example, the first neural network model may be the same as the second neural network model, or the first neural network model may be different from the second neural network model. For example, the second neural network model can be a SPADE (Spatially-Adaptive Normalization) model, and the SPADE model can solve the problem that information in the input semantic image is easily lost in the traditional normalization layer.
针对第二神经网络模型的训练过程如后文所述,这里不再赘述。The training process for the second neural network model is described later, and will not be repeated here.
例如,第一神经网络模型、第二神经网络模型和第三神经网络模型中的一个或多个可以为卷积神经网络模型。For example, one or more of the first neural network model, the second neural network model and the third neural network model may be a convolutional neural network model.
图4A为本公开至少一实施例提供的中间目标区域的示意图,图4B为本公开至少一实施例提供的第二中间图像的示意图。Fig. 4A is a schematic diagram of an intermediate target area provided by at least one embodiment of the present disclosure, and Fig. 4B is a schematic diagram of a second intermediate image provided by at least one embodiment of the present disclosure.
例如,通过第三神经网络模型对图3所示的第一中间图像进行识别处理,以得到图4A所示的中间目标区域;接着,通过第二神经网络模型对图4A所示的中间目标区域进行第二清晰化处理,以得到图4B所示的第二中间图像。如图4A及图4B所示,经过第二清晰化处理后的第二中间图像的纹理特征更加丰富,清晰度更高,且去除了中间目标区域中人脸鼻头至嘴巴处的黑色线条。例如,如图4B所示,在第二中间图像中,人脸上的原本存在的皱纹等细节得到体现,使得该人脸更加符合真实人脸的特征。For example, the first intermediate image shown in Figure 3 is identified and processed by the third neural network model to obtain the intermediate target area shown in Figure 4A; then, the intermediate target area shown in Figure 4A is processed by the second neural network model A second sharpening process is performed to obtain a second intermediate image shown in FIG. 4B . As shown in FIG. 4A and FIG. 4B , the second intermediate image after the second sharpening process has richer texture features and higher definition, and removes the black lines from the nose to the mouth of the face in the intermediate target area. For example, as shown in FIG. 4B , in the second intermediate image, details such as wrinkles that originally existed on the human face are reflected, so that the human face is more in line with the characteristics of a real human face.
例如,基于第一清晰化处理得到的第一中间图像和基于第二清晰化处理过得到的第二中间图像的色调可能不统一,如果直接将第一中间图像和第二中间图像合成,则所得到的合成图像可能存在多种色调,因此,需要先对第一中间图像和第二中间图像进行色调处理,以使得二者的色调趋于一致,例如,二者的色调统一或一致,此时再进行图像合并处理就可以得到色调统一的合成图像。For example, the hues of the first intermediate image obtained based on the first sharpening process and the second intermediate image obtained based on the second sharpening process may not be uniform. If the first intermediate image and the second intermediate image are directly synthesized, the resulting There may be multiple tones in the resulting composite image. Therefore, it is necessary to perform tone processing on the first intermediate image and the second intermediate image so that the tones of the two tend to be consistent. For example, the tones of the two are unified or consistent. At this time Then image merging is performed to obtain a composite image with uniform tone.
例如,步骤S40可以包括:基于第一中间图像的色调,对第二中间图像进行色调处理,以得到第三中间图像,例如,第三中间图像的色调趋于第一中间图像的色调;对第一中间图像和第三中间图像进行图像合并处理,以得到合成图像。For example, step S40 may include: based on the tone of the first intermediate image, performing tone processing on the second intermediate image to obtain a third intermediate image, for example, the tone of the third intermediate image tends to the tone of the first intermediate image; The first intermediate image and the third intermediate image are combined to obtain a composite image.
例如,可以采用任何可以实现色调调整的算法、工具,基于第一中间图像的色调对第二中间图像进行色调处理,本公开对此不作限制。For example, any algorithm or tool capable of tone adjustment may be used to perform tone processing on the second intermediate image based on the tone of the first intermediate image, which is not limited in the present disclosure.
需要说明的是,在上述描述中,将第二中间图像的色调调整为与第一中间图像的色调一致,但本公开不限于此,只要能够使得第一中间图像的色调和第二中间图像的色调一致即可,例如,在另一些实施例中,步骤S40可以包括:基于第二中间图像的色调,对第一中间图像进行色调处理,以得到第四中间图像,例如,第四中间图像的色调趋于第二中间图像的色调;对第二中间图像和第四中间图像进行图像合并处理,以得到合成图像。It should be noted that, in the above description, the tone of the second intermediate image is adjusted to be consistent with the tone of the first intermediate image, but the disclosure is not limited thereto, as long as the tone of the first intermediate image and the tone of the second intermediate image can be adjusted It only needs to be consistent in tone. For example, in some other embodiments, step S40 may include: performing tone processing on the first intermediate image based on the tone of the second intermediate image to obtain a fourth intermediate image, for example, the fourth intermediate image The tone tends to the tone of the second intermediate image; performing an image combination process on the second intermediate image and the fourth intermediate image to obtain a composite image.
例如,在一些实施例中,合成图像中的所有像素排列为n行m列,在步骤S40中,对第一中间图像和第三中间图像进行图像合并处理,以得到合成图像,可以包括:对于第一中间图像中的第t1行第t2列的像素:响应于第一中间图像中的第t1行第t2列的像素不位于中间目标区域,将第一中间图像中的第t1行第t2列的像素的像素值作为合成图像中的第t1行第t2列的像素的像素值;响应于第一中间图像中的第t1行第t2列的像素位于中间目标区域,将第三中间图像中的第二中间像素的像素值作为合成图像中的第t1行第t2列的像素的像素值,其中,第二中间像素为第三中间图像中的与第一中间图像中的第t1行第t2列的像素所对应的像素,这里,n、m、t1、t2均为正整数,且t1小于等于n,t2小于等于m。For example, in some embodiments, all pixels in the synthesized image are arranged in n rows and m columns, and in step S40, image merging processing is performed on the first intermediate image and the third intermediate image to obtain the synthesized image, which may include: The pixels in the t1th row and the t2th column in the first intermediate image: in response to the pixel in the t1th row and the t2th column in the first intermediate image is not located in the intermediate target area, the t1th row and the t2th column in the first intermediate image The pixel value of the pixel is used as the pixel value of the pixel in the t1th row and the t2th column in the composite image; in response to the pixel in the t1th row and the t2th column in the first intermediate image is located in the intermediate target area, the third intermediate image is The pixel value of the second intermediate pixel is used as the pixel value of the pixel in the t1th row and the t2th column in the composite image, wherein the second intermediate pixel is the t1th row and the t2th column in the third intermediate image and the t1th row and the t2th column in the first intermediate image The pixel corresponding to the pixel of , where n, m, t1, and t2 are all positive integers, and t1 is less than or equal to n, and t2 is less than or equal to m.
例如,当对第二中间图像和第四中间图像进行图像合并处理,以得到合成图像时,图像合并处理过程与上述过程相同,这里不再赘述。For example, when image combination processing is performed on the second intermediate image and the fourth intermediate image to obtain a composite image, the image combination processing process is the same as the above-mentioned process, and will not be repeated here.
需要说明的是,图像合并处理过程也可以采用其他合并方式,本公开对此不作限制。It should be noted that the image merging process may also use other merging methods, which is not limited in the present disclosure.
例如,该合成图像可以为彩色图像,例如彩色图像中的像素的像素值可以包括一组RGB像素值,或者,该合成图像也可以为单色图像,例如,单色图像的像素的像素值可以为一个颜色通道的像素值。For example, the composite image can be a color image, for example, the pixel values of the pixels in the color image can include a set of RGB pixel values, or the composite image can also be a monochrome image, for example, the pixel values of the pixels in the monochrome image can be is the pixel value of a color channel.
图5A为本公开至少一实施例提供的第三中间图像的示意图,图5B为本公开一实施例提供的一种合成图像的示意图,例如,图5B为对图2所示的待处理图像执行本公开至少一实施例提供的图像处理方法所得到的合成图像。FIG. 5A is a schematic diagram of a third intermediate image provided by at least one embodiment of the present disclosure, and FIG. 5B is a schematic diagram of a composite image provided by an embodiment of the present disclosure. For example, FIG. A composite image obtained by the image processing method provided by at least one embodiment of the present disclosure.
如图5A所示,经过色调处理后的第三中间图像的色调与图3所示的第一中间图像的色调一致。As shown in FIG. 5A , the tone of the third intermediate image after tone processing is consistent with the tone of the first intermediate image shown in FIG. 3 .
如图5B所示,合成图像的图像细节相较于待处理图像更丰富,清晰度更高,且合成图像中仅存在一种色调。As shown in FIG. 5B , the image details of the synthesized image are richer and clearer than that of the unprocessed image, and there is only one tone in the synthesized image.
例如,在通过第一神经网络模型对待处理图像进行第一清晰化处理之前,本公开至少一实施例提供的图像处理方法还包括:获取样本图像;对样本图像进行模糊处理,以得到待训练图像,例如,待训练图像的清晰度小于样本图像的清晰度;基于样本图像和待训练图像,对待训练的第一神经网络模型和待训练的第二神经网络模型进行训练,以得到第一神经网络模型和第二神经网络模型。For example, before performing the first sharpening process on the image to be processed by using the first neural network model, the image processing method provided by at least one embodiment of the present disclosure further includes: acquiring a sample image; performing blurring processing on the sample image to obtain an image to be trained , for example, the clarity of the image to be trained is smaller than the clarity of the sample image; based on the sample image and the image to be trained, the first neural network model to be trained and the second neural network model to be trained are trained to obtain the first neural network model and the second neural network model.
例如,样本图像可以为清晰度大于清晰度阈值的图像,清晰度阈值可以由用户根据实际情况设置。例如,样本图像包括样本目标区域,例如,样本目标区域为人脸区域。例如,在对待训练的第一神经网络模型和待训练的第二神经网络模型进行训练时,可以将待训练图像作为神经网络模型的输入,将样本图像作为神经网络模型的目标输出,对待训练的第一神经网络模型和待训练的第二神经网络模型进行训练。For example, the sample image may be an image with a sharpness greater than a sharpness threshold, and the sharpness threshold may be set by the user according to actual conditions. For example, the sample image includes a sample target area, for example, the sample target area is a face area. For example, when the first neural network model to be trained and the second neural network model to be trained are trained, the image to be trained can be used as the input of the neural network model, the sample image can be used as the target output of the neural network model, and the image to be trained can be used as the target output of the neural network model. The first neural network model and the second neural network model to be trained are trained.
例如,神经网络模型的训练过程可以包括:利用待训练的神经网络模型对待训练图像进行处理,以得到训练输出图像;基于训练输出图像以及样本图像,通过待训练的神经网络模型对应的损失函数计算待训练的神经网络模型的损失值;以及基于该损失值对待训练的神经网络模型的参数进行修正;在待训练的神经网络模型对应的损失函数满足预定条件时,获得训练好的神经网络模型,在待训练的神经网络模型对应的损失函数不满足预定条件时,继续输入待训练图像以重复执行上述训练过程。此处,该待训练的神经网络模型可以为上述待训练的第一神经网络模型或待训练的第二神经网络模型。For example, the training process of the neural network model may include: using the neural network model to be trained to process the training image to obtain the training output image; based on the training output image and the sample image, calculating The loss value of the neural network model to be trained; and modifying the parameters of the neural network model to be trained based on the loss value; when the loss function corresponding to the neural network model to be trained satisfies a predetermined condition, the trained neural network model is obtained, When the loss function corresponding to the neural network model to be trained does not meet the predetermined condition, continue to input the image to be trained to repeat the above training process. Here, the neural network model to be trained may be the first neural network model to be trained or the second neural network model to be trained.
例如,在一个示例中,预定条件对应于在输入一定数量的待训练图像下,该待训练的神经网络模型的损失函数的最小化。在另一个示例中,预定条件为待训练的神经网络模型对应的训练次数或训练周期达到预定数目,该预定数目可以为上百万,只要待训练图像的数量足够大。For example, in one example, the predetermined condition corresponds to the minimization of the loss function of the neural network model to be trained under the input of a certain number of images to be trained. In another example, the predetermined condition is that the number of training times or training cycles corresponding to the neural network model to be trained reaches a predetermined number, and the predetermined number may be millions, as long as the number of images to be trained is large enough.
例如,第一神经网络模型和第二神经网络模型可以采用上述训练过程分开训练,此时,第二神经网络模型对应的样本图像需要包括样本目标区域,第一神经网络模型对应的样本图像可以不包括样本目标区域。For example, the first neural network model and the second neural network model can be trained separately using the above training process. At this time, the sample image corresponding to the second neural network model needs to include the sample target area, and the sample image corresponding to the first neural network model may not Include the sample target area.
例如,第一神经网络模型和第二神经网络模型可以基于同一个样本图像及待训练图像同时进行训练,此时,该样本图像需要包括样本目标区域。例如,此时第一神经网络模型和第二神经网络模型采用不同的结构,例如第一神经网络模型为pix2pixHD模型,第二神经网络模型为SPADE模型,第一神经网络模型基于样本图像的全局进行训练,第二神经网络模型仅基于样本图像中的样本目标区域进行训练,从而使得第一神经网络模型可以对待处理图像的全局进行第一清晰化处理,第二神经网络模型可以针对目标区域进行第二清晰化处理。For example, the first neural network model and the second neural network model can be trained simultaneously based on the same sample image and the image to be trained. In this case, the sample image needs to include the sample target area. For example, at this time, the first neural network model and the second neural network model adopt different structures. For example, the first neural network model is a pix2pixHD model, the second neural network model is a SPADE model, and the first neural network model is based on the overall image of the sample image. Training, the second neural network model is only trained based on the sample target area in the sample image, so that the first neural network model can perform the first clearing process on the whole image to be processed, and the second neural network model can perform the second clearing process on the target area 2. Clarification treatment.
图6A示出了本公开至少一实施例提供的模糊处理的示意性流程图。如图6A所示,模糊处理可以包括步骤S501-S504。Fig. 6A shows a schematic flowchart of obfuscation processing provided by at least one embodiment of the present disclosure. As shown in FIG. 6A, the blurring process may include steps S501-S504.
步骤S501,获取纹理切片。Step S501, acquiring texture slices.
例如,纹理切片的尺寸与样本图像的尺寸相同。For example, texture tiles are the same size as the sample image.
步骤S502,对样本图像进行第一模糊处理,以得到第一模糊图像。Step S502, performing a first blurring process on the sample image to obtain a first blurred image.
例如,第一模糊图像的清晰度小于样本图像的清晰度。For example, the sharpness of the first blurred image is smaller than that of the sample image.
步骤S503,将第一模糊图像与纹理切片进行颜色混合处理,以得到第二模糊图像。Step S503, performing color mixing processing on the first blurred image and the texture slice to obtain a second blurred image.
步骤S504,对第二模糊图像进行第二模糊处理,以得到待训练图像。Step S504, performing a second blurring process on the second blurred image to obtain an image to be trained.
例如,步骤S501可以包括:获取至少一张预设纹理图像;从至少一张预设纹理图像中随机选择一张预设纹理图像,作为目标纹理图像;响应于目标纹理图像的尺寸与样本图像的尺寸相同,将目标纹理图像作为纹理切片;响应于目标纹理图像的尺寸大于样本图像的尺寸,基于样本图像的尺寸,对目标纹理图像进行随机切割,以得到与样本图像的尺寸相同的切片区域,将切片区域作为纹理切片。For example, step S501 may include: acquiring at least one preset texture image; randomly selecting a preset texture image from at least one preset texture image as the target texture image; responding to the size of the target texture image and the sample image The size is the same, and the target texture image is used as a texture slice; in response to the size of the target texture image being larger than the size of the sample image, based on the size of the sample image, the target texture image is randomly cut to obtain a slice area with the same size as the sample image, Treat sliced regions as texture slices.
例如,纹理切片的尺寸与样本图像的尺寸相同。For example, texture tiles are the same size as the sample image.
图6B为本公开至少一实施例提供的纹理切片的示意图。如图6B所示,该纹理切片具有模仿照片噪点(例如,胶片颗粒)的杂色斑点,以及模仿划痕的杂色线条,杂色斑点与杂色线条可以是随机产生的或者预先设置好的,本公开对此不作限制。Fig. 6B is a schematic diagram of a texture slice provided by at least one embodiment of the present disclosure. As shown in FIG. 6B, the texture slice has noise spots imitating photo noise (eg, film grain) and noise lines imitating scratches. The noise spots and noise lines can be randomly generated or preset. , which is not limited in the present disclosure.
例如,可以预先生成多张预设纹理图像,预设纹理图像具有随机分布的杂色斑点和杂色线条,预设纹理图像的尺寸相对于样本图像的尺寸来说可以设置的较大,在获取纹理切片时,首先从多张预设纹理图像中选择一张作为目标纹理图像,并对目标纹理图像进行随机切割,以得到一个与样本图像的尺寸相同的切片区域作为纹理切片。通过这种方式可以更加真实地模拟清晰度较低的图像的状态。For example, multiple preset texture images can be generated in advance. The preset texture images have randomly distributed mottled spots and mottled lines. The size of the preset texture image can be set larger than the size of the sample image. When slicing the texture, first select one of the preset texture images as the target texture image, and randomly cut the target texture image to obtain a slice area with the same size as the sample image as the texture slice. In this way, the state of a lower-sharp image can be more realistically simulated.
需要说明的是,在另一些实施例中,目标纹理图像的尺寸也可以小于样本图像的尺寸,然后基于样本图像的尺寸,将目标纹理图像进行扩大以使得该目标纹理图像的尺寸与样本图像的尺寸相同,该扩大后的目标纹理图像即为纹理切片。It should be noted that, in some other embodiments, the size of the target texture image may also be smaller than the size of the sample image, and then based on the size of the sample image, the target texture image is enlarged so that the size of the target texture image is the same as that of the sample image. If the dimensions are the same, the expanded target texture image is a texture slice.
例如,第一模糊处理包括高斯模糊处理、噪声添加处理或基于任意顺序及任意数量的高斯模糊处理和噪声添加处理构成的组合处理;第二模糊处理包括高斯模糊处理、噪声添加处理或基于任意顺序及任意数量的高斯模糊处理和噪声添加处理构成的组合处理。For example, the first blur processing includes Gaussian blur processing, noise addition processing, or a combination of Gaussian blur processing and noise addition processing based on any order and any number; the second blur processing includes Gaussian blur processing, noise addition processing, or based on any order And any number of combinations of Gaussian blur processing and noise addition processing.
需要说明的是,高斯模糊(Gaussian Blur)处理包括模糊参数相同或不同的高斯模糊处理,噪声添加处理包括噪声参数相同或不同的噪声添加处理,组合处理中的任意数量的高斯模糊处理的模糊参数可以相同或不同,根据实际需要进行设置即可,同样的,组合处理中的任意数量的噪声添加处理的噪声参数也可以相同或不同,本公开对此不作限制。It should be noted that Gaussian Blur (Gaussian Blur) processing includes Gaussian Blur processing with the same or different blur parameters, noise addition processing includes noise addition processing with the same or different noise parameters, and any number of Gaussian Blur processing blur parameters in combination processing They can be the same or different, and can be set according to actual needs. Similarly, the noise parameters of any number of noise addition processes in the combination process can also be the same or different, which is not limited in the present disclosure.
例如,高斯模糊处理可以根据高斯曲线调节像素的像素值,以实现图像模糊。噪声添加处理可以生成图像噪声,例如高斯白噪声等,将图像噪声与图像进行合成以实现图像模糊。需要说明的是,高斯模糊处理和噪声添加处理的具体实现方式可以采用图像处理中的任意相关技术手段,本公开对此不作限制。For example, Gaussian blur processing can adjust the pixel values of pixels according to a Gaussian curve to achieve image blur. Noise addition processing can generate image noise, such as Gaussian white noise, etc., and image noise is synthesized with the image to achieve image blur. It should be noted that the Gaussian blur processing and the noise adding processing may be implemented in any relevant technical means in image processing, which is not limited in the present disclosure.
例如,步骤S502可以具体包括:对样本图像进行高斯模糊处理,以得到第一模糊图 像。For example, step S502 may specifically include: performing Gaussian blur processing on the sample image to obtain a first blurred image.
例如,步骤S504可以具体包括:对第二模糊图像进行第二模糊处理,以得到待训练图像,包括:对第二模糊图像进行噪声添加处理,以得到中间模糊图像;对中间模糊图像进行高斯模糊处理,以得到待训练图像。For example, step S504 may specifically include: performing a second blurring process on the second blurred image to obtain an image to be trained, including: performing noise addition processing on the second blurred image to obtain an intermediate blurred image; performing Gaussian blurring on the intermediate blurred image processed to obtain images to be trained.
例如,颜色混合处理包括滤色(Screen)处理、图层添加(Addition)处理、加亮(Lighten Only)处理等处理中的一种或多种处理。For example, the color mixing processing includes one or more processings such as Screen processing, Addition processing, and Lighten Only processing.
例如,在一些实施例中,步骤S503可以包括:对第一模糊图像和纹理切片进行滤色(Screen)处理,以得到第二模糊图像。For example, in some embodiments, step S503 may include: performing color filtering (Screen) processing on the first blurred image and the texture slice to obtain a second blurred image.
例如,第一模糊图像的像素排列为p行q列,纹理切片的像素排列为p行q列,第二模糊图像的像素排列为p行q列,p和q均为正整数。例如,像素的像素值的位数为8位,也即像素的每个通道的像素值的范围为(0-255)。For example, the pixels of the first blurred image are arranged in p rows and q columns, the pixels of the texture slice are arranged in p rows and q columns, the pixels of the second blurred image are arranged in p rows and q columns, and both p and q are positive integers. For example, the number of bits of the pixel value of the pixel is 8 bits, that is, the range of the pixel value of each channel of the pixel is (0-255).
例如,当对第一模糊图像和纹理切片进行滤色(Screen)处理时,对于第二模糊图像中的位于第t3行第t4列的像素,该像素的像素值的计算公式如下所示:For example, when screen processing is performed on the first blurred image and the texture slice, for a pixel located at row t3 and column t4 in the second blurred image, the calculation formula of the pixel value of the pixel is as follows:
Result_pix=255-[(255-fig1_pix)*(255-slice_pix)]/255   (公式1)Result_pix=255-[(255-fig1_pix)*(255-slice_pix)]/255 (Formula 1)
其中,Result_pix为第二模糊图像中的位于第t3行第t4列的像素的像素值,fig1_pix为第一模糊图像中的位于第t3行第t4列的像素的像素值,slice_pix为纹理切片中的位于第t3行第t4列的像素的像素值。Among them, Result_pix is the pixel value of the pixel located in row t3 and column t4 in the second blurred image, fig1_pix is the pixel value of the pixel located in row t3 and column t4 in the first blurred image, and slice_pix is the pixel value in the texture slice The pixel value of the pixel located at row t3 and column t4.
例如,在另一些实施例中,步骤S503可以包括:对纹理切片和第一模糊图像进行加亮(Lighten Only)处理,以得到第二模糊图像。For example, in some other embodiments, step S503 may include: performing lightening (Lighten Only) processing on the texture slice and the first blurred image to obtain the second blurred image.
例如,当对第一模糊图像和纹理切片进行加亮(Lighten Only)处理时,对于第二模糊图像中的位于第t3行第t4列的像素,该像素的像素值的计算公式如下所示:For example, when the first blurred image and the texture slice are lightened (Lighten Only), for the pixel located in row t3 and column t4 in the second blurred image, the calculation formula of the pixel value of the pixel is as follows:
Result_pix=max(fig1_pix,slice_pix)      (公式2)Result_pix=max(fig1_pix,slice_pix) (Formula 2)
其中,max(x,y)表示取x和y中的最大值,其他参数具体含义与公式1中相同,这里不再赘述。Among them, max(x, y) means to take the maximum value of x and y, and the specific meanings of other parameters are the same as those in formula 1, and will not be repeated here.
例如,在另一些实施例中,步骤S503可以包括:对纹理切片和第一模糊图像进行图层添加(Addition)处理,以得到第二模糊图像。For example, in some other embodiments, step S503 may include: performing layer addition (Addition) processing on the texture slice and the first blurred image to obtain the second blurred image.
例如,当对第一模糊图像和纹理切片进行图层添加(Addition)处理时,对于第二模糊图像中的位于第t3行第t4列的像素,该像素的像素值的计算公式如下所示:For example, when layer addition (Addition) processing is performed on the first blurred image and the texture slice, for a pixel located at row t3 and column t4 in the second blurred image, the calculation formula of the pixel value of the pixel is as follows:
Result_pix=fig1_pix+slice_pix      (公式3)Result_pix=fig1_pix+slice_pix (Formula 3)
其中,参数具体含义与公式1中相同,这里不再赘述。Wherein, the specific meanings of the parameters are the same as those in Formula 1, and will not be repeated here.
需要说明的是,颜色混合处理还可以根据需要采用其他混合模式(Blend Mode),本公开对此不作限制。It should be noted that the color mixing process may also adopt other blending modes (Blend Mode) as required, which is not limited in the present disclosure.
图7A为本公开至少一实施例提供的样本图像,图7B为本公开至少一实施例提供的待训练图像,例如,图7B所示的待训练图像为对图7A所示的样本图像执行前述第一模糊处理、颜色混合处理和第二模糊处理之后得到的图像。FIG. 7A is a sample image provided by at least one embodiment of the present disclosure, and FIG. 7B is an image to be trained provided by at least one embodiment of the present disclosure. For example, the image to be trained shown in FIG. The resulting image after the first blurring, color blending, and second blurring.
如图7A所示,该样本图像为高清图像,经过前述步骤的第一模糊处理、颜色混合处理和第二模糊处理后所得到的该样本图像对应的待训练图像如图7B所示,该待训练图像的清晰度小于样本图像的清晰度,待训练图像中具有模拟的噪点和划痕。As shown in FIG. 7A, the sample image is a high-definition image. The image to be trained corresponding to the sample image obtained after the first blurring process, color mixing process, and second blurring process in the aforementioned steps is shown in FIG. 7B. The sharpness of the training image is smaller than that of the sample image, and there are simulated noises and scratches in the training image.
本公开至少一实施例还提供一种图像处理装置,图8为本公开至少一实施例提供的一种图像处理装置的示意性框图。At least one embodiment of the present disclosure further provides an image processing device, and FIG. 8 is a schematic block diagram of an image processing device provided by at least one embodiment of the present disclosure.
如图8所示,图像处理装置800可以包括:图像获取单元801、第一处理单元802、第二处理单元803和合成单元804。As shown in FIG. 8 , the image processing apparatus 800 may include: an image acquisition unit 801 , a first processing unit 802 , a second processing unit 803 and a synthesis unit 804 .
例如,这些模块可以通过硬件(例如电路)模块、软件模块或二者的任意组合等实现,以下实施例与此相同,不再赘述。例如,可以通过中央处理单元(CPU)、图像处理器(GPU)、张量处理器(TPU)、现场可编程逻辑门阵列(FPGA)或者具有数据处理能力和/或指令执行能力的其它形式的处理单元以及相应计算机指令来实现这些单元。For example, these modules may be implemented by hardware (such as circuit) modules, software modules, or any combination of the two, and the following embodiments are the same as this, and will not be repeated here. For example, a central processing unit (CPU), a graphics processing unit (GPU), a tensor processing unit (TPU), a field programmable logic gate array (FPGA), or other forms of processors with data processing capabilities and/or instruction execution capabilities The processing units and corresponding computer instructions implement these units.
例如,图像获取单元801被配置为获取待处理图像,其中,待处理图像包括目标区域。For example, the image acquiring unit 801 is configured to acquire an image to be processed, wherein the image to be processed includes a target area.
例如,第一处理单元802被配置为通过第一神经网络模型对待处理图像进行第一清晰化处理,以得到待处理图像对应的第一中间图像,其中,第一中间图像的清晰度大于待处理图像的清晰度。For example, the first processing unit 802 is configured to perform first sharpening processing on the image to be processed through the first neural network model to obtain a first intermediate image corresponding to the image to be processed, wherein the definition of the first intermediate image is greater than that of the image to be processed. Image clarity.
例如,第二处理单元803被配置为通过第二神经网络模型对第一中间图像中与目标区域对应的中间目标区域进行第二清晰化处理,以得到中间目标区域对应的第二中间图像。For example, the second processing unit 803 is configured to perform a second sharpening process on the intermediate target area corresponding to the target area in the first intermediate image through the second neural network model, so as to obtain a second intermediate image corresponding to the intermediate target area.
例如,合成单元804被配置为对第一中间图像和第二中间图像进行合成处理,以得到与待处理图像对应的合成图像。For example, the compositing unit 804 is configured to composite the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed.
例如,图像获取单元801、第一处理单元802、第二处理单元803和合成单元804可以包括存储在存储器中的代码和程序;处理器可以执行该代码和程序以实现如上所述的图像获取单元801、第一处理单元802、第二处理单元803和合成单元804的一些功能或全部功能。例如,图像获取单元801、第一处理单元802、第二处理单元803和合成单元804可以是专用硬件器件,用来实现如上所述的图像获取单元801、第一处理单元802、第二处理单元803和合成单元804的一些或全部功能。例如,图像获取单元801、第一处理单元802、第二处理单元803和合成单元804可以是一个电路板或多个电路板的组合,用于实现如上所述的功能。在本申请实施例中,该一个电路板或多个电路板的组合可以包括:(1)一个或多个处理器;(2)与处理器相连接的一个或多个非暂时的存储器;以及(3)处理器可执行的存储在存储器中的固件。For example, the image acquisition unit 801, the first processing unit 802, the second processing unit 803, and the synthesis unit 804 may include codes and programs stored in memory; the processor may execute the codes and programs to realize the image acquisition unit as described above 801 , some or all of the functions of the first processing unit 802 , the second processing unit 803 and the synthesis unit 804 . For example, the image acquisition unit 801, the first processing unit 802, the second processing unit 803, and the synthesis unit 804 may be dedicated hardware devices, which are used to implement the image acquisition unit 801, the first processing unit 802, and the second processing unit described above. 803 and some or all of the functions of the synthesis unit 804. For example, the image acquiring unit 801 , the first processing unit 802 , the second processing unit 803 and the compositing unit 804 may be a circuit board or a combination of multiple circuit boards for realizing the functions described above. In the embodiment of the present application, the circuit board or a combination of multiple circuit boards may include: (1) one or more processors; (2) one or more non-transitory memories connected to the processors; and (3) Processor-executable firmware stored in memory.
需要说明的是,图像获取单元801可以用于实现图1所示的步骤S10,第一处理单元802可以用于实现图1所示的步骤S20,第二处理单元803可以用于实现图1所示的步骤S30,合成单元804可以用于实现图1所示的步骤S40。从而关于图像获取单元801、第一处理单元802、第二处理单元803和合成单元804能够实现的功能的具体说明可以参考上述图像处理方法的实施例中的步骤S10至步骤S40的相关描述,重复之处不再赘述。此外,图像处理装置800可以实现与前述图像处理方法相似的技术效果,在此不再赘述。It should be noted that the image acquisition unit 801 can be used to realize the step S10 shown in FIG. 1, the first processing unit 802 can be used to realize the step S20 shown in FIG. In the step S30 shown, the combining unit 804 can be used to realize the step S40 shown in FIG. 1 . Therefore, for a specific description of the functions that can be realized by the image acquisition unit 801, the first processing unit 802, the second processing unit 803, and the synthesis unit 804, reference may be made to the relevant descriptions of steps S10 to S40 in the above-mentioned embodiment of the image processing method, and repeat The place will not be repeated. In addition, the image processing apparatus 800 can achieve technical effects similar to those of the aforementioned image processing method, which will not be repeated here.
需要注意的是,在本公开的实施例中,该图像处理装置800可以包括更多或更少的电路或单元,并且各个电路或单元之间的连接关系不受限制,可以根据实际需求而定。各个电路或单元的具体构成方式不受限制,可以根据电路原理由模拟器件构成,也可以由数字芯片构成,或者以其他适用的方式构成。It should be noted that, in the embodiment of the present disclosure, the image processing device 800 may include more or fewer circuits or units, and the connection relationship between the various circuits or units is not limited, and may be determined according to actual needs . The specific configuration of each circuit or unit is not limited, and may be composed of analog devices according to circuit principles, or may be composed of digital chips, or in other suitable ways.
本公开至少一实施例还提供一种电子设备,图9为本公开至少一实施例提供的一种电子设备的示意图。At least one embodiment of the present disclosure further provides an electronic device, and FIG. 9 is a schematic diagram of an electronic device provided by at least one embodiment of the present disclosure.
例如,如图9所示,电子设备包括处理器901、通信接口902、存储器903和通信总线904。处理器901、通信接口902、存储器903通过通信总线904实现相互通信,处理器901、通信接口902、存储器903等组件之间也可以通过网络连接进行通信。本公开对网络的类型和功能在此不作限制。应当注意,图9所示的电子设备的组件只是示例性的,而非限制性的,根据实际应用需要,该电子设备还可以具有其他组件。For example, as shown in FIG. 9 , the electronic device includes a processor 901 , a communication interface 902 , a memory 903 and a communication bus 904 . The processor 901, the communication interface 902, and the memory 903 communicate with each other through the communication bus 904, and the processor 901, the communication interface 902, the memory 903 and other components may also communicate with each other through a network connection. The present disclosure does not limit the type and function of the network here. It should be noted that the components of the electronic device shown in FIG. 9 are exemplary rather than limiting, and the electronic device may also have other components according to actual application requirements.
例如,存储器903用于非瞬时性地存储计算机可读指令。处理器901用于执行计算机可读指令时,实现根据上述任一实施例所述的图像处理方法。关于该图像处理方法的各个步骤的具体实现以及相关解释内容可以参见上述图像处理方法的实施例,在此不作赘述。For example, memory 903 is used to store computer readable instructions on a non-transitory basis. When the processor 901 is configured to execute computer-readable instructions, implement the image processing method according to any one of the foregoing embodiments. For the specific implementation of each step of the image processing method and related explanations, reference may be made to the above-mentioned embodiment of the image processing method, and details are not repeated here.
例如,处理器901执行存储器903上所存放的计算机可读指令而实现的图像处理方法的其他实现方式,与前述方法实施例部分所提及的实现方式相同,这里也不再赘述。For example, other implementations of the image processing method implemented by the processor 901 executing computer-readable instructions stored in the memory 903 are the same as the implementations mentioned in the foregoing method embodiments, and will not be repeated here.
例如,通信总线904可以是外设部件互连标准(PCI)总线或扩展工业标准结构(EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。For example, communication bus 904 may be a Peripheral Component Interconnect Standard (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
例如,通信接口902用于实现电子设备与其他设备之间的通信。For example, the communication interface 902 is used to implement communication between the electronic device and other devices.
例如,处理器901和存储器903可以设置在服务器端(或云端)。For example, the processor 901 and the memory 903 may be set at the server (or cloud).
例如,处理器901可以控制电子设备中的其它组件以执行期望的功能。处理器901可以是中央处理器(CPU)、网络处理器(NP)、张量处理器(TPU)或者图形处理器(GPU)等具有数据处理能力和/或程序执行能力的器件;还可以是数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。中央处理器(CPU)可以为X86或ARM架构等。For example, the processor 901 can control other components in the electronic device to perform desired functions. The processor 901 may be a device with data processing capability and/or program execution capability such as a central processing unit (CPU), a network processor (NP), a tensor processing unit (TPU) or a graphics processing unit (GPU); it may also be Digital Signal Processor (DSP), Application Specific Integrated Circuit (ASIC), Field Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The central processing unit (CPU) may be an X86 or ARM architecture or the like.
例如,存储器903可以包括一个或多个计算机程序产品的任意组合,计算机程序产品可以包括各种形式的计算机可读存储介质,例如易失性存储器和/或非易失性存储器。易失性存储器例如可以包括随机存取存储器(RAM)和/或高速缓冲存储器(cache)等。非易失性存储器例如可以包括只读存储器(ROM)、硬盘、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、USB存储器、闪存等。在所述计算机可读存储介质上可以存储一个或多个计算机可读指令,处理器901可以运行所述计算机可读指令,以实现电子设备的各种功能。在存储介质中还可以存储各种应用程序和各种数据等。For example, memory 903 may include any combination of one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include random access memory (RAM) and/or cache memory (cache), etc., for example. Non-volatile memory may include, for example, read only memory (ROM), hard disks, erasable programmable read only memory (EPROM), compact disc read only memory (CD-ROM), USB memory, flash memory, and the like. One or more computer-readable instructions can be stored on the computer-readable storage medium, and the processor 901 can execute the computer-readable instructions to realize various functions of the electronic device. Various application programs, various data, and the like can also be stored in the storage medium.
例如,在一些实施例中,电子设备还可以包括图像获取部件。图像获取部件用于获取图像。存储器903还用于存储获取的图像。For example, in some embodiments, the electronic device may further include an image acquisition component. The image acquisition component is used to acquire images. The memory 903 is also used to store acquired images.
例如,图像获取部件可以是智能手机的摄像头、平板电脑的摄像头、个人计算机的摄像头、数码照相机的镜头、或者甚至可以是网络摄像头。For example, the image acquisition component may be a camera of a smartphone, a camera of a tablet computer, a camera of a personal computer, a lens of a digital camera, or even a webcam.
例如,关于电子设备执行图像处理的过程的详细说明可以参考图像处理方法的实施例中的相关描述,重复之处不再赘述。For example, for a detailed description of the process of image processing performed by the electronic device, reference may be made to relevant descriptions in the embodiments of the image processing method, and repeated descriptions will not be repeated.
图10为本公开至少一实施例提供的一种非瞬时性计算机可读存储介质的示意图。例如,如图10所示,存储介质1000可以为非瞬时性计算机可读存储介质,在存储介质1000上可以非暂时性地存储一个或多个计算机可读指令1001。例如,当计算机可读指令1001由处理器执行时可以执行根据上文所述的图像处理方法中的一个或多个步骤。Fig. 10 is a schematic diagram of a non-transitory computer-readable storage medium provided by at least one embodiment of the present disclosure. For example, as shown in FIG. 10 , the storage medium 1000 may be a non-transitory computer-readable storage medium, and one or more computer-readable instructions 1001 may be non-transitorily stored on the storage medium 1000 . For example, when the computer-readable instructions 1001 are executed by the processor, one or more steps in the image processing method described above may be performed.
例如,该存储介质1000可以应用于上述电子设备中,例如,该存储介质1000可以包括电子设备中的存储器。For example, the storage medium 1000 may be applied to the above-mentioned electronic device, for example, the storage medium 1000 may include a memory in the electronic device.
例如,存储介质可以包括智能电话的存储卡、平板电脑的存储部件、个人计算机的硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、闪存、或者上述存储介质的任意组合,也可以为其他适用的存储介质。For example, the storage medium may include a memory card of a smartphone, a storage unit of a tablet computer, a hard disk of a personal computer, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM), Portable compact disc read-only memory (CD-ROM), flash memory, or any combination of the above-mentioned storage media may also be other applicable storage media.
例如,关于存储介质1000的说明可以参考电子设备的实施例中对于存储器的描述,重复之处不再赘述。For example, for the description of the storage medium 1000, reference may be made to the description of the memory in the embodiments of the electronic device, and repeated descriptions will not be repeated.
图11示出了为本公开至少一实施例提供的一种硬件环境的示意图。本公开提供的电子设备可以应用在互联网系统。Fig. 11 shows a schematic diagram of a hardware environment provided for at least one embodiment of the present disclosure. The electronic device provided by the present disclosure can be applied in the Internet system.
利用图11中提供的计算机系统可以实现本公开中涉及的图像处理装置和/或电子设备的功能。这类计算机系统可以包括个人电脑、笔记本电脑、平板电脑、手机、个人数码助理、智能眼镜、智能手表、智能指环、智能头盔及任何智能便携设备或可穿戴设备。本实施例中的特定系统利用功能框图解释了一个包含用户界面的硬件平台。这种计算机设备可以是一个通用目的的计算机设备,或一个有特定目的的计算机设备。两种计算机设备都可以被用于实现本实施例中的图像处理装置和/或电子设备。计算机系统可以包括实施当前描述的实现图像处理所需要的信息的任何组件。例如,计算机系统能够被计算机设备通过其硬件设备、软件程序、固件以及它们的组合所实现。为了方便起见,图11中只绘制了一台计算机设备,但是本实施例所描述的实现图像处理所需要的信息的相关计算机功能是可以以分布的方式、由一组相似的平台所实施的,分散计算机系统的处理负荷。The functions of the image processing apparatus and/or electronic equipment involved in the present disclosure can be realized by using the computer system provided in FIG. 11 . Such computer systems can include personal computers, laptops, tablets, mobile phones, personal digital assistants, smart glasses, smart watches, smart rings, smart helmets, and any smart portable or wearable device. The specific system in this embodiment illustrates a hardware platform including a user interface using functional block diagrams. Such computer equipment may be a general purpose computer equipment or a special purpose computer equipment. Both computer devices can be used to realize the image processing device and/or electronic device in this embodiment. The computer system may include any components that implement the presently described information needed to achieve image processing. For example, a computer system can be realized by a computer device through its hardware devices, software programs, firmware, and combinations thereof. For the sake of convenience, only one computer device is drawn in Fig. 11, but the relevant computer functions for realizing the information required for image processing described in this embodiment can be implemented by a group of similar platforms in a distributed manner, Distribute the processing load of a computer system.
如图11所示,计算机系统可以包括通信端口250,与之相连的是实现数据通信的网络,例如,计算机系统可以通过通信端口250发送和接收信息及数据,即通信端口250可以实现计算机系统与其他电子设备进行无线或有线通信以交换数据。计算机系统还可以包括一个处理器组220(即上面描述的处理器),用于执行程序指令。处理器组220可以由至少一个处理器(例如,CPU)组成。计算机系统可以包括一个内部通信总线210。计算机系统可以包括不同形式的程序储存单元以及数据储存单元(即上面描述的存储器或存储介质),例如硬盘270、只读存储器(ROM)230、随机存取存储器(RAM)240,能够用于 存储计算机处理和/或通信使用的各种数据文件,以及处理器组220所执行的可能的程序指令。计算机系统还可以包括一个输入/输出组件260,输入/输出组件260用于实现计算机系统与其他组件(例如,用户界面280等)之间的输入/输出数据流。As shown in Figure 11, the computer system can include a communication port 250, which is connected to a network for data communication, for example, the computer system can send and receive information and data through the communication port 250, that is, the communication port 250 can realize the communication between the computer system and the computer system. Other electronic devices communicate wirelessly or by wire to exchange data. The computer system may also include a processor group 220 (ie, the processor described above) for executing program instructions. The processor group 220 may consist of at least one processor (eg, CPU). The computer system may include an internal communication bus 210 . A computer system may include different forms of program storage units and data storage units (i.e., memory or storage media described above), such as hard disk 270, read-only memory (ROM) 230, random access memory (RAM) 240, which can be used to store Various data files used by the computer for processing and/or communicating, and possibly program instructions executed by the processor group 220 . The computer system may also include an input/output component 260 for enabling input/output data flow between the computer system and other components (eg, user interface 280, etc.).
通常,以下装置可以连接输入/输出组件260:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置;包括例如磁带、硬盘等的存储装置;以及通信接口。Typically, the following devices can be connected to the input/output assembly 260: input devices including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a liquid crystal display (LCD), speaker, vibrator, etc. output devices; storage devices including, for example, magnetic tapes, hard disks, etc.; and communication interfaces.
虽然图11示出了具有各种装置的计算机系统,但应理解的是,并不要求计算机系统具备所有示出的装置,可以替代地,计算机系统可以具备更多或更少的装置。While FIG. 11 shows a computer system with various devices, it should be understood that the computer system is not required to have all of the devices shown and, instead, the computer system may have more or fewer devices.
对于本公开,还有以下几点需要说明:For this disclosure, the following points need to be explained:
(1)本公开实施例附图只涉及到与本公开实施例涉及到的结构,其他结构可参考通常设计。(1) The drawings of the embodiments of the present disclosure only relate to the structures involved in the embodiments of the present disclosure, and other structures may refer to general designs.
(2)为了清晰起见,在用于描述本发明的实施例的附图中,层或结构的厚度和尺寸被放大。可以理解,当诸如层、膜、区域或基板之类的元件被称作位于另一元件“上”或“下”时,该元件可以“直接”位于另一元件“上”或“下”,或者可以存在中间元件。(2) For clarity, in the drawings used to describe the embodiments of the present invention, the thickness and size of layers or structures are exaggerated. It will be understood that when an element such as a layer, film, region, or substrate is referred to as being "on" or "under" another element, it can be "directly on" or "under" the other element, Or intervening elements may be present.
(3)在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合以得到新的实施例。(3) In the case of no conflict, the embodiments of the present disclosure and the features in the embodiments can be combined with each other to obtain new embodiments.
以上所述仅为本公开的具体实施方式,但本公开的保护范围并不局限于此,本公开的保护范围应以所述权利要求的保护范围为准。The above description is only a specific implementation manner of the present disclosure, but the protection scope of the present disclosure is not limited thereto, and the protection scope of the present disclosure should be based on the protection scope of the claims.

Claims (17)

  1. 一种图像处理方法,其特征在于,包括:An image processing method, characterized in that, comprising:
    获取待处理图像,其中,所述待处理图像包括目标区域;Acquiring an image to be processed, wherein the image to be processed includes a target area;
    通过第一神经网络模型对所述待处理图像进行第一清晰化处理,以得到所述待处理图像对应的第一中间图像,其中,所述第一中间图像的清晰度大于所述待处理图像的清晰度;Perform a first sharpening process on the image to be processed by using a first neural network model to obtain a first intermediate image corresponding to the image to be processed, wherein the definition of the first intermediate image is greater than that of the image to be processed clarity;
    通过第二神经网络模型对所述第一中间图像中与所述目标区域对应的中间目标区域进行第二清晰化处理,以得到所述中间目标区域对应的第二中间图像;performing a second sharpening process on the intermediate target area corresponding to the target area in the first intermediate image through a second neural network model, so as to obtain a second intermediate image corresponding to the intermediate target area;
    对所述第一中间图像和所述第二中间图像进行合成处理,以得到与所述待处理图像对应的合成图像。Compositing the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed.
  2. 根据权利要求1所述的图像处理方法,其特征在于,在通过第二神经网络模型对所述第一中间图像中与所述目标区域对应的中间目标区域进行第二清晰化处理,以得到与所述中间目标区域对应的第二中间图像之前,所述图像处理方法还包括:The image processing method according to claim 1, wherein the second sharpening process is performed on the intermediate target area corresponding to the target area in the first intermediate image through the second neural network model, so as to obtain Before the second intermediate image corresponding to the intermediate target area, the image processing method further includes:
    通过第三神经网络模型对所述第一中间图像进行识别处理,以得到在所述第一中间图像中与所述目标区域对应的所述中间目标区域。Perform recognition processing on the first intermediate image by using a third neural network model to obtain the intermediate target area corresponding to the target area in the first intermediate image.
  3. 根据权利要求1所述的图像处理方法,其特征在于,所述第二中间图像的清晰度大于所述中间目标区域的清晰度。The image processing method according to claim 1, wherein the definition of the second intermediate image is greater than the definition of the intermediate target area.
  4. 根据权利要求1所述的图像处理方法,其特征在于,对所述第一中间图像和所述第二中间图像进行合成处理,以得到与所述待处理图像对应的合成图像,包括:The image processing method according to claim 1, wherein the composite processing of the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed comprises:
    基于所述第一中间图像的色调,对所述第二中间图像进行色调处理,以得到第三中间图像,其中,所述第三中间图像的色调趋于所述第一中间图像的色调;以及performing tone processing on the second intermediate image based on the tone of the first intermediate image to obtain a third intermediate image, wherein the tone of the third intermediate image tends to the tone of the first intermediate image; and
    对所述第一中间图像和所述第三中间图像进行图像合并处理,以得到所述合成图像。performing image combination processing on the first intermediate image and the third intermediate image to obtain the synthesized image.
  5. 根据权利要求1-4任一项所述的图像处理方法,其特征在于,所述目标区域为人脸区域。The image processing method according to any one of claims 1-4, wherein the target area is a human face area.
  6. 根据权利要求1-4任一项所述的图像处理方法,其特征在于,所述第一神经网络模型与所述第二神经网络模型不同。The image processing method according to any one of claims 1-4, wherein the first neural network model is different from the second neural network model.
  7. 根据权利要求1-4任一项所述的图像处理方法,其特征在于,在通过第一神经网络模型对所述待处理图像进行第一清晰化处理之前,所述图像处理方法还包括:The image processing method according to any one of claims 1-4, wherein, before performing the first sharpening process on the image to be processed through the first neural network model, the image processing method further comprises:
    获取样本图像;get sample image;
    对所述样本图像进行模糊处理,以得到待训练图像,其中,所述待训练图像的清晰度小于所述样本图像的清晰度;Blurring the sample image to obtain an image to be trained, wherein the definition of the image to be trained is smaller than the definition of the sample image;
    基于所述样本图像和所述待训练图像,对待训练的第一神经网络模型和待训练的第二神经网络模型进行训练,以得到所述第一神经网络模型和所述第二神经网络模型。Based on the sample image and the image to be trained, a first neural network model to be trained and a second neural network model to be trained are trained to obtain the first neural network model and the second neural network model.
  8. 根据权利要求7所述的图像处理方法,其特征在于,对所述样本图像进行模糊处理,以得到待训练图像,包括:The image processing method according to claim 7, wherein blurring the sample image to obtain an image to be trained comprises:
    获取纹理切片,其中,所述纹理切片的尺寸与所述样本图像的尺寸相同;Acquiring a texture slice, where the size of the texture slice is the same as the size of the sample image;
    对所述样本图像进行第一模糊处理,以得到第一模糊图像,其中,所述第一模糊图像的清晰度小于所述样本图像的清晰度;performing a first blurring process on the sample image to obtain a first blurred image, wherein the definition of the first blurred image is smaller than the definition of the sample image;
    将所述第一模糊图像与所述纹理切片进行颜色混合处理,以得到第二模糊图像;performing color mixing processing on the first blurred image and the texture slice to obtain a second blurred image;
    对所述第二模糊图像进行第二模糊处理,以得到所述待训练图像。performing a second blurring process on the second blurred image to obtain the image to be trained.
  9. 根据权利要求8所述的图像处理方法,其特征在于,获取纹理切片,包括:The image processing method according to claim 8, wherein obtaining texture slices comprises:
    获取至少一张预设纹理图像;Obtain at least one preset texture image;
    从所述至少一张预设纹理图像中随机选择一张预设纹理图像,作为目标纹理图像;Randomly select a preset texture image from the at least one preset texture image as the target texture image;
    响应于所述目标纹理图像的尺寸与所述样本图像的尺寸相同,将所述目标纹理图像作为所述纹理切片;In response to the size of the target texture image being the same as the size of the sample image, using the target texture image as the texture slice;
    响应于所述目标纹理图像的尺寸大于所述样本图像的尺寸,基于所述样本图像的尺寸,对所述目标纹理图像进行随机切割,以得到与所述样本图像的尺寸相同的切片区域,将所述切片区域作为所述纹理切片。In response to the size of the target texture image being larger than the size of the sample image, randomly cutting the target texture image based on the size of the sample image to obtain a slice area with the same size as the sample image, The slice area serves as the texture slice.
  10. 根据权利要求8所述的图像处理方法,其特征在于,所述第一模糊处理包括高斯模糊处理、噪声添加处理或基于任意顺序及任意数量的所述高斯模糊处理和所述噪声添加处理构成的组合处理;The image processing method according to claim 8, characterized in that, the first blurring process includes Gaussian blurring, noise adding, or a combination of Gaussian blurring and noise adding in any order and in any number. combined processing;
    所述第二模糊处理包括所述高斯模糊处理、所述噪声添加处理或基于任意顺序及任意数量的所述高斯模糊处理和所述噪声添加处理构成的组合处理。The second blurring process includes the Gaussian blurring process, the noise adding process, or a combined process based on an arbitrary order and an arbitrary number of the Gaussian blurring process and the noise adding process.
  11. 根据权利要求10所述的图像处理方法,其特征在于,对所述样本图像进行第一模糊处理,以得到第一模糊图像,包括:对所述样本图像进行所述高斯模糊处理,以得到所述第一模糊图像;The image processing method according to claim 10, wherein performing the first blurring process on the sample image to obtain the first blurred image comprises: performing the Gaussian blurring process on the sample image to obtain the The first blurred image;
    对所述第二模糊图像进行第二模糊处理,以得到所述待训练图像,包括:对所述第二模糊图像进行所述噪声添加处理,以得到中间模糊图像;对所述中间模糊图像进行所述高斯模糊处理,以得到所述待训练图像。Performing a second blurring process on the second blurred image to obtain the image to be trained includes: performing the noise addition process on the second blurred image to obtain an intermediate blurred image; performing The Gaussian blur processing to obtain the image to be trained.
  12. 根据权利要求8所述的图像处理方法,其特征在于,将所述第一模糊图像与所述纹理切片进行颜色混合处理,以得到第二模糊图像,包括:The image processing method according to claim 8, wherein color mixing is performed on the first blurred image and the texture slice to obtain a second blurred image, comprising:
    对所述第一模糊图像和所述纹理切片进行滤色处理,以得到所述第二模糊图像。performing color filtering processing on the first blurred image and the texture slice to obtain the second blurred image.
  13. 根据权利要求8所述的图像处理方法,其特征在于,将所述第一模糊图像与所述纹理切片进行颜色混合处理,以得到第二模糊图像,包括:The image processing method according to claim 8, wherein color mixing is performed on the first blurred image and the texture slice to obtain a second blurred image, comprising:
    对所述纹理切片和所述第一模糊图像进行加亮处理,以得到所述第二模糊图像。Perform highlighting processing on the texture slice and the first blurred image to obtain the second blurred image.
  14. 一种图像处理装置,其特征在于,包括:An image processing device, characterized in that it comprises:
    图像获取单元,配置为获取待处理图像,其中,所述待处理图像包括目标区域;an image acquisition unit configured to acquire an image to be processed, wherein the image to be processed includes a target area;
    第一处理单元,配置为通过第一神经网络模型对所述待处理图像进行第一清晰化处理,以得到所述待处理图像对应的第一中间图像,其中,所述第一中间图像的清晰度大于所述待处理图像的清晰度;The first processing unit is configured to perform a first sharpening process on the image to be processed by using a first neural network model to obtain a first intermediate image corresponding to the image to be processed, wherein the sharpness of the first intermediate image The degree is greater than the definition of the image to be processed;
    第二处理单元,配置为通过第二神经网络模型对所述第一中间图像中与所述目标区域对应的中间目标区域进行第二清晰化处理,以得到所述中间目标区域对应的第二中间图像;The second processing unit is configured to perform a second sharpening process on the intermediate target area corresponding to the target area in the first intermediate image through a second neural network model, so as to obtain a second intermediate image corresponding to the intermediate target area image;
    合成单元,配置为对所述第一中间图像和所述第二中间图像进行合成处理,以得到与所述待处理图像对应的合成图像。A compositing unit configured to composite the first intermediate image and the second intermediate image to obtain a composite image corresponding to the image to be processed.
  15. 根据权利要求14所述的图像处理装置,其特征在于,所述合成单元包括色调处理模块和图像合并处理模块,The image processing device according to claim 14, wherein the synthesis unit includes a color tone processing module and an image merging processing module,
    所述色调处理模块被配置为基于所述第一中间图像的色调,对所述第二中间图像进行色调处理,以得到第三中间图像,其中,所述第三中间图像的色调趋于所述第一中间图像的色调;The tone processing module is configured to perform tone processing on the second intermediate image based on the tone of the first intermediate image to obtain a third intermediate image, wherein the tone of the third intermediate image tends to the the hue of the first intermediate image;
    所述图像合并处理模块被配置为对所述第一中间图像和所述第三中间图像进行图像合并处理,以得到所述合成图像。The image combination processing module is configured to perform image combination processing on the first intermediate image and the third intermediate image to obtain the composite image.
  16. 一种电子设备,其特征在于,包括:An electronic device, characterized in that it comprises:
    存储器,非瞬时性地存储有计算机可执行指令;memory non-transitoryly storing computer-executable instructions;
    处理器,配置为运行所述计算机可执行指令,a processor configured to execute said computer-executable instructions,
    其中,所述计算机可执行指令被所述处理器运行时实现根据权利要求1-13任一项所述的图像处理方法。Wherein, the computer-executable instructions are executed by the processor to implement the image processing method according to any one of claims 1-13.
  17. 一种非瞬时性计算机可读存储介质,其特征在于,所述非瞬时性计算机可读存储介质存储有计算机可执行指令,所述计算机可执行指令被处理器执行时实现根据权利要求1-13中任一项所述的图像处理方法。A non-transitory computer-readable storage medium, characterized in that the non-transitory computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, the computer-executable instructions according to claims 1-13 are implemented. The image processing method described in any one.
PCT/CN2022/093586 2021-05-28 2022-05-18 Image processing method and apparatus, electronic device, and storage medium WO2022247702A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110593707.8A CN113344832A (en) 2021-05-28 2021-05-28 Image processing method and device, electronic equipment and storage medium
CN202110593707.8 2021-05-28

Publications (1)

Publication Number Publication Date
WO2022247702A1 true WO2022247702A1 (en) 2022-12-01

Family

ID=77471959

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/093586 WO2022247702A1 (en) 2021-05-28 2022-05-18 Image processing method and apparatus, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN113344832A (en)
WO (1) WO2022247702A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113344832A (en) * 2021-05-28 2021-09-03 杭州睿胜软件有限公司 Image processing method and device, electronic equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090060373A1 (en) * 2007-08-24 2009-03-05 General Electric Company Methods and computer readable medium for displaying a restored image
CN110097110A (en) * 2019-04-26 2019-08-06 华南理工大学 A kind of semantic image restorative procedure based on objective optimization
CN111445415A (en) * 2020-03-30 2020-07-24 北京市商汤科技开发有限公司 Image restoration method and device, electronic equipment and storage medium
CN111914785A (en) * 2020-08-10 2020-11-10 北京小米松果电子有限公司 Method and device for improving definition of face image and storage medium
CN112419179A (en) * 2020-11-18 2021-02-26 北京字跳网络技术有限公司 Method, device, equipment and computer readable medium for repairing image
CN113344832A (en) * 2021-05-28 2021-09-03 杭州睿胜软件有限公司 Image processing method and device, electronic equipment and storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103455969B (en) * 2013-08-28 2019-06-04 腾讯科技(成都)有限公司 The method and device of image procossing
CN107563978A (en) * 2017-08-31 2018-01-09 苏州科达科技股份有限公司 Face deblurring method and device
US10586129B2 (en) * 2018-02-21 2020-03-10 International Business Machines Corporation Generating artificial images for use in neural networks
CN108737750A (en) * 2018-06-07 2018-11-02 北京旷视科技有限公司 Image processing method, device and electronic equipment
CN109087256A (en) * 2018-07-19 2018-12-25 北京飞搜科技有限公司 A kind of image deblurring method and system based on deep learning
TWI693576B (en) * 2019-02-26 2020-05-11 緯創資通股份有限公司 Method and system for image blurring processing
CN111488865B (en) * 2020-06-28 2020-10-27 腾讯科技(深圳)有限公司 Image optimization method and device, computer storage medium and electronic equipment
CN111754396B (en) * 2020-07-27 2024-01-09 腾讯科技(深圳)有限公司 Face image processing method, device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090060373A1 (en) * 2007-08-24 2009-03-05 General Electric Company Methods and computer readable medium for displaying a restored image
CN110097110A (en) * 2019-04-26 2019-08-06 华南理工大学 A kind of semantic image restorative procedure based on objective optimization
CN111445415A (en) * 2020-03-30 2020-07-24 北京市商汤科技开发有限公司 Image restoration method and device, electronic equipment and storage medium
CN111914785A (en) * 2020-08-10 2020-11-10 北京小米松果电子有限公司 Method and device for improving definition of face image and storage medium
CN112419179A (en) * 2020-11-18 2021-02-26 北京字跳网络技术有限公司 Method, device, equipment and computer readable medium for repairing image
CN113344832A (en) * 2021-05-28 2021-09-03 杭州睿胜软件有限公司 Image processing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113344832A (en) 2021-09-03

Similar Documents

Publication Publication Date Title
US9639956B2 (en) Image adjustment using texture mask
US11373275B2 (en) Method for generating high-resolution picture, computer device, and storage medium
US20200234414A1 (en) Systems and methods for transforming raw sensor data captured in low-light conditions to well-exposed images using neural network architectures
WO2018082185A1 (en) Image processing method and device
CN112602088B (en) Method, system and computer readable medium for improving quality of low light images
US8731248B2 (en) Method of performing eye circle correction an image and related computing device
WO2020108009A1 (en) Method, system, and computer-readable medium for improving quality of low-light images
KR102145220B1 (en) Method and apparatus for convert two-dimensional image to three-dimensional image utilizing deep learning
WO2020093782A1 (en) Method, system, and computer-readable medium for improving quality of low-light images
US20240121521A1 (en) Image processing based on object categorization
JP2008083820A (en) Image processor, image processing method, and image processing program
CN111383232A (en) Matting method, matting device, terminal equipment and computer-readable storage medium
CN103440674A (en) Method for rapidly generating crayon special effect of digital image
US11127111B2 (en) Selective allocation of processing resources for processing image data
WO2022247702A1 (en) Image processing method and apparatus, electronic device, and storage medium
WO2022213784A1 (en) Image processing method and apparatus, and electronic device and storage medium
WO2019047409A1 (en) Image processing method and system, readable storage medium and mobile camera device
Hsieh et al. Variational contrast-saturation enhancement model for effective single image dehazing
CN115294055A (en) Image processing method, image processing device, electronic equipment and readable storage medium
AU2018271418B2 (en) Creating selective virtual long-exposure images
WO2022002002A1 (en) Image processing method, image processing apparatus, electronic device, and storage medium
CN111316628A (en) Image shooting method and image shooting system based on intelligent terminal
US20220398704A1 (en) Intelligent Portrait Photography Enhancement System
CN110942488A (en) Image processing apparatus, image processing system, image processing method, and recording medium
US9154671B2 (en) Image processing apparatus, image processing method, and program

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22810429

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE