Image processing method and device, equipment and storage medium
By acquiring the associated pixel sequence and dispersive optical properties in the image, the dispersive weight of the associated pixels is determined, which solves the problem of unnatural dispersive blur effect in the prior art, realizes a natural and coherent dispersive blur effect, avoids overexposure and color fragmentation, and meets the needs of high-quality visual presentation.
Patent Information
- Application Number
- CN202511399904.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-28
- Publication Date
- 2025-12-26
AI Technical Summary
Existing technologies struggle to effectively control processing quality in image dispersion and blurring, resulting in unnatural dispersion effects, overexposure, and color fragmentation, making it difficult to meet the demands for high-quality visual presentation.
By acquiring the sequence of associated pixels in the image, the dispersion weight of the associated pixels is determined based on the dispersive optical properties. The second color information is calculated by combining the color information of the pixel itself. The final dispersion blur effect is determined by using the dispersion weight and color information of multiple associated pixels, which conforms to the optical dispersion law.
It achieves a natural and coherent chromatic aberration blur effect, avoiding overexposure and color fragmentation, and meeting the needs of high-quality visual presentation.
Smart Images

Figure CN121213402A_ABST
Abstract
Description
[0001] Image processing method, device, equipment and storage medium TECHNICAL FIELD The present application relates to the technical field of computer, in particular to an image processing method, device, equipment and storage medium. BACKGROUND
[0002] In the related art, it is difficult to effectively control the processing quality when performing color dispersion blur processing on an image, resulting in strong limitations of the color dispersion blur effect, and overexposure is prone to occur. The color and brightness of the processing result are difficult to be effectively controlled within a reasonable and natural range. In many cases, if a significant color dispersion blur effect is required, the color fragmentation phenomenon of the processing result after color dispersion blur processing is often serious, and the naturalness and continuity of the visual effect are significantly affected, making it difficult to meet the demand for high-quality visual presentation. SUMMARY
[0003] Embodiments of the present application provide an image processing method, device, equipment and storage medium to solve at least one of the foregoing technical problems.
[0004] According to an aspect of an embodiment of the present application, an image processing method is provided, the method comprising: obtaining a first image; in the first image, sampling a sequence of associated pixels corresponding to any pixel, the first associated pixel of the sequence being the pixel, and the distance between the other associated pixels and the pixel along a preset direction increasing in turn, the preset direction indicating the color dispersion direction corresponding to the pixel; determining a color dispersion weight corresponding to any of the associated pixels based on color dispersion optical characteristics, the color dispersion weight indicating the corresponding color change degree of the corresponding associated pixel in color dispersion blur processing; determining second color information corresponding to the pixel based on first color information of a plurality of associated pixels in the first image respectively, and the color dispersion weight corresponding to the plurality of associated pixels respectively; obtaining a second image based on the second color information corresponding to a plurality of pixels in the first image respectively, the second image indicating the processing result of performing color dispersion blur processing on the first image.
[0005] According to another aspect of an embodiment of the present application, an image processing device is provided, the device comprising: an image acquisition module configured to obtain a first image; a sampling module, configured to sample, in the first image, a sequence of associated pixels corresponding to any pixel, a first associated pixel in the sequence being the pixel, and other associated pixels being sequentially farther away from the pixel along a preset direction, the preset direction indicating a dispersion direction corresponding to the pixel; a weight determining module, configured to determine, based on the dispersion optical characteristic, a dispersion weight corresponding to any associated pixel, the dispersion weight indicating a degree of color change of the corresponding associated pixel in dispersion blur processing; a dispersion processing module, configured to determine, based on first color information of the plurality of associated pixels in the first image respectively and the dispersion weight corresponding to the plurality of associated pixels respectively, second color information corresponding to the pixel; an image determining module, configured to obtain a second image based on the second color information corresponding to the plurality of pixels in the first image respectively, the second image indicating a processing result of dispersion blur processing on the first image.
[0006] In an exemplary embodiment, the dispersion weight includes a channel weight corresponding to each color channel respectively, and the weight determining module is configured to: obtain a first parameter and a second parameter, the first parameter being used to control a degree of overall dispersion blur effect, and the second parameter being used to control an influence degree of dispersion effect corresponding to the associated parameter on a processing result of dispersion blur processing corresponding to the pixel; determine, based on the first parameter, the second parameter and a preset spectral function, a dispersion adjustment parameter corresponding to each color channel; determine, based on the dispersion adjustment parameter corresponding to each color channel, the channel weight corresponding to each color channel.
[0007] In an exemplary embodiment, the dispersion processing module is configured to: determine, for each associated pixel in the plurality of associated pixels, dispersion information corresponding to the associated pixel based on a product of first color information of the associated pixel in the first image and the dispersion weight corresponding to the associated pixel; determine, based on the dispersion information, a total amount of dispersion information corresponding to the pixel, the total amount of dispersion information indicating a total dispersion contribution amount of the plurality of associated pixels to the pixel after dispersion blur processing; determine, based on the total amount of color information corresponding to the pixel, the second color information corresponding to the pixel.
[0008] In an exemplary embodiment, the dispersion processing module is configured to: determine, based on the dispersion weight corresponding to each associated pixel in the plurality of associated pixels, a comprehensive dispersion weight corresponding to the pixel; determine second color information corresponding to the pixel based on a ratio of the total amount of dispersion information and the comprehensive dispersion weight.
[0009] In an exemplary embodiment, the first color information comprises first channel components respectively corresponding to color channels, the dispersion weight comprises channel weights respectively corresponding to the color channels, and the dispersion information comprises second channel components respectively corresponding to the color channels. The dispersion processing module is configured to: For each color channel, determine a corresponding second channel component based on a product of a corresponding first channel component and a corresponding channel weight.
[0010] In an exemplary embodiment, the sampling module is configured to: sample the pixel as a first associated pixel in the sequence of associated pixels; obtain a third parameter and a fourth parameter, the third parameter being used to indicate the preset direction, and the fourth parameter being used to indicate a sampling number; sample the first image based on the third parameter and the fourth parameter to obtain the sequence of associated pixels.
[0011] In an exemplary embodiment, the sampling module is configured to: determine a sampling step length based on the fourth parameter and a sampling distance; initialize a sampling step number; in the preset direction indicated by the third parameter, determine a second position of the first image corresponding to the associated pixel based on a first position of the first image corresponding to the pixel, the sampling step length, and the sampling step number, and sample the associated pixel at the second position; update the sampling step number, continue to sample associated pixels, and obtain the sequence of associated pixels until the sampling step number reaches the fourth parameter.
[0012] In an exemplary embodiment, the sampling module is configured to: in a case where the third parameter indicates that the preset direction is determined based on a three-dimensional color sphere, determine a projection position of the pixel corresponding to the three-dimensional color sphere; determine the preset direction based on three-dimensional color information corresponding to the projection position; sample the first image based on the preset direction and the fourth parameter to obtain the sequence of associated pixels.
[0013] In an exemplary embodiment, the three-dimensional color information comprises channel values respectively corresponding to three color channels, and the sampling module is configured to: A direction vector is constructed based on any two of the channel values, and the direction vector indicates the preset direction.
[0014] In an exemplary embodiment, the sampling module is configured to: In a case where the third parameter indicates that the preset direction is a fixed direction, the first image is sampled based on the fixed direction and the fourth parameter to obtain the sequence of associated pixels.
[0015] According to an aspect of an embodiment of the present application, a computer device is provided, the computer device comprising a processor and a memory, the memory storing at least one instruction, the at least one instruction being loaded and executed by the processor to implement the image processing method described above.
[0016] According to an aspect of an embodiment of the present application, a computer readable storage medium is provided, the storage medium storing at least one instruction, the at least one instruction being loaded and executed by a processor to implement the image processing method described above.
[0017] According to an aspect of an embodiment of the present application, a computer program product is provided, the computer program product comprising computer instructions stored in a computer readable storage medium. A processor of a computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to cause the computer device to perform to implement the image processing method described above.
[0018] The technical solutions provided by the embodiments of the present application can bring the following beneficial effects: The image processing method provided by the embodiments of the present application can perform chromatic dispersion blur processing on a first image and obtain a corresponding chromatic dispersion blur processing result, i.e., a second image. In the processing, for a pixel in the first image, the second color information of the pixel in the second image is determined based on the first color information of the pixel itself and associated pixels related to the pixel in the first image.
[0019] In order to determine the second color information of the pixel, a sequence of associated pixels corresponding to the pixel needs to be sampled, and the distances of the associated pixels in the sequence to the pixel along a preset direction gradually increase, the preset direction indicating a color dispersion direction corresponding to the pixel. This design is used to control the contribution degree of the color dispersion blur result of the pixel presented by the associated pixels which gradually perform color dispersion blur along the preset direction. This design can make the final color dispersion blur effect more natural and consistent with the optical dispersion law.
[0020] Next, the dispersion weight corresponding to the associated pixel can be determined based on the dispersion optical characteristic, the dispersion weight indicating a degree of color change of the corresponding associated pixel in the dispersion blur processing, which aims to better simulate the dispersion effect of light in the propagation process based on the physical characteristics, and ensure that the result of the dispersion blur processing is more consistent with the real optical phenomenon.
[0021] Finally, the second color information of the pixel is calculated according to the dispersion weight of the associated pixel and the first color information of the pixel itself, which makes the color and brightness of the second color information of the pixel be within a reasonable and natural range, and overexposure phenomenon will not occur. Even if the degree of dispersion blur effect is increased, the naturalness and continuity of the dispersion effect can still be ensured, the demand for high-quality visual presentation can be met, and color fragmentation phenomenon will not occur. BRIEF DESCRIPTION OF DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0023] Figure 1 is a schematic diagram of an image processing method running environment provided by an embodiment of the present application; Figure 2 is a flowchart of an image processing method provided by an embodiment of the present application; Figure 3 is a flowchart of a dispersion weight determination method provided by an embodiment of the present application; Figure 4 is a schematic diagram of a second color information determination method provided by an embodiment of the present application; Figure 5 is a schematic diagram of an associated pixel sequence sampling method provided by an embodiment of the present application; Figure 6 is a sampling process diagram of an associated pixel sequence provided by an embodiment of the present application Figure 1 ; Figure 7 is a schematic diagram of a dispersion blur effect provided by an embodiment of the present application; Figure 8 is a sampling process diagram of an associated pixel sequence provided by an embodiment of the present application Figure 2 ; Figure 9 is a schematic diagram of an image processing process provided by an embodiment of the present application; Figure 10 is a comparison diagram of image processing effects provided by an embodiment of the present application; Figure 11 is a block diagram of an image processing apparatus provided by an embodiment of the present application; Figure 12 is a structural block diagram of a computer device provided by an embodiment of the present application; Figure 13 is a structural block diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0024] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of the present application.
[0025] It should be noted that the terms "first", "second", and the like in the specification and claims of the embodiments of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. Therefore, the features defined as "first", "second" can explicitly or implicitly include one or more of the features. In the description of the embodiments, unless otherwise specified, the meaning of "a plurality of" is two or more. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or server including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product, or device.
[0026] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, further detailed descriptions of the embodiments of the present application will be given below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the embodiments of the present application, and are not used to limit the embodiments of the present application.
[0027] In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, further detailed descriptions of the embodiments of the present application will be given below with reference to the drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the embodiments of the present application, and are not used to limit the embodiments of the present application.
[0028] Reference should be made to Figure 1Fig. 1 shows a schematic diagram of an application running environment according to an embodiment of the present application. The application can be any application that can perform image processing. The application running environment can include a terminal 10 and a server 20. The embodiment of the present application can be implemented independently in the terminal 10, or jointly based on the terminal 10 and the server 20.
[0029] The terminal 10 can include, but is not limited to, a mobile phone, a computer, a smart voice interactive device, a smart home appliance, a vehicle-mounted terminal, a game console, an e-book reader, a multimedia playback device, a wearable device, and the like. The terminal 10 can install a user end of the application.
[0030] In the embodiment of the present application, the application can be any application that can perform image processing. Typically, the application is an image processing application. Of course, in addition to the image processing application, other types of applications can also provide image processing services. For example, a cloud service application, an e-commerce application, a social application, a search application, a video editing application, a browser application, a content interaction application, a virtual reality (VR) application, an augmented reality (AR) application, and the like, which are not limited in the embodiment of the present application. Optionally, the terminal 10 runs the user end of the application.
[0031] The server 20 can be used to provide background services for the user end of the application in the terminal 10. For example, the server 20 can be a background server of the application. The server 20 can be a standalone physical server, a server cluster or a distributed system composed of multiple physical servers, a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms, and the like. Optionally, the server 20 provides background services for multiple terminals 10.
[0032] Optionally, the terminal 10 and the server 20 can communicate with each other through a network 30. The terminal 10 and the server 20 can be directly or indirectly connected through wired or wireless communication, which is not limited in the present application.
[0033] Reference is made to Figure 2Fig. 1 shows a flowchart of an image processing method according to an embodiment of the present application. The method can be applied in a computer device, which is an electronic device with data computing and processing capability. For example, the execution subject of each step can be a processor in the computer device. Figure 1 The image processing method is executed in the environment shown in Fig. 2. Next, the image processing method will be described in detail, which includes the following steps: Figure 2 S210. Obtain a first image.
[0034] The first image in the embodiment of the present application is the material for color dispersion blur processing, which is the original image before color dispersion blur processing. The content of the first image is not limited in the embodiment of the present application. For example, the content can include natural landscape, portrait, architectural structure or any other type of visual information. The format of the first image can be a common picture format, such as JPEG, PNG or BMP, etc., and its resolution can be adjusted according to actual needs. In addition, the source of the first image is not limited, which can be image data uploaded by a user, automatically generated by an application program or imported from an external device.
[0035] After obtaining the first image, it can be preprocessed to ensure that the subsequent color dispersion blur processing can be carried out smoothly. The preprocessing is not limited in the embodiment of the present application. For example, the preprocessing can include size adjustment, color correction, noise removal and other operations of the first image. Through these preprocessing steps, the quality of the first image can be improved, thereby providing a more reliable basis for subsequent color dispersion blur processing. For example, in the size adjustment, the first image can be scaled to a suitable resolution according to actual needs; in the color correction, the brightness, contrast and saturation of the first image can be adjusted to ensure that the color performance is more accurate; in the noise removal, random noise points in the first image can be reduced through a filtering algorithm, so that the first image is clearer.
[0036] S220. In the first image, sample a sequence of associated pixels corresponding to any pixel, the first associated pixel of the sequence of associated pixels is the pixel, and the distance between the other associated pixels and the pixel along a preset direction increases in turn, the preset direction indicating the color dispersion direction corresponding to the pixel.
[0037] The preset direction corresponding to the pixel in the embodiments of the present application indicates the dispersion direction corresponding to the pixel. The preset direction can be determined by analyzing the position of the pixel in the first image and the environment around the pixel, or can be set or inferred according to actual requirements. The embodiments of the present application do not limit the actual requirements. For example, the preset direction can be set according to the shooting conditions of the first image, the expected dispersion blur effect or a specific application scenario. For example, in some scenarios, the influence of the light incidence angle on dispersion can be considered to adjust the preset direction to better simulate the real situation. In addition, the preset direction can be generated in combination with the user input parameters or the application program default rules to ensure that it can accurately reflect the change rule of the pixel in the dispersion process.
[0038] For example, if dispersion needs to occur along a specific direction, the preset direction corresponding to each pixel can be along the specific direction. In addition, in some complex scenarios, it can be necessary to adjust the preset direction by considering multiple factors, for example, the local features, texture distribution or color change of the first image, and information such as the light incidence direction can be combined to infer. This method can more flexibly adapt to the needs of different scenarios, thereby improving the authenticity and accuracy of the dispersion simulation.
[0039] The embodiments of the present application can perform step S220 on each pixel or part of the pixels in the first image. The processing mode of any pixel is described in the embodiments of the present application, which is described in detail below.
[0040] S230. Based on the dispersion optical characteristics, determine the dispersion weight corresponding to any of the associated pixels, the dispersion weight indicating the corresponding color change degree of the corresponding associated pixel in the dispersion blur processing.
[0041] The dispersion weight is determined based on the dispersion optical characteristics. The dispersion optical characteristics refer to the separation phenomenon of different wavelengths of light propagating in a medium due to the difference in refractive index. The embodiments of the present application simulate this separation phenomenon based on the dispersion optical characteristics to determine the dispersion weight. The color information of the pixel after dispersion blur processing determined based on the dispersion weight of each related associated pixel and the first color information of the associated pixel itself in the first image can fully comply with the physical law indicated by the dispersion optical characteristics. Thus, phenomena such as overexposure, color splitting, unnatural dispersion effect and unobvious dispersion effect will not occur.
[0042] The embodiments of the present application can perform step S230 on each associated pixel or all associated pixels corresponding to the pixel. The processing mode of any associated pixel corresponding to the pixel is described in the embodiments of the present application, which is described in detail below.
[0043] S240. Determine the second color information corresponding to the pixel based on the first color information of the plurality of associated pixels in the first image respectively, and the dispersion weight corresponding to the plurality of associated pixels respectively.
[0044] The color information in the first image is referred to as the first color information, and the color information in the second image is referred to as the second color information in the embodiments of the present application. The second image refers to the image obtained after the color dispersion blur processing of the first image.
[0045] The plurality of associated pixels in the embodiments of the present application refer to the associated pixels that play a role in calculating the second color information of the pixel. The embodiments of the present application do not limit the determination method of the plurality of associated pixels. All or part of the associated pixels corresponding to the pixel can be used as the plurality of associated pixels. For example, the embodiments of the present application can use all the associated pixels corresponding to any pixel as the plurality of associated pixels. The second color information of the pixel is determined using the color weight corresponding to each associated pixel and the first color information.
[0046] S250. Obtain a second image based on the second color information corresponding to the plurality of pixels in the first image respectively, the second image indicating the processing result of the color dispersion blur processing of the first image.
[0047] The plurality of pixels in the embodiments of the present application refer to the pixels that reflect the color dispersion blur result in the second image. The embodiments of the present application do not limit the determination method of the plurality of pixels. All or part of the pixels in the first image can be used as the plurality of pixels. For example, the embodiments of the present application can determine the second color information corresponding to each pixel in the first image, thereby constructing the second image. The second image obviously has the same specification as the first image and reflects the color dispersion blur effect of the first image.
[0048] The related art can only perform simple color dispersion blur. For example, for each pixel, three offsets are performed, each offset is larger than the previous one, the first offset only offsets the red (R) channel, the second offset only offsets the green (G) channel, and the third offset only offsets the blue (B) channel. This offset mode does not consider the dispersion optical characteristics, but uses a fixed offset mode, resulting in a color dispersion blur effect that is not natural and reasonable, lacks realism and delicacy. This method fails to fully simulate the complex dispersion phenomenon of light passing through a lens or medium in nature, making the image after color dispersion blur processing appear harsh and unnatural in vision. If the offset is not reasonable, it is likely to cause overexposure and color splitting.
[0049] Different from the related art, the embodiment of the present application proposes an image processing method, which can perform chromatic dispersion blur processing on a first image and obtain a corresponding chromatic dispersion blur processing result, i.e., a second image. In the processing, for a pixel in the first image, the color information of the pixel in the second image, i.e., the second color information of the pixel, is determined based on the first color information of the pixel itself and the associated pixels related to the pixel in the first image.
[0050] To determine the second color information of the pixel, a sequence of associated pixels corresponding to the pixel is sampled, and the distance between the associated pixels in the sequence and the pixel along a preset direction increases in turn, the preset direction indicating the chromatic dispersion direction corresponding to the pixel. This design is used to control the contribution degree of the chromatic dispersion blur result of the pixel presented by the associated pixels along the preset distance direction step by step, which can make the final chromatic dispersion blur effect more natural and consistent with the optical dispersion law.
[0051] Next, the chromatic dispersion weight corresponding to the associated pixel is determined based on the chromatic dispersion optical characteristics, which indicates the corresponding color change degree of the corresponding associated pixel in the chromatic dispersion blur processing. The purpose of this design is to better simulate the chromatic dispersion effect generated by light in the propagation process based on the physical characteristics, and to ensure that the result of the chromatic dispersion blur processing is more consistent with the real optical phenomenon.
[0052] Finally, the second color information of the pixel is calculated according to the chromatic dispersion weight of the associated pixel and the first color information of the pixel itself, which makes the color and brightness of the second color information of the pixel be within a reasonable and natural range, and does not produce overexposure phenomenon. Even if the degree of chromatic dispersion blur effect is increased, the naturalness and continuity of the chromatic dispersion effect can still be ensured, the demand for high-quality visual presentation can be met, and the color fragmentation phenomenon can be avoided.
[0053] In an exemplary embodiment, the first color information of any associated pixel in the embodiment of the present application can include multiple channels, and correspondingly, the corresponding chromatic dispersion weight includes the channel weight corresponding to each color channel. For example, in actual application, the channels can correspond to red, green and blue three basic colors. By assigning a weight to each channel, the contribution degree of different colors in the chromatic dispersion blur processing process can be more accurately controlled.
[0054] In an exemplary embodiment, please refer to Figure 3 which shows the chromatic dispersion weight determination method flowchart of the embodiment of the present application. The chromatic dispersion weight corresponding to any associated pixel is determined based on the chromatic dispersion optical characteristics, which includes: S310. Obtain a first parameter and a second parameter, the first parameter being used to control a degree of a global chromatic dispersion blur effect, and the second parameter being used to control a degree of influence of a chromatic dispersion effect corresponding to the associated parameter on a chromatic dispersion blur processing result corresponding to the pixel.
[0055] The first parameter in the embodiments of the present application can be obtained by characterizing, controlling a degree of a global chromatic dispersion blur effect, The greater, the more prominent the rainbow edge effect and the purple edge effect embodied by the chromatic dispersion blur, and the smaller the sawtooth, the more natural the chromatic dispersion. The second parameter x in the embodiments of the present application controls the degree of chromatic dispersion corresponding to the associated parameter. The second parameter x in the embodiments of the present application corresponds to the position of the associated parameter in the sequence of associated pixels, that is, the second parameter x indicates the distance between the associated pixel and the corresponding pixel in the preset direction. If the position of the associated parameter in the sequence of associated pixels is more backward, that is, the distance between the associated pixel and the corresponding pixel in the preset direction is greater, the value of x is also large, indicating that the degree of influence of the corresponding chromatic dispersion effect of the corresponding associated pixel on the chromatic dispersion blur processing result corresponding to the pixel is smaller.
[0056] S320. Determine a chromatic dispersion adjustment parameter corresponding to each color channel based on the first parameter, the second parameter, and a preset spectral function.
[0057] The embodiments of the present application do not limit the preset spectral function, which can be any function form capable of describing spectral distribution, such as Gaussian function, polynomial function, or other custom functions. By combining the first parameter, the second parameter, and the preset spectral function, a corresponding chromatic dispersion adjustment parameter can be generated for each color channel, which can be used to adjust the chromatic dispersion effect of each color channel.
[0058] For example, the spectral functions corresponding to the red channel, the green channel, and the blue channel can be respectively set according to actual needs, and these spectral functions all belong to the aforementioned preset spectral function. For example, the spectral function corresponding to the red channel can be , the spectral function corresponding to the green channel can be b , and the spectral function corresponding to the blue channel can be c , wherein, and are respectively adjustable parameters corresponding to the red channel and the blue channel, and can be parameters between 0 and 1, and a, b, and c respectively represent the chromatic dispersion adjustment parameters under the red channel, the green channel, and the blue channel. For example, and are both 0.5, we can obtain , b , and c wherein, and x have been described above, and will not be repeated here.
[0059] S330. Determine a channel weight corresponding to each of the color channels based on the dispersion adjustment parameter corresponding to the color channel.
[0060] The embodiments of the present application do not limit the method of determining the channel weight based on the corresponding dispersion adjustment parameter. For example, the corresponding channel weight can be determined based on experimental data or an empirical model.
[0061] In an exemplary embodiment, the channel weight corresponding to the red channel can be r The channel weight corresponding to the green channel can be g The channel weight corresponding to the blue channel can be b wherein, and M are adjustable parameters, and a, b, c respectively represent the dispersion adjustment parameters under the red channel, the green channel and the blue channel. The foregoing has been described above, and will not be repeated here. r, g, b respectively represent the channel weight under the red channel, the green channel and the blue channel. () is a function that limits its own output result within a specified range, ensuring the numerical stability in the calculation process. The function is usually used to avoid calculation errors caused by excessively large or small values. In the above channel weight formula, the function of clamp() is to constrain its own output result between 0.0 and 1.0, so as to ensure that the value range of the channel weight meets the expectation. The embodiments of the present application do not limit the values of and M, which can be between 0 and 1, for example, both can be 0.5.
[0062] In this way, the accuracy and controllability of dispersion adjustment in the image processing process can be effectively improved. Obviously, r, g, b all belong to the dispersion weight of the associated pixel. If the dispersion weight of the associated pixel is denoted as SD, then SD can be a three-tuple, i.e. SD=(r, g, b), wherein r, g, b respectively represent the channel weight of the red channel, the green channel and the blue channel. In this way, the contribution proportion of each channel in the dispersion adjustment can be more intuitively reflected. Through the first parameter, the second parameter, the parameter q, the parameter M, the parameter and the parameter The flexible adjustment can flexibly control the dispersion blur effect, especially the first parameter and the second parameter, which can effectively control the width and prominence of the rainbow edge in the dispersion blur effect, and can also effectively control the sawtooth phenomenon in the dispersion blur effect. If the first parameter is smaller, the width and prominence of the rainbow edge in the dispersion blur effect are also smaller, the purple area is not prominent, and the sawtooth phenomenon is higher. If the first parameter is larger, the width and prominence of the rainbow edge in the dispersion blur effect are also larger, the purple area is more prominent, and the sawtooth phenomenon is lower. If the second parameter has a larger variation range, the sawtooth phenomenon can be effectively improved, and the dispersion blur result is more delicate.
[0063] In an exemplary embodiment, refer to Figure 4 which shows a second color information determination method in the embodiment of the application. The second color information of the pixel is determined based on the first color information of the plurality of associated pixels in the first image and the dispersion weight corresponding to the plurality of associated pixels, and the dispersion information of the pixel is determined based on the product of the first color information of the associated pixel in the first image and the corresponding dispersion weight. S410. For each associated pixel in the plurality of associated pixels, the corresponding dispersion information is determined based on the product of the first color information of the associated pixel in the first image and the corresponding dispersion weight.
[0064] The first color information of the associated pixel in the first image in the embodiment of the application can include values in a plurality of color channels, that is, the first color information includes first channel components corresponding to each color channel, for example, the first color information includes values (first channel components) corresponding to the red channel, the green channel and the blue channel. Correspondingly, the dispersion weight includes channel weights corresponding to each color channel, that is, SD=(r, g, b), so the dispersion information determined based on the product of the first color information of the associated pixel and the corresponding dispersion weight should also include values in a plurality of color channels, that is, the dispersion information includes second channel components corresponding to each color channel.
[0065] That is, the corresponding dispersion information is determined based on the product of the first color information of the associated pixel in the first image and the corresponding dispersion weight, which includes: for each color channel, the corresponding second channel component is determined based on the product of the corresponding first channel component and the corresponding channel weight. Based on this design, the contribution of each color channel of the associated pixel to the dispersion blur effect can be accurately calculated, the dispersion control accuracy can be improved, and more fine-grained dispersion blur effect control can be achieved.
[0066] S420. Based on each dispersion information, the total amount of dispersion information corresponding to the pixel is determined, and the total amount of dispersion information indicates the total dispersion contribution amount of the plurality of associated pixels to the pixel after dispersion blur processing.
[0067] The dispersion information of the associated pixels in the embodiments of the present application includes a second channel component in three color channels, and is a triplet. The dispersion information total amount C can be obtained by adding the dispersion information corresponding to each associated pixel channel by channel, and the dispersion information total amount C is used to quantify the overall influence of each associated pixel on the pixel in the dispersion blur processing. By accumulating the second channel component of each color channel, the dispersion of different color channels in the dispersion blur process can be comprehensively evaluated and recorded in the dispersion information total amount C.
[0068] S430. Determine the second color information corresponding to the pixel based on the color information total amount corresponding to the pixel.
[0069] The embodiments of the present application do not limit the method for determining the second color information corresponding to the pixel based on the color information total amount corresponding to the pixel. For example, the second color information can be determined by normalizing the color information total amount or by introducing a nonlinear mapping function to map the color information total amount into a color space.
[0070] In an exemplary embodiment, the determination of the second color information corresponding to the pixel based on the dispersion information total amount corresponding to the pixel includes: S431. Determine the comprehensive dispersion weight corresponding to the pixel based on the dispersion weight corresponding to each associated pixel in the plurality of associated pixels.
[0071] The embodiments of the present application do not limit the specific method for determining the comprehensive dispersion weight corresponding to the pixel based on the dispersion weight corresponding to each associated pixel. For example, the comprehensive dispersion weight can be obtained by weighted summation of the dispersion weights of the associated pixels or by analyzing the weight distribution using a specific algorithm. In one embodiment, the dispersion weights SC corresponding to the associated pixels can be directly added to obtain the comprehensive dispersion weight SW.
[0072] S432. Determine the second color information corresponding to the pixel based on the ratio of the dispersion information total amount and the comprehensive dispersion weight.
[0073] The embodiments of the present application do not limit the specific method for determining the second color information corresponding to the pixel based on the ratio of the dispersion information total amount and the comprehensive dispersion weight. For example, the ratio of the dispersion information total amount C and the comprehensive dispersion weight SW can be used as the second color information corresponding to the pixel. Based on this design, the accuracy of color information processing can be effectively improved, the controllable dispersion blur effect can be accurately realized, the dispersion blur effect is natural and reasonable, and the dispersion blur effect is delicate and has a good visual perception.
[0074] In an example embodiment, refer to Figure 5 which shows a schematic diagram of a method for sampling a sequence of associated pixels according to an embodiment of the present application. The method comprises: S510. Sampling a first associated pixel in the sequence of associated pixels.
[0075] The sequence of associated pixels is a sequence starting with the pixel. Take pixel P0 in the first image as an example. The sequence of associated pixels corresponding to P0 is SP={P0, …}. Different pixels can use the same or different threads to execute the method according to an embodiment of the present application, which will not be described herein.
[0076] S520. Obtaining a third parameter and a fourth parameter, the third parameter being used to indicate the preset direction, and the fourth parameter being used to indicate the sampling times.
[0077] The sampling times can be used to determine the length of the sequence of associated pixels. In addition, the sampling times can also affect the color dispersion blur effect. If a more delicate color dispersion blur effect is needed, the sampling times can be appropriately increased to expand the length of the sequence of associated pixels, so that the amount of sawtooth in the color dispersion blur effect can be significantly reduced or even eliminated. If only a simple color dispersion blur processing is needed, the processing efficiency can be optimized by reducing the sampling times.
[0078] S530. Sampling the first image based on the third parameter and the fourth parameter to obtain the sequence of associated pixels.
[0079] For example, for pixel P0 (0.5, 0.5), the third parameter indicates that the sampling direction is direction D, and the fourth parameter is represented by X. After P0 (0.5, 0.5) is added to the sequence of associated pixels, the position of the next associated pixel added to the sequence of associated pixels is (0.5, 0.5) + N * (1 / X, 1 / X) * D * 1, and the position of the next associated pixel added to the sequence of associated pixels is (0.5, 0.5) + N * (1 / X, 1 / X) * D * 2, and so on. N can represent the sampling range of the associated pixel, which can be preset, such as being set to 1. Through S510-S530, the sequence of associated pixels corresponding to the pixel can be sampled, thereby providing data support for subsequent calculation of the pixel value of the pixel after color dispersion blur.
[0080] The embodiment of the present application can determine the preset direction based on the third parameter. In an exemplary embodiment, the sampling of the first image based on the third parameter and the fourth parameter to obtain the associated pixel sequence includes: in the case that the third parameter indicates that the preset direction is a fixed direction, sampling the first image based on the fixed direction and the fourth parameter to obtain the associated pixel sequence.
[0081] In this case, for any pixel in the first image, the associated pixel sequence corresponding to the pixel is sampled based on the fixed direction. The embodiment of the present application does not limit the fixed direction, which can be set arbitrarily. For example, if the color dispersion blur effect caused by the illumination of light from a certain angle is to be simulated, the fixed direction can be set as a direction consistent with the illumination angle of the light. For example, if the light is illuminated from the upper left corner, the fixed direction can be set as a direction from the upper left to the lower right. In this way, the color dispersion blur phenomenon in the actual scene can be simulated more realistically, thereby improving the realism and visual effect of image processing.
[0082] In an exemplary embodiment, please refer to Figure 6 which shows the sampling process of the associated pixel sequence of the embodiment of the present application Figure 1 . The sampling of the first image based on the third parameter and the fourth parameter to obtain the associated pixel sequence includes: S610. In the case that the third parameter indicates that the preset direction is determined based on a three-dimensional color sphere, determining the projection position of the pixel in the three-dimensional color sphere.
[0083] Please refer to Figure 7 which shows a schematic diagram of the color dispersion blur effect of the embodiment of the present application. Figure 7 (a) is a three-dimensional color sphere used in the color dispersion blur process. Each pixel point in the three-dimensional color sphere can have a channel value corresponding to each of the three color channels. The source of the three-dimensional color sphere is not limited by the present application. It can come from the art assets stored in the application program, or it can be generated by a preset algorithm, such as dynamically generating a three-dimensional color sphere meeting the requirements by analyzing the distribution characteristics of the color space. By establishing the mapping relationship between the three-dimensional color sphere and the first image, the projection position of any pixel in the first image can be determined in the three-dimensional color sphere. The method for establishing the mapping relationship is not limited by the embodiment of the present application. For example, machine learning method or method based on preset rules can be used.
[0084] S620. Determining the preset direction based on the three-dimensional color information corresponding to the projection position.
[0085] The three-dimensional color information includes three color channel values corresponding to each of the three color channels. The embodiments of the present application do not limit the method for determining the preset direction based on the three color channel values corresponding to each of the three color channels. For example, a weighted average method can be used to calculate two directional components in a two-dimensional space according to the weights of the three color channels, so as to construct a directional vector indicating the preset direction. The present application does not limit the weights, which can be set according to actual conditions.
[0086] In an exemplary embodiment, the method for determining the preset direction based on the three-dimensional color information of the projection position includes: constructing a directional vector based on any two of the channel values, the directional vector indicating the preset direction. For each pixel, the preset direction can be determined by the three color channel values corresponding to each of the three color channels at the projection position of the three-dimensional color sphere. Since the preset direction is only a two-dimensional vector, any two of the channel values can be selected to construct a directional vector.
[0087] S630. Based on the preset direction and the fourth parameter, the first image is sampled to obtain the associated pixel sequence.
[0088] Please refer to Figure 7 (b), which shows the preset direction used by the embodiments of the present application Figure 7 (a) to obtain a color dispersion blur effect diagram (second image) after color dispersion blur processing. Obviously, by using the three-dimensional color sphere to determine the preset direction in the embodiments of the present application, the color dispersion blur effect can show a trend of color dispersion from the center to the edge, and different edge dispersion blur degrees are different. This color dispersion effect is very natural, and can simulate the color dispersion effect of a point light source in different directions and different degrees of color dispersion. Figure 7 (b), the center of the screen appears a color dispersion blur effect, which is a color dispersion blur effect consistent with the physical law, and can show the "purple edge" and "rainbow edge" difficult to present in related technologies. By saving Figure 7 (b), the first image can be converted into controllable artistic assets (second image). In the process of generating the second image, the embodiments of the present application realize accurate adjustment of the color dispersion blur effect by controlling various parameters, enrich the monotonous picture, and improve the picture performance effect.
[0089] Please refer to Figure 8 , which shows the sampling process of the associated pixel sequence of the embodiments of the present application Figure 2 . The method for sampling the first image based on the third parameter and the fourth parameter to obtain the associated pixel sequence includes: S810. Based on the fourth parameter and the sampling distance, a sampling step is determined.
[0090] The fourth parameter indicates the sampling number, and the sampling step can be uniquely determined based on the sampling number and the sampling distance. The sampling distance can be determined based on actual requirements and the size of the first image. For example, the sampling distance can be set to one-tenth of the diagonal length of the first image to ensure that the sampling process covers a sufficient range while avoiding excessive dense sampling that wastes computing resources.
[0091] S820. Initialize the sampling step number.
[0092] In the initial case, the sampling step number can be set to 0.
[0093] S830. In the preset direction indicated by the third parameter, determine the second position of the associated pixel in the first image based on the first position of the pixel in the first image, the sampling step, and the sampling step number, and sample the associated pixel at the second position.
[0094] S840. Update the sampling step number, continue to sample the associated pixel, and obtain the sequence of associated pixels until the sampling step number reaches the fourth parameter.
[0095] Through the cyclic sampling, the sequence of associated pixels corresponding to a certain pixel can be quickly obtained.
[0096] Please refer to Figure 9 which shows a schematic diagram of an image processing process performed by an application in an embodiment of the present application. The image processing process includes the following steps: S910. Input the picture.
[0097] The application is input with the first image, and presents a picture corresponding to the first image.
[0098] S920. Sample the target pixel at position p+(1 / X,1 / X)*D*i, i is a loop identifier, and obtain the Color1 value of the target pixel.
[0099] The target pixel refers to an associated pixel corresponding to any pixel in the first image, p indicates the position of the pixel, i refers to the loop identifier of the loop, the minimum value of i is 0, and the maximum value of i is X, X indicating the fourth parameter in the embodiment of the present application. Color1 refers to the first color information of the current associated pixel (target pixel) in the first image obtained by sampling. D refers to the sampling range, which is a configurable constant.
[0100] S930. Substitute WL and lambda into the preset spectral function to output the SD value.
[0101] WL refers to the second parameter of the embodiment of the present application, and WL is a value related to i, so it is related to the position of the current associated pixel in the sequence of associated pixels, and in each loop process, it can be calculated by the sum of a preset value and i / X, and the preset value is a configurable constant, such as 0. Lambda refers to the first parameter, which can also be represented as SD refers to the dispersion weight of the current associated pixel (target pixel) calculated by the present application.
[0102] S940. Accumulate the WL value, WL+1 / X=WL.
[0103] In this case, the second parameter corresponding to the next associated pixel corresponding to the current associated pixel is calculated.
[0104] S950. The value obtained by SD*Color1 is added to the C value, SD*Color1+C=C.
[0105] The value obtained by SD*Color1 is the dispersion information corresponding to the current associated pixel, and C refers to the sum of the dispersion information that has been calculated, which is updated with the loop process.
[0106] S960. Add SD to the SW value, SD+SW=SW.
[0107] SW refers to the sum of the dispersion weight that has been calculated, which is updated with the loop process.
[0108] S970. After the loop ends, divide the accumulated C value by SW to obtain Color2 corresponding to the pixel.
[0109] The final accumulated C value and SW value are the total amount of dispersion information and the comprehensive dispersion weight in the embodiment of the present application, respectively. Color2 refers to the second color information of the second image corresponding to the pixel.
[0110] S980. Output the picture.
[0111] By calculating the second color information of each pixel in the first image, the second image is obtained, and then the picture of the second image is output.
[0112] Please refer to Figure 10 , which shows the image processing effect comparison chart of the embodiment of the present application. Among them, Figure 10 (a) shows the picture corresponding to the first image before processing, Figure 10(b) a picture corresponding to a processed second image is displayed, the second image is obtained by using a three-dimensional color ball for color dispersion blur processing, and this processing manner can facilitate control of the color dispersion blur processing process based on the three-dimensional color ball, so that the color dispersion blur processing result presents artistic effects, relevant personnel only need to adjust some parameters of the three-dimensional color ball to improve the color dispersion blur picture effect, the process is simple, and the color dispersion blur effect can be improved in various scenes.
[0113] The embodiments of the present application can be widely applied to various scenes related to image processing, such as visual effect enhancement in film and television post-production, game picture optimization, and virtual reality environment. By flexibly adjusting the parameters of the three-dimensional color ball, users can customize different color dispersion blur effects according to specific needs, thereby meeting diversified artistic creation requirements. For example, in a game application, the game picture can be subjected to color dispersion blur processing by executing the image processing method of the embodiments of the present application, thereby setting up a unique atmosphere. For example, in an intense battle scene, a tense atmosphere can be created by enhancing the color dispersion blur effect. In a quiet natural scene, the picture appears softer and more real by appropriately weakening the color dispersion blur degree. In addition, in a film and television post-production scene, a film and television production application can quickly realize complex color transition and light and shadow change by executing the image processing method of the embodiments of the present application, thereby greatly improving the production efficiency.
[0114] The following is an apparatus embodiment of the present application, which can be used to execute the method embodiments of the present application. For details not disclosed in the apparatus embodiments of the present application, refer to the method embodiments of the present application.
[0115] For reference Figure 11 which shows a block diagram of an image processing apparatus according to an embodiment of the present application, the apparatus comprises: An image acquisition module 1110 is configured to acquire a first image. A sampling module 1120 is configured to sample, in the first image, a sequence of associated pixels corresponding to any pixel, a first associated pixel in the sequence of associated pixels being the pixel, and other associated pixels being sequentially farther away from the pixel along a preset direction, the preset direction indicating a color dispersion direction corresponding to the pixel. A weight determination module 1130 is configured to determine, based on color dispersion optical characteristics, a color dispersion weight corresponding to any associated pixel, the color dispersion weight indicating a corresponding color change degree of the corresponding associated pixel in color dispersion blur processing. A color dispersion processing module 1140 is configured to determine, based on first color information of a plurality of associated pixels in the first image and color dispersion weights respectively corresponding to the plurality of associated pixels, second color information corresponding to the pixel. The image determination module 1150 is configured to obtain a second image based on second color information corresponding to each of the plurality of pixels in the first image, the second image indicating a processing result of performing color dispersion blur processing on the first image.
[0116] In an exemplary embodiment, the color dispersion weight includes a channel weight corresponding to each color channel, and the weight determination module 1130 is configured to: obtain a first parameter and a second parameter, the first parameter being used to control a degree of overall color dispersion blur effect, and the second parameter being used to control an influence of a color dispersion effect corresponding to the association parameter on a color dispersion blur processing result corresponding to the pixel; determine a color dispersion adjustment parameter corresponding to each color channel based on the first parameter, the second parameter, and a preset spectral function; determine a channel weight corresponding to each color channel based on a color dispersion adjustment parameter corresponding to each color channel.
[0117] In an exemplary embodiment, the color dispersion processing module 1140 is configured to: for each of the plurality of associated pixels, determine corresponding dispersion information based on a product of first color information of the associated pixel in the first image and the corresponding color dispersion weight; determine a total amount of dispersion information corresponding to the pixel based on each of the dispersion information, the total amount of dispersion information indicating a total color dispersion contribution of the plurality of associated pixels to the pixel after color dispersion blur processing; determine second color information corresponding to the pixel based on the total amount of color information.
[0118] In an exemplary embodiment, the color dispersion processing module 1140 is configured to: determine a comprehensive color dispersion weight corresponding to the pixel based on a color dispersion weight corresponding to each of the plurality of associated pixels; determine second color information corresponding to the pixel based on a ratio of the total amount of dispersion information and the comprehensive color dispersion weight.
[0119] In an exemplary embodiment, the first color information includes a first channel component corresponding to each color channel, the color dispersion weight includes a channel weight corresponding to each color channel, and the dispersion information includes a second channel component corresponding to each color channel, The color dispersion processing module 1140 is configured to: for each color channel, determine a corresponding second channel component based on a product of a corresponding first channel component and a corresponding channel weight.
[0120] In an example implementation, the sampling module 1120 is configured to: sample the pixel as a first associated pixel in the sequence of associated pixels; obtain a third parameter and a fourth parameter, the third parameter being indicative of the preset direction, and the fourth parameter being indicative of a sampling number; sample the first image based on the third parameter and the fourth parameter to obtain the sequence of associated pixels.
[0121] In an example implementation, the sampling module 1120 is configured to: determine a sampling step length based on the fourth parameter and a sampling distance; initialize a sampling step number; determine a second position of the first image corresponding to the associated pixel based on the first position of the first image, the sampling step length and the sampling step number in the preset direction indicated by the third parameter, and sample the associated pixel at the second position; update the sampling step number and continue to sample the associated pixels until the sampling step number reaches the fourth parameter to obtain the sequence of associated pixels.
[0122] In an example implementation, the sampling module 1120 is configured to: determine a projection position of the pixel corresponding to the three-dimensional color sphere in a case where the third parameter indicates that the preset direction is determined based on the three-dimensional color sphere; determine the preset direction based on three-dimensional color information corresponding to the projection position; sample the first image based on the preset direction and the fourth parameter to obtain the sequence of associated pixels.
[0123] In an example implementation, the three-dimensional color information includes a channel value corresponding to each of three color channels, and the sampling module 1120 is configured to: construct a direction vector based on any two of the channel values, the direction vector being indicative of the preset direction.
[0124] In an example implementation, the sampling module 1120 is configured to: sample the first image based on a fixed direction and the fourth parameter in a case where the third parameter indicates that the preset direction is the fixed direction to obtain the sequence of associated pixels.
[0125] It should be noted that the apparatus provided by the above embodiments, in realizing its functions, only divides the above-mentioned various functional modules by way of example, and in actual application, the above-mentioned functions can be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and the specific implementation process is detailed in the method embodiments, which will not be repeated here.
[0126] Please refer to Figure 12 which shows a structural block diagram of a computer device provided by an embodiment of the present application, for executing the image processing method described above, which can be a server. Specifically: The computer device 1200 includes a central processing unit (CPU) 1201, a system memory 1204 including a random access memory (RAM) 1202 and a read-only memory (ROM) 1203, and a system bus 1205 connecting the system memory 1204 and the central processing unit 1201. The computer device 1200 also includes a basic input / output system (I / O) 1206 to help transfer information between various devices in the computer, and a mass storage device 1207 for storing an operating system 1213, application programs 1214 and other program modules 1215.
[0127] The basic input / output system 1206 includes a display 1208 for displaying information and an input device 1209 such as a mouse, keyboard, etc. for user input. Among them, the display 1208 and the input device 1209 are connected to the central processing unit 1201 through the input / output controller 1210 connected to the system bus 1205. The basic input / output system 1206 can also include an input / output controller 1210 for receiving and processing input from a keyboard, mouse, or electronic stylus, and other devices. Similarly, the input / output controller 1210 also provides output to the display screen, printer, or other types of output devices.
[0128] The mass storage device 1207 is connected to the central processing unit 1201 through a mass storage controller (not shown) connected to the system bus 1205. The mass storage device 1207 and its associated computer readable media provide nonvolatile storage for the computer device 1200, that is, storage of information
[0129] Without loss of generality, computer readable media can include computer storage media and communication media. Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data. Computer storage media includes RAM, ROM, EPROM (Erasable Programmable Read Only Memory), EEPROM (Electrically Erasable Programmable Read Only Memory), flash memory or other solid state memory technology, CD-ROM, digital versatile disks (DVD), or other optical disk storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices. Computer storage media would not, however, include communication media including wired or wireless signaling media that communicate program code in a modulated data signal. The system memory 1204 and mass storage device 1207 described above can be embodied as a memory component.
[0130] According to various embodiments of the present application, the computer device 1200 can also operate in a networking environment via the network 1212 and via the network interface 1211 that connects to the network 1212 through the system bus 1205. By way of example, and not limitation, computer device 1200 can
[0131] Figure 13 is a block diagram of an electronic device according to an exemplary embodiment, which can be a terminal, for performing the image processing method described above, and an internal structure diagram thereof can be as shown in Figure 13As shown, the terminal structure shown can include RF (Radio Frequency) circuit 1310, memory 1320 including one or more computer readable storage media, input unit 1330, display unit 1340, sensor 1350, audio circuit 1360, WiFi (wireless fidelity) module 1370, processor 1380 including one or more processing cores, and power supply 1390, etc. Those skilled in the art can understand that the terminal structure shown is not a limitation on the terminal, and can include more or fewer components than shown, or combine certain components, or different component arrangements. Among them: Figure 13 The terminal structure shown in the middle does not constitute a limitation on the terminal, and can include more or fewer components than shown, or combine certain components, or different component arrangements. Among them: The RF circuit 1310 can be used for receiving and sending signals in the process of information or communication, especially receiving the downlink information of the base station and handing it over to one or more processors 1380 for processing; in addition, sending data related to uplink to the base station. Usually, the RF circuit 1310 includes but is not limited to an antenna, at least one amplifier, a tuner, one or more oscillators, a subscriber identity module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier), a duplexer, etc. In addition, the RF circuit 1310 can also communicate with the network and other terminals through wireless communication. Wireless communication can use any communication standard or protocol, including but not limited to GSM (Global System for Mobile Communication), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), etc.
[0132] The memory 1320 can be used to store software programs and modules, and the processor 1380 can execute various functions and data processing by running the software programs and modules stored in the memory 1320. The memory 1320 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs required for functions, etc., and the data storage area can store data created according to the use of the terminal, etc. In addition, the memory 1320 can include a high-speed random access memory, and can also include a non-volatile memory such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state memory device. Accordingly, the memory 1320 can also include a memory controller to provide access for the processor 1380 and the input unit 1330 to the memory 1320.
[0133] The input unit 1330 can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control. Specifically, the input unit 1330 can include a touch-sensitive surface 1331 and other input devices 1332. The touch-sensitive surface 1331, also known as a touch display screen or touchpad, can collect user touch operations (such as user operations using fingers, styluses, etc. or any suitable objects or accessories near the touch-sensitive surface 1331) on or near it, and drive the corresponding connection device according to the pre-set program. Optionally, the touch-sensitive surface 1331 can include two parts of touch detection device and touch controller. Among them, the touch detection device detects the touch position of the user and detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device and converts it into touch coordinates, and sends it to the processor 1380, and can also receive the commands from the processor 1380 and execute them. In addition, the touch-sensitive surface 1331 can be implemented in various types such as resistive, capacitive, infrared and surface acoustic wave. In addition to the touch-sensitive surface 1331, the input unit 1330 can also include other input devices 1332. Specifically, the other input devices 1332 can include one or more of a physical keyboard, function keys (such as volume control keys, on-off keys, etc.), trackballs, mice, joysticks, etc. The display unit 1340 can be used to display information input by a user or provided to the user, as well as various graphical user interfaces of the terminal, which can be composed of graphics, text, icons, video, and any combination thereof. The display unit 1340 can include a display panel 1341, which can be configured in the form of an LCD (Liquid Crystal Display), an OLED (Organic Light-Emitting Diode), or the like. Further, a touch-sensitive surface 1331 can cover the display panel 1341, which, when detecting a touch operation thereon or adjacent thereto, transmits to the processor 1380 to determine the type of touch event, and then the processor 1380 provides corresponding visual output on the display panel 1341 according to the type of touch event. Among them, the touch-sensitive surface 1331 and the display panel 1341 can realize the input and output functions as two independent components, but in some embodiments, the touch-sensitive surface 1331 and the display panel 1341 can be integrated to realize the input and output functions.
[0134] The terminal can also include at least one sensor 1350, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor can include an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 1341 according to the brightness of the ambient light, and the proximity sensor can turn off the display panel 1341 and / or the backlight when the terminal is moved to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the size of the acceleration in each direction (generally three axes), and when at rest, it can detect the size and direction of gravity, which can be used for applications that identify the posture of the terminal (such as landscape / portrait switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer, tapping), etc. As for other sensors that the terminal can also be configured, such as a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., will not be described here.
[0135] The audio circuit 1360, the speaker 1361, and the microphone 1362 can provide an audio interface between the user and the terminal. The audio circuit 1360 can convert the received audio data into an electrical signal and transmit it to the speaker 1361, which converts it into a sound signal output. On the other hand, the microphone 1362 converts the collected sound signal into an electrical signal, which is received by the audio circuit 1360 and converted into audio data. After being processed by the processor 1380, the audio data is output to the RF circuit 1310 for transmission to, for example, another terminal, or to the memory 1320 for further processing. The audio circuit 1360 can also include a jack for providing communication between an external earphone and the terminal.
[0136] WiFi belongs to short-range wireless transmission technology. The terminal can help users send and receive emails, browse web pages, and access streaming media, etc. through the WiFi module 1370, which provides users with wireless broadband Internet access. Although Figure 13 The WiFi module 1370 is shown, but it can be understood that it does not belong to the necessary structure of the terminal, and can be omitted as needed without changing the essence of the application.
[0137] The processor 1380 is the control center of the terminal, which connects all parts of the terminal through various interfaces and lines, executes various functions of the terminal and processes data by running or executing software programs and / or modules stored in the memory 1320 and calling data stored in the memory 1320, and thus monitors the terminal as a whole. Optionally, the processor 1380 can include one or more processing cores; preferably, the processor 1380 can integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interaction area and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1380.
[0138] The terminal also includes a power supply 1390 (such as a battery) for supplying power to various components. Preferably, the power supply can be logically connected to the processor 1380 through a power management system, so as to realize functions such as management of charging, discharging and power consumption management through the power management system. The power supply 1390 can also include one or more than one direct or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power state indicator, and any other components.
[0139] Although not shown, the terminal can also include a camera, a Bluetooth module, etc., which will not be described here. In this embodiment, the display unit of the terminal is a touch screen display, and the terminal further includes a memory and one or more than one program, wherein one or more than one program is stored in the memory and is configured to be executed by one or more than one processor to execute instructions in the method embodiment of the application.
[0140] The above-mentioned memory also includes a computer program, which is stored in the memory and is configured to be executed by one or more than one processor to implement the above-mentioned image processing method.
[0141] In an exemplary embodiment, a computer readable storage medium is also provided, wherein the storage medium stores at least one instruction, the at least one instruction, the at least one program, the code set or the instruction set is executed by the processor to implement the above-mentioned image processing method.
[0142] Optionally, the computer readable storage medium can include: ROM (Read Only Memory), RAM (Random Access Memory), SSD (Solid State Drives) or optical disc, etc. Among them, the random access memory can include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0143] In the example embodiment, a computer program product or computer program is also provided, which includes computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device executes the above image processing method.
[0144] It should be understood that "multiple" mentioned herein refers to two or more. The "and / or" describes the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent: A exists alone, A and B exist together, and B exists alone. The character " / " generally represents that the associated objects before and after it are in an "or" relationship. In addition, the step numbers described herein only exemplarily show a possible execution order between steps. In some other embodiments, the above steps can also be executed in a different order, such as two different numbered steps are executed at the same time, or two different numbered steps are executed in an order opposite to the illustration, and the embodiments of the present application do not limit this.
[0145] In addition, in the specific embodiments of the present application, data related to user information and the like are involved. When the above embodiments of the present application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of related data need to comply with relevant national and regional laws, regulations and standards.
[0146] The above is only an example embodiment of the present application, and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. An image processing method, characterized in that, The method includes: Get the first image; In the first image, the associated pixel sequence corresponding to any pixel is sampled. The first associated pixel in the associated pixel sequence is the pixel, and the distance between the other associated pixels and the pixel increases sequentially along a preset direction. The preset direction indicates the dispersion direction corresponding to the pixel. Based on the dispersive optical properties, the dispersive weight corresponding to any of the associated pixels is determined, and the dispersive weight indicates the degree of color change of the corresponding associated pixel in the dispersive blurring process. Based on the first color information of multiple associated pixels in the first image and the dispersion weights corresponding to the multiple associated pixels, the second color information corresponding to the pixel is determined. A second image is obtained based on the second color information corresponding to multiple pixels in the first image. The second image indicates the processing result of chromatic dispersion blurring of the first image.
2. The method according to claim 1, characterized in that, The dispersion weight includes the channel weights corresponding to each color channel. Determining the dispersion weight for any associated pixel based on dispersive optical properties includes: Obtain a first parameter and a second parameter. The first parameter is used to control the saliency of the overall chromatic aberration blur effect, and the second parameter is used to control the degree of influence of the chromatic aberration effect corresponding to the associated parameter on the chromatic aberration blur processing result corresponding to the pixel. Based on the first parameter, the second parameter, and the preset spectral function, the dispersion adjustment parameter corresponding to each color channel is determined; Based on the dispersion adjustment parameters corresponding to each color channel, the channel weights corresponding to each color channel are determined.
3. The method according to claim 1 or 2, characterized in that, The step of determining the second color information corresponding to the pixel based on the first color information of multiple associated pixels in the first image and the dispersion weights corresponding to the multiple associated pixels includes: For each of the plurality of associated pixels, the corresponding dispersion information is determined based on the product of the first color information of the associated pixel in the first image and the corresponding dispersion weight. Based on the dispersion information, the total amount of dispersion information corresponding to the pixel is determined, and the total amount of dispersion information indicates the overall dispersion contribution of the multiple associated pixels to the pixel after dispersion blurring processing. Based on the total amount of color information corresponding to the pixel, the second color information corresponding to the pixel is determined.
4. The method according to claim 3, characterized in that, The step of determining the second color information corresponding to the pixel based on the total amount of dispersion information corresponding to the pixel includes: Based on the dispersion weight corresponding to each of the plurality of associated pixels, the comprehensive dispersion weight corresponding to the pixel is determined; The second color information corresponding to the pixel is determined based on the ratio of the total amount of dispersion information to the comprehensive dispersion weight.
5. The method according to claim 3, characterized in that, The first color information includes the first channel component corresponding to each color channel, the dispersion weight includes the channel weight corresponding to each color channel, and the dispersion information includes the second channel component corresponding to each color channel. The step of determining the corresponding chromatic dispersion information based on the product of the first color information of the associated pixel in the first image and the corresponding chromatic dispersion weight includes: For each color channel, the corresponding second channel component is determined based on the product of the corresponding first channel component and the corresponding channel weight.
6. The method according to claim 1, characterized in that, The step of sampling the associated pixel sequence corresponding to any pixel in the first image includes: The pixel is sampled as the first associated pixel in the associated pixel sequence; Obtain the third parameter and the fourth parameter, wherein the third parameter is used to indicate the preset direction and the fourth parameter is used to indicate the number of samplings; Based on the third and fourth parameters, the first image is sampled to obtain the associated pixel sequence.
7. The method according to claim 6, characterized in that, The step of sampling the first image based on the third parameter and the fourth parameter to obtain the associated pixel sequence includes: Based on the fourth parameter and the sampling distance, the sampling step size is determined; Initialize the number of sampling steps; In the preset direction indicated by the third parameter, based on the first position of the pixel in the first image, the sampling step size, and the number of sampling steps, the corresponding associated pixel is determined to be at the second position of the first image, and the associated pixel is sampled at the second position; Update the sampling step number and continue sampling associated pixels until the sampling step number reaches the fourth parameter to obtain the associated pixel sequence.
8. The method according to claim 6, characterized in that, The step of sampling the first image based on the third parameter and the fourth parameter to obtain the associated pixel sequence includes: When the third parameter indicates that the preset direction is determined based on the three-dimensional color sphere, the projection position of the pixel on the three-dimensional color sphere is determined. The preset direction is determined based on the three-dimensional color information corresponding to the projection position; Based on the preset direction and the fourth parameter, the first image is sampled to obtain the associated pixel sequence.
9. The method according to claim 8, characterized in that, The three-dimensional color information includes the channel values corresponding to each of the three color channels. Determining the preset direction based on the three-dimensional color information of the projection position includes: Based on any two of the channel values, a direction vector is constructed, which indicates the preset direction.
10. The method according to claim 6, characterized in that, The step of sampling the first image based on the third parameter and the fourth parameter to obtain the associated pixel sequence includes: When the third parameter indicates that the preset direction is a fixed direction, the first image is sampled based on the fixed direction and the fourth parameter to obtain the associated pixel sequence.
11. An image processing apparatus, characterized in that, The device includes: The image acquisition module is used to acquire the first image; The sampling module is used to sample the associated pixel sequence corresponding to any pixel in the first image, wherein the first associated pixel in the associated pixel sequence is the pixel, and the distance between the other associated pixels and the pixel increases sequentially along a preset direction, wherein the preset direction indicates the dispersion direction corresponding to the pixel; The weight determination module is used to determine the dispersion weight corresponding to any of the associated pixels based on the dispersive optical characteristics. The dispersion weight indicates the degree of color change of the corresponding associated pixel in the dispersive blurring process. The dispersion processing module is used to determine the second color information corresponding to the pixel based on the first color information of multiple associated pixels in the first image and the dispersion weights corresponding to the multiple associated pixels. The image determination module is used to obtain a second image based on the second color information corresponding to multiple pixels in the first image, wherein the second image indicates the processing result of performing chromatic dispersion blurring on the first image.
12. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction, which is loaded and executed by the processor to implement the image processing method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, which is loaded and executed by a processor to implement the image processing method as described in any one of claims 1 to 10.
14. A computer program product, characterized in that, The computer program product includes computer instructions, the processor of the computer device reads the computer instructions, and the processor of the computer device executes the computer instructions to implement the image processing method as described in any one of claims 1 to 10.