An image processing method, apparatus, electronic device, and storage medium
By performing resolution reconstruction and grayscale processing followed by color fusion on the image, the problem of independent processing of super-resolution reconstruction and image color replacement is solved, realizing integrated color processing of high-resolution images and improving the sensory effect and detail information of the image.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD
- Filing Date
- 2021-11-03
- Publication Date
- 2026-07-31
AI Technical Summary
In existing technologies, super-resolution reconstruction and image color replacement are two separate processes, which increases the workload of image processing and can easily lead to an unnatural appearance in the final image.
By reconstructing the resolution of the first-resolution image, a second-resolution image is obtained. This second-resolution image is then converted to grayscale and color-added. Finally, the initial color image is fused with the second-resolution image to achieve high-resolution and color-integrated image processing.
While acquiring high-resolution images, it enhances the visual appeal and detail of the images, reduces the workload of image processing, and improves the harmony of the images.
Smart Images

Figure CN116071228B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing, and more particularly to an image processing method, apparatus, electronic device, and storage medium. Background Technology
[0002] With the advent of the information age, people have access to a wide variety of information, among which images are an important component. As the demand for high-quality digital images increases, and the proportion of information obtained through images and videos rises, image resolution has become a key concern. In recent years, resolution enhancement technology has become one of the most popular research areas; this type of resolution enhancement technology is called super-resolution (SR) reconstruction technology.
[0003] Most image recoloring techniques utilize image processing software (Adobe Photoshop, PS) to perform the recoloring. In existing technologies, super-resolution reconstruction and image recoloring are two completely independent processes. This not only increases the workload required for image processing but also easily leads to an unnatural appearance in the final image. Summary of the Invention
[0004] To address the existing technical problems, embodiments of the present invention provide an image processing method, apparatus, electronic device, and storage medium. The technical solution of the embodiments of the present invention is implemented as follows:
[0005] This invention provides an image processing method applied to an electronic device, the method comprising:
[0006] A resolution reconstruction process is performed on the image at the first resolution to obtain an image at the second resolution; wherein the second resolution is higher than the first resolution.
[0007] Perform grayscale processing on the image with the second resolution to obtain a grayscale image corresponding to the image with the second resolution;
[0008] The grayscale image is colored according to the color parameters to obtain an initial color image;
[0009] The initial color image and the image at the second resolution are fused together to obtain the target color image.
[0010] In the above scheme, the step of performing resolution reconstruction processing on the image at the first resolution to obtain an image at the second resolution includes:
[0011] The image at the first resolution is input into M linearly connected residual dense blocks to obtain the local features output by each residual dense block;
[0012] Based on the local features output by each residual dense block, the global features corresponding to the image at the first resolution are obtained;
[0013] Based on the global features, the image at the second resolution is obtained;
[0014] The input to the first residual dense block among the M residual dense blocks is the image at the first resolution; the input to the kth residual dense block is the output of the (k-1)th residual dense block among the M residual dense blocks, where k is a positive integer greater than 1 and less than or equal to M.
[0015] In the above scheme, obtaining the global features corresponding to the image at the first resolution based on the local features output by each residual dense block includes:
[0016] The global feature is obtained by concatenating the M local features.
[0017] In the above scheme, the residual dense block comprises N linearly connected dense layers, and the method further includes:
[0018] The local features output by the (k-1)th residual dense block are input into the N linearly connected dense layers in the kth residual dense block to obtain the local sub-features output by each dense layer.
[0019] The local features of the k-th residual dense block are obtained based on the local features output by the (k-1)-th residual dense block and the local sub-features output by each dense layer.
[0020] In the above scheme, obtaining the local features of the k-th residual dense block based on the local features output by the (k-1)-th residual dense block and the local sub-features output by each dense layer includes:
[0021] The local features output by the (k-1)th residual dense block and the local sub-features output by each dense layer are weighted based on preset weights, and the weighted results are added together to obtain the local features of the kth residual dense block.
[0022] In the above scheme, the step of inputting the local features output by the (k-1)th residual dense block into the N linearly connected dense layers in the kth residual dense block to obtain the local sub-features output by each dense layer includes:
[0023] The local features output by the (k-1)th residual dense block and the n-1 local sub-features output by the first n-1 dense layers in the N dense layers are input into the nth dense layer to obtain the local sub-features output by the nth dense layer. This process is repeated until all N dense layers have been traversed to obtain the local sub-features output by each dense layer.
[0024] Where n is a positive integer greater than 1 and less than or equal to N.
[0025] The method in the above scheme further includes:
[0026] The local feature output by the (k-1)th residual dense block is input into the first dense layer of N linear connections in the kth residual dense block to obtain the first local sub-feature output by the first dense layer.
[0027] This invention also provides an image processing apparatus, the apparatus comprising:
[0028] The reconstruction module is used to perform resolution reconstruction processing on the image at the first resolution to obtain an image at the second resolution; wherein the second resolution is higher than the first resolution.
[0029] The processing module is used to perform grayscale processing on the image of the second resolution to obtain a grayscale image corresponding to the image of the second resolution;
[0030] The coloring module is used to colorize the grayscale image according to color parameters to obtain an initial color image;
[0031] The fusion module is used to fuse the initial color image and the image at the second resolution to obtain the target color image.
[0032] This invention also provides an electronic device, which includes at least a processor and a storage medium configured to store executable instructions, wherein the processor is configured to execute the stored executable instructions, and the executable instructions are configured to execute the image processing method provided in the above embodiments.
[0033] This invention also provides a computer-readable storage medium storing computer-executable instructions configured to execute the image processing method provided in the above embodiments.
[0034] The image processing method proposed in this invention reconstructs an image at a first resolution to obtain an image at a second resolution, performs grayscale processing on the second resolution image to obtain a grayscale image corresponding to the second resolution image, performs color processing on the grayscale image according to color parameters to obtain an initial color image, and obtains a target color image by fusing the initial color image and the image at the second resolution.
[0035] In this embodiment of the application, by combining image reconstruction technology and image color changing technology, while acquiring high-resolution images, the reconstructed images can also be color-changed, thereby improving the sensory effect of the images and enriching the details. Attached Figure Description
[0036] Figure 1 This is a flowchart illustrating the image processing method provided in an embodiment of the present invention. Figure 1 ;
[0037] Figure 2 This is a schematic diagram of the connection of M residual dense blocks provided in an embodiment of the present invention;
[0038] Figure 3 This is a schematic diagram of a network structure including M residual dense blocks provided in an embodiment of the present invention. Figure 1 ;
[0039] Figure 4 This is a schematic diagram of a network structure including M residual dense blocks provided in an embodiment of the present invention. Figure 2 ;
[0040] Figure 5 This is a schematic diagram of the network structure of a residual dense block comprising N linearly connected dense layers provided in an embodiment of the present invention. Figure 1 ;
[0041] Figure 6 This is a schematic diagram of the network structure of a residual dense block comprising N linearly connected dense layers provided in an embodiment of the present invention. Figure 2 ;
[0042] Figure 7 This is a schematic diagram of the network structure of a residual dense block comprising N linearly connected dense layers provided in an embodiment of the present invention. Figure 3 ;
[0043] Figure 8 This is a flowchart illustrating the image processing method provided in an embodiment of the present invention. Figure 2 ;
[0044] Figure 9 This is a schematic diagram of the image color-changing structure provided in an embodiment of the present invention;
[0045] Figure 10This is a schematic diagram of the structure of an image processing device provided in an embodiment of the present invention;
[0046] Figure 11 This is a schematic diagram of an electronic device structure provided in an embodiment of the present invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this invention. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this invention.
[0048] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.
[0049] In the following description, the terms "first, second, third" are used merely to distinguish similar objects and do not represent a specific ordering of objects. It is understood that "first, second, third" may be interchanged in a specific order or sequence where permitted, so that the embodiments of the invention described herein can be implemented in an order other than that illustrated or described herein.
[0050] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to limit the invention.
[0051] The image processing method provided by embodiments of the present invention is described below. See also Figure 1 , Figure 1 This is a flowchart illustrating the image processing method provided in an embodiment of the present invention. Figure 1 The image processing method provided in this embodiment of the invention can be applied to electronic devices.
[0052] It should be noted that electronic devices can include terminal devices, such as mobile terminals or fixed terminals. Mobile terminals can include devices such as mobile phones, tablets, laptops, or wearable devices, and can also include electric home appliances, such as smart speakers. Fixed terminals can include desktop computers or smart TVs.
[0053] The image processing method provided in this embodiment of the invention includes:
[0054] In step 101, the image at the first resolution is subjected to resolution reconstruction processing to obtain an image at the second resolution; wherein, the second resolution is higher than the first resolution;
[0055] In step 102, the image at the second resolution is processed to obtain a grayscale image corresponding to the image at the second resolution.
[0056] In step 103, the grayscale image is colored according to the color parameters to obtain an initial color image;
[0057] In step 104, the initial color image and the image at the second resolution are fused to obtain the target color image.
[0058] It should be noted that resolution reconstruction technology can convert low-resolution images into high-resolution images; image resolution is used to represent the amount of information stored in an image. The higher the image resolution, the higher the pixel density, the more details it contains, and the clearer the image can be represented.
[0059] In one embodiment, a resolution reconstruction process can be performed on a first-resolution image using an interpolation-based method. The interpolation method allows known pixel information (e.g., the first-resolution image) to be used to fit unknown pixel information (e.g., the second-resolution image). The interpolation-based method may include nearest-neighbor interpolation, and may also include bilinear interpolation and bicubic interpolation.
[0060] In another embodiment, the image at the first resolution can also be reconstructed using a reconstruction method; wherein the reconstruction method may include: iterative back projection method, and may also include: convex set projection method, maximum a posteriori probability method.
[0061] In another embodiment, a learning method can also be used to perform resolution reconstruction processing on the image at the first resolution; the learning method may include deep learning, and may also include sparse representation and support vector regression.
[0062] In the implementation process, image reconstruction can also be achieved by combining different methods. For example, the image parameters of the Y channel, Cb channel, and Cr channel of the first resolution image can be extracted. The resolution reconstruction processing of the Y channel image parameters can be performed through deep learning, and the resolution reconstruction processing of the Cb channel image parameters and Cr channel image parameters can be performed through bicubic interpolation to obtain the second resolution image.
[0063] In one embodiment, the image at the first resolution may include a grayscale image or a color image. Taking a color image as an example, the image parameters of the R channel, G channel, and B channel of the color channels can be extracted. Deep learning is then used to perform resolution reconstruction processing on the R channel, G channel, and B channel image parameters respectively, resulting in high-resolution R channel, G channel, and B channel image parameters. Finally, a second resolution image is obtained based on these high-resolution R channel, G channel, and B channel image parameters. During implementation, a corresponding reconstruction algorithm can be selected to reconstruct the image at the first resolution, and no specific limitations are imposed here.
[0064] In another embodiment, there can be multiple images at the first resolution. During the reconstruction of these multiple images at the first resolution, the images can be reconstructed sequentially. Alternatively, the multiple images at the first resolution can be sorted according to a set order, and then the sorted images can be input into the reconstruction algorithm sequentially. The choice can be made based on the actual situation, and no specific limitation is made here.
[0065] In one embodiment, when the image at the second resolution is a color image, grayscale processing of the image at the second resolution may include: extracting the image parameters of the Y channel of the image at the second resolution, and obtaining the grayscale image corresponding to the image at the second resolution based on the image parameters of the Y channel. In other embodiments, grayscale processing of the image at the second resolution may further include: transforming the image at the second resolution from a color image to a grayscale image using a transformation algorithm. The choice can be made according to the actual situation and is not specifically limited here.
[0066] Taking the conversion of a color image to a grayscale image using a transformation algorithm as an example, we can first extract the image parameters of the R channel, G channel, and B channel of the color image, and then obtain the grayscale image based on the extracted R channel, G channel, and B channel image parameters. The formula for obtaining the grayscale image can be expressed as follows:
[0067]
[0068] In formula (1), x and y represent the horizontal and vertical coordinates of the image pixels, respectively, I represents the grayscale image, r represents the image parameters of the R channel of the color image, g represents the image parameters of the G channel of the color image, b represents the image parameters of the B channel of the color image, I(x,y) represents the pixel value at coordinate (x,y) in the grayscale image, r(x,y) represents the pixel value at coordinate (x,y) in the R channel image, g(x,y) represents the pixel value at coordinate (x,y) in the G channel image, and b(x,y) represents the pixel value at coordinate (x,y) in the B channel image.
[0069] In another embodiment, the formula for obtaining a grayscale image can also be expressed as follows:
[0070] I(x,y)=0.3×r(x,y)+0.59×g(x,y)+0.11×b(x,y) (2);
[0071] In formula (2), x and y represent the horizontal and vertical coordinates of an image pixel, respectively; I represents a grayscale image; r represents the image parameters of the R channel of a color image; g represents the image parameters of the G channel of a color image; b represents the image parameters of the B channel of a color image; I(x,y) represents the pixel value at coordinate (x,y) in the grayscale image; r(x,y) represents the pixel value at coordinate (x,y) in the R channel image; g(x,y) represents the pixel value at coordinate (x,y) in the G channel image; and b(x,y) represents the pixel value at coordinate (x,y) in the B channel image. 0.3, 0.59, and 0.11 are weighting parameters, which can be, for example, weighting parameters adjusted based on the human brightness perception system.
[0072] In one embodiment, color parameters can be extracted from the image at a second resolution, and the target area of the grayscale image can be colored to obtain an initial color image.
[0073] In another embodiment, the pixel values of the grayscale image can be compared with a set pixel value threshold, and the pixel regions of the grayscale image can be divided according to the comparison result, thereby achieving colorization of each pixel region in the grayscale image. The set pixel value threshold can include 127, 128, 20, etc., and can be set as needed, without specific limitation here. Taking a set pixel value threshold of 20 as an example, when the pixel values of the grayscale image are less than 20, the image in that range can be colorized to change the color of that range, thereby making the image brighter or darker.
[0074] In another embodiment, the user can select a target area of the grayscale image, and the target area can be colored based on the user-selected color parameters to obtain an initial color image. For example, the user can input a first selection operation through the display interface of the electronic device and select the target area through the first selection operation. As another example, a color block to be selected can be displayed on the display interface, and the user can drag the desired color block to the target area through a second selection operation (e.g., a drag operation). Of course, other gestures or operations can also be used to fill the target area with the desired color block. The settings can be configured according to actual needs, and no specific limitations are made here.
[0075] In this embodiment, during implementation, the image at the first resolution can be converted from the first color space to the second color space, and resolution reconstruction processing is performed on the first resolution image converted to the second color space to obtain the second resolution image. Taking the first color space as RGB color space and the second color space as YCbCr color space as an example, the image at the first resolution can be converted from the RGB color space to the YCbCr color space, and the image parameters of the Y channel, Cb channel, and Cr channel of the first resolution image can be extracted. Resolution reconstruction processing is then performed on the image parameters of the Y channel, Cb channel, and Cr channel respectively to obtain the second resolution image. After obtaining the second resolution image, the image parameters of the Y channel of the second resolution image can be extracted. Based on the image parameters of the Y channel, the corresponding grayscale image of the second resolution image can be obtained. This allows the user to select a target area in the grayscale image, and based on the user-selected color parameters, the target area can be colored to obtain the initial color image.
[0076] In one embodiment, the target region can be determined after grayscale processing. After the target region is determined, the size of the convolution kernel can be determined according to the size of the target region, and the convolution kernel can be used to perform a convolution operation on the parameter region corresponding to the target region in the second resolution image to obtain the target color image, wherein the coordinates of the target region are the same as the coordinates of the parameter region.
[0077] F(Y) = P(W*f(Y) + C) (3);
[0078] In formula (3), W represents the convolution kernel, f(Y) represents the parameter region corresponding to the target region in the second resolution image, C represents the bias of the convolution operation, F(Y) represents the color-changed image, * represents the convolution operation, + represents the sum of results, and P() represents the activation function.
[0079] In one embodiment, the activation function may include: sigmoid function, tanh function, and may also include: relu function, dropout function; it can be set according to experimental requirements, and is not specifically limited here.
[0080] In another embodiment, the size of the convolution kernel can be set according to actual needs, and will not be specifically set here. For example, the size of the convolution kernel may include 3×3, 5×5, or 1×1.
[0081] The image processing method proposed in this invention reconstructs an image at a first resolution to obtain an image at a second resolution, performs grayscale processing on the second resolution image to obtain a grayscale image corresponding to the second resolution image, and performs color processing on the grayscale image according to color parameters to obtain an initial color image. By fusing the initial color image and the image at the second resolution, a target color image is obtained.
[0082] In this embodiment of the application, by combining image reconstruction technology and image color changing technology, while acquiring high-resolution images, the reconstructed images can also be color-changed, thereby improving the sensory effect of the images and enriching the details.
[0083] In some embodiments, the resolution reconstruction processing of the image at the first resolution to obtain an image at the second resolution includes:
[0084] The image at the first resolution is input into M linearly connected residual dense blocks to obtain the local features output by each residual dense block;
[0085] Based on the local features output by each residual dense block, the global features corresponding to the image at the first resolution are obtained;
[0086] Based on the global features, the image at the second resolution is obtained;
[0087] The input to the first residual dense block among the M residual dense blocks is the image at the first resolution; the input to the kth residual dense block is the output of the (k-1)th residual dense block among the M residual dense blocks, where k is a positive integer greater than 1 and less than or equal to M.
[0088] In one embodiment, M can be set according to actual requirements or determined based on experimental data. For example, M may include 5, or it may include 8 or 10, and no specific limitation is made here.
[0089] Figure 2 This is a schematic diagram showing the connection of M residual dense blocks provided in an embodiment of the present invention. Figure 2As shown, the connection diagram of the residual dense blocks provided in this embodiment of the invention includes: M linearly connected residual dense blocks 20.
[0090] In one embodiment, the image at the first resolution can be input into the first residual dense block 21 of M linearly connected residual dense blocks 20 to obtain the local features of the first residual dense block 21; the local features of the first residual dense block 21 can be input into the second residual dense block 22 to obtain the local features of the second residual dense block 22; the local features of the second residual dense block can be input into the third residual dense block 23 to obtain the local features of the third residual dense block 23, and so on, until all M residual dense blocks have been traversed to obtain M local features.
[0091] Here, the input of the first residual dense block among the M residual dense blocks is the image at the first resolution; the inputs of the M-1 residual dense blocks other than the first residual dense block are the outputs of the previous residual dense block.
[0092] The residual dense block can be a network structure that includes multiple convolutional layers, which can perform multi-level feature extraction on the image and fuse the features extracted based on multiple convolutional layers to make full use of all hierarchical features.
[0093] In this embodiment of the disclosure, different local features can be extracted through M linearly connected residual dense blocks, thereby enabling the extraction of rich image features.
[0094] Figure 3 This is a schematic diagram of a network structure including M residual dense blocks provided in an embodiment of the present invention. Figure 1 .like Figure 3 As shown, the network structure includes: a shallow feature extraction layer 30 and M linearly connected residual dense blocks 20.
[0095] In another embodiment, the method further includes: inputting an image of a first resolution into a shallow feature extraction layer 30 to extract shallow features of the image of the first resolution, and inputting the shallow features into M linearly connected residual dense blocks 20 to obtain local features output by each residual dense block.
[0096] Here, the input to the first residual dense block 21 of the M residual dense blocks is the shallow features extracted from the image at the first resolution; the inputs to the M-1 residual dense blocks other than the first residual dense block 21 are the outputs of the previous residual dense block. The shallow features are used to characterize the shallow contour features of the image at the first resolution, and may include: edges, corners, points, and may also include: curves, color features, and texture features.
[0097] Here, by extracting shallow features and inputting them into the residual dense block, the shallow features, local features, and global features are combined to extract rich feature information of the first-resolution image, which enables better resolution reconstruction of the first-resolution image.
[0098] In one embodiment, after obtaining M local features, the M local features can be fused to obtain the global features corresponding to the image at the first resolution.
[0099] In one embodiment, local features can be local contour features obtained by feature extraction from a specific region of the image. Local features may include edges, corners, points, and may also include curves. Global features characterize the overall properties of the image. Global features may include color features, and may also include shape features and texture features.
[0100] In some embodiments, obtaining the global features corresponding to the image at the first resolution based on the local features output by each residual dense block includes:
[0101] The global feature is obtained by concatenating the M local features.
[0102] In one embodiment, M local features are concatenated to obtain the global features corresponding to the image at the first resolution. For example, two local features are A and B, where the dimensions of A and B are p and q, respectively. Concatenating A and B yields the global feature Z, where the dimension of the global feature is p+q.
[0103] In one embodiment, after obtaining the global features, the global features can be input into a dimensionality reduction layer to perform dimensionality reduction operations on the global features, thereby reducing the dimension of the global features and obtaining dimensionality-reduced global features. The dimensionality-reduced global features are then input into a reconstruction layer and a magnification layer to obtain an image with a second resolution. The reconstruction process is performed to obtain the dimension corresponding to the image with the first resolution.
[0104] Figure 4 This is a schematic diagram of a network structure including M residual dense blocks provided in an embodiment of the present invention. Figure 2 .like Figure 4 As shown, the network structure includes: a shallow feature extraction layer 30, M linearly connected residual dense blocks 20, a splicing layer 42, a dimensionality reduction layer 43, a reconstruction layer 44, and an amplification layer 45.
[0105] In one embodiment, the image at a first resolution is input into a shallow feature extraction layer 30 to obtain shallow features. These shallow features are then input into M linearly connected residual dense blocks 20 to obtain M local features corresponding to each of the M linearly connected residual dense blocks 20. These M local features are then input into a stitching layer 42 to obtain global features. After obtaining the global features, they are input into a dimensionality reduction layer 43, a reconstruction layer 44, and a magnification layer 45 to obtain an image at a second resolution. This approach utilizes all extracted features to obtain rich image features, enabling better recovery of image detail information.
[0106] In one embodiment, the concatenation layer 42 may include a concat() function. The concat() function is used to concatenate M local features to obtain global features.
[0107] In one embodiment, the dimensionality reduction layer 43 may include at least one convolution kernel for performing a convolution operation; wherein the size of the convolution kernel is 1×1; the reconstruction layer 44 may include a convolution operation; wherein the size of the convolution kernel may include 3×3 or 5×5, which can be set according to actual needs and is not specifically limited here.
[0108] In one embodiment, the amplification layer 45 may include at least one convolution kernel for performing deconvolution operations. The amplification factor can be set according to actual needs and is not specifically limited here. The amplification factor may include 4, and may also include 2 or 3.
[0109] In some embodiments, the residual dense block comprises N linearly connected dense layers, and the method further comprises:
[0110] The local features output by the (k-1)th residual dense block are input into the N linearly connected dense layers in the kth residual dense block to obtain the local sub-features output by each dense layer.
[0111] The local features of the k-th residual dense block are obtained based on the local features output by the (k-1)-th residual dense block and the local sub-features output by each dense layer.
[0112] Figure 5 This is a schematic diagram of the network structure of a residual dense block comprising N linearly connected dense layers provided in an embodiment of the present invention. Figure 1 ,like Figure 5 As shown, the local features output by the (k-1)th residual dense block 50 can be input into the N linearly connected dense layers in the kth residual dense block 51 to obtain the local sub-features in the kth residual dense block 51. This way, the local features extracted by each residual dense block can be fully utilized so as not to lose the feature information of the image.
[0113] In this embodiment of the disclosure, taking k=2 as an example, the image of the first resolution is input into the first residual dense block to obtain each local sub-feature of the first residual dense block; the local features of the first residual dense block are input into the second residual dense block to obtain each local sub-feature of the second residual dense block, so that the second residual dense block can make full use of the feature information extracted by the first residual dense block.
[0114] In one embodiment, N can be set according to actual requirements or determined based on experimental data. For example, N can include 6, 8, or 10, and is not specifically limited here.
[0115] In one embodiment, a first-resolution image is input into N linearly connected dense layers in a first residual dense block to obtain local sub-features in the first residual dense block; the local features output from the first residual dense block are input into N linearly connected dense layers in a second residual dense block to obtain local sub-features in the second residual dense block; the local features output from the second residual dense block are input into N linearly connected dense layers in a third residual dense block to obtain local sub-features in the third residual dense block; the local features output from the third residual dense block are input into N linearly connected dense layers in a fourth residual dense block to obtain local sub-features in the fourth residual dense block; this process continues until all M residual dense blocks have been traversed to obtain local sub-features in the Mth residual dense block.
[0116] In one embodiment, the local sub-features output by each dense layer in the k-th residual dense block are spliced together to obtain spliced local sub-features, and then the spliced local sub-features are subjected to dimensionality reduction to reduce the dimensionality of the spliced local sub-features.
[0117] In one embodiment, the local features output by the (k-1)th residual dense block, the local sub-features output by each dense layer in the kth residual dense block, and the dimensionality-reduced concatenated local sub-features are added together to obtain the local features of the kth residual dense block. This not only preserves the various features extracted from the previous residual dense blocks but also better combines the results of each dense layer, resulting in better recovery of the image's detailed information.
[0118] In some embodiments, obtaining the local features of the k-th residual dense block based on the local features output by the (k-1)-th residual dense block and the local sub-features output by each dense layer includes:
[0119] The local features output by the (k-1)th residual dense block and the local sub-features output by each dense layer are weighted based on preset weights, and the weighted results are added together to obtain the local features of the kth residual dense block.
[0120] Figure 6 This is a schematic diagram of the network structure of a residual dense block comprising N linearly connected dense layers provided in an embodiment of the present invention. Figure 2 .like Figure 6 As shown, the network structure includes: the (k-1)th residual dense block 50, the kth residual dense block 51, and the (k+1)th residual dense block 60.
[0121] In one embodiment, the local features output by the (k-1)th residual dense block 50 and each local sub-feature in the kth residual dense block 51 are weighted, and according to the weighting result, the local features output by the (k-1)th residual dense block 50 and each local sub-feature in the kth residual dense block 51 are added together, and the result of the addition is input into the (k+1)th residual dense block 60.
[0122] In this way, the results of each residual dense block and each dense layer can be input together into the next residual dense block. This not only preserves the various features extracted from each residual dense block, but also better merges the results of each dense layer, thus better restoring the detailed information of the image.
[0123] In one embodiment, the preset weights can be set according to actual requirements or determined based on experimental data. For example, the preset weights may include: all weights being 1, or they may include: weights increasing from 0.1. These can be set according to actual conditions and are not specifically limited here.
[0124] In this embodiment, obtaining the local features of the k-th residual dense block may include:
[0125] F k =F k-1 +F k,c o n +F1+F2+…+F N (4);
[0126] In formula (4), F k F represents the local features of the k-th residual dense block. k-1 F represents the local features of the (k-1)th residual dense block. k,con F represents the result obtained by concatenating N local sub-features in the k-th residual dense block and then performing a dimensionality reduction operation on the concatenated result. N This represents the Nth local sub-feature in the kth residual dense block.
[0127] This not only preserves the local sub-features of each dense layer in the k-th residual dense block and the local features extracted from the (k-1)-th residual dense block, but also better combines the results of each dense layer to better recover the detailed information of the image.
[0128] In some embodiments, the step of inputting the local features output by the (k-1)th residual dense block into the N linearly connected dense layers in the kth residual dense block to obtain the local sub-features output by each dense layer includes:
[0129] The local features output by the (k-1)th residual dense block and the n-1 local sub-features output by the first n-1 dense layers in the N dense layers are input into the nth dense layer to obtain the local sub-features output by the nth dense layer. This process is repeated until all N dense layers have been traversed to obtain the local sub-features output by each dense layer.
[0130] Where n is a positive integer greater than 1 and less than or equal to N.
[0131] Figure 7 This is a schematic diagram of the network structure of a residual dense block comprising N linearly connected dense layers provided in an embodiment of the present invention. Figure 3 .like Figure 7 As shown, the network structure includes: the (k-1)th residual dense block 50, the kth residual dense block 51, and the (k+1)th residual dense block 60.
[0132] In one embodiment, the local features output by the (k-1)th residual dense block 50 are input into the first dense layer in the k-th residual dense block 51 to obtain the first local sub-feature output by the first dense layer; the local features output by the (k-1)th residual dense block 50 and the first local sub-feature of the k-th residual dense block 51 are input into the second dense layer in the k-th residual dense block 51 to obtain the second local sub-feature output by the second dense layer; the local features output by the (k-1)th residual dense block 50, the first local sub-feature of the k-th residual dense block 51, and the second local sub-feature of the k-th residual dense block 51 are input into the third dense layer in the k-th residual dense block 51 to obtain the third local sub-feature output by the third dense layer; this process continues until all N dense layers have been traversed to obtain the local sub-features output by each dense layer.
[0133] In one embodiment, the local sub-features output by each dense layer in the k-th residual dense block 51 are spliced together to obtain spliced local sub-features, and the spliced local sub-features are then subjected to dimensionality reduction processing to reduce the dimensionality of the spliced local sub-features.
[0134] In one embodiment, the local features output by the (k-1)th residual dense block 50, the local sub-features output by each dense layer in the kth residual dense block 51, and the dimensionality-reduced concatenated local sub-features are added together to obtain the local features of the kth residual dense block 51. This not only preserves the various features extracted from the previous residual dense blocks but also better combines the results of each dense layer, resulting in better recovery of image detail information.
[0135] In one embodiment, the local features output by the kth residual dense block 51 are input into the N linearly connected dense layers in the (k+1)th residual dense block 60 to obtain the local features of the (k+1)th residual dense block 60.
[0136] In one embodiment, the local features output by the (k-1)th residual dense block are input into each dense layer in the k-th residual dense block, thereby making full use of the local features output by the (k-1)th residual dense block so as to preserve the local features of each residual dense block.
[0137] In one embodiment, the local sub-features of the first n-1 dense layers in the k-th residual dense block are also input into the n-th dense layer. This preserves the features extracted from each dense layer and makes full use of the information in each dense layer to obtain rich image features.
[0138] In some embodiments, the method further includes:
[0139] The local feature output by the (k-1)th residual dense block is input into the first dense layer of N linear connections in the kth residual dense block to obtain the first local sub-feature output by the first dense layer.
[0140] In one embodiment, the local features output by the (k-1)th residual dense block are input into the first dense layer in the kth residual dense block to obtain the first local sub-feature output by the first dense layer. This allows for the acquisition of multi-level local features, resulting in richer extracted image features.
[0141] In one embodiment, the first local sub-feature output from the first dense layer in the k-th residual dense block is input into n dense layers in the k-th residual dense block, so as to preserve the first local sub-feature and avoid loss of image features.
[0142] Figure 8 This is a flowchart illustrating the image processing method provided in an embodiment of the present invention. Figure 2 The image processing method provided in this embodiment of the invention can be applied to electronic devices. For example... Figure 8 As shown, the image processing method provided in this embodiment of the invention includes:
[0143] In step 401, shallow features of the image at the first resolution are extracted.
[0144] In one embodiment, shallow features are used to characterize the contour features of an image at a first resolution (low-resolution image), and may include: edges, corners, points, and may also include: curves, color features, and texture features.
[0145] In one embodiment, the image at the first resolution may include a grayscale image or a color image.
[0146] Taking a color image at the first resolution as an example, the image parameters of the Y channel, Cb channel, and Cr channel of the image at the first resolution are extracted. Convolution operations are then performed on the image parameters of the Y channel, Cb channel, and Cr channel respectively to extract the shallow features of the image parameters of the Y channel, Cb channel, and Cr channel.
[0147] F(Y t )=P(W t *f(Y t )+C t (5);
[0148] In formula (5), when t = {1, 2, 3}, Y t These represent the image parameters for the Y channel, Cb channel, and Cr channel, respectively. F(Y) t ) represent the image parameters of the Y channel, Cb channel, and Cr channel output after the convolution operation, respectively; W t These represent the convolution kernels corresponding to the image parameters of the Y channel, Cb channel, and Cr channel, respectively. t These represent the biases corresponding to the image parameters of the Y channel, Cb channel, and Cr channel, respectively. P() represents the activation function, * represents the convolution operation, and + represents the sum of the results.
[0149] In one embodiment, the size of the convolution kernel can be set according to experimental requirements, and will not be specifically set here. For example, the size of the convolution kernel may include 3×3, 5×5, or 1×1.
[0150] In step 402, the shallow features are input into M linearly connected residual dense blocks to obtain M local features.
[0151] In one embodiment, M can be set according to actual requirements or determined based on experimental data. For example, M may include 5, or it may include 8 or 10, and no specific limitation is made here.
[0152] In one embodiment, shallow features can be input into a first linearly connected dense residual block to obtain local features of the first dense residual block; the local features of the first dense residual block can be input into a second linearly connected dense residual block to obtain local features of the second dense residual block; the local features of the second dense residual block can be input into a third linearly connected dense residual block to obtain local features of the third dense residual block; and so on, until all M dense residual blocks have been traversed to obtain M local features. In this way, different local features can be extracted from M linearly connected dense residual blocks.
[0153] In step 403, the global features corresponding to the first-resolved image are obtained based on the M local features.
[0154] In one embodiment, M local features are concatenated to obtain a global feature. For example, two local features are A and B, where the dimensions of A and B are p and q, respectively. Concatenating A and B yields a global feature Z, where the dimension of the global feature is p+q.
[0155] In step 404, an image with a second resolution is obtained based on global features.
[0156] In one embodiment, the second resolution is higher than the first resolution.
[0157] In one embodiment, a dimensionality reduction operation is performed on the global features to reduce their dimensionality, and then the dimensionality-reduced global features are reconstructed and magnified to obtain an image with a second resolution (high-resolution image). The reconstruction process is performed to obtain the dimensionality corresponding to the image with the first resolution.
[0158] In this embodiment, M local features corresponding to the Y-channel, Cb-channel, and Cr-channel image parameters of a low-resolution image are obtained. These M local features are then concatenated to obtain the global features corresponding to the Y-channel, Cb-channel, and Cr-channel image parameters. Two convolution operations and one deconvolution operation are then performed on these global features. The first convolution operation is used to reduce the dimensionality of the global features, the second convolution operation is used to reconstruct the dimensionality-reduced global features, and the deconvolution operation is used to enlarge the image. This process yields high-resolution Y-channel, Cb-channel, and Cr-channel image parameters. A high-resolution image is then obtained based on these high-resolution Y-channel, Cb-channel, and Cr-channel image parameters.
[0159] In step 405, the image at the second resolution is processed to obtain a grayscale image corresponding to the image at the second resolution.
[0160] In one embodiment, when the image at the second resolution is a color image, grayscale processing of the image at the second resolution may include: extracting the image parameters of the Y channel of the image at the second resolution, and obtaining the grayscale image corresponding to the image at the second resolution based on the image parameters of the Y channel; it may also include: transforming the image at the second resolution from a color image to a grayscale image using a transformation algorithm. The specific method can be chosen according to the actual situation and is not specifically limited here.
[0161] In step 406, the grayscale image is colored according to the color parameters to obtain an initial color image.
[0162] In one embodiment, color parameters can be extracted from the image at a second resolution, and the target area of the grayscale image can be colored to obtain an initial color image.
[0163] In another embodiment, the pixel values of the grayscale image can be compared with a set pixel value threshold to divide the pixel regions of the grayscale image, thereby achieving colorization of the grayscale image. The set pixel value threshold can include 127, 128, or 20, and can be set as needed; no specific limitation is made here. Taking a set pixel value threshold of 20 as an example, when the pixel values of the grayscale image are less than 20, the image within that range can be colorized to change the color of that range, thereby making the image brighter or darker.
[0164] In another embodiment, the user can select a target area of the grayscale image, and based on the user-selected color parameters, colorize the target area to obtain an initial color image. For example, the user can input a first selection operation through the display interface of the electronic device and select the target area through the first selection operation. As another example, a color block to be selected can be displayed on the display interface, and the user can drag the desired color block to the target area through a second selection operation (e.g., drag operation). Of course, other gestures or operations can also be used to fill the target area with the desired color block. The settings can be configured according to actual needs, and no specific limitations are made here.
[0165] In step 407, the initial color image and the second resolution image are fused to obtain the target color image.
[0166] In one embodiment, the target region can be determined after grayscale processing. After the target region is determined, the size of the convolution kernel can be determined according to the size of the target region, and the convolution kernel can be used to perform a convolution operation on the parameter region corresponding to the target region in the second resolution image to obtain the target color image, wherein the coordinates of the target region are the same as the coordinates of the parameter region.
[0167] Figure 9 This is a schematic diagram of the image color-changing structure provided in an embodiment of the present invention. For example... Figure 9 As shown, the schematic diagram of the image color-changing structure provided in this embodiment of the invention includes: a second resolution image 80, a grayscale image 81, an initial color image 82, and a target color image 83.
[0168] In one embodiment, when the image 80 at the second resolution is a color image, performing grayscale processing on the image 80 at the second resolution may include: extracting the image parameters of the Y channel of the image 80 at the second resolution, and obtaining the grayscale image 81 corresponding to the image 80 at the second resolution based on the image parameters of the Y channel; it may also include: transforming the image 80 at the second resolution from a color image to a grayscale image 81 using a transformation algorithm. The specific method can be chosen according to the actual situation and is not specifically limited here.
[0169] In one embodiment, color parameters can be extracted from the second resolution image 80, and the target area of the grayscale image 81 can be colored to obtain an initial color image 82.
[0170] In another embodiment, the pixel values of the grayscale image 81 can be compared with a set pixel value threshold to divide the pixel region of the grayscale image 81, thereby achieving colorization of the grayscale image 81. The set pixel value threshold can include 127, 128, or 20, and can be set as needed, without specific limitation here. Taking a set pixel value threshold of 20 as an example, when the pixel values of the grayscale image 81 are less than 20, the image in that range can be colorized to change the color of that range, thereby making the image brighter or darker.
[0171] In another embodiment, the user can also select a target area of the grayscale image 81, and color the target area based on the color parameters selected by the user to obtain an initial color image 82.
[0172] In one embodiment, the target region can be determined after grayscale processing. After the target region is determined, the size of the convolution kernel can be determined according to the size of the target region, and the convolution kernel can be used to perform a convolution operation on the parameter region corresponding to the target region in the second resolution image 80 to obtain the target color image 83, wherein the coordinates of the target region are the same as the coordinates of the parameter region.
[0173] The following is a schematic diagram of the structure of an image processing device provided in an embodiment of the present invention. Figure 10 This is a schematic diagram of the structure of an image processing device provided in an embodiment of the present invention. Figure 10 As shown, the image processing apparatus 500 provided in this embodiment of the invention includes:
[0174] The reconstruction module 501 is used to perform resolution reconstruction processing on the image at the first resolution to obtain an image at the second resolution; wherein the second resolution is higher than the first resolution.
[0175] Processing module 502 is used to perform grayscale processing on the image of the second resolution to obtain a grayscale image corresponding to the image of the second resolution;
[0176] The coloring module 503 is used to perform coloring processing on the grayscale image according to color parameters to obtain an initial color image;
[0177] The fusion module 504 is used to perform fusion processing on the initial color image and the image at the second resolution to obtain the target color image.
[0178] In some embodiments, the reconstruction module 501 is further configured to:
[0179] The image at the first resolution is input into M linearly connected residual dense blocks to obtain the local features output by each residual dense block;
[0180] Based on the local features output by each residual dense block, the global features corresponding to the image at the first resolution are obtained;
[0181] Based on the global features, the image at the second resolution is obtained;
[0182] The input to the first residual dense block among the M residual dense blocks is the image at the first resolution; the input to the kth residual dense block is the output of the (k-1)th residual dense block among the M residual dense blocks, where k is a positive integer greater than 1 and less than or equal to M.
[0183] In some embodiments, the image processing apparatus 500 further includes: a stitching module, used for:
[0184] The global feature is obtained by concatenating the M local features.
[0185] In some embodiments, the residual dense block includes: N linearly connected dense layers, and the reconstruction module 501 is further configured to:
[0186] The local features output by the (k-1)th residual dense block are input into the N linearly connected dense layers in the kth residual dense block to obtain the local sub-features output by each dense layer.
[0187] The local features of the k-th residual dense block are obtained based on the local features output by the (k-1)-th residual dense block and the local sub-features output by each dense layer.
[0188] In some embodiments, the image processing apparatus 500 further includes: a weighting module, configured to:
[0189] The local features output by the (k-1)th residual dense block and the local sub-features output by each dense layer are weighted based on preset weights, and the weighted results are added together to obtain the local features of the kth residual dense block.
[0190] In some embodiments, the reconstruction module 501 is further configured to:
[0191] The local features output by the (k-1)th residual dense block and the n-1 local sub-features output by the first n-1 dense layers in the N dense layers are input into the nth dense layer to obtain the local sub-features output by the nth dense layer. This process is repeated until all N dense layers have been traversed to obtain the local sub-features output by each dense layer.
[0192] Where n is a positive integer greater than 1 and less than or equal to N.
[0193] In some embodiments, the reconstruction module 501 is further configured to:
[0194] The local feature output by the (k-1)th residual dense block is input into the first dense layer of N linear connections in the kth residual dense block to obtain the first local sub-feature output by the first dense layer.
[0195] This invention also provides an electronic device, the device comprising at least: a processor and a storage medium configured to store executable instructions, wherein:
[0196] The processor is configured to execute stored executable instructions, which are configured to execute the image processing method provided in the embodiments of the present invention.
[0197] It should be noted that, Figure 11 This is a schematic diagram of an electronic device structure provided in an embodiment of the present invention, such as... Figure 11 As shown, the device 600 includes at least: a processor 601, a communication interface 602, a memory 603, and a bus 604, wherein:
[0198] Processor 601 typically controls the overall operation of device 600.
[0199] Communication interface 602 enables the device to communicate with other devices over a network.
[0200] The memory 603 is configured to store instructions and applications executable by the processor 601, and can also cache data to be processed or already processed by the processor 601 and the various modules in the device 600 (e.g., image data, audio data, voice communication data and video communication data), which can be implemented by flash memory or random access memory (RAM).
[0201] Bus 604 is used to establish communication connections between processor 601, communication interface 602 and memory 603.
[0202] It should be noted that, in the embodiments of this application, if the above image processing method is implemented as a software functional module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a server to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, mobile hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0203] Correspondingly, embodiments of this application provide a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps in the image processing method provided in the above embodiments.
[0204] It should be noted that the descriptions of the storage medium and device embodiments above are similar to those of the method embodiments above, and have similar beneficial effects. For technical details not disclosed in the storage medium and device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0205] Of course, the apparatus in the embodiments of this application may have other similar protocol interaction implementation cases. Without departing from the spirit and essence of this application, those skilled in the art can make various corresponding changes and modifications based on the embodiments of this application, but these corresponding changes and modifications should all fall within the protection scope of the claims appended to the method of this application.
[0206] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or more computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.
[0207] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 Devices that specify the functions in one or more boxes.
[0208] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including an instruction device, which is implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0209] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0210] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential order of execution; the execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.
[0211] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0212] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of modules is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple modules or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or modules can be electrical, mechanical, or other forms.
[0213] The modules described above as separate components may or may not be physically separate. The components shown as modules may or may not be physical modules. They may be located in one place or distributed across multiple network modules. Some or all of the modules may be selected to achieve the purpose of this embodiment according to actual needs.
[0214] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An image processing method, characterized by, Applied to electronic devices, the method includes: A resolution reconstruction process is performed on the image at the first resolution to obtain an image at the second resolution; wherein the second resolution is higher than the first resolution. If the image at the second resolution is a color image, then the image at the second resolution is processed into grayscale to obtain a grayscale image corresponding to the image at the second resolution. The pixel values of the grayscale image are compared with a set pixel value threshold, and the target region is determined from the grayscale image based on the comparison result. Extract the color parameters corresponding to the target region from the image at the second resolution, and perform color processing on the target region of the grayscale image according to the color parameters to obtain an initial color image; The initial color image and the image at the second resolution are fused together to obtain the target color image; The fusion process includes: determining a convolution kernel based on the size of the target region after colorization in the initial color image; and using the convolution kernel to perform a convolution operation on a parameter region in the second resolution image corresponding to the target region to obtain the target color image, wherein the coordinates of the target region are the same as the coordinates of the parameter region.
2. The method of claim 1, wherein, The process of reconstructing the image at the first resolution to obtain an image at the second resolution includes: The image at the first resolution is input into M linearly connected residual dense blocks to obtain the local features output by each residual dense block; Based on the local features output by each residual dense block, the global features corresponding to the image at the first resolution are obtained; Based on the global features, the image at the second resolution is obtained; The input to the first residual dense block among the M residual dense blocks is the image at the first resolution; the input to the kth residual dense block is the output of the (k-1)th residual dense block among the M residual dense blocks, where k is a positive integer greater than 1 and less than or equal to M.
3. The method of claim 2, wherein, The step of obtaining the global features corresponding to the image at the first resolution based on the local features output by each residual dense block includes: The global feature is obtained by concatenating the M local features.
4. The method of claim 2, wherein, The residual dense block comprises N linearly connected dense layers, and the method further comprises: The local features output by the (k-1)th residual dense block are input into the N linearly connected dense layers in the kth residual dense block to obtain the local sub-features output by each dense layer. The local features of the k-th residual dense block are obtained based on the local features output by the (k-1)-th residual dense block and the local sub-features output by each dense layer.
5. The method of claim 4, wherein, The step of obtaining the local features of the k-th residual dense block based on the local features output by the (k-1)-th residual dense block and the local sub-features output by each dense layer includes: The local features output by the (k-1)th residual dense block and the local sub-features output by each dense layer are weighted based on preset weights, and the weighted results are added together to obtain the local features of the kth residual dense block.
6. The method according to claim 4, characterized in that, The local features output from the (k-1)th residual dense block are input into the N linearly connected dense layers in the kth residual dense block to obtain the local sub-features output by each dense layer, including: The local features output by the (k-1)th residual dense block and the n-1 local sub-features output by the first n-1 dense layers in the N dense layers are input into the nth dense layer to obtain the local sub-features output by the nth dense layer. This process is repeated until all N dense layers have been traversed to obtain the local sub-features output by each dense layer. Where n is a positive integer greater than 1 and less than or equal to N.
7. The method according to claim 6, characterized in that, The method further includes: The local feature output by the (k-1)th residual dense block is input into the first dense layer of N linear connections in the kth residual dense block to obtain the first local sub-feature output by the first dense layer.
8. An image processing apparatus, characterized in that, The device includes: The reconstruction module is used to perform resolution reconstruction processing on the image at the first resolution to obtain an image at the second resolution; wherein the second resolution is higher than the first resolution. The processing module is used to perform grayscale processing on the image at the second resolution if the image at the second resolution is a color image, so as to obtain a grayscale image corresponding to the image at the second resolution. The coloring module is used to compare the pixel values of the grayscale image with a set pixel value threshold, determine the target region from the grayscale image based on the comparison result, extract the color parameters corresponding to the target region from the image at the second resolution, and perform coloring processing on the grayscale image based on the color parameters to obtain an initial color image. A fusion module is used to fuse the initial color image and the image at the second resolution to obtain a target color image; wherein the fusion process includes: determining a convolution kernel based on the size of the target region after colorization in the initial color image, and using the convolution kernel to perform a convolution operation on a parameter region in the image at the second resolution that corresponds to the target region to obtain the target color image, wherein the coordinates of the target region are the same as the coordinates of the parameter region.
9. An electronic device, characterized in that, The electronic device includes at least: a processor and a storage medium configured to store executable instructions, wherein: The processor is configured to execute stored executable instructions, which are configured to perform the image processing method provided by any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions configured to perform the image processing method provided by any one of claims 1 to 7.