Spectrum generation method and device of target color, terminal and storage medium
By calculating the deviation value and updating the spectral data using an optimization algorithm, the accuracy problem of converting color coordinates into spectral data is solved, and the color design of optical nanostructures and accurate color adjustment of pigment products is realized.
Patent Information
- Application Number
- CN202410116893.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-26
- Publication Date
- 2025-07-29
AI Technical Summary
The prior art cannot accurately convert the color coordinate data provided by the client into spectral data, resulting in inaccurate color design of optical nanostructures and color adjustment of pigment products.
By obtaining the initial spectral data and target chromaticity information, calculating the deviation value and optimizing and updating it, the initial spectral data is optimized using particle worm algorithm, genetic algorithm, differential evolution algorithm or gradient descent algorithm until the deviation value meets the threshold value and generate target spectral data.
Improve the accuracy of spectral data, ensure the accuracy of color adjustment of pigment products, and meet customer needs.
Smart Images

Figure CN120385633A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of optical pigments, and particularly to a method, device, terminal and computer-readable storage medium for generating a spectrum of a target color. Background Art
[0002] Optical nanostructured color generates specific colors by adjusting the structure of materials at the nanoscale, causing optical interference, diffraction, etc. of incident light on its structure. Due to its excellent properties such as good stability, non-toxicity, rich and easy-to-adjust colors, high color saturation, and angle-dependent color change, it is widely used in various fields. In the process of designing structural colors, by adjusting and changing the corresponding physical structure parameters, the spectrum generated by the structural color can be adjusted, thereby changing the visual color effect. That is to say, for structural colors, one structure corresponds to one spectrum and thus one color.
[0003] In the process of large-scale industrial application of optical nanostructured colors and their pigment products, the client's color requirements are often not provided in the form of spectral data, but rather in the form of relatively abstract color coordinate data. In order to better facilitate the design and color adjustment of structural colors and provide the pigment products required by the client, it is particularly important to convert color coordinate information into spectral data. Summary of the Invention
[0004] The main technical problem to be solved by the present invention is to provide a method, device, terminal and computer-readable storage medium for generating a spectrum of a target color, so as to solve the problem in the prior art that an accurate spectrum cannot be obtained based on color coordinates.
[0005] To solve the above technical problem, the first technical solution adopted by the present invention is: to provide a method for generating a spectrum of a target color, the method for generating a spectrum of a target color comprising:
[0006] Obtain initial spectral data and target chromaticity information; the initial spectral data has corresponding chromaticity information;
[0007] Based on the initial spectral data, chromaticity information and target chromaticity information, obtain a deviation value corresponding to the initial spectral data;
[0008] In response to the deviation value corresponding to the initial spectral data exceeding a threshold, update the initial spectral data based on the deviation value to obtain updated spectral data;
[0009] In response to the deviation value corresponding to the updated spectral data not exceeding the threshold, use the updated spectral data as the target spectral data corresponding to the target chromaticity information.
[0010] Wherein, obtaining a deviation value corresponding to the initial spectral data based on the initial spectral data, chromaticity information and target chromaticity information includes:
[0011] Obtain a first deviation value based on the difference between the chromaticity information and the target chromaticity information;
[0012] Perform second-order differentiation and summation on all wavelengths of the initial spectral data to obtain the sum of the second-order derivatives of all wavelengths;
[0013] Based on the first deviation value and the sum of the second-order derivatives of all wavelengths, obtain the deviation value corresponding to the initial spectral data.
[0014] Among them, obtaining the deviation value corresponding to the initial spectral data based on the first deviation value and the sum of the second-order derivatives of all wavelengths of the initial spectral data includes:
[0015] Obtain the deviation value corresponding to the initial spectral data based on the weighted sum between the first deviation value and the sum of the second-order derivatives of all wavelengths.
[0016] Among them, the chromaticity information includes color coordinates; the target chromaticity information includes target color coordinates;
[0017] Obtaining a first deviation value based on the difference between the chromaticity information and the target chromaticity information includes:
[0018] Generate a first deviation value according to the difference between the color coordinates corresponding to the initial spectral data and the target color coordinates.
[0019] Among them, updating the initial spectral data based on the deviation value includes:
[0020] Use an optimization algorithm to update the initial spectral data based on the deviation value; among them, the optimization algorithm includes at least one of a particle worm algorithm, a genetic algorithm, a differential evolution algorithm, and a gradient descent algorithm.
[0021] Among them, the wavelengths of the target spectral data belong to the visible light band, and the wavelength range is 380nm - 780nm.
[0022] Among them, obtaining the initial spectral data and the target chromaticity information; the initial spectral data has corresponding chromaticity information, including:
[0023] Obtain the initial spectral data and the target chromaticity information;
[0024] Based on the principle of colorimetry, perform chromaticity conversion on the initial spectral data to obtain the chromaticity information corresponding to the initial spectral data, and the chromaticity information includes at least one of Lab value, Luv value, LCh value, Yxy value, CMYK value, RGB value, and Hex value.
[0025] To solve the above technical problems, the second technical solution adopted by the present invention is: provide a spectral generation device for a target color, and the spectral generation device for a target color includes:
[0026] An acquisition module, configured to acquire initial spectral data and target chromaticity information; the initial spectral data has corresponding chromaticity information;
[0027] A calculation module, configured to obtain a deviation value corresponding to the initial spectral data based on the initial spectral data, the chromaticity information, and the target chromaticity information;
[0028] An analysis module, configured to, in response to the deviation value corresponding to the initial spectral data exceeding a threshold, update the initial spectral data based on the deviation value to obtain updated spectral data;
[0029] A determination module, configured to, in response to the deviation value corresponding to the updated spectral data not exceeding the threshold, use the updated spectral data as the target spectral data corresponding to the target chromaticity information.
[0030] To solve the above technical problem, the third technical solution adopted by the present invention is: to provide a terminal, which includes a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor is configured to execute program data to implement the steps in the method for generating a spectrum of a target color as described above.
[0031] To solve the above technical problem, the fourth technical solution adopted by the present invention is: to provide a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps in the method for generating a spectrum of a target color as described above are implemented.
[0032] The beneficial effects of the present invention are: different from the prior art, a method, device, terminal, and storage medium for generating a spectrum of a target color are provided. The method for generating a spectrum of a target color includes: acquiring initial spectral data and target chromaticity information; the initial spectral data has corresponding chromaticity information; obtaining a deviation value corresponding to the initial spectral data based on the initial spectral data, the chromaticity information, and the target chromaticity information; in response to the deviation value corresponding to the initial spectral data exceeding a threshold, updating the initial spectral data based on the deviation value to obtain updated spectral data; in response to the deviation value corresponding to the updated spectral data not exceeding the threshold, using the updated spectral data as the target spectral data corresponding to the target chromaticity information. This application determines the deviation value corresponding to the initial spectral data according to the difference between the target chromaticity information and the chromaticity information corresponding to the initial spectral data and the spectral continuity of the initial spectral data, and optimizes the initial spectral data based on the deviation value. When the deviation value corresponding to the updated spectral data is less than the threshold, the updated spectral data is used as the target spectral data corresponding to the target chromaticity information, and then the target spectral data is determined based on the target chromaticity information, improving the accuracy of the spectrum, so as to determine the pigment corresponding to the target chromaticity information according to the spectrum. Description of the Drawings
[0033] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0034] Figure 1 is a schematic flowchart of the method for generating the spectrum of the target color provided by the present invention;
[0035] Figure 2 is Figure 1 a schematic flowchart of a specific embodiment of step S2 in the method for generating the spectrum of the target color provided;
[0036] Figure 3(a) is the target spectral data in a specific embodiment corresponding to the target chromaticity information RGB of (121, 77, 62);
[0037] Figure 3(b) is the target spectral data in another specific embodiment corresponding to the target chromaticity information RGB of (121, 77, 62);
[0038] Figure 4(a) is the target spectral data in a specific embodiment corresponding to the target chromaticity information RGB of (49, 84, 66);
[0039] Figure 4(b) is the target spectral data in another specific embodiment corresponding to the target chromaticity information RGB of (49, 84, 66);
[0040] Figure 5 is a schematic framework diagram of an embodiment of the device for generating the spectrum of the target color provided by the present invention;
[0041] Figure 6 is a schematic framework diagram of an embodiment of the terminal provided by the present invention;
[0042] Figure 7 is a schematic framework diagram of an embodiment of the computer-readable storage medium provided by the present invention. Specific Embodiments
[0043] The following will elaborate on the solutions of the embodiments of the present application in conjunction with the accompanying drawings of the specification.
[0044] In the following description, specific details such as specific system architectures, interfaces, and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the present application.
[0045] In this text, the term "and / or" is merely a description of the association relationship between associated objects, indicating that there can be three relationships. For example, A and / or B can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. Additionally, in this text, the character " / " generally indicates that the associated objects before and after are in an "or" relationship. Furthermore, "multiple" in this text means two or more than two.
[0046] To enable those skilled in the art to better understand the technical solution of the present invention, the following further details the method for generating the spectrum of a target color provided by the present invention in combination with the accompanying drawings and specific embodiments.
[0047] Please refer to Figure 1 , Figure 1 which is a schematic flowchart of the method for generating the spectrum of a target color provided by the present invention.
[0048] In this embodiment, a method for generating the spectrum of a target color is provided. The method embodiments provided in the embodiments of the present application can be executed on a mobile terminal, a computer terminal, or a similar computing device. The method for generating the spectrum of a target color includes the following steps.
[0049] S1: Obtain initial spectral data and target chromaticity information; the initial spectral data has corresponding chromaticity information.
[0050] S2: Based on the initial spectral data, chromaticity information, and target chromaticity information, obtain the deviation value corresponding to the initial spectral data.
[0051] S3: In response to the deviation value corresponding to the initial spectral data exceeding the threshold, update the initial spectral data based on the deviation value to obtain updated spectral data.
[0052] S4: In response to the deviation value corresponding to the updated spectral data not exceeding the threshold, use the updated spectral data as the target spectral data corresponding to the target chromaticity information.
[0053] Specifically, the specific implementation manners of obtaining the initial spectral data and the initial spectral data having corresponding chromaticity information in step S1 are as follows.
[0054] In one embodiment, obtain the initial spectral data and target chromaticity information.
[0055] In a specific embodiment, a spectral line is randomly generated within the wavelength range of 380 nm - 780 nm as the initial spectral data. Alternatively, a spectral line can be preset within the wavelength range of 380 nm - 780 nm as the initial spectral data. The user can input target chromaticity information on the interaction interface, and the type of the target chromaticity information is at least one of the Lab color space, Luv color space, LCh color space, Yxy color space, CMYK color space, RGB color space, and Hex color space.
[0056] Based on the principle of colorimetry, the initial spectral data is subjected to chromaticity conversion using a python package to obtain the chromaticity information corresponding to the initial spectral data. Based on the type of the target chromaticity information, the initial spectral data is subjected to chromaticity conversion to obtain the chromaticity information corresponding to the initial spectral data. The type of the chromaticity information is consistent with the type of the target chromaticity information. The chromaticity information includes at least one of Lab value, Luv value, LCh value, Yxy value, CMYK value, RGB value, and Hex value.
[0057] Among them, the chromaticity information includes color coordinates, and the target chromaticity information includes target color coordinates. For example, both the color coordinates and the target color coordinates are RGB values.
[0058] Specifically, the specific implementation manner of obtaining the deviation value corresponding to the initial spectral data in step S2 is as follows.
[0059] Please refer to Figure 2 , Figure 2 which is Figure 1 a schematic flow chart of a specific embodiment of step S2 in the spectral generation method of the target color provided.
[0060] S21: Obtain a first deviation value according to the difference between the chromaticity information and the target chromaticity information.
[0061] Specifically, the chromaticity information includes color coordinates; the target chromaticity information includes target color coordinates. A first deviation value is generated according to the difference between the color coordinates corresponding to the initial spectral data and the target color coordinates.
[0062] S22: Perform second-order differentiation and summation on all wavelengths of the initial spectral data to obtain the sum of the second-order derivatives of all wavelengths.
[0063] Specifically, the initial spectral data can be represented as a vector, wherein, is the spectral data at the wavelength λ i , and λ1 to λ N are the discretized wavelength information. A wavelength is set every 10 nm within the wavelength range of visible light. For example, λ1 = 380 nm, λ2 = 390 nm,..., λ N= 780 nm, thus discretizing the spectral data into a 41 - dimensional vector.
[0064] The initial spectral data is second - order differentiated and summed through the following formula to obtain the sum of the second - order derivatives of all wavelengths.
[0065]
[0066] Where, L represents the sum of the second - order derivatives of all wavelengths corresponding to the initial spectral data; S″(λ i ) represents the second - order derivative of the spectrum at wavelength λ i .
[0067] In this embodiment, the sum of the second - order derivatives of all wavelengths can be obtained by summing based on the second - order derivatives at each wavelength using the interpolation method.
[0068] S23: Based on the first deviation value and the sum of the second - order derivatives of all wavelengths, a weighted sum is performed to obtain the deviation value corresponding to the initial spectral data.
[0069] Specifically, based on the weighted sum between the first deviation value and the sum of the second - order derivatives of all wavelengths, the deviation value corresponding to the initial spectral data is obtained.
[0070] The deviation value corresponding to the initial spectral data is obtained through the following formula.
[0071] Loss = α1·W t +α2·L
[0072] Where, Loss represents the deviation value of the initial spectral data; W t represents the first deviation value; L represents the sum of the second - order derivatives of all wavelengths of the initial spectral data; α1 represents the first adjustment factor; α2 represents the second adjustment factor.
[0073] Through the first adjustment factor and the second adjustment factor, the contributions of the first deviation value and the second - order derivative data to the deviation value corresponding to the initial spectral data can be balanced. If the first adjustment factor is increased, the algorithm will be more inclined to minimize the first deviation value, that is, tend to minimize the difference between the chromaticity coordinates of the initial spectral data and the target chromaticity coordinates; however, being too inclined to the first deviation value will result in the spectrum finally obtained for the target chromaticity information being discontinuous. If the second adjustment factor is increased, the algorithm can tend to obtain a more continuous spectrum; however, being too inclined to the second - order derivative data of the initial spectral data will result in a larger first deviation value. Therefore, by adjusting the first adjustment factor and the second adjustment factor, the deviation value between the chromaticity information corresponding to the finally obtained spectrum and the target chromaticity information can meet the preset requirements, and the obtained spectrum has excellent continuity at the same time. In this embodiment, the optimal first adjustment factor and the second adjustment factor are selected from multiple pairs of adjustment factors so that the obtained spectrum is closest to the spectrum corresponding to the target chromaticity information.
[0074] Compare the deviation value corresponding to the initial spectral data with a set threshold value. Among them, the threshold value is set according to the actual situation. For example, the threshold value can be 0.02, 0.015 or 0.01.
[0075] Specifically, the specific implementation of obtaining the updated spectral data in step S3 is as follows.
[0076] In one embodiment, when the deviation value corresponding to the initial spectral data exceeds the threshold value, it indicates that the difference between the chromaticity information corresponding to the initial spectral data and the target chromaticity information is too large, and the initial spectral data is not the effective spectrum corresponding to the target chromaticity information.
[0077] Use an optimization algorithm to update the initial spectral data based on the deviation value. Among them, the optimization algorithm includes at least one of particle swarm optimization, genetic algorithm, Differential Evolution, and gradient descent.
[0078] In response to the deviation value corresponding to the updated spectral data exceeding the threshold value, continue to update the current updated spectral data based on the deviation value to obtain new updated spectral data. Stop updating the updated spectral data until the deviation value corresponding to the new updated spectral data does not exceed the threshold value.
[0079] Specifically, the specific implementation of obtaining the target spectral data in step S4 is as follows.
[0080] In one embodiment, when the deviation value corresponding to the updated spectral data does not exceed the threshold value, it indicates that the difference between the chromaticity information corresponding to the updated spectral data and the target chromaticity information is not large, and the updated spectral data can be used as the target spectrum corresponding to the target chromaticity information. Among them, the wavelength of the target spectral data belongs to the visible light band, and the wavelength range is 380nm - 780nm.
[0081] To facilitate the design of structural color and the preparation of pigments, target spectral data can be generated according to the target chromaticity information. Since the spectrum may have a high reflectance or transmittance in a specific band, or a large spectral fluctuation in a specific band, and the spectrum with the above characteristics is not easy to be designed and prepared. Therefore, based on the target chromaticity information, multiple candidate spectral data need to be generated, and then an effective spectrum is selected from the multiple candidate spectral data as the target spectral data according to the screening conditions. Among them, the screening conditions include transmittance, reflectance and / or fluctuation degree.
[0082] Please refer to FIGS. 3(a) and 3(b). FIG. 3(a) is the target spectral data in a specific embodiment corresponding to the target chromaticity information RGB of (121, 77, 62); FIG. 3(b) is the target spectral data in another specific embodiment corresponding to the target chromaticity information RGB of (121, 77, 62).
[0083] In a specific embodiment, the target chromaticity information, the target chromaticity type, and the target spectral quantity input by the user are obtained. Among them, the target chromaticity type is the RGB color space, the target chromaticity information RGB is (121, 77, 62), and the target spectral quantity is two. Python is used to perform chromaticity conversion on two sets of randomly generated initial spectral data respectively to obtain the chromaticity information of the initial spectral data, and the type of the chromaticity information is also the RGB color space. Based on the initial spectral data, the preset spectral data, the chromaticity information, and the target chromaticity information, the deviation value corresponding to the initial spectral data is obtained; in response to the deviation value corresponding to the initial spectral data exceeding the threshold, the initial spectral data is updated based on the deviation value to obtain updated spectral data; in response to the deviation value corresponding to the updated spectral data not exceeding the threshold, the updated spectral data is used as the target spectral data corresponding to the target chromaticity information. That is, two sets of target spectral data obtained by optimizing the two sets of initial spectral data respectively are obtained, as shown in FIGS. 3(a) and 3(b).
[0084] Please refer to FIGS. 4(a) and 4(b). FIG. 4(a) is the target spectral data in a specific embodiment corresponding to the target chromaticity information RGB of (49, 84, 66); FIG. 4(b) is the target spectral data in another specific embodiment corresponding to the target chromaticity information RGB of (49, 84, 66).
[0085] In a specific embodiment, the target chromaticity information, the target chromaticity type, and the target spectral quantity input by the user are obtained. Among them, the target chromaticity type is the RGB color space, the target chromaticity information RGB is (49, 84, 66), and the target spectral quantity is two. Python is used to perform chromaticity conversion on two sets of randomly generated initial spectral data respectively to obtain the chromaticity information of the initial spectral data, and the type of the chromaticity information is also the RGB color space. Based on the initial spectral data, the preset spectral data, the chromaticity information, and the target chromaticity information, the deviation value corresponding to the initial spectral data is obtained; in response to the deviation value corresponding to the initial spectral data exceeding the threshold, the initial spectral data is updated based on the deviation value to obtain updated spectral data; in response to the deviation value corresponding to the updated spectral data not exceeding the threshold, the updated spectral data is used as the target spectral data corresponding to the target chromaticity information. That is, two sets of target spectral data obtained by optimizing the two sets of initial spectral data respectively are obtained, as shown in FIGS. 4(a) and 4(b).
[0086] The method for generating the spectrum of the target color provided in this embodiment obtains initial spectral data and target chromaticity information; the initial spectral data has corresponding chromaticity information; based on the initial spectral data, chromaticity information, and target chromaticity information, the deviation value corresponding to the initial spectral data is obtained; in response to the deviation value corresponding to the initial spectral data exceeding the threshold, the initial spectral data is updated based on the deviation value to obtain updated spectral data; in response to the deviation value corresponding to the updated spectral data not exceeding the threshold, the updated spectral data is used as the target spectral data corresponding to the target chromaticity information. This application determines the deviation value corresponding to the initial spectral data according to the target chromaticity information and the chromaticity information corresponding to the initial spectral data, optimizes the initial spectral data, and if the deviation value corresponding to the spectral data to be updated is less than the threshold, the updated spectral data is used as the target spectral data corresponding to the target chromaticity information, and then the target spectral data is determined based on the target chromaticity information, improving the accuracy of the spectrum, so as to determine the pigment corresponding to the target chromaticity information according to the spectrum.
[0087] Please refer to Figure 5 , Figure 5 FIG. is a schematic framework diagram of an embodiment of a device for generating the spectrum of the target color provided by the present invention. This embodiment provides a device 60 for generating the spectrum of the target color. The device 60 for generating the spectrum of the target color includes an acquisition module 61, a calculation module 62, an analysis module 63, and a determination module 64.
[0088] The acquisition module 61 is used to acquire initial spectral data and target chromaticity information; the initial spectral data has corresponding chromaticity information;
[0089] The calculation module 62 is used to obtain the deviation value corresponding to the initial spectral data based on the initial spectral data, chromaticity information, and target chromaticity information;
[0090] The analysis module 63 is used to update the initial spectral data based on the deviation value to obtain updated spectral data in response to the deviation value corresponding to the initial spectral data exceeding the threshold;
[0091] The determination module 64 is used to use the updated spectral data as the target spectral data corresponding to the target chromaticity information in response to the deviation value corresponding to the updated spectral data not exceeding the threshold.
[0092] The device for generating the spectrum of the target color provided in this embodiment determines the deviation value corresponding to the initial spectral data according to the target chromaticity information and the chromaticity information corresponding to the initial spectral data, optimizes the initial spectral data, and determines the target spectral data based on the target chromaticity information when the deviation value corresponding to the spectral data to be updated is less than the threshold, improving the accuracy of the spectrum, so as to determine the pigment corresponding to the target chromaticity information according to the spectrum.
[0093] Please refer to Figure 6 , Figure 6It is a schematic framework diagram of an embodiment of the terminal provided by the present invention. The terminal 80 includes a memory 81 and a processor 82 that are coupled to each other. The processor 82 is configured to execute program instructions stored in the memory 81 to implement the steps of the embodiment of the method for generating the spectrum of any of the above target colors. In a specific implementation scenario, the terminal 80 may include, but is not limited to: a microcomputer, a server. In addition, the terminal 80 may also include mobile devices such as a laptop computer, a tablet computer, etc., which are not limited herein.
[0094] Specifically, the processor 82 is configured to control itself and the memory 81 to implement the steps of the embodiment of the method for generating the spectrum of any of the above target colors. The processor 82 may also be referred to as a CPU (Central Processing Unit). The processor 82 may be an integrated circuit chip with signal processing capabilities. The processor 82 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. Additionally, the processor 82 may be implemented jointly by integrated circuit chips.
[0095] Please refer to Figure 7 , Figure 7 It is a schematic framework diagram of an embodiment of the computer-readable storage medium provided by the present invention. The computer-readable storage medium 90 stores program instructions 901 that can be run by a processor. The program instructions 901 are used to implement the steps of the embodiment of the method for generating the spectrum of any of the above target colors.
[0096] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the methods described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0097] The descriptions of the above embodiments tend to emphasize the differences between the embodiments. The similarities or similarities between them can be referred to each other. For the sake of brevity, they will not be repeated herein.
[0098] In several embodiments provided in the present application, it should be understood that the disclosed methods and apparatuses can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections between each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical or other forms.
[0099] In addition, in each embodiment of the present application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.
[0100] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to execute all or part of the steps of the methods in various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0101] The above are only the embodiments of the present invention, and do not limit the patent protection scope of the present invention. All equivalent structural or equivalent process transformations made by using the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, are equally included in the patent protection scope of the present invention.
Claims
1. A method for generating a spectrum of a target color, characterized in that, The method for generating the spectrum of the target color includes: Obtaining initial spectral data and target chromaticity information; the initial spectral data has corresponding chromaticity information; Based on the initial spectral data, the chromaticity information, and the target chromaticity information, obtaining a deviation value corresponding to the initial spectral data; In response to the deviation value corresponding to the initial spectral data exceeding a threshold, updating the initial spectral data based on the deviation value to obtain updated spectral data; In response to the deviation value corresponding to the updated spectral data not exceeding the threshold, taking the updated spectral data as the target spectral data corresponding to the target chromaticity information.
2. The method for generating the spectrum of the target color according to claim 1, wherein: The obtaining of the deviation value corresponding to the initial spectral data based on the initial spectral data, the chromaticity information, and the target chromaticity information includes: Obtaining a first deviation value according to the difference between the chromaticity information and the target chromaticity information; Performing second-order derivation and summation on all wavelengths of the initial spectral data to obtain the sum of the second-order derivatives of all wavelengths; Based on the first deviation value and the sum of the second-order derivatives of all wavelengths of the initial spectral data, obtaining the deviation value corresponding to the initial spectral data.
3. The method for generating the spectrum of the target color according to claim 2, wherein: The obtaining of the deviation value corresponding to the initial spectral data based on the first deviation value and the sum of the second-order derivatives of all wavelengths of the initial spectral data includes: Obtaining the deviation value corresponding to the initial spectral data based on the weighted sum between the first deviation value and the sum of the second-order derivatives of all wavelengths.
4. The method for generating a spectrum of a target color according to claim 2, wherein The chromaticity information includes color coordinates; the target chromaticity information includes target color coordinates; The obtaining of the first deviation value according to the difference between the chromaticity information and the target chromaticity information includes: Generating the first deviation value according to the difference between the color coordinates corresponding to the initial spectral data and the target color coordinates.
5. The method for generating the spectrum of the target color according to claim 1, wherein: The updating of the initial spectral data based on the deviation value includes: Using an optimization algorithm to update the initial spectral data based on the deviation value; wherein, the optimization algorithm includes at least one of a particle swarm algorithm, a genetic algorithm, a differential evolution algorithm, and a gradient descent algorithm.
6. The method for generating the spectrum of the target color according to claim 1, wherein The wavelengths of the target spectral data belong to the visible light band, and the wavelength range is 380nm - 780nm.
7. The method for generating the spectrum of the target color according to claim 1, wherein: The obtaining of the initial spectral data and the target chromaticity information; The initial spectral data having corresponding chromaticity information includes: Obtaining the initial spectral data and the target chromaticity information; Based on the principle of colorimetry, performing chromaticity conversion on the initial spectral data to obtain the chromaticity information corresponding to the initial spectral data, and the chromaticity information includes at least one of Lab value, Luv value, LCh value, Yxy value, CMYK value, RGB value, and Hex value.
8. A spectral generation device for a target color, characterized in that The spectral generation device includes: An acquisition module, configured to acquire initial spectral data and target chromaticity information; the initial spectral data has corresponding chromaticity information; A calculation module, configured to obtain a deviation value corresponding to the initial spectral data based on the initial spectral data, the chromaticity information, and the target chromaticity information; An analysis module, configured to update the initial spectral data based on the deviation value to obtain updated spectral data in response to the deviation value corresponding to the initial spectral data exceeding a threshold; A determination module, configured to use the updated spectral data as the target spectral data corresponding to the target chromaticity information in response to the deviation value corresponding to the updated spectral data not exceeding the threshold.
9. A terminal, characterized in that, The terminal includes a memory, a processor, and a computer program stored in the memory and running on the processor, and the processor is configured to execute program data to implement the steps in the method for generating a spectrum of a target color according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps in the method for generating a spectrum of a target color according to any one of claims 1 to 7 are implemented.