Filter parameter acquisition method and device

By acquiring and determining the 3D LUT of the target filter, the problem of filter libraries not being usable across platforms is solved, enabling rapid restoration and flexible addition of filters.

CN115908191BActive Publication Date: 2026-04-21VIVO MOBILE COMM CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
VIVO MOBILE COMM CO LTD
Filing Date
2022-12-09
Publication Date
2026-04-21

AI Technical Summary

Technical Problem

The existing filter library cannot be used across platforms, lacks flexibility, and users cannot expand the filter library according to their needs.

Method used

By acquiring the first calibration image and inputting it into the target filter, the 3D lookup table (3D LUT) of the target filter is determined, enabling cross-platform use of the filter.

Benefits of technology

It enables rapid filter restoration and cross-platform addition, improving the flexibility and efficiency of filter acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115908191B_ABST
    Figure CN115908191B_ABST
Patent Text Reader

Abstract

This application discloses a method and apparatus for obtaining filter parameters, belonging to the field of image processing technology. The method includes: obtaining a first calibration map, the first calibration map including M first image blocks, each first image block including M*M first sub-image blocks, each first sub-image block including multiple pixels with the same pixel value, where M is a positive integer less than or equal to 255; inputting the first calibration map into a target filter to obtain a second calibration map, the second calibration map including M second image blocks, each second image block including M*M second sub-image blocks; and determining a first 3D LUT of the target filter based on each second sub-image block.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of image processing technology, specifically relating to a method and apparatus for obtaining filter parameters. Background Technology

[0002] One-click and personalized photo editing are increasingly popular among users. Common quick photo editing techniques include filters, background removal, effects, and blurring. Among these, filters can adjust the style and tone of an image, clearly reflecting the author's mood, such as melancholy or sunshine, and are widely used. Currently, commonly used filters include retro, film, natural, party, panning, sketch, oil painting, and many others. The vast majority of filters are tone-based filters, implemented through 3D lookup tables (LUTs), such as retro, natural, warm sunshine, and fresh filters.

[0003] There are currently many types of color tone filters on the market, and due to different manufacturers' different aesthetics, their filter libraries are not entirely the same. Even filters with the same name may have slight differences between different manufacturers, and each manufacturer can only provide a limited filter library. When the limited filter library provided by a certain manufacturer cannot meet the user's aesthetic needs, the user can only use the filter library of other manufacturers to satisfy their preferences, or manually adjust it to their satisfaction.

[0004] In other words, filters provided by different manufacturers can only be used on the manufacturer's platform, and the filters cannot be expanded across platforms according to user needs, resulting in a lack of flexibility in adding filters. Summary of the Invention

[0005] The purpose of this application is to provide a method and apparatus for obtaining filter parameters, which can solve the problem of lack of flexibility in adding filters.

[0006] In a first aspect, embodiments of this application provide a method for obtaining filter parameters, the method comprising:

[0007] Obtain a first calibration image, which includes M first image blocks, each first image block includes M*M first sub-image blocks, and each first sub-image block includes multiple pixels with the same pixel value, where M is a positive integer less than or equal to 255;

[0008] The first calibration map is input into the target filter to obtain a second calibration map. The second calibration map includes M second image blocks, and each second image block includes M*M second sub-image blocks.

[0009] Based on each of the second sub-image blocks, a first three-dimensional lookup table (3D LUT) for the target filter is determined.

[0010] Secondly, embodiments of this application provide a filter parameter acquisition device, the device comprising:

[0011] The first acquisition module is used to acquire a first calibration map. The first calibration map includes M first image blocks, each first image block includes M*M first sub-image blocks, and each first sub-image block includes multiple pixels with the same pixel value. M is a positive integer less than or equal to 255.

[0012] The second acquisition module is used to input the first calibration map into the target filter to obtain a second calibration map. The second calibration map includes M second image blocks, and each second image block includes M*M second sub-image blocks.

