Image processing method and related device thereof
This application relates to the field of image processing, and provides an image processing method and a related device thereof. The method includes: displaying a first interface, where the first interface includes a first control; detecting a first operation on the first control; obtaining a plurality of frames of exposure images in response to the first operation; and performing style transfer on the plurality of frames of exposure images to obtain a target image.
1 . A method, wherein the method comprises:
displaying a first interface, wherein the first interface comprises a first control;
detecting a first operation on the first control;
obtaining a plurality of frames of exposure images in response to detecting the first operation, wherein exposure times of the plurality of frames of exposure images are different, the plurality of frames of exposure images comprises at least one frame of a first long-exposure image, and an exposure time of the first long-exposure image is longer than that of a remaining exposure image in the plurality of frames of exposure images;
processing the plurality of frames of exposure images by using a deep learning network model to obtain a first fused image;
performing first backend processing on the first fused image to obtain a first backend image;
performing second backend processing on the first long-exposure image to obtain a second backend image; and
performing style transfer on the plurality of frames of exposure images to obtain a target image.
2 . The method according to claim 1 , wherein performing style transfer on the plurality of frames of exposure images to obtain the target image comprises:
performing style transfer on the first backend image and the second backend image by using a target style transfer network model to obtain the target image.
3 . The method according to claim 2 , wherein performing style transfer on the first backend image and the second backend image by using the target style transfer network model to obtain the target image comprises:
processing the first backend image and the second backend image by using the target style transfer network model to obtain a first style transformation matrix;
up-sampling the first style transformation matrix to obtain a second style transformation matrix;
determining a mask image corresponding to the second backend image; and
fusing the first backend image, the second style transformation matrix, and the mask image to obtain the target image.
4 . The method according to claim 3 , wherein processing the first backend image and the second backend image by using the target style transfer network model to obtain the first style transformation matrix comprises:
processing the first backend image and the second backend image by using the target style transfer network model to obtain a chrominance deviation coefficient; and
determining the first style transformation matrix according to the first backend image and the chrominance deviation coefficient.
5 . The method according to claim 4 , further comprising:
separately converting the first backend image and the second backend image from a YUV domain to an red green blue (RGB) domain; and
wherein processing the first backend image and the second backend image by using the target style transfer network model comprises:
processing, by using the target style transfer network model, the first backend image and the second backend image that have been converted from the YUV domain to the RGB domain.
6 . The method according to claim 5 , further comprising:
training an initial style transfer network model by using a plurality of pairs of training images to determine the target style transfer network model, wherein the plurality of pairs of training images are all in the RGB domain, and each pair of training images has same content but different colors corresponding to dark areas.
7 . The method according to claim 4 , further comprising:
training an initial style transfer network model by using a plurality of pairs of training images to determine the target style transfer network model, wherein the plurality of pairs of training images are all in a YUV domain, and each pair of training images has same content but different colors corresponding to dark areas.
8 . The method according to claim 6 , wherein training the initial style transfer network model by using the plurality of pairs of training images to determine the target style transfer network model comprises:
processing each frame of training image in each pair of training images by using one feature extraction network model to obtain a corresponding feature map; and
training the initial style transfer network model by using two feature maps corresponding to each pair of training images, to obtain the target style transfer network model.
9 . The method according to claim 6 , wherein training the initial style transfer network model by using the plurality of pairs of training images to determine the target style transfer network model comprises:
splicing two frames of training images comprised in each pair of training images to obtain a spliced training image;
processing the spliced training image by using a feature extraction network model to obtain a corresponding spliced feature map; and
training the initial style transfer network model by using the spliced feature map to obtain the target style transfer network model.
10 . The method according to claim 8 , wherein the feature extraction network model is any one of a ResNet model, a VGG model, or a MobileNet model.
11 . The method according to claim 1 , wherein the deep learning network model is any one of a Unet model, an LLnet model, or an FCN model.
12 . The method according to claim 1 , wherein the first backend processing comprises: conversion from an RGB domain to a YUV domain.
13 . The method according to claim 12 , wherein the first backend processing further comprises: at least one of dynamic range control or tone mapping.
14 . The method according to claim 2 , wherein the target style transfer network model is any one of a ResNet model, a VGG model, a Unet model, or a Vnet model.
15 . An electronic device, comprising:
one or more processors and a memory, wherein
the memory is coupled to the one or more processors, the memory stores computer program code, the computer program code comprises computer instructions, and the one or more processors invoke the computer instructions to cause the electronic device to:
display a first interface, wherein the first interface comprises a first control;
detect a first operation on the first control;
obtain a plurality of frames of exposure images in response to detecting the first operation, wherein exposure times of the plurality of frames of exposure images are different, the plurality of frames of exposure images comprise at least one frame of first long-exposure image, and an exposure time of the first long-exposure image is longer than that of a remaining exposure image in the plurality of frames of exposure images;
processing the plurality of frames of exposure images by using a deep learning network model to obtain a first fused image;
performing first backend processing on the first fused image to obtain a first backend image;
obtaining a second long-exposure image, wherein exposure time of the second long-exposure image is longer than that of the remaining exposure image other than the first long-exposure image in the plurality of frames of exposure images;
performing second backend processing on the second long-exposure image to obtain a second backend image; and
perform style transfer on the plurality of frames of exposure images to obtain a target image.
16 . A chip system, wherein the chip system is applied to an electronic device, the chip system comprises one or more processors, and the one or more processors are configured to invoke computer instructions to cause the electronic device to:
display a first interface, wherein the first interface comprises a first control;
detect a first operation on the first control;
obtain a plurality of frames of exposure images in response to detecting the first operation, wherein exposure times of the plurality of frames of exposure images are different, the plurality of frames of exposure images comprise at least one frame of first long-exposure image, and an exposure time of the first long-exposure image is longer than that of a remaining exposure image in the plurality of frames of exposure images;
process the plurality of frames of exposure images by using a deep learning network model to obtain a first fused image;
perform first backend processing on the first fused image to obtain a first backend image;
perform second backend processing on the first long-exposure image to obtain a second backend image; and
perform style transfer on the plurality of frames of exposure images to obtain a target image.
17 . The electronic device according to claim 15 , wherein performing style transfer on the plurality of frames of exposure images to obtain the target image comprises:
performing style transfer on the first backend image and the second backend image by using a target style transfer network model to obtain the target image.
18 . The electronic device according to claim 17 , wherein the one or more processors invoke the computer instructions to cause the electronic device further to:
determine whether an ambient luminance value corresponding to the first backend image is less than a preset ambient luminance value; and
wherein performing style transfer on the first backend image and the second backend image by using a target style transfer network model to obtain the target image comprises:
when the ambient luminance value corresponding to the first backend image is not less than the preset ambient luminance value, outputting the first backend image as the target image; or
when the ambient luminance value corresponding to the first backend image is less than the preset ambient luminance value, performing style transfer on the first backend image and the second backend image by using the target style transfer network model to obtain the target image.
19 . The chip system according to claim 16 , wherein the deep learning network model is any one of a Unet model, an LLnet model, or an FCN model.
20 . The chip system according to claim 16 , wherein the first backend processing comprises: conversion from an RGB domain to a YUV domain.