Processing method and device for converting multi-channel image into single-channel image based on large model
By large-model processing of multi-channel images and performing neighborhood operations when generating single-channel images, the inconsistency problem caused by different pixel values in the generated image is solved, and a more natural image transition and higher image quality are achieved.
Patent Information
- Application Number
- CN202311489609.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-09
- Publication Date
- 2025-05-09
AI Technical Summary
When generating a single-channel image, due to the randomness and stability of the visual big model, the values of some pixels in the generated single-channel image on a single channel are different, and the processing method is single, resulting in the pixels after replacing the numerical value are inconsistent with adjacent pixels.
By inputting the multi-channel image to the preset large model to generate a single-channel image, and perform at least one round of neighborhood operations for pixels whose numerical differences on different channels are greater than the preset threshold, obtain the pixel value and replace the original value to generate the target single-channel image.
The coordination and natural transition between pixels and adjacent pixels after denoising in the target single-channel image is achieved, and the overall smoothness of the image and the image quality and recognition accuracy of the subsequent generated images are improved.
Smart Images

Figure CN119963459A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing technology, and in particular to a processing method and device for converting a multi-channel image into a single-channel image based on a large model. Background Art
[0002] With the rapid development of hardware technology of image acquisition devices such as cameras, it has become easier and easier to obtain color images; however, due to limitations in acquisition sensors and other methods, single-channel images of the same color image are often difficult to obtain.
[0003] In related technologies, when a single-channel image of the same color image needs to be obtained, a deep learning model such as a visual big model is often used to generate a single-channel image of the color image. In practice, the color image is input into the visual big model, and the color image is processed based on the visual big model to generate a single-channel image of the color image. However, due to the randomness and stability of the visual big model, some pixels in the generated single-channel image may have different values on a single channel.
[0004] At present, the processing method for processing the different values on the above channels is mostly to simply calculate the average of the values on each channel. The processing method is relatively simple, and the resulting single-channel image often has the problem of inconsistency between the pixels after the replacement of the values and the adjacent pixels. Summary of the invention
[0005] The embodiments of the present application provide a method and device for converting a multi-channel image into a single-channel image based on a large model, which is used to provide a processing method for different numerical values on a single channel in a single-channel image generated by a preset large model, so that the denoised pixels in the target single-channel image are coordinated with adjacent pixels and the transition is natural.
[0006] The specific technical solutions provided by the embodiments of this application are as follows:
[0007] In a first aspect, an embodiment of the present application provides a processing method for converting a multi-channel image into a single-channel image based on a large model, comprising:
[0008] Generate a single-channel image from a multi-channel image through a preset large model, wherein the multi-channel image is an N-channel image, and each pixel in the single-channel image includes values of N channels;
[0009] For any pixel in the single-channel image, based on the values of the any pixel on the N channels, determining whether the values of the any pixel on the N channels are the same;
[0010] If not, and among the absolute values of the difference between the values on any two channels of any pixel, there is at least one absolute value greater than a preset threshold, then based on the values of each pixel on N channels in the single-channel image, at least one round of neighborhood operation is performed on the any pixel to obtain the pixel value of the any pixel;
[0011] The pixel values are used to replace the values of any pixel in the single-channel image on the N channels respectively, so as to obtain a target single-channel image corresponding to the multi-channel image.
[0012] The embodiment of the present application provides a processing method for converting a multi-channel image to a single-channel image based on a large model, which is used to provide a processing method for solving the problem of different values on different channels in a single-channel image. Specifically, it is first determined whether the values of each pixel in the single-channel image generated by a preset large model on N channels are the same, so as to screen out pixels with different values on different channels in the single-channel image, and then perform subsequent denoising processing on pixels greater than a preset threshold; wherein, when the pixel is denoised, since the pixel value of the pixel is obtained by performing at least one round of neighborhood operation on the pixel based on the values of each pixel in the single-channel image on each channel, the pixel value of the pixel in the target single-channel image takes into account the values of the neighboring pixels of the pixel on each channel, and explores the spatial relationship between the pixel and the neighboring pixels, so as to achieve the unification of the values of the same pixel in different channels in the target single-channel image, and more importantly, the pixel in the target single-channel image is coordinated with the neighboring pixels and the transition is natural.
[0013] In a possible implementation, if the at least one round of neighborhood operations includes multiple rounds of neighborhood operations, then based on the values of each pixel in the single-channel image on the N channels, performing at least one round of neighborhood operations on any pixel to obtain the pixel value of any pixel includes:
[0014] For any round of neighborhood operations in the multiple rounds of neighborhood operations, based on the values of each neighborhood pixel corresponding to the any round of neighborhood operations on the target channel, a sub-fusion value corresponding to the any round of neighborhood operations of any pixel on the target channel is obtained, wherein the target channel is any channel among the N channels;
[0015] Obtaining a fusion value of any pixel on the target channel based on sub-fusion values corresponding to multiple rounds of neighborhood operations of any pixel on the target channel;
[0016] Based on the fusion values of any pixel on the N channels, a pixel value of any pixel is obtained.
[0017] In the above method, the sub-fusion value corresponding to any round of neighborhood operation of the pixel on the target channel is obtained based on the values of each neighborhood pixel corresponding to the round of neighborhood operation on the target channel. Therefore, the sub-fusion value takes into account the values of the neighboring pixels of the pixel on the target channel and also explores the spatial relationship between the pixel and the neighboring pixels, thereby ensuring that the pixel and the neighboring pixels in the target single-channel image subsequently obtained based on the sub-fusion value are coordinated and the transition is natural.
[0018] In a possible implementation, before obtaining the sub-fusion value corresponding to the any round of neighborhood operation of any pixel on the target channel based on the value of each neighborhood pixel corresponding to the any round of neighborhood operation on the target channel, the method further includes:
[0019] Based on the pixel coordinates of any pixel, determining each neighborhood pixel corresponding to any round of neighborhood operation;
[0020] Wherein, if the any round of neighborhood operation is the first round of neighborhood operation, the neighborhood pixels corresponding to the any round of neighborhood operation are the pixels surrounding the any pixel in the target image, and the target image is obtained by performing image expansion on the single-channel image based on the single-channel image;
[0021] If any round of neighborhood operation is not the first round of neighborhood operation, the neighborhood pixels corresponding to any round of neighborhood operation are the pixels in the target image that surround the neighborhood pixels corresponding to the previous round of neighborhood operation.
[0022] The above method, through multiple rounds of neighborhood operations, can make the difference between the pixel and the adjacent pixels or surrounding pixels smaller, thereby ensuring that the pixel and the adjacent pixels in the target single-channel image after subsequent denoising are coordinated and transitioned naturally, so as to improve the overall smoothness of the picture.
[0023] In a possible implementation, obtaining a sub-fusion value corresponding to any round of neighborhood operation of any pixel on the target channel based on the values of each neighborhood pixel corresponding to any round of neighborhood operation on the target channel includes:
[0024] The statistical value of the values of each neighborhood pixel corresponding to any round of neighborhood operation on the target channel is determined as the sub-fusion value corresponding to any round of neighborhood operation of any pixel on the target channel, wherein the statistical value is any one of the mean and the mode.
[0025] In a possible implementation, obtaining the fusion value of any pixel on the target channel based on the sub-fusion values corresponding to the multiple rounds of neighborhood operations of any pixel on the target channel includes:
[0026] The weighted sum of the value of any pixel on the target channel, the first fusion weight, the sub-fusion values corresponding to the multiple rounds of neighborhood operations, and the second fusion weights corresponding to the multiple rounds of neighborhood operations is determined as the fusion value of any pixel on the target channel.
[0027] The above method, by setting the first fusion weight and the second fusion weight corresponding to multiple rounds of neighborhood operations, can customize the value of the pixel on the target channel and the sub-fusion value corresponding to each neighborhood operation according to the scene requirements in the actual scene, and determine the proportion of the pixel value of the pixel, thereby improving the reliability and universality of the denoising method.
[0028] In a possible implementation manner, obtaining the pixel value of any pixel based on the fused values of any pixel on the N channels includes:
[0029] The weighted sum of the fusion value of any pixel on the N channels and the channel fusion weights corresponding to the N channels is determined as the pixel value of any pixel.
[0030] The above method, by setting the channel fusion weight, can customize the fusion value on each channel according to the scene requirements in the actual scene, and determine the proportion of the pixel value of the pixel, thereby improving the reliability and universality of the denoising processing method.
[0031] In a second aspect, an embodiment of the present application provides a processing device for converting a multi-channel image into a single-channel image based on a large model, comprising:
[0032] A first determination module is used to generate a single-channel image from a multi-channel image through a preset large model, wherein the multi-channel image is an N-channel image, and each pixel in the single-channel image includes values of N channels;
[0033] A second determination module is used to determine, for any pixel in the single-channel image, whether the values of the any pixel on the N channels are the same based on the values of the any pixel on the N channels;
[0034] A neighborhood operation module, configured to, if no, and at least one absolute value of the difference between the values on any two channels of any pixel is greater than a preset threshold, perform at least one round of neighborhood operation on the any pixel based on the values of each pixel on the N channels in the single-channel image to obtain the pixel value of the any pixel;
[0035] The denoising module is used to replace the values of any pixel in the single-channel image on the N channels with the pixel values to obtain a target single-channel image corresponding to the multi-channel image.
[0036] In a possible implementation manner, if the at least one round of neighborhood operation includes multiple rounds of neighborhood operation, the neighborhood operation module is specifically used to:
[0037] For any round of neighborhood operations in the multiple rounds of neighborhood operations, based on the values of each neighborhood pixel corresponding to the any round of neighborhood operations on the target channel, a sub-fusion value corresponding to the any round of neighborhood operations of any pixel on the target channel is obtained, wherein the target channel is any channel among the N channels;
[0038] Obtaining a fusion value of any pixel on the target channel based on sub-fusion values corresponding to multiple rounds of neighborhood operations of any pixel on the target channel;
[0039] Based on the fusion values of any pixel on the N channels, a pixel value of any pixel is obtained.
[0040] In a possible implementation, before obtaining the sub-fusion value corresponding to any round of neighborhood operation of any pixel on the target channel based on the value of each neighborhood pixel corresponding to any round of neighborhood operation on the target channel, the neighborhood operation module is further used to:
[0041] Based on the pixel coordinates of any pixel, determining each neighborhood pixel corresponding to any round of neighborhood operation;
[0042] Wherein, if the any round of neighborhood operation is the first round of neighborhood operation, the neighborhood pixels corresponding to the any round of neighborhood operation are the pixels surrounding the any pixel in the target image, and the target image is obtained by performing image expansion on the single-channel image based on the single-channel image;
[0043] If any round of neighborhood operation is not the first round of neighborhood operation, the neighborhood pixels corresponding to any round of neighborhood operation are the pixels in the target image that surround the neighborhood pixels corresponding to the previous round of neighborhood operation.
[0044] In a possible implementation, the neighborhood operation module is specifically used to:
[0045] The statistical value of the values of each neighborhood pixel corresponding to any round of neighborhood operation on the target channel is determined as the sub-fusion value corresponding to any round of neighborhood operation of any pixel on the target channel, wherein the statistical value is any one of the mean and the mode.
[0046] In a possible implementation, the neighborhood operation module is specifically used to:
[0047] The weighted sum of the value of any pixel on the target channel, the first fusion weight, the sub-fusion values corresponding to the multiple rounds of neighborhood operations, and the second fusion weights corresponding to the multiple rounds of neighborhood operations is determined as the fusion value of any pixel on the target channel.
[0048] In a possible implementation, the neighborhood operation module is specifically used to:
[0049] The weighted sum of the fusion value of any pixel on the N channels and the channel fusion weights corresponding to the N channels is determined as the pixel value of any pixel.
[0050] In a third aspect, an embodiment of the present application provides an electronic device, including:
[0051] Memory, used to store computer programs or instructions;
[0052] A processor is used to execute the computer program or instructions in the memory so that any method in the first aspect described above is executed.
[0053] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor, the processor is enabled to execute any one of the methods described in the first aspect above.
[0054] In addition, the technical effects brought about by any one of the implementation methods in the second to fourth aspects can refer to the technical effects brought about by different implementation methods in the first aspect, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 This is a schematic diagram of an optional application scenario in an embodiment of the present application;
[0056] Figure 2 This is a schematic diagram of another optional application scenario in the embodiment of the present application;
[0057] Figure 3 A schematic flow chart of a method for converting a multi-channel image into a single-channel image based on a large model in an embodiment of the present application;
[0058] Figure 4 A schematic diagram of a scene in which a single-channel image is generated by a large visual model in an embodiment of the present application;
[0059] Figure 5 is a schematic diagram of a single-channel image with pixels to be denoised in an embodiment of the present application;
[0060] Figure 6 A schematic diagram of a flow chart of a method for determining a pixel value of a pixel in an embodiment of the present application;
[0061] Figure 7 A schematic diagram of a processing process of an image expansion method in an embodiment of the present application;
[0062] Figure 8 A schematic diagram of a processing process of another image expansion method in an embodiment of the present application;
[0063] Fig. 9 A schematic diagram of a processing process for determining each neighborhood pixel corresponding to a first round of neighborhood operation in an embodiment of the present application;
[0064] Fig.10 A schematic diagram of a processing process for determining each neighborhood pixel corresponding to a second round of neighborhood operation in an embodiment of the present application;
[0065] Fig.11 A schematic diagram of a processing process for determining each neighborhood pixel corresponding to the third round of neighborhood operation in an embodiment of the present application;
[0066] Fig.12 Schematic diagram of comparison of a single-channel image before and after denoising in an embodiment of the present application;
[0067] Fig.13 A schematic diagram of the logical architecture of a processing device for converting a multi-channel image into a single-channel image based on a large model in an embodiment of the present application;
[0068] Fig.14 It is a schematic diagram of the physical structure of the electronic device in the embodiment of the present application. DETAILED DESCRIPTION
[0069] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0070] It should be noted that the terms "first", "second", "third", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein.
[0071] The following is a brief introduction to the design concept of the embodiments of the present application.
[0072] The present application relates to the field of image processing technology, and mainly to a processing method and device for converting a multi-channel image into a single-channel image based on a large model.
[0073] In the related art, when it is necessary to obtain a single-channel image of the same color image (e.g., a multi-channel image: a red, green, blue (RGB) image), a deep learning model such as a visual big model is often used to generate a single-channel image of the color image. In practice, the color image is input into the visual big model, and the color image is processed based on the visual big model to generate a single-channel image of the color image. However, in view of the randomness and stability characteristics of the visual big model, some pixels in the generated single-channel image will have different values on a single channel.
[0074] At present, the processing method for handling the different values on the above channels is mostly to simply calculate the average of the values on each channel, and use the average to replace the values on each channel of the pixel in the single-channel image. However, this processing method is relatively simple and single, and the resulting single-channel image often has problems such as inconsistency and unnaturalness between the pixel after the replacement value and the adjacent pixels, which affects the overall smoothness of the image and even affects the image quality and image recognition accuracy of the subsequent image generated based on the single-channel image.
[0075] For example, in an application scenario where an infrared image is generated based on a single-channel image, when temperature recognition is performed on the infrared image generated based on the single-channel image obtained based on the above-mentioned traditional processing method, there will often be problems such as a large deviation between the temperature recognized in some areas and the temperature recognized in the surrounding areas.
[0076] For another example, in an application scenario where a black-and-white image is generated based on a single-channel image, problems such as image distortion in some areas often occur in the black-and-white image generated based on the single-channel image obtained by the above-mentioned traditional processing method.
[0077] In view of this, in order to solve the problem of the singleness of traditional processing methods, an embodiment of the present application provides a processing method for converting a multi-channel image into a single-channel image based on a large model. In the embodiment of the present application, a single-channel image is generated from a multi-channel image through a preset large model. The multi-channel image is an N-channel image, and each pixel in the single-channel image includes the values of N channels; for any pixel in the single-channel image, when it is determined that the values on the N channels are different based on the values of the pixel on the N channels, it is further determined whether there is at least one absolute value greater than a preset value in the absolute value of the difference between the values on any two channels of the pixel; if so, based on the values of each pixel in the single-channel image on the N channels, at least one round of neighborhood operation is performed on the pixel to obtain the pixel value of the pixel, thereby replacing the values of the pixel on the N channels in the single-channel image with the pixel values to obtain the target single-channel image corresponding to the multi-channel image.
[0078] In this way, a processing method for different values on a single channel in a single-channel image is provided. By adopting a processing method for converting a multi-channel image to a single-channel image based on a large model provided in an embodiment of the present application, since the pixel value of the pixel is obtained by performing at least one round of neighborhood operation on the pixel based on the values of each pixel on each channel in the single-channel image, the pixel value of the pixel in the target single-channel image takes into account the values of the adjacent pixels of the pixel on each channel, and explores the spatial relationship between the pixel and the adjacent pixels, thereby achieving the unification of the values of the same pixel on different channels in the target single-channel image. More importantly, the pixel is coordinated with the adjacent pixels in the target single-channel image and the transition is natural, thereby improving the overall smoothness of the target single-channel image, thereby improving the image quality of the subsequent image generated based on the target single-channel image, the image recognition accuracy, etc.
[0079] The embodiment of the present application provides a large-model-based method for converting a multi-channel image into a single-channel image, which is applicable to electronic devices.
[0080] Exemplarily, the electronic device may be one having an image display device (e.g., a display panel), such as a smart terminal, a smart mobile terminal, a tablet computer, a laptop computer, a smart handheld device, a personal computer (PC), a computer, a smart screen, a display device, a vehicle-mounted display device, various wearable devices (e.g., virtual reality (VR), augmented reality (AR)), a personal digital assistant (PDA), etc.
[0081] Another exemplary embodiment, the electronic device can also be a server connected to a device with a display function (such as a display device), such as an independent physical server, a server cluster or a distributed system composed of multiple physical servers, a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms; wherein the server can be connected to the device with a display function by wire or wireless means, and this application does not limit the connection method.
[0082] It is to be understood that the specific type of the above electronic device is not limited in the present application.
[0083] In conjunction with the accompanying drawings, a schematic diagram of an application scenario of an optional large model-based multi-channel image conversion single-channel image processing method in an embodiment of the present application is shown below, taking the electronic device as a display device as an example. Figure 1 .like Figure 1 As shown, the application scenario includes a display device 10, which utilizes a large model-based multi-channel image to single-channel image processing method provided in an embodiment of the present application to implement denoising of target pixels in the single-channel image, thereby obtaining a target single-channel image with higher overall smoothness, wherein the single-channel image is obtained by converting a multi-channel image, and the target pixel is a pixel whose absolute value of the difference between the numerical values on any two channels in the single-channel image is greater than a preset threshold.
[0084] The following is a schematic diagram of an application scenario of another optional large model-based processing method for converting a multi-channel image into a single-channel image in an embodiment of the present application, taking an electronic device as a server as an example. Figure 2 . See Figure 2 As shown, the application scenario includes a display device 10 and a server 20, and the display device 10 communicates with the server 20 via the Internet. The server 20 utilizes a large-model-based multi-channel image to single-channel image processing method provided in an embodiment of the present application to implement denoising of target pixels in a single-channel image, and obtain a target single-channel image with higher overall smoothness of the picture. Then, the image data corresponding to the target single-channel image is transmitted to the display device 10 via the Internet, so that the display device 10 performs subsequent processing on the received image data and then displays it or directly displays it; wherein, the single-channel image is obtained by converting a multi-channel image, and the target pixel is a pixel whose absolute value of the difference between the values on any two channels in the single-channel image is greater than a preset threshold.
[0085] Of course, the method provided in the embodiment of the present application is not limited to Figure 1 , Figure 2 The application scenario shown can also be used in other possible application scenarios, which are not limited in the embodiments of the present application.
[0086] After introducing the application scenarios of the embodiments of the present application, the preferred implementation modes of the present application are further described in detail below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments of the present application and the features in the embodiments may be combined with each other if there is no conflict.
[0087] See also Figure 3 As shown, the embodiment of the present application provides a processing method for converting a multi-channel image into a single-channel image based on a large model, and the specific process of the method is as follows:
[0088] Step 300: Generate a single-channel image from a multi-channel image through a preset large model, wherein the multi-channel image is an N-channel image, and each pixel in the single-channel image includes values of N channels.
[0089] In an embodiment of the present application, the multi-channel image can be converted into the above-mentioned single-channel image through the aforementioned visual big model, wherein the visual big model includes Stable Diffusion, InstructPix2Pix, etc.; Stable Diffusion is an image expansion generation model based on artificial intelligence (AI), and InstructPix2Pix is an image editing technology based on input instructions.
[0090] In progress, see Figure 4 As shown, the RGB image is input into the visual large model to obtain a single-channel image of the RGB image, wherein the single-channel image also includes three channels: R, G, and B. Usually, the values of the three channels R, G, and B of each pixel in the single-channel image are exactly the same; however, due to the randomness and stability characteristics of the visual large model, in the single-channel image generated based on the visual large model, there are often some pixels whose values on each channel are not exactly the same. Therefore, in order to eliminate the problem of different values of the same pixel on different channels in the single-channel image generated by the visual large model, subsequent steps 310 to 340 are performed.
[0091] It should be noted that the processing method for converting a multi-channel image into a single-channel image based on a large model provided in the embodiment of the present application can also handle application scenarios in which multi-channel images are converted into single-channel images by other means. In the embodiment of the present application, only the generation of a single-channel image based on a multi-channel image through a large visual model is taken as an example to introduce the processing method of the present application; it can be understood that the generation method of the single-channel image is not limited in the embodiment of the present application, such as a single-channel image generated by grayscale processing, etc. The above method can also be used to obtain a denoised target single-channel image with a coordinated and natural picture and high overall smoothness.
[0092] Step 310: For any pixel in the single-channel image, based on the values of the pixel in the N channels, determine whether the values of the pixel in the N channels are the same. If so, end the process; if not, execute step 320.
[0093] In a specific implementation, when executing step 310, the values on the N channels of the pixel are compared. If it is determined that the values on the N channels are the same, the process ends; if it is determined that the values on the N channels are different, step 320 is executed.
[0094] Step 320: Determine whether there is at least one absolute value greater than a preset threshold value among the absolute values of the difference between the numerical values on any two channels of the pixel. If so, execute step 330; if not, end the process.
[0095] In a specific implementation, when executing step 320, a difference operation is performed on the numerical values of the pixel on any two channels to obtain various differences, and the absolute values of the differences are taken respectively. Then, each absolute value is compared with a preset threshold value respectively. If at least one absolute value among the absolute values is greater than the preset threshold value, step 330 is executed; if no absolute value among the absolute values is greater than the preset threshold value, the process ends.
[0096] For example, see Figure 5 As shown, taking the single-channel image A as an example.
[0097] Assume that the single-channel image A is obtained by Figure 4 Therefore, each pixel in the single-channel image A includes the values of the three channels R, G, and B.
[0098] Then, for any pixel p0 in the single-channel image A, its pixel coordinates are marked as (x, y), and the values of the pixel p0 in the three channels of R, G, and B are recorded as r0(x, y), g0(x, y), and b0(x, y) respectively.
[0099] When executing step 320, the absolute values of the differences between the values of the pixel p0 in the three channels R, G, and B are respectively recorded as
[0100] D rg (x,y)=|r0(x,y)-g0(x,y)|
[0101] D rb (x,y)=|r0(x,y)-b0(x,y)|
[0102] D gb (x,y)=|g0(x,y)-b0(x,y)|
[0103] Among them, D rg (x,y),D rb (x,y) and D gb (x, y) are the absolute values of the differences between the values of the pixel p0 in the two channels of RG, the two channels of RB, and the two channels of GB.
[0104] Then, each determined absolute value is compared with a preset threshold (denoted as t), where the threshold t is a preset value, which is related to the accuracy requirement of image recognition or image detection of the corresponding scene. In specific implementation, it can be set according to the needs of the actual scene, and this application does not limit its specific value.
[0105] In some possible embodiments, if it is determined that at least one of the above absolute values is greater than a threshold, that is, D rg (x,y),D rb (x,y) and D gb If one or more values in (x, y) are greater than the threshold t, step 330 is executed.
[0106] In some other possible embodiments, if it is determined that none of the above absolute values is greater than the threshold, that is, D rg (x,y),D rb (x,y) and D gb If no value in (x, y) is greater than the threshold t, the process ends.
[0107] In the above example, see Figure 5 As shown, assuming that the pixel p0 appears green in the single-channel image A, and the adjacent pixels of the pixel p0 appear gray, then, by comparing the absolute value of the difference between the values on any two channels of the pixel p0 with the threshold t, it is determined that there is at least one absolute value greater than the threshold t among the absolute values of the pixel p0, and then the subsequent step 330 is executed.
[0108] Step 330: Based on the values of each pixel in the single-channel image on the N channels, perform at least one round of neighborhood operation on the pixel to obtain the pixel value of the pixel.
[0109] In some feasible embodiments, the at least one round of neighborhood operation includes multiple rounds of neighborhood operation. Figure 6 As shown, when executing step 330, the following steps are specifically performed:
[0110] Step 3301: For any round of neighborhood operations in multiple rounds of neighborhood operations, based on the values of each neighborhood pixel corresponding to the round of neighborhood operations on the target channel, obtain the sub-fusion value corresponding to the pixel in the target channel in the round of neighborhood operations, wherein the target channel is any channel among the N channels.
[0111] In an embodiment of the present application, after executing step 320 to determine that there is at least one absolute value greater than a preset threshold value in the absolute value of the difference between the numerical values of the pixel on any two channels in the single-channel image, before executing step 3301, it is necessary to determine the neighborhood pixels corresponding to this round of neighborhood operation based on the pixel coordinates of the pixel; wherein, if this round of neighborhood operation is the first round of neighborhood operation, then the neighborhood pixels corresponding to this round of neighborhood operation are the pixels surrounding the pixel in the target image, and the target image is obtained by image expansion of the single-channel image based on the single-channel image; if this round of neighborhood operation is not the first round of neighborhood operation, then the neighborhood pixels corresponding to this round of neighborhood operation are the pixels in the target image that surround the neighborhood pixels corresponding to the previous round of neighborhood operation.
[0112] In the embodiment of the present application, in order to ensure that there are enough pixels around the pixel when multiple rounds of neighborhood operations are performed on the pixel subsequently, in the specific implementation of the embodiment of the present application, after determining that the values of the pixel in the single-channel image on the N channels are different, before executing step 3301, it is preferred to expand 8 images of the same size as the single-channel image in eight neighborhoods around the single-channel image according to a preset image expansion method based on the single-channel image, to achieve image expansion of the single-channel image and obtain the above-mentioned target image, wherein the above-mentioned image expansion method can be direct translation or symmetric transformation, etc.
[0113] For example, see Figure 7 As shown, the single-channel image A is still taken as an example.
[0114] Assuming that the image expansion method is direct translation, for the single-channel image A (i.e. Figure 7 The image marked with the word "original image" is copied, and the copied single-channel images A are moved to eight neighborhoods around the single-channel image A ( Figure 7 The target image is obtained in the neighborhood 1 to neighborhood 8 shown, where neighborhood 1 is the upper left corner area of the single-channel image A, and neighborhoods 1 to 8 are sorted in a clockwise direction.
[0115] For example, see Figure 8 As shown, the single-channel image A is still taken as an example.
[0116] Assuming that the image expansion method is symmetric transformation, first, determine the single-channel image A (i.e. Figure 8 The images in neighborhood 2, neighborhood 4, neighborhood 5, and neighborhood 7 of the image marked with the word "original image" shown in FIG. Figure 8 The neighborhood 1 shown is still the upper left corner area of the single-channel image A, and neighborhoods 1 to 8 are sorted in a clockwise direction. In the specific implementation, taking neighborhood 2 as an example, the upper side of the single-channel image A is used as the symmetry axis to mirror the single-channel image A to obtain the image in neighborhood 2, and similarly, the images in neighborhoods 4, 5, and 7 are obtained.
[0117] Then, the images in neighborhood 1, neighborhood 3, neighborhood 6, and neighborhood 8 of the single-channel image A are determined. In the specific implementation, taking neighborhood 1 as an example, the left side of the image in neighborhood 2 is taken as the axis of symmetry, and the image in neighborhood 2 is mirrored to obtain the image in neighborhood 1; the right side of the image in neighborhood 2 is taken as the axis of symmetry, and the image in neighborhood 2 is mirrored to obtain the image in neighborhood 1; similarly, the images in neighborhood 6 and neighborhood 8 are obtained, thereby obtaining the target image.
[0118] In the embodiment of the present application, after the target image is obtained by the above-mentioned image expansion method, before executing step 3301, each neighborhood pixel corresponding to the neighborhood operation of this round is further determined based on the pixel coordinates of the pixel.
[0119] See also Fig. 9 As shown, still taking the single-channel image A as an example, it is assumed that among the absolute values of the difference between the values on any two channels in the single-channel image determined by the aforementioned step 320, there is at least one pixel whose absolute value is greater than the preset threshold, which is still the pixel p0.
[0120] Assume that the target image is Figure 8 The image shown, that is, the image expansion method adopts symmetric transformation.
[0121] Then, before executing step 3301, refer to Fig. 9 As shown, first, based on the pixel coordinates of the pixel p0, the neighborhood pixels corresponding to this round of neighborhood operation are determined.
[0122] If this round of neighborhood operation is the first round of neighborhood operation, the pixels surrounding the pixel p0 in the target image are used as the neighborhood pixels corresponding to the first round of neighborhood operation; Fig. 9 As shown in the figure, the neighboring pixels corresponding to the first round of neighborhood operation in the target image are the eight pixels surrounding the pixel p0, which are denoted as p 0-1 、p 0-2 、p 0-3 、p 0-4 、p 0-5 、p 0-6 、p 0-7 、p 0-8 .
[0123] Assuming that the pixel coordinates of pixel p0 are (x, y), the pixel coordinates of the above-mentioned neighboring pixels are p 0-1 (x-1, y-1), p 0-2 (x-1, y), ..., p 0-8 (x+1, y+1).
[0124] Then, based on the pixel coordinates of each neighborhood pixel, the values corresponding to each neighborhood pixel on the three channels are obtained; then, step 3301 is executed, and based on the values of each neighborhood pixel on the target channel corresponding to this round of neighborhood operation, the sub-fusion value corresponding to the first round of neighborhood operation of the pixel p0 on the target channel is calculated, where the target channel is any one of the three channels.
[0125] In the specific implementation, when executing step 3301, the statistical value of the values of each neighborhood pixel corresponding to this round of neighborhood operation on the target channel is determined as the sub-fusion value corresponding to this round of neighborhood operation of pixel p0 on the target channel, where the statistical value is any one of the mean and the mode.
[0126] For example, see Fig. 9 As shown, it is still assumed that this round of neighborhood operation is the first round of neighborhood operation, and it is assumed that the values of the above-mentioned neighborhood pixels (i.e., the eight pixels surrounding the pixel p0) on the R channel are p 0-r1 、p 0-r2 ,……,p 0-r8 , then the statistical value of the value of each neighborhood pixel is determined as the sub-fusion value corresponding to the first round of neighborhood operation of the pixel p0 on the R channel, denoted as r 2nd (x,y).
[0127] In the embodiment of the present application, assuming that the above statistical value is the mean, the sub-fusion value r corresponding to the first round of neighborhood operation of the pixel p0 on the R channel can be expressed by the following formula: 2nd (x,y):
[0128] r 2nd (x,y)=(p 0-r1 +p 0-r2 +…+p 0-r8 ) / 8.
[0129] Similarly, the above method is used to calculate the sub-fusion values corresponding to the first round of neighborhood operations of the pixel p0 on the G channel and the B channel based on the values of the above neighborhood pixels on the G channel and the B channel, which are respectively recorded as g and 2nd (x,y) and b 2nd (x,y).
[0130] Similarly, if this round of neighborhood operation is not the first round of neighborhood operation, then before executing step 3301, each neighborhood pixel corresponding to this round of neighborhood operation is obtained based on the pixel coordinates of the pixel.
[0131] Then, if this round of neighborhood operation is the second round of neighborhood operation, then Fig.10 As shown, still taking the single-channel image A as an example, the target image is still Figure 8Take the image shown as an example. The neighborhood pixels corresponding to the second round of neighborhood operations are the pixels in the target image that surround the neighborhood pixels corresponding to the previous round of neighborhood operations. That is, on the basis of the neighborhood pixels corresponding to the previous round of neighborhood operations (that is, the first round of neighborhood operations), a circle of pixels is expanded, and the expanded circle of pixels serves as the neighborhood pixels corresponding to the second round of neighborhood operations. In other words, with pixel p0 as the center, a circle of pixels is expanded outside the neighborhood pixels corresponding to the first round of neighborhood operations, and the newly expanded circle of pixels serves as the neighborhood pixels corresponding to the second round of neighborhood operations. Then, the neighborhood pixels corresponding to the second round of neighborhood operations include 16 pixels, which are denoted as p in sequence. 0-9 、p 0-10 ,……,p 0-24 .
[0132] Assuming that the pixel coordinates of pixel p0 are (x, y), the pixel coordinates of each neighboring pixel corresponding to the second round of neighborhood operation are p 0-9 (x-2, y-2), p 0-10 (x-2, y-1), ..., p 0-24 (x+2, y+2).
[0133] Then, based on the pixel coordinates of each neighborhood pixel corresponding to the second round of neighborhood operation, the values corresponding to each neighborhood pixel on the three channels are obtained; then, step 3301 is executed, and based on the values of each neighborhood pixel corresponding to the second round of neighborhood operation on the target channel, the sub-fusion value corresponding to the second round of neighborhood operation of the pixel p0 on the target channel is calculated, where the target channel is any one of the three channels.
[0134] Assume that the values of the neighborhood pixels (i.e., the above 16 pixels) corresponding to the second round of neighborhood operation on the R channel are p and 0-r9 、p 0-r10 ,……,p 0-r24 , then the statistical value of the values of each neighborhood pixel is determined as the sub-fusion value corresponding to the second round of neighborhood operation of the pixel p0 on the R channel, recorded as r 3rd (x,y).
[0135] In the embodiment of the present application, the above statistical value is still the mean value, so the sub-fusion value r corresponding to the second round of neighborhood operation of the pixel p0 on the R channel can be expressed by the following formula: 3rd (x,y):
[0136] r 3rd (x,y)=(p 0-r9 +p 0-r10 +…+p 0-r24 ) / 16
[0137] Similarly, the above method is used to calculate the sub-fusion values corresponding to the second round of neighborhood operation of the pixel p0 on the G channel and the B channel based on the values of each neighborhood pixel on the G channel and the B channel corresponding to the second round of neighborhood operation, which are respectively recorded as g and 3rd (x,y) and b 3rd (x,y).
[0138] Similarly, see Fig.11 As shown in FIG. 1 , if the current round of neighborhood operation is the third round of neighborhood operation, then the neighborhood pixels corresponding to the third round of neighborhood operation are the pixels surrounding the neighborhood pixels corresponding to the second round of neighborhood operation in the target image, that is, based on the neighborhood pixels corresponding to the second round of neighborhood operation, a circle of pixels is expanded, and the expanded circle of pixels are respectively used as the neighborhood pixels corresponding to the third round of neighborhood operation. The neighborhood pixels corresponding to the third round of neighborhood operation contain 24 pixels, which are denoted as p 0-25 、p 0-26 ,……,p 0-48 .
[0139] Assuming that the pixel coordinates of pixel p0 are (x, y), the pixel coordinates of each neighboring pixel corresponding to the second round of neighborhood operation are p 0-25 (x-2, y-2), p 0-26 (x-2, y-1), ..., p 0-48 (x+2, y+2). Then, based on the pixel coordinates of each neighborhood pixel corresponding to the third round of neighborhood operation, the values corresponding to each neighborhood pixel on the three channels are obtained; then, step 3101 is executed, based on the values of each neighborhood pixel corresponding to the third round of neighborhood operation on the target channel, the sub-fusion value corresponding to the third round of neighborhood operation of the pixel p0 on the target channel is calculated, wherein the target channel is any one of the three channels.
[0140] Assume that the values of the neighborhood pixels (i.e. the above 24 pixels) corresponding to the third round of neighborhood operation on the R channel are p and 0-r25 、p 0-r26 ,……,p 0-r48 , then the statistical value of the values of each neighborhood pixel is determined as the sub-fusion value corresponding to the third round of neighborhood operation of the pixel p0 on the R channel, recorded as r 3rd (x,y).
[0141] In the embodiment of the present application, the above statistical value is still the mean value, so the sub-fusion value r corresponding to the third round of neighborhood operation of the pixel p0 on the R channel can be expressed by the following formula: 3rd (x,y):
[0142] r 3rd (x,y)=(p 0-r25+p 0-r26 +…+p 0-r48 ) / twenty four
[0143] Similarly, the above method is used to calculate the sub-fusion values corresponding to the third round of neighborhood operation of the pixel p0 on the G channel and the B channel based on the values of each neighborhood pixel on the G channel and the B channel, which are recorded as g and b respectively. 3rd (x,y) and b 3rd (x,y).
[0144] In this way, in the embodiment of the present application, the above-mentioned method can also be used to obtain the fourth round of neighborhood operations in sequence until the sub-fusion value corresponding to the last round of neighborhood operations on the pixel on the target channel, thereby obtaining the sub-fusion value corresponding to multiple rounds of neighborhood operations on the pixel on the target channel. The method of determining each neighborhood pixel corresponding to each subsequent round of neighborhood operations, and the method of determining the sub-fusion value corresponding to the corresponding round of neighborhood operations based on each neighborhood pixel are similar to the above content and will not be repeated here.
[0145] However, it should be noted that more rounds of neighborhood operations can improve the image denoising effect to a certain extent, but at the same time, it will also greatly increase the amount of calculation. Therefore, in specific implementation, the total number of neighborhood operations can be set comprehensively considering factors such as denoising effect and amount of calculation.
[0146] In other feasible embodiments, only one round of neighborhood operation may be performed on the pixel. In this case, the neighborhood pixels corresponding to the round of neighborhood operation and how to obtain the sub-fusion value corresponding to the round of neighborhood operation of the pixel on the target channel based on the neighborhood pixels corresponding to the round of neighborhood operation can be referred to the first round of neighborhood operation in the aforementioned content and will not be repeated here.
[0147] In some possible embodiments, the values on different channels in a single-channel image are different, and there is at least one pixel whose absolute value is greater than a preset threshold in the absolute value of the difference between the values on any two channels. They may also be distributed in the middle of the single-channel image. Then, before executing step 330, the pixel coordinates of each determined pixel can be analyzed to determine the distribution of each pixel in the single-channel image, and combined with the total number of neighborhood operations set, to determine whether the single-channel image needs to be expanded. If there are enough pixels around each pixel in the single-channel image to complete multiple rounds of neighborhood operations on each pixel, it is not necessary to expand the single-channel image. At this time, the target image is a single-channel image, and the above-mentioned determination of each neighborhood pixel corresponding to each round of neighborhood operations and the values of each neighborhood pixel corresponding to any round of neighborhood operations on N channels are used directly based on the single-channel image to obtain the sub-fusion values corresponding to each round of neighborhood operations. The specific processing flow is detailed in the aforementioned content and will not be repeated here.
[0148] Step 3302: Based on the sub-fusion values corresponding to multiple rounds of neighborhood operations on the pixel on the target channel, a fusion value of the pixel on the target channel is obtained.
[0149] In an embodiment of the present application, after executing step 3301, the sub-fusion value corresponding to multiple rounds of neighborhood operations on the pixel on the target channel can be obtained. Then, when executing step 3302, the weighted sum of the value of the pixel on the target channel, the first fusion weight, the sub-fusion value corresponding to multiple rounds of neighborhood operations, and the second fusion weight corresponding to multiple rounds of neighborhood operations is specifically determined as the fusion value of the pixel on the target channel.
[0150] For example, still taking the single-channel image A as an example, assuming that only three rounds of neighborhood operations are performed on pixel p0, the fusion value of the pixel p0 on the target channel (such as the R channel) can be expressed by the following formula:
[0151] r s (x,y)=λ1r0(x,y)+λ2r 2nd (x,y)+λ3r 3rd (x,y)+λ4r 4th (x,y)
[0152] Among them, λ1, λ2, λ3, and λ4 are preset second fusion weights, and their values are all greater than or equal to 0 and less than or equal to 1, and λ1+λ2+λ3+λ4=1. It should be noted that if λ1=0, it means that the sub-fusion value of pixel p0 on the R channel does not participate in the fusion calculation, and if λ4=0, it means that the sub-fusion value of pixel p0 on the R channel does not participate in the fusion calculation.
[0153] Similarly, the fusion value of pixel p0 on the target channel (such as G channel) can be expressed by the following formula:
[0154] g s (x,y)=λ1g0(x,y)+λ2g 2nd (x,y)+λ3g 3rd (x,y)+λ4g 4th (x,y).
[0155] The fusion value of pixel p0 on the target channel (such as B channel) can be expressed by the following formula:
[0156] b s (x,y)=λ1b0(x,y)+λ2b 2nd (x,y)+λ3b 3rd (x,y)+λ4b 4th (x,y).
[0157] In this way, the fusion values of the pixel p0 on the three channels are obtained. Since the sub-fusion values corresponding to any round of neighborhood operations on the target channel of the pixel p0 are obtained based on the values of the neighborhood pixels corresponding to the round of neighborhood operations on the target channel, that is, the sub-fusion value of the pixel p0 on the target channel takes into account the values of the neighboring pixels of the pixel p0 on the target channel, and explores the spatial relationship between the pixel p0 and the neighboring pixels. Therefore, the fusion value of the pixel p0 on the target channel obtained based on the sub-fusion value includes the spatial relationship between the pixel p0 and the neighboring pixels, so as to ensure that the neighboring pixels of the pixel p0 in the image after the denoising of the single-channel image based on the subsequent fusion values of the pixel p0 on N channels are coordinated and the transition is natural, which can improve the overall smoothness of the denoised target single-channel image.
[0158] Step 3303: Obtain the pixel value of the pixel based on the fusion values of the pixel on N channels.
[0159] In the embodiment of the present application, when executing step 3303, the fusion value of the pixel on N channels and the weighted sum of the channel fusion weights corresponding to the N channels are specifically determined as the pixel value of the pixel.
[0160] For example, still taking the single-channel image A as an example, assuming that the fusion values of the pixel p0 obtained on the three channels are r s (x,y),g s (x,y) and b s (x, y), the pixel value v of the pixel p0 can be expressed by the following formula:
[0161] v=σ r r s (x,y)+σ g g s (x,y)+σ b b s (x,y)
[0162] Among them, σ gr , σ g , σ b are the preset fusion weights of different channels, all of which are greater than or equal to 0 and less than or equal to 1, and σ gr +σ g +σ b =1.
[0163] In the embodiment of the present application, since the fusion value of the pixel on any channel is obtained by performing at least one round of neighborhood operation on the pixel based on the values of each pixel in the single-channel image on the channel, the fusion value of the pixel on the channel takes into account the values of the neighboring pixels of the pixel on N channels, and explores the spatial relationship between the pixel and the neighboring pixels. Further, based on the fusion value of the pixel on N channels and the channel fusion weights corresponding to the N channels, the difference between the pixel value of the pixel and the pixel values of the neighboring pixels is determined to be small, so that the features between the pixel and the neighboring pixels in the denoised image are more coordinated, harmonious, and the transition is natural, thereby improving the overall smoothness of the denoised target single-channel image.
[0164] Step 340: Replace the values of the pixel in the N channels in the single-channel image with the pixel values respectively, to obtain a target single-channel image corresponding to the multi-channel image.
[0165] In the embodiment of the present application, by executing step 330, the denoised pixel value of the pixel can be obtained, and then step 340 is executed to replace the values on the N channels of the pixel with the denoised pixel value, and the target single-channel image corresponding to the obtained multi-channel image is as follows: Fig.12 As shown, Fig.12 In this paper, we still take the single-channel image A as an example. Fig.12 As shown, the pixel p0 in the target single-channel image and the adjacent pixels are all gray, and there is no green phenomenon that the pixel p0 in the original single-channel image A presents. It should be noted that Fig.12 The white box shown is only used to mark the position of pixel p0, and there is no such white box in the actual target single-channel image.
[0166] It should be noted that the above processing flow in the embodiment of the present application only takes one pixel as an example to provide a detailed overview of the processing method in the embodiment of the present application. In specific implementation, the target single-channel image is obtained only after the pixel value of each pixel that needs to be denoised in the single-channel image is replaced by the value of the corresponding pixel in the single-channel image on N channels. Among them, the pixels that need to be denoised, that is, the absolute value of the difference between the values on any two channels, have at least one pixel whose absolute value is greater than a preset threshold.
[0167] In this way, by executing a processing method for converting a multi-channel image to a single-channel image based on a large model provided in an embodiment of the present application, the numerical unification of the same pixel in a single-channel image on different channels can be achieved. More importantly, the coordination and natural transition between the denoised pixels and adjacent pixels in the target single-channel image are achieved, thereby improving the overall smoothness of the target single-channel image, and further improving the image quality, image recognition accuracy, etc. of subsequent images generated based on the target single-channel image.
[0168] Based on the same inventive concept, refer to Fig.13 As shown, in an embodiment of the present application, a processing device for converting a multi-channel image into a single-channel image based on a large model is provided, comprising:
[0169] A first determination module 1310 is used to generate a single-channel image from a multi-channel image through a preset large model, wherein the multi-channel image is an N-channel image, and each pixel in the single-channel image includes values of N channels;
[0170] A second determination module 1320 is used to determine, for any pixel in the single-channel image, whether the values of the any pixel on the N channels are the same based on the values of the any pixel on the N channels;
[0171] A neighborhood operation module 1330 is configured to, if no, and at least one absolute value of the difference between the values on any two channels of the any pixel is greater than a preset threshold, perform at least one round of neighborhood operation on the any pixel based on the values of each pixel on the N channels in the single-channel image to obtain the pixel value of the any pixel;
[0172] The denoising module 1340 is used to replace the values of any pixel in the single-channel image on the N channels with the pixel values to obtain a target single-channel image corresponding to the multi-channel image.
[0173] In a possible implementation, if the at least one round of neighborhood operation includes multiple rounds of neighborhood operation, the neighborhood operation module 1330 is specifically configured to:
[0174] For any round of neighborhood operations in the multiple rounds of neighborhood operations, based on the values of each neighborhood pixel corresponding to the any round of neighborhood operations on the target channel, a sub-fusion value corresponding to the any round of neighborhood operations of any pixel on the target channel is obtained, wherein the target channel is any channel among the N channels;
[0175] Obtaining a fusion value of any pixel on the target channel based on sub-fusion values corresponding to multiple rounds of neighborhood operations of any pixel on the target channel;
[0176] Based on the fusion values of any pixel on the N channels, a pixel value of any pixel is obtained.
[0177] In a possible implementation, before obtaining the sub-fusion value corresponding to any round of neighborhood operation of any pixel on the target channel based on the value of each neighborhood pixel corresponding to any round of neighborhood operation on the target channel, the neighborhood operation module 1330 is further used to:
[0178] Based on the pixel coordinates of any pixel, determining each neighborhood pixel corresponding to any round of neighborhood operation;
[0179] Wherein, if the any round of neighborhood operation is the first round of neighborhood operation, the neighborhood pixels corresponding to the any round of neighborhood operation are the pixels surrounding the any pixel in the target image, and the target image is obtained by performing image expansion on the single-channel image based on the single-channel image;
[0180] If any round of neighborhood operation is not the first round of neighborhood operation, the neighborhood pixels corresponding to any round of neighborhood operation are the pixels in the target image that surround the neighborhood pixels corresponding to the previous round of neighborhood operation.
[0181] In a possible implementation, the neighborhood operation module 1330 is specifically used to:
[0182] The statistical value of the values of each neighborhood pixel corresponding to any round of neighborhood operation on the target channel is determined as the sub-fusion value corresponding to any round of neighborhood operation of any pixel on the target channel, wherein the statistical value is any one of the mean and the mode.
[0183] In a possible implementation, the neighborhood operation module 1330 is specifically used to:
[0184] The weighted sum of the value of any pixel on the target channel, the first fusion weight, the sub-fusion values corresponding to the multiple rounds of neighborhood operations, and the second fusion weights corresponding to the multiple rounds of neighborhood operations is determined as the fusion value of any pixel on the target channel.
[0185] In a possible implementation, the neighborhood operation module 1330 is specifically used to:
[0186] The weighted sum of the fusion value of any pixel on the N channels and the channel fusion weights corresponding to the N channels is determined as the pixel value of any pixel.
[0187] Based on the same inventive concept, refer to Fig.14 As shown, an electronic device is provided in an embodiment of the present application, including:
[0188] Memory 141, used to store computer programs or instructions;
[0189] The processor 142 is used to execute the computer program or instructions in the memory 141 so that any one of the methods in the above embodiments is executed.
[0190] The processor 142 may include one or more central processing units (CPUs) or digital processing units, etc., for executing computer programs or instructions in the memory 141, so that any of the methods in the above embodiments is executed;
[0191] It should be noted that the specific connection medium between the memory 141 and the processor 142 is not limited in the embodiment of the present application. Fig.14 In the embodiment, the memory 141 and the processor 142 are connected via a bus 143, and the connection between other components is only for illustrative purposes and is not intended to be limiting. The bus 143 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.14 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0192] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium. When the instructions in the storage medium are executed by a processor, the processor is enabled to execute any one of the methods in the above embodiments. Since the principle of solving the problem by the above computer-readable storage medium is similar to a processing method for converting a multi-channel image to a single-channel image based on a large model, the implementation of the above computer-readable storage medium can refer to the implementation of the method, and the repeated parts will not be repeated.
[0193] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0194] The present application is described with reference to the flowchart and / or block diagram of the method, device (system), and computer program product according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the process and / or box in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one process or multiple processes in the flowchart and / or one box or multiple boxes in the block diagram.
[0195] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0196] These computer program instructions may also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0197] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.
Claims
1. A method for converting a multi-channel image into a single-channel image based on a large model, characterized in that: include: Generate a single-channel image from a multi-channel image through a preset large model, wherein the multi-channel image is an N-channel image, and each pixel in the single-channel image includes values of N channels; For any pixel in the single-channel image, based on the values of the any pixel on the N channels, determining whether the values of the any pixel on the N channels are the same; If not, and among the absolute values of the difference between the values on any two channels of any pixel, there is at least one absolute value greater than a preset threshold, then based on the values of each pixel on N channels in the single-channel image, at least one round of neighborhood operation is performed on the any pixel to obtain the pixel value of the any pixel; The pixel values are used to replace the values of any pixel in the single-channel image on the N channels respectively, so as to obtain a target single-channel image corresponding to the multi-channel image.
2. The method according to claim 1, characterized in that If the at least one round of neighborhood operations includes multiple rounds of neighborhood operations, then based on the values of each pixel in the single-channel image on the N channels, performing at least one round of neighborhood operations on any pixel to obtain the pixel value of any pixel includes: For any round of neighborhood operations in the multiple rounds of neighborhood operations, based on the values of each neighborhood pixel corresponding to the any round of neighborhood operations on the target channel, a sub-fusion value corresponding to the any round of neighborhood operations of any pixel on the target channel is obtained, wherein the target channel is any channel among the N channels; Obtaining a fusion value of any pixel on the target channel based on sub-fusion values corresponding to multiple rounds of neighborhood operations of any pixel on the target channel; Based on the fusion values of any pixel on the N channels, a pixel value of any pixel is obtained.
3. The method according to claim 2, characterized in that Before obtaining the sub-fusion value corresponding to any round of neighborhood operation of any pixel on the target channel based on the value of each neighborhood pixel corresponding to any round of neighborhood operation on the target channel, the method further includes: Based on the pixel coordinates of any pixel, determining each neighborhood pixel corresponding to any round of neighborhood operation; Wherein, if the any round of neighborhood operation is the first round of neighborhood operation, the neighborhood pixels corresponding to the any round of neighborhood operation are the pixels surrounding the any pixel in the target image, and the target image is obtained by performing image expansion on the single-channel image based on the single-channel image; If any round of neighborhood operation is not the first round of neighborhood operation, the neighborhood pixels corresponding to any round of neighborhood operation are the pixels in the target image that surround the neighborhood pixels corresponding to the previous round of neighborhood operation.
4. The method according to claim 2, characterized in that The obtaining, based on the values of each neighborhood pixel corresponding to the arbitrary round of neighborhood operation on the target channel, a sub-fusion value corresponding to the arbitrary round of neighborhood operation of any pixel on the target channel comprises: The statistical value of the values of each neighborhood pixel corresponding to any round of neighborhood operation on the target channel is determined as the sub-fusion value corresponding to any round of neighborhood operation of any pixel on the target channel, wherein the statistical value is any one of the mean and the mode.
5. The method according to claim 2, characterized in that The obtaining the fusion value of any pixel on the target channel based on the sub-fusion values corresponding to the multiple rounds of neighborhood operations of any pixel on the target channel comprises: The weighted sum of the value of any pixel on the target channel, the first fusion weight, the sub-fusion values corresponding to the multiple rounds of neighborhood operations, and the second fusion weights corresponding to the multiple rounds of neighborhood operations is determined as the fusion value of any pixel on the target channel.
6. The method according to claim 2, characterized in that The obtaining the pixel value of any pixel based on the fusion value of any pixel on the N channels includes: The weighted sum of the fusion values of any pixel on the N channels and the channel fusion weights corresponding to the N channels is determined as the pixel value of any pixel.
7. A processing device for converting a multi-channel image into a single-channel image based on a large model, characterized in that: include: A first determination module is used to generate a single-channel image from a multi-channel image through a preset large model, wherein the multi-channel image is an N-channel image, and each pixel in the single-channel image includes values of N channels; A second determination module is used to determine, for any pixel in the single-channel image, whether the values of the any pixel on the N channels are the same based on the values of the any pixel on the N channels; A neighborhood operation module, configured to, if no, and at least one absolute value of the difference between the values on any two channels of any pixel is greater than a preset threshold, perform at least one round of neighborhood operation on the any pixel based on the values of each pixel on the N channels in the single-channel image to obtain the pixel value of the any pixel; The denoising module is used to replace the values of any pixel in the single-channel image on the N channels with the pixel values to obtain a target single-channel image corresponding to the multi-channel image.
8. The device according to claim 7, characterized in that If the at least one round of neighborhood operation includes multiple rounds of neighborhood operation, the neighborhood operation module is specifically used for: For any round of neighborhood operations in the multiple rounds of neighborhood operations, based on the values of each neighborhood pixel corresponding to the any round of neighborhood operations on the target channel, a sub-fusion value corresponding to the any round of neighborhood operations of any pixel on the target channel is obtained, wherein the target channel is any channel among the N channels; Obtaining a fusion value of any pixel on the target channel based on sub-fusion values corresponding to multiple rounds of neighborhood operations of any pixel on the target channel; Based on the fusion values of any pixel on the N channels, a pixel value of any pixel is obtained.
9. An electronic device, characterized in that: include: Memory, used to store computer programs or instructions; A processor is used to execute the computer program or instructions in the memory so that the method according to any one of claims 1 to 6 is executed.
10. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor, the processor is enabled to execute the method according to any one of claims 1 to 6.