[0013] The determination module is used to determine the first three-dimensional lookup table (3D LUT) of the target filter based on each of the second sub-image blocks.

[0014] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing programs or instructions executable on the processor, the programs or instructions, when executed by the processor, implementing the steps of the method described in the first aspect.

[0015] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0016] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0017] In a sixth aspect, embodiments of this application provide a program product stored in a storage medium, which is executed by at least one processor to implement the method described in the first aspect.

[0018] In this embodiment, a first calibration map is obtained, comprising M first image blocks, each first image block comprising M*M first sub-image blocks, and each first sub-image block comprising multiple pixels with the same pixel value, where M is a positive integer less than or equal to 255. The first calibration map is input to the target filter to obtain a second calibration map, comprising M second image blocks, each second image block comprising M*M second sub-image blocks. Based on each second sub-image block, a first 3D LUT for the target filter is determined. Through this method, a first 3D LUT for the target filter can be obtained, enabling rapid restoration of the target filter. The target filter can be added to other platforms using the first 3D LUT, achieving cross-platform use. Users can add the first 3D LUT to the filter library as needed, thereby enabling flexible filter addition. Attached Figure Description

[0019] Figure 1 This is a flowchart of a filter parameter acquisition method provided in an embodiment of this application;

[0020] Figure 2a This is a schematic diagram of color space division nodes provided in an embodiment of this application;

[0021] Figure 2b A first calibration diagram provided for embodiments of this application;

[0022] Figure 2c Another flowchart of the filter parameter acquisition method provided in the embodiments of this application;

[0023] Figure 3 This is a structural diagram of the filter parameter acquisition device provided in the embodiments of this application;

[0024] Figure 4 This is one of the structural diagrams of the electronic device provided in the embodiments of this application;

[0025] Figure 5 This is the second structural diagram of the electronic device provided in the embodiments of this application. Detailed Implementation

[0026] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0027] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such terms can be used interchangeably where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0028] The filter parameter acquisition method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0029] Figure 1 This is one of the flowcharts for a filter parameter acquisition method provided in this application embodiment. The filter parameter acquisition method in this embodiment is applied to an electronic device and includes the following steps:

[0030] Step 101: Obtain the first calibration image. The first calibration image includes M first image blocks, each first image block includes M*M first sub-image blocks, and each first sub-image block includes multiple pixels with the same pixel value. M is a positive integer less than or equal to 255.

[0031] The method in this application can be applied to tone filters, which are implemented using 3D LUTs. By setting the parameter values ​​of each node in the 3D LUT, different filters can be obtained. A 3D LUT can be understood as a 3D LUT composed of three 1D LUTs: R (red), G (green), and B (blue). The input color values ​​of the three channels R, G, and B are mapped according to the 3D LUT to obtain the converted colors.

[0032] 3D LUTs can divide the RGB color space. The RGB color space coordinate axis has three dimensions: R, G, and B. Each dimension is [0, 255]. If each dimension is divided into two segments and three nodes, the size of the color space is 2*2*2 if divided by segments, and 3*3*3 if divided by nodes. Both statements are correct. In this embodiment, M is used as an example of node division.

[0033] The dimensions of a 3D LUT include, but are not limited to, 17*17*17, 18*18*18, 33*33*33, 52*52*52, and 65*65*65. A first calibration image can be obtained based on a standard M*M*M 3D LUT. For example, if M is 18, then there are 18 nodes in each of the R, G, and B dimensions. These 18 nodes divide the pixel value [0, 255] into 17 equally spaced parts, with each part having a step size of 15. Figure 2a The image shown is a standard 18*18*18 3DLUT. The first calibration image contains 18 large squares (Block0, i.e., the first image block), and the B component in each Block0 is a fixed value. The horizontal axis of the first image block is the R component, and the vertical axis is the G component. Each large square (Block0) contains 18*18 small squares (Block1, i.e., the first sub-image block). To reduce the loss that may be introduced by image compression, each small square (Block1) is composed of multiple pixels with the same pixel value. That is, the first sub-image block includes N*N pixels with the same pixel value, where N is a positive integer, for example, N is 20 or 30. The larger the value of N, the higher the accuracy.

[0034] It should be noted that the M first image blocks can be arranged in a preset manner in the first calibration image, for example, I rows and J columns, where I and J are positive integers. When arranging, the M first image blocks may not be enough to fill I rows and J columns. In this case, the missing positions can be filled with a preset image. The pixel values ​​in the preset image can be set according to the actual situation. For example, it can be set to (0, 0, 0).

[0035] Step 102: Input the first calibration map into the target filter to obtain the second calibration map. The second calibration map includes M second image blocks, and each second image block includes M*M second sub-image blocks.

[0036] The target filter adjusts the pixel values ​​of the pixels in the first calibration image without changing the size of the first calibration image. This means that the first image block and the second image block are the same size, and there is a one-to-one correspondence between the M first image blocks and the M second image blocks. There is also a one-to-one correspondence between the first sub-image blocks within the first image block and the second sub-image blocks within the second image block.

[0037] Step 103: Determine the first 3D LUT of the target filter based on each of the second sub-image blocks.

[0038] The target filter can be a black box filter, which is a filter that does not disclose detailed 3D LUT parameters. The parameter value of a node in the first 3D LUT can be determined based on the pixel value of each second sub-image block.

[0039] In this embodiment, a first calibration map is obtained, comprising M first image blocks, each first image block comprising M*M first sub-image blocks, and each first sub-image block comprising multiple pixels with the same pixel value, where M is a positive integer less than or equal to 255. The first calibration map is input to the target filter to obtain a second calibration map, comprising M second image blocks, each second image block comprising M*M second sub-image blocks. Based on each second sub-image block, a first 3D LUT for the target filter is determined. Through the above method, a first 3D LUT for the target filter can be obtained, enabling rapid restoration of the target filter. The target filter can be added to other platforms via the first 3D LUT, achieving cross-platform use of the target filter. Users can add the first 3D LUT to the filter library as needed, thereby achieving flexible filter addition.

[0040] In one embodiment of this application, step 101, obtaining the first calibration map, includes:

[0041] Step 1011: Divide the preset color space to obtain multiple partition nodes. The multiple partition nodes include M first partition nodes, each first partition node includes M*M partition sub-nodes, and each partition sub-node corresponds to a color value.

[0042] Step 1012: Determine the M first image blocks based on the M first partitioning nodes, where one first partitioning node corresponds to one first image block. The target image block is any image block among the M first image blocks. The pixel value of the first sub-image block in the target image block is determined based on the color value of the partitioning sub-nodes included in the target partitioning node. The target partitioning node is the first partitioning node corresponding to the target image block.

[0043] Specifically, the preset color space can be the RGB color space, which includes three dimensions: R, G, and B. Each dimension includes M partitioning nodes, such as... Figure 2a As shown, for example, if M is 18, then there are 18 partitioning nodes in each of the R, G, and B dimensions. These 18 partitioning nodes divide the pixel value [0, 255] into 17 equally spaced parts, with each part having a step size of 15. The first partitioning node includes a sub-node whose B component is 0. Specifically, the first partitioning node includes a sub-node whose B component is 0, whose R component is one of [0, 15, 30…, 255], and whose G component is one of [0, 15, 30…, 255]. The parameter value of each sub-node is the color value at that node, for example, Figure 2aIn the example, the parameter value of node 11 is (0, 0, 0), that is, the values ​​on R, G, and B are 0, 0, 0 respectively. The parameter value of node 12 is (0, 15, 0), and the parameter value of node 13 is (15, 0, 0).

[0044] Each first partition node is mapped to a first image patch; that is, each first partition node corresponds to a first image patch, and each partition sub-node within each first partition node corresponds to a first sub-image patch. The pixel value of each first sub-image patch is the same as the color value of the partition sub-node corresponding to that first sub-image patch. For example, ... Figure 2b As shown in the figure, label 14 represents a first image block. The pixel value of the first sub-image block 15 is the same as the parameter value (0, 0, 0) of the node labeled 11. The pixel value of the first sub-image block 16 is the same as the parameter value (0, 15, 0) of the node labeled 12. The pixel value of the first sub-image block 17 is the same as the parameter value (15, 0, 0) of the node labeled 13. The first sub-image block can include one pixel or N*N pixels with the same pixel value.

[0045] In this embodiment, a standard M*M*M 3DLUT can be obtained by dividing the preset color space. The parameter values ​​of the nodes in the 3D LUT are mapped to the pixel values ​​of the first sub-image block in the first calibration image. The 3D LUT can be mapped to a two-dimensional image, which facilitates the subsequent processing of the first calibration image using the target filter to obtain the 3D LUT of the target filter. The operation is simple and the acquisition efficiency is high.

[0046] In one embodiment of this application, the first 3D LUT includes multiple nodes, and each node corresponds one-to-one with a multiple partitioning node; step 103, determining the first three-dimensional lookup table (3DLUT) of the target filter based on each of the second sub-image blocks, includes:

[0047] The parameter values ​​of the target node in the first 3D LUT are determined based on the pixel values ​​of the pixels in the target sub-image block. The target sub-image block is any second sub-image block, and the target sub-image block corresponds to the target node.

[0048] Specifically, since multiple nodes in the first 3D LUT correspond one-to-one with multiple partitioning nodes, multiple partitioning nodes correspond one-to-one with multiple first sub-image blocks, and multiple first sub-image blocks correspond one-to-one with multiple second sub-image blocks, then multiple nodes correspond one-to-one with multiple second sub-image blocks.

[0049] The target sub-image block is any second sub-image block, and each target sub-image block corresponds to a target node. Based on the pixel values ​​of the pixels in the target sub-image block, the parameter values ​​of the target node can be determined. For example, the average pixel values ​​of all pixels in the target sub-image block can be used as the parameter value of the target node. Thus, the parameter values ​​of each node in the first 3D LUT can be obtained. This first 3D LUT is the 3D LUT of the target filter, and a filter with pixel-level precision can be obtained based on the first 3D LUT.

[0050] The above method can be used to obtain the 3D LUT of the target filter. Users can add the 3D LUT to the filter library to realize cross-platform use of filters and improve the efficiency of filter acquisition.

[0051] In another embodiment of this application, in order to improve the accuracy of the acquired filter, after determining the first three-dimensional lookup table (3D LUT) of the target filter according to each of the second sub-image blocks in step 103, the method further includes:

[0052] Step 104: Obtain the initial color image.

[0053] The initial color image can be a random color image where R, G, and B are uniformly distributed within the range [0, 255]. This random color image should ideally include all combinations of R, G, and B within the range [0, 255] to ensure relatively high accuracy. In this embodiment, there is no limit to the size of the initial color image; the larger the size, the higher the accuracy. For example, the initial color image can have a capacity of 4MB and a size of approximately 2000x2000. The uniform() function can be used to generate a random color image where R, G, and B are uniformly distributed within the range [0, 255].

[0054] Step 105: Input the initial color image into the target filter to obtain the first color image.

[0055] Step 106: Apply a filter to the initial color image based on the first 3D LUT to obtain a second color image.

[0056] Step 107: Adjust the parameter values ​​of the nodes of the first 3D LUT according to the first color image and the second color image to obtain the second 3D LUT of the target filter.

[0057] The first color image can serve as the standard image (or reference image) for the target filter. The second color image is obtained based on the first 3D LUT processing and can be understood as the result of the first 3D LUT processing. Based on the differences between the first and second color images, the parameter values ​​of the nodes in the first 3D LUT are adjusted. The result of the first 3D LUT processing is closer to the result of the target filter processing. The adjusted 3D LUT is called the second 3D LUT. Compared to the first 3D LUT, the second 3D LUT has higher accuracy and a smaller difference from the 3D LUT of the target filter. In this embodiment, by adjusting the parameter values ​​of the nodes in the first 3D LUT using the first and second color images, a more accurate second 3D LUT can be obtained.

[0058] In the above, step 107, adjusting the parameter values ​​of the nodes of the first 3D LUT based on the first color image and the second color image to obtain the second 3D LUT of the target filter, includes:

[0059] The first color image and the second color image are input into a machine learning model to obtain a second 3D LUT for the target filter. The loss function of the machine learning model is determined based on the first color image, the second color image, the output of the machine learning model, and the first 3D LUT. The machine learning model uses a gradient descent algorithm.

[0060] Specifically, the adjustment of the first 3D LUT can be processed using a machine learning model. The input to the machine learning model is the first color image and the second color image, and the output of the machine learning model is the second 3D LUT. The machine learning model iterates multiple times to obtain the final second 3D LUT. The number of iterations of the machine learning model can be set, for example, 1000 iterations. After 1000 iterations, the iteration stops and the second 3D LUT is output. The second 3D LUT is a subpixel-level filter.

[0061] Machine learning models can also be configured to stop iterating when the loss function falls below a preset threshold. The loss function can be the L1 loss (mean absolute error) of the first color image. Additionally, to reduce errors introduced by the non-uniform distribution of the initial color image, the L1 loss of the 3D LUT should also be considered. Therefore, the loss function is loss = avg(B2–B1) + avg(3DLut1–3DLut0), where B1 represents the first color image, B2 represents the second color image, 3DLut0 represents the first 3D LUT, 3DLut1 represents the second 3D LUT, (B2–B1) represents the subtraction of pixel values ​​at corresponding positions in the second and first color images, avg(B2–B1) represents the average of the sums of pixel values ​​in (B2–B1), and (3DLut1–3DLut0) represents the subtraction of parameter values ​​at corresponding positions, with avg(3DLut1–3DLut0) representing the average of the sums of parameter values ​​in (3DLut1–3DLut0). The smaller the difference between B1 and B2, the smaller the loss value; the smaller the difference between 3DLut1 and 3DLut0, the smaller the loss value.

[0062] In this embodiment, the machine learning model can employ the gradient descent algorithm, and the learning rate can be 0.1 or 0.05, etc. Figure 2c As shown, the specific process by which the machine learning model obtains the second 3D LUT is as follows:

[0063] Step 201: Assign a value to 3DLut1. The initial value of 3DLut1 is the value of 3DLut0.

[0064] Step 202: Process the initial color image using 3DLut1 to obtain the second color image.

[0065] Step 203: Calculate the gradient of the loss function loss, loss = avg(B2 – B1) + avg(3DLut1 – 3DLut0);

[0066] Step 204: Determine if the gradient is minimum. If yes, proceed to step 205; otherwise, proceed to step 206.

[0067] Step 205, output 3DLut1.

[0068] Step 206: Adjust the value of 3DLut1 and assign the adjusted value to 3DLut1.

[0069] The method provided in this application can quickly restore the target filter for expanding the filter library and improving development efficiency; a special calibration map (i.e., the first calibration map) is set up, which only needs to pass through the target filter once to obtain a filter with pixel-level precision; a uniformly distributed initial color map is set up, and combined with the gradient descent method, a high-precision filter with sub-pixel precision can be obtained.

[0070] This application focuses on restoring tone-based filters, achieving target filter restoration in just a few milliseconds. It boasts fast response and high accuracy, enabling rapid expansion of filter libraries. Furthermore, the method provided can be integrated into image editing software, allowing users to "add filters with a single click." Manufacturers can prepare a first calibration image and a uniformly distributed initial color image in advance. Users can process these two images with their preferred black-box filter and then send them back to the manufacturer's integrated "one-click filter addition" function to add the filter to their personal filter library. This flexible and efficient filter addition method offers high efficiency.

[0071] The filter parameter acquisition method provided in this application can be executed by a filter parameter acquisition device. This application uses the example of a filter parameter acquisition device executing the filter parameter acquisition method to illustrate the filter parameter acquisition device provided in this application.

[0072] like Figure 3 As shown, the filter parameter acquisition device 300 includes:

[0073] The first acquisition module 301 is used to acquire a first calibration map. The first calibration map includes M first image blocks, each first image block includes M*M first sub-image blocks, and each first sub-image block includes multiple pixels with the same pixel value. M is a positive integer less than or equal to 255.

[0074] The second acquisition module 302 is used to input the first calibration map into the target filter to obtain a second calibration map. The second calibration map includes M second image blocks, and each second image block includes M*M second sub-image blocks.

[0075] The determination module 303 is used to determine the first three-dimensional lookup table (3D LUT) of the target filter based on each of the second sub-image blocks.

[0076] Optionally, the first acquisition module 301 includes:

[0077] The first acquisition submodule is used to divide the preset color space and obtain multiple division nodes. The multiple division nodes include M first division nodes, each first division node includes M*M division sub-nodes, and each division sub-node corresponds to a color value.

[0078] The second acquisition submodule is used to determine the M first image blocks based on the M first partitioning nodes, wherein one first partitioning node corresponds to one first image block, and the target image block is any image block among the M first image blocks. The pixel value of the first sub-image block in the target image block is determined based on the color value of the partitioning sub-nodes included in the target partitioning node. The target partitioning node is the first partitioning node corresponding to the target image block.

[0079] Optionally, the first 3D LUT includes multiple nodes, and each node corresponds one-to-one with a multiple partitioning node;

[0080] The determining module 303 is used to determine the parameter value of the target node in the first 3DLUT based on the pixel value of the pixel point in the target sub-image block, wherein the target sub-image block is any second sub-image block and the target sub-image block corresponds to the target node.

[0081] Optionally, the device 300 further includes:

[0082] The third acquisition module is used to acquire the initial color image;

[0083] The fourth acquisition module is used to input the initial color image into the target filter to obtain the first color image;

[0084] The fifth acquisition module is used to perform filter processing on the initial color image based on the first 3D LUT to obtain a second color image;

[0085] An adjustment module is used to adjust the parameter values ​​of the nodes of the first 3D LUT according to the first color image and the second color image to obtain the second 3D LUT of the target filter.

[0086] Optionally, the adjustment module is used to input the first color image and the second color image into a machine learning model to obtain a second 3D LUT for the target filter, wherein the loss function of the machine learning model is determined based on the first color image, the second color image, the output of the machine learning model, and the first 3D LUT, and the machine learning model employs a gradient descent algorithm.

[0087] The filter parameter acquisition device 300 provided in this application embodiment can realize the various processes implemented in the aforementioned method embodiment, and will not be described again here to avoid repetition.

[0088] The filter parameter acquisition device 300 in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific type of device.

[0089] The filter parameter acquisition device 300 in this embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this embodiment does not specifically limit its use.

[0090] Optionally, such as Figure 4 As shown, this application embodiment also provides an electronic device 600, including a processor 601 and a memory 602. The memory 602 stores a program or instructions that can run on the processor 601. When the program or instructions are executed by the processor 601, they implement the various steps of the above-described filter parameter acquisition method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.

[0091] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.

[0092] Figure 5 A hardware structure diagram of an electronic device to implement an embodiment of this application.

[0093] The electronic device 700 includes, but is not limited to, components such as: radio frequency unit 701, network module 702, audio output unit 703, input unit 704, sensor 705, display unit 706, user input unit 707, interface unit 708, memory 709, and processor 710.

[0094] Those skilled in the art will understand that the electronic device 700 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 710 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. Figure 5 The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.

[0095] The processor 710 is configured to: acquire a first calibration map, the first calibration map comprising M first image blocks, each first image block comprising M*M first sub-image blocks, each first sub-image block comprising multiple pixels with the same pixel value, where M is a positive integer less than or equal to 255; input the first calibration map into a target filter to obtain a second calibration map, the second calibration map comprising M second image blocks, each second image block comprising M*M second sub-image blocks; and determine a first three-dimensional lookup table (3D LUT) for the target filter based on each second sub-image block.

[0096] Optionally, the processor 710 is further configured to divide a preset color space to obtain multiple division nodes, the multiple division nodes including M first division nodes, each first division node including M*M division sub-nodes, each division sub-node corresponding to a color value; and to determine M first image blocks based on the M first division nodes, one first division node corresponding to one first image block, wherein the target image block is any image block among the M first image blocks, the pixel value of the first sub-image block in the target image block is determined according to the color value of the division sub-nodes included in the target division node, and the target division node is the first division node corresponding to the target image block.

[0097] Optionally, the first 3D LUT includes multiple nodes, and the multiple nodes correspond one-to-one with multiple partitioning nodes; the processor 710 is further configured to determine the parameter value of the target node in the first 3D LUT based on the pixel value of the pixel point in the target sub-image block, wherein the target sub-image block is any second sub-image block, and the target sub-image block corresponds to the target node.

[0098] Optionally, the processor 710 is further configured to: acquire an initial color image; input the initial color image into the target filter to obtain a first color image; perform filter processing on the initial color image based on the first 3D LUT to obtain a second color image; and adjust the parameter values ​​of the nodes of the first 3D LUT according to the first color image and the second color image to obtain a second 3D LUT of the target filter.

[0099] Optionally, the processor 710 is further configured to input the first color image and the second color image into a machine learning model to obtain a second 3D LUT for the target filter, wherein the loss function of the machine learning model is determined based on the first color image, the second color image, the output of the machine learning model, and the first 3D LUT, and the machine learning model employs a gradient descent algorithm.

[0100] The electronic device provided in this application embodiment can implement the various processes implemented in the foregoing method embodiments, and will not be described again here to avoid repetition.

[0101] It should be understood that, in this embodiment, the input unit 704 may include a graphics processing unit (GPU) 7041 and a microphone 7042. The GPU 7041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 706 may include a display panel 7061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, or the like. The user input unit 707 includes at least one of a touch panel 7071 and other input devices 7072. The touch panel 7071 is also called a touch screen. The touch panel 7071 may include a touch detection device and a touch controller. Other input devices 7072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be described in detail here.

[0102] The memory 709 can be used to store software programs and various data. The memory 709 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 709 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 709 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0103] Processor 710 may include one or more processing units; optionally, processor 710 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 710.

[0104] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described filter parameter acquisition method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0105] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0106] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described filter parameter acquisition method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0107] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0108] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the filter parameter acquisition method embodiment described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0109] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0110] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0111] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method for obtaining filter parameters, characterized in that, include: Obtain a first calibration image, which includes M first image blocks, each first image block including M*M first sub-image blocks, and each first sub-image block including multiple pixels with the same pixel value, where M is a positive integer less than or equal to 255; input the first calibration image into the target filter to obtain a second calibration image, which includes M second image blocks, each second image block including M*M second sub-image blocks; Based on each of the second sub-image blocks, determine the first three-dimensional lookup table (3D LUT) for the target filter; The first calibration image is a pre-set image based on a standard M×M×M three-dimensional lookup table structure, wherein each first sub-image block corresponds to a node in the three-dimensional lookup table; The first calibration map can be set up in the following ways: The preset color space is divided to obtain multiple division nodes, wherein the multiple division nodes include M first division nodes, each first division node includes M*M division sub-nodes, and each division sub-node corresponds to a color value. Based on the M first partitioning nodes, the M first image blocks are determined, with one first partitioning node corresponding to one first image block. The target image block is any image block among the M first image blocks. The pixel value of the first sub-image block in the target image block is determined based on the color value of the partitioning sub-nodes included in the target partitioning node. The target partitioning node is the first partitioning node corresponding to the target image block. The first 3D LUT includes multiple nodes, and each node corresponds one-to-one with a partitioning node. The step of determining the first three-dimensional lookup table (3D LUT) of the target filter based on each of the second sub-image blocks includes: The parameter values ​​of the target node in the first 3D LUT are determined based on the pixel values ​​of the pixels in the target sub-image block. The target sub-image block is any second sub-image block, and the target sub-image block corresponds to the target node.

2. The method according to claim 1, characterized in that, After determining the first 3D lookup table (3D LUT) of the target filter based on each of the second sub-image blocks, the method further includes: Obtain the initial color image; The initial color image is input into the target filter to obtain the first color image; The initial color image is filtered based on the first 3D LUT to obtain the second color image; Based on the first color image and the second color image, the parameter values ​​of the nodes of the first 3D LUT are adjusted to obtain the second 3D LUT of the target filter.

3. The method according to claim 2, characterized in that, The step of adjusting the parameter values ​​of the nodes of the first 3D LUT based on the first color image and the second color image to obtain the second 3D LUT of the target filter includes: The first color image and the second color image are input into a machine learning model to obtain the second 3D LUT of the target filter. The loss function of the machine learning model is determined based on the first color image, the second color image, the output of the machine learning model, and the first 3D LUT. The machine learning model uses the gradient descent algorithm.

4. A filter parameter acquisition device, characterized in that, include: The first acquisition module is used to acquire a first calibration map. The first calibration map includes M first image blocks, each first image block includes M*M first sub-image blocks, and each first sub-image block includes multiple pixels with the same pixel value. M is a positive integer less than or equal to 255. The second acquisition module is used to input the first calibration map into the target filter to obtain a second calibration map. The second calibration map includes M second image blocks, and each second image block includes M*M second sub-image blocks. The determining module is used to determine the first three-dimensional lookup table (3DLUT) of the target filter based on each of the second sub-image blocks; The first calibration image is a pre-set image based on a standard M×M×M three-dimensional lookup table structure, wherein each first sub-image block corresponds to a node in the three-dimensional lookup table; The first acquisition module includes: The first acquisition submodule is used to divide the preset color space to obtain multiple division nodes, wherein the multiple division nodes include M first division nodes, each first division node includes M*M division sub-nodes, and each division sub-node corresponds to a color value. The second acquisition submodule is used to determine the M first image blocks based on the M first partitioning nodes, wherein one first partitioning node corresponds to one first image block, and the target image block is any image block among the M first image blocks. The pixel value of the first sub-image block in the target image block is determined based on the color value of the partitioning sub-nodes included in the target partitioning node. The target partitioning node is the first partitioning node corresponding to the target image block. The first 3D LUT includes multiple nodes, and each node corresponds one-to-one with a partitioning node. The determining module is used to determine the parameter value of the target node in the first 3D LUT based on the pixel value of the pixel point in the target sub-image block, wherein the target sub-image block is any second sub-image block and the target sub-image block corresponds to the target node.

5. The apparatus according to claim 4, characterized in that, The device further includes: The third acquisition module is used to acquire the initial color image; The fourth acquisition module is used to input the initial color image into the target filter to obtain the first color image; The fifth acquisition module is used to perform filter processing on the initial color image based on the first 3D LUT to obtain a second color image; An adjustment module is used to adjust the parameter values ​​of the nodes of the first 3D LUT according to the first color image and the second color image to obtain the second 3D LUT of the target filter.

6. The apparatus according to claim 5, characterized in that, The adjustment module is used to input the first color image and the second color image into a machine learning model to obtain the second 3D LUT of the target filter. The loss function of the machine learning model is determined based on the first color image, the second color image, the output of the machine learning model, and the first 3D LUT. The machine learning model uses the gradient descent algorithm.

Citation Information

Patent Citations

  • Multimedia data processing method and mobile terminal

    CN106791756A