Spectral response image calibration method and device, computer device and storage medium
By using a preset sampling strategy and data grouping and fusion, the calibration process of spectral response images is simplified, the calibration efficiency and accuracy are improved, and the problem of high complexity in traditional methods is solved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- NINGBO INVIEW INTELLIGENT TECH CO LTD
- Filing Date
- 2022-08-01
- Publication Date
- 2026-05-22
AI Technical Summary
In traditional spectral response image calibration techniques, the extraction methods for characteristic spectral response data are complex, resulting in low calibration efficiency and difficulty in quickly obtaining data distribution information.
Spectral response data are collected using a preset sampling strategy, grouped and fused, and initial spectral response data that meet the intensity and quantity conditions are selected. Data fitting is then performed to determine the correspondence between spectral response image coordinates and spectral wavelengths.
It simplifies the calibration process of spectral response images, improves calibration efficiency and accuracy, and reduces the complexity of data processing.
Smart Images

Figure CN115345926B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of optical technology, and in particular to a method, apparatus, computer device, storage medium, and computer program product for calibrating spectral response images. Background Technology
[0002] With the development of optical technology, calibration technology for spectral response images has emerged. This technology can establish the correspondence between the coordinates of a spectral response image and the spectral wavelength. In practical applications, based on the spectral data to be acquired, the spectral wavelength corresponding to that spectral data can be determined. Then, the coordinate position corresponding to that spectral wavelength can be found in the spectral response image, and the spectral data in the spectral response image corresponding to that coordinate position can be obtained.
[0003] In traditional techniques, calibrating a spectral response image involves establishing the correspondence between the coordinates of the spectral response image and the spectral wavelengths. Traditional spectral response image calibration techniques first acquire the spectral response image, then extract characteristic spectral response data from it, and finally construct the correspondence between the coordinates of the spectral response image and the spectral wavelengths based on this characteristic spectral response data.
[0004] However, current calibration techniques for spectral response images extract characteristic spectral response data by filtering data with high spectral response intensities from the spectral response image, then fitting these data with similar coordinates to obtain a data distribution map. Next, a linear data distribution curve is found on this map. If the number of linear data distribution curves meets a preset requirement, the characteristic spectral response data extraction is complete; otherwise, the spectral response data in the spectral response image is filtered again. This feature extraction method is complex, and obtaining datasets with linear data distributions is difficult, reducing the efficiency of spectral response image calibration. Summary of the Invention
[0005] Therefore, it is necessary to provide a calibration method, apparatus, computer device, computer-readable storage medium, and computer program product for spectral response images that can improve the calibration efficiency of spectral response images, addressing the aforementioned technical problems.
[0006] Firstly, this application provides a calibration method for a spectral response image. The method includes:
[0007] According to a preset sampling strategy, data is collected from the spectral response image to obtain a spectral response dataset; the spectral response data in the spectral response dataset includes the coordinates of the spectral response image and the sampled spectral response intensity corresponding to the coordinates of the spectral response image;
[0008] Based on a preset coordinate interval length, the fused spectral response data are grouped to obtain a spectral response data group corresponding to each coordinate interval. Based on the spectral response data group, the initial spectral response data corresponding to each coordinate interval is determined. The fused spectral response data is determined based on the spectral response data.
[0009] If the initial spectral response intensity in the initial spectral response data meets the preset intensity condition, the initial spectral response data is used as the target spectral response data, and it is determined whether the number of the target spectral response data meets the preset number condition. If not, the process returns to the step of executing the preset sampling strategy until the number of the target spectral response data meets the preset number condition.
[0010] Based on the target spectral response data and the preset spectral data, the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum is determined.
[0011] In one embodiment, the step of acquiring data from the spectral response image according to a preset sampling strategy to obtain a spectral response dataset includes:
[0012] Obtain a first preset number of spectral response intensities to obtain the sampled spectral response intensity;
[0013] The spectral response data corresponding to each sampled spectral response intensity in the spectral response image are obtained to obtain a spectral response dataset; there are a first preset number of spectral response data corresponding to the same sampled spectral response intensity; the spectral response image coordinates corresponding to each spectral response data corresponding to the same sampled spectral response intensity are different.
[0014] In one embodiment, the method further includes:
[0015] For each of the spectral response image coordinates, the spectral response data corresponding to the spectral response image coordinates are fused to obtain fused spectral response data.
[0016] In one embodiment, determining the initial spectral response data corresponding to each coordinate interval based on the spectral response data set includes:
[0017] For each spectral response data group, data fitting is performed on each fused spectral response data in the spectral response data group to obtain a first correspondence between the spectral response image coordinates and the fused spectral response intensity.
[0018] Based on the first correspondence between each set of spectral response data, the maximum value of the fused spectral response intensity corresponding to each coordinate interval is determined, and the fused spectral response data corresponding to the maximum value is used as the initial spectral response data to obtain the initial spectral response data corresponding to each coordinate interval.
[0019] In one embodiment, determining the correspondence between the spectral response image coordinates and the wavelengths of the preset spectrum based on the target spectral response data and preset spectral data includes:
[0020] Acquire preset spectral data; the preset spectral data includes the wavelength of the preset spectrum and the preset spectral intensity corresponding to the wavelength of the preset spectrum;
[0021] If the preset spectral intensity corresponding to the preset spectral data is equal to the target spectral response intensity corresponding to the target spectral response data, the preset spectral data and the target spectral response data are paired to obtain a target data group;
[0022] Data fitting is performed on all the target data sets to obtain the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum.
[0023] In one embodiment, the method further includes:
[0024] If each spectral response data in the spectral response image has been sampled, but the number of target spectral response data does not yet meet the preset number condition, then a new spectral response image is obtained.
[0025] In one embodiment, if the initial spectral response intensity in the initial spectral response data meets a preset intensity condition, the initial spectral response data is used as the target spectral response data, and it is determined whether the number of the target spectral response data meets a preset number condition. If not, the process returns to the step of executing the preset sampling strategy until the number of the target spectral response data meets the preset number condition, including:
[0026] If the initial spectral response intensity in the initial spectral response data is greater than or equal to a preset intensity, the initial spectral response data is used as the target spectral response data, and it is determined whether the number of the target spectral response data reaches a second preset number. If not, the process returns to the step of executing the preset sampling strategy until the number of the target spectral response data reaches the second preset number.
[0027] Secondly, this application also provides a calibration apparatus for a spectral response image. The apparatus includes:
[0028] The first determining module is used to acquire data from the spectral response image according to a preset sampling strategy to obtain a spectral response dataset; the spectral response data in the spectral response dataset includes the coordinates of the spectral response image and the sampled spectral response intensity corresponding to the coordinates of the spectral response image.
[0029] The second determining module is used to group the fused spectral response data according to a preset coordinate interval length to obtain a spectral response data group corresponding to each coordinate interval, and to determine the initial spectral response data corresponding to each coordinate interval based on the spectral response data group; the fused spectral response data is determined based on the spectral response data.
[0030] The judgment module is used to determine whether the initial spectral response data meets the preset intensity condition, and whether the number of the target spectral response data meets the preset number condition. If not, it returns to the step of executing the preset sampling strategy until the number of the target spectral response data meets the preset number condition.
[0031] The third determining module is used to determine the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum based on the target spectral response data and the preset spectral data.
[0032] In one embodiment, the first determining module is specifically used for:
[0033] Obtain a first preset number of spectral response intensities to obtain the sampled spectral response intensity;
[0034] The spectral response data corresponding to each sampled spectral response intensity in the spectral response image are obtained to obtain a spectral response dataset; there are a first preset number of spectral response data corresponding to the same sampled spectral response intensity; the spectral response image coordinates corresponding to each spectral response data corresponding to the same sampled spectral response intensity are different.
[0035] In one embodiment, the device further includes:
[0036] The fusion module is used to perform fusion processing on the spectral response data corresponding to each spectral response image coordinate for each spectral response image coordinate, so as to obtain fused spectral response data.
[0037] In one embodiment, the second determining module is specifically used for:
[0038] For each spectral response data group, data fitting is performed on each fused spectral response data in the spectral response data group to obtain a first correspondence between the spectral response image coordinates and the fused spectral response intensity.
[0039] Based on the first correspondence between each set of spectral response data, the maximum value of the fused spectral response intensity corresponding to each coordinate interval is determined, and the fused spectral response data corresponding to the maximum value is used as the initial spectral response data to obtain the initial spectral response data corresponding to each coordinate interval.
[0040] In one embodiment, the third determining module is specifically used for:
[0041] Acquire preset spectral data; the preset spectral data includes the wavelength of the preset spectrum and the preset spectral intensity corresponding to the wavelength of the preset spectrum;
[0042] If the preset spectral intensity corresponding to the preset spectral data is equal to the target spectral response intensity corresponding to the target spectral response data, the preset spectral data and the target spectral response data are paired to obtain a target data group;
[0043] Data fitting is performed on all the target data sets to obtain the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum.
[0044] In one embodiment, the device further includes:
[0045] The acquisition module is used to acquire a new spectral response image if each spectral response data in the spectral response image has been sampled, but the number of target spectral response data does not yet meet the preset number condition.
[0046] In one embodiment, the determining module is specifically used for:
[0047] If the initial spectral response intensity in the initial spectral response data is greater than or equal to a preset intensity, the initial spectral response data is used as the target spectral response data, and it is determined whether the number of the target spectral response data reaches a second preset number. If not, the process returns to the step of executing the preset sampling strategy until the number of the target spectral response data reaches the second preset number.
[0048] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps described in the first aspect.
[0049] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps described in the first aspect.
[0050] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, performs the steps described in the first aspect.
[0051] The aforementioned calibration method, apparatus, computer equipment, storage medium, and computer program product for spectral response images acquire data from the spectral response image according to a preset sampling strategy to obtain a spectral response dataset. The spectral response data in the dataset includes the coordinates of the spectral response image and the sampled spectral response intensity corresponding to those coordinates. Based on a preset coordinate interval length, the fused spectral response data are grouped to obtain spectral response data groups corresponding to each coordinate interval. Initial spectral response data for each coordinate interval is determined based on these spectral response data groups. The fused spectral response data is determined based on the spectral response data. If the initial spectral response intensity in the initial spectral response data meets a preset intensity condition, the initial spectral response data is used as the target spectral response data. It is then determined whether the number of target spectral response data meets a preset number condition. If not, the process returns to the steps based on the preset sampling strategy until the number of target spectral response data meets the preset number condition. The correspondence between the spectral response image coordinates and the wavelengths of the preset spectrum is determined based on the target spectral response data and the preset spectral data. In this scheme, a spectral response dataset is obtained by acquiring a portion of the spectral response data, and the initial spectral response data corresponding to each coordinate interval is determined based on this dataset. Given that the initial spectral response data meets the preset intensity conditions, target spectral response data is obtained. Furthermore, provided that the number of target spectral response data meets the preset limit, the correspondence between the coordinates of the spectral response image and the wavelengths of the preset spectrum is determined based on the target spectral response data and the preset spectral data. This scheme uses the preset intensity conditions and the preset number of response data as selection criteria. This selection method is relatively simple and easy to meet, thus improving the calibration efficiency of the spectral response image. Attached Figure Description
[0052] Figure 1 This is a flowchart illustrating a calibration method for a spectral response image in one embodiment;
[0053] Figure 2 Here is a filtered spectral response image from one embodiment;
[0054] Figure 3This is a flowchart illustrating a method for determining initial spectral response data in one embodiment;
[0055] Figure 4 This is a structural block diagram of a calibration device for a spectral response image in one embodiment;
[0056] Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0057] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0058] In one embodiment, such as Figure 1 As shown, a calibration method for a spectral response image is provided. This embodiment illustrates the application of this method to a terminal. It is understood that this method can also be applied to a server, and to a system including both a terminal and a server, and implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0059] Step 102: According to the preset sampling strategy, data is acquired from the spectral response image to obtain the spectral response dataset.
[0060] The spectral response data in the spectral response dataset includes the coordinates of the spectral response image and the sampled spectral response intensity corresponding to the coordinates of the spectral response image.
[0061] In this embodiment, the terminal acquires an initial spectral response image and performs image filtering on the initial spectral response image to obtain a filtered spectral response image (i.e., a spectral response image). Each pixel in the spectral response image contains filtered spectral response data. Each filtered spectral response data includes spectral response image coordinates and the filtered spectral response intensity corresponding to the spectral response image coordinates. It is understood that multiple pixels correspond to the same filtered spectral response intensity, and the spectral response image coordinates corresponding to pixels with the same filtered spectral response intensity are not the same. In one embodiment, the number of acquired initial spectral response images is 1. The terminal randomly extracts a first preset number of pixels corresponding to spectral response intensities from the spectral response image to obtain target pixels. The terminal extracts data from the spectral response data corresponding to the target pixels to obtain a spectral response dataset. The spectral response dataset includes multiple spectral response data, each spectral response data including spectral response image coordinates and the sampled spectral response intensity corresponding to the spectral response image coordinates. In one embodiment, the first preset number can be 10. Specifically, the spectral response image acquired by the terminal can be as follows: Figure 2 The filtered spectral response image is shown. Figure 2 The data represented by the horizontal direction (x-direction) are the coordinates of the spectral response image. Figure 2 The data represented by the vertical direction (y-direction) is used as the filtered spectral response intensity. Pixels in the same vertical direction (i.e., the same y-direction) have the same filtered spectral response intensity.
[0062] Step 104: Based on the preset coordinate interval length, group the fused spectral response data to obtain the spectral response data group corresponding to each coordinate interval, and determine the initial spectral response data corresponding to each coordinate interval based on the spectral response data group.
[0063] The fused spectral response data is determined based on the spectral response data. Specifically, the fused spectral response data is determined based on the spectral response data corresponding to the same spectral response image coordinates. The fused spectral response data includes the spectral response image coordinates and the fused spectral response intensity corresponding to those coordinates.
[0064] In this embodiment, the terminal acquires the fused spectral response data and groups the fused spectral response data according to a preset coordinate interval length. The fused spectral response data within the same coordinate interval form a spectral response data group, thus obtaining the spectral response data groups corresponding to each coordinate interval. Optionally, the preset coordinate interval length can be 20 units or 30 units. Specifically, assuming there are n fused spectral response data points and the preset coordinate interval length is l units, the terminal groups the fused spectral response data to obtain... There are spectral response data sets, where each coordinate interval corresponds to one spectral response data set, and each spectral response data set contains l fused spectral response data points. For each coordinate interval, the terminal performs calculations based on the fused spectral response data points in the corresponding spectral response data set to obtain the maximum value corresponding to the fused spectral response intensity. The fused spectral response data corresponding to this maximum value is then used as the initial spectral response data for that coordinate interval. The initial spectral response data includes the spectral response image coordinates and the initial spectral response intensity corresponding to those coordinates. For example, assuming the preset coordinate interval length is 20 units, the terminal obtains... A set of spectral response data (equivalent to having) (each coordinate interval) corresponds to an initial spectral response data point, so the terminal obtains... Initial spectral response data.
[0065] Step 106: If the initial spectral response intensity in the initial spectral response data meets the preset intensity condition, the initial spectral response data is used as the target spectral response data, and it is determined whether the number of target spectral response data meets the preset number condition. If not, the process returns to the steps according to the preset sampling strategy until the number of target spectral response data meets the preset number condition.
[0066] In this embodiment, for each initial spectral response data, if the initial spectral response intensity in the initial spectral response data meets a preset intensity condition, the terminal uses the initial spectral response data as the target spectral response data. The target spectral response data includes spectral response image coordinates and the target spectral response intensity corresponding to those coordinates. The terminal counts the number of target spectral response data that meet the preset number condition and determines whether the number of target spectral response data meets the preset number condition. If not, the terminal returns to step 102 until the number of target spectral response data meets the preset number condition; if so, the terminal continues to step 108.
[0067] Step 108: Determine the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum based on the target spectral response data and the preset spectral data.
[0068] The preset spectral data includes the wavelength of the preset spectrum and the preset spectral intensity corresponding to the wavelength of the preset spectrum.
[0069] In this embodiment, the terminal acquires preset spectral data and target spectral response data, and performs data fitting on the preset spectral data and target spectral response data to obtain the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum. In one embodiment, the preset spectrum can be a standard light source spectrum. In one embodiment, the data fitting method is least squares fitting. Specifically, the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum is shown in the following formula (1).
[0070] S(x) = a0 + a1·x + a2·x 2 (1)
[0071] Where S(x) is the wavelength of the preset spectrum, a0 is a constant, a1 is the coefficient of the first term, a2 is the coefficient of the second term, and x is the coordinate of the spectral response image.
[0072] Assuming x′ represents the wavelength of the preset spectrum, the terminal can determine the wavelength based on the correspondence between the spectral response image coordinates and the preset spectrum wavelength, as well as the spectral response image coordinates x′. j x is calculated j The wavelength x′ of the preset spectrum corresponding to the filtered spectral response at the location jIt can be understood that if the above calculation process is performed on each coordinate of the spectral response image, the terminal can obtain the wavelength of the preset spectrum corresponding to each pixel on the spectral response image. Figure 2 For example, Figure 2 The data represented by the horizontal direction (x-direction) are the coordinates of the spectral response image. Figure 2 The data represented by the vertical direction (y-direction) is used as the filtered spectral response intensity. After calculation by the terminal, Figure 2 The spectral response image coordinates represented by the horizontal direction (x-direction) can be mapped to the wavelength of the preset spectrum (i.e., x′). Figure 2 The filtered spectral response data corresponding to each pixel can be represented as (x′, y), where y represents the intensity of the filtered spectral response.
[0073] In the above-described calibration method for spectral response images, a spectral response dataset is obtained by acquiring partially filtered spectral response data. Based on this dataset, initial spectral response data corresponding to each coordinate interval is determined. If the initial spectral response data meets a preset intensity condition, target spectral response data is obtained. If the number of target spectral response data meets a preset requirement, the correspondence between the coordinates of the spectral response image and the wavelengths of the preset spectrum is determined based on the target spectral response data and the preset spectral data. This scheme uses the criteria of whether the response intensity meets the preset intensity condition and whether the number meets the preset requirement for spectral response data. This selection method is relatively simple and easy to meet, thus improving the calibration efficiency of spectral response images.
[0074] In one embodiment, step 102 includes:
[0075] Obtain a first preset number of spectral response intensities to obtain sampled spectral response intensities; obtain spectral response data corresponding to each sampled spectral response intensity in the spectral response image to obtain a spectral response dataset.
[0076] There are a first preset number of spectral response data corresponding to the same sampled spectral response intensity, and the spectral response image coordinates corresponding to each spectral response data corresponding to the same sampled spectral response intensity are different.
[0077] In this embodiment, the terminal acquires a first preset number of spectral response intensities and uses these intensities as the sampled spectral response intensities. Optionally, the first preset number can be 3, 8, 10, etc. In one embodiment, the terminal can randomly select a first preset number of spectral response intensities from the filtered spectral response image to obtain the sampled spectral response intensities. That is, referring to... Figure 2 The filtered spectral response image shown is an example of a spectral response image. Figure 2The data represented by the vertical direction (y-direction) is used as the filtered spectral response intensity. Figure 2 Pixels from a first preset number of rows are randomly selected, and the filtered spectral response intensity corresponding to the selected pixels is used as the sampled spectral response intensity. In another embodiment, the sampled spectral response intensity can also be preset. The terminal directly acquires the first preset number of sampled spectral response intensities. That is, referring to... Figure 2 The filtered spectral response image shown is used by the terminal to obtain the pixel corresponding to the sampled spectral response intensity on the filtered spectral response image based on the sampled spectral response intensity.
[0078] For each sampled spectral response intensity, the terminal acquires the pixel corresponding to the sampled spectral response intensity on the filtered spectral response image (i.e., the spectral response image). Each pixel contains spectral response data. Each spectral response data includes the spectral response image coordinates and the sampled spectral response intensity corresponding to those coordinates. The terminal extracts the spectral response data from each pixel to obtain a spectral response dataset. The elements in the spectral response dataset are spectral response data, which includes the spectral response image coordinates and the sampled spectral response intensity corresponding to those coordinates.
[0079] by Figure 2The filtered spectral response image shown is illustrated as an example. If a two-dimensional Cartesian coordinate system (i.e., a Cartesian coordinate system) is used to represent the filtered spectral response data contained in a pixel, it can be represented as (x, y), where x represents the coordinates of the spectral response image and y represents the intensity of the filtered spectral response. The terminal establishes a coordinate system (a two-dimensional Cartesian coordinate system) for the spectral response image based on the pixel arrangement, obtaining the established spectral response image. If the spectral response image contains (n×m) pixels, where n represents the number of pixels with the same filtered spectral response intensity (y), and m represents the number of pixels with the same spectral response image coordinates (x), n and m can be equal or unequal; this application does not impose any limitation. Specifically, the terminal establishes a two-dimensional Cartesian coordinate system with an horizontal axis of n units and a vertical axis of m units on the spectral response image, obtaining the established spectral response image. Assuming the first preset number is k, the terminal extracts the spectral response data (i.e., (x, y)) corresponding to each of the k sampled spectral response intensities (i.e., y) from the constructed spectral response image, thus obtaining a spectral response dataset. That is, the spectral response dataset contains (n×k) elements, including k sampled spectral response intensities, each corresponding to n spectral response image coordinates. For example, suppose the spectral response image has (2×3) pixels, the first preset number is 1, and the sampled spectral response intensities are y. i The terminal selects y i The corresponding spectral response data (x1, y) i (x2, y) i ), thus obtaining the spectral response dataset {(x1, y i ), (x2, y i )}.
[0080] In this embodiment, the terminal acquires spectral response data corresponding to a first preset number of sampled spectral response intensities on the spectral response image, thus obtaining a spectral response dataset. In this way, no band filtering is performed on the spectral response data; therefore, the acquired spectral response data includes spectral response data corresponding to the preset full spectral band, improving the accuracy of subsequent calibration.
[0081] In one embodiment, the calibration method for the above-mentioned spectral response image further includes:
[0082] For each spectral response image coordinate, the spectral response data corresponding to the spectral response image coordinates are fused to obtain the fused spectral response data.
[0083] In this embodiment, for each spectral response image coordinate, the terminal extracts spectral response data corresponding to the same spectral response image coordinate from the spectral response dataset, and performs a weighted summation of the sampled spectral response intensities corresponding to the extracted spectral response data to obtain the fused spectral response intensity. The fused spectral response data includes the spectral response image coordinate and the fused spectral response intensity corresponding to that coordinate. In one embodiment, the weights of the sampled spectral response intensities corresponding to the same spectral response image coordinate can be equal. Specifically, assume that the spectral response dataset has (n×k) elements. There are k sampled spectral response intensities, and each sampled spectral response intensity corresponds to n spectral response image coordinates. For spectral response coordinate x... a The terminal can obtain the spectral response coordinates x. a The corresponding k sampled spectral response intensities The weighted summation of these k sampled spectral response intensities yields the fused spectral response intensity y′. a .in, The x-coordinate represents the k-th spectral response. a The corresponding sampling spectral response intensity y a So, for the spectral response coordinate x... a After all the corresponding spectral response data are fused at the terminal, the terminal obtains the fused spectral response data as (x a y′ a It can be understood that after the above fusion process, the terminal obtains n fused spectral response data, which are (x1, y′1), (x2, y′2), ..., (x...). n y′ n ).
[0084] In this embodiment, the terminal fuses spectral response data with the same spectral response image coordinates within the spectral response dataset to obtain multiple fused spectral response data. In other words, the terminal performs fusion at the level of spectral response intensity, while the spectral response coordinates retain the full band of the spectral response corresponding to the preset spectrum, which can improve calibration accuracy. Furthermore, subsequent calibration based on the fused spectral response data can more comprehensively consider the spectral response intensity corresponding to the same spectral response image coordinates, reducing errors caused by a single spectral response intensity and further improving calibration accuracy.
[0085] In one embodiment, such as Figure 3 As shown, based on the spectral response data set, the initial spectral response data corresponding to each coordinate interval are determined as follows:
[0086] Step 302: For each spectral response data group, perform data fitting on each fused spectral response data in the spectral response data group to obtain the first correspondence between the coordinates of the spectral response image and the intensity of the fused spectral response.
[0087] In this embodiment, for each spectral response data group, the terminal performs data fitting on each fused spectral response data in the spectral response data group to obtain a first correspondence between the spectral response image coordinates and the fused spectral response intensity. The fused spectral response data includes the spectral response image coordinates and the fused spectral response intensity corresponding to those coordinates. In one embodiment, each first correspondence can be represented by a functional relationship, where the independent variable is the spectral response image coordinates, the dependent variable is the fused spectral response intensity, and the range of the independent variable is the coordinate interval where the spectral response image coordinates in the spectral response data group are located. Optionally, the functional relationship can be a quadratic function.
[0088] Step 304: Based on the first correspondence between each spectral response data group, determine the maximum value of the fused spectral response intensity corresponding to each coordinate interval, and use the fused spectral response data corresponding to the maximum value as the initial spectral response data to obtain the initial spectral response data corresponding to each coordinate interval.
[0089] In this embodiment, for each spectral response data group, the terminal calculates the maximum value of the fused spectral response intensity based on the first correspondence and the coordinate interval where the spectral response image coordinates corresponding to that spectral response data group are located. The maximum value of the fused spectral response intensity and the corresponding spectral response image coordinates are then used as the initial spectral response data. After calculating the maximum value of the fused spectral response intensity for each spectral response data group, the terminal obtains the initial spectral response data corresponding to each coordinate interval. If there are n fused spectral response data (i.e., (x, y′)) and the preset coordinate interval length is l units, then the terminal groups the fused spectral response data to obtain... There are 3 sets of spectral response data, where each coordinate interval corresponds to one set of spectral response data. Assume the maximum value of the fused spectral response intensity is y. max Then the initial spectral response data is (x, y) max The terminal can obtain Initial spectral response data, The initial spectral response data are respectively
[0090] In this embodiment, the terminal performs data fitting based on the spectral response data sets to obtain a first correspondence between the coordinates of the spectral response image and the fused spectral response intensity. Based on each first correspondence, the maximum value of the fused spectral response intensity corresponding to each spectral response data set is calculated, thus obtaining each initial spectral response data. Using data fitting to process spectral response data allows for the rapid acquisition of data distribution patterns from large datasets. Based on these distribution patterns, the maximum value of the fused spectral response intensity can be quickly found, thereby improving calibration efficiency.
[0091] In one embodiment, step 108 includes:
[0092] Acquire preset spectral data; if the preset spectral intensity corresponding to the preset spectral data is equal to the target spectral response intensity corresponding to the target spectral response data, pair the preset spectral data and the target spectral response data to obtain target data sets; perform data fitting on all target data sets to obtain the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum.
[0093] The preset spectral data includes the wavelength of the preset spectrum and the preset spectral intensity corresponding to the wavelength of the preset spectrum.
[0094] In this embodiment, the terminal acquires preset spectral data and identifies preset spectral intensities in each preset spectral data set. If the preset spectral intensity equals the target spectral response intensity, the terminal pairs the preset spectral data corresponding to the preset spectral intensity with the target spectral response data corresponding to the target spectral response intensity to obtain a target data set. Specifically, if the preset spectral intensity equals the target spectral response intensity, the terminal pairs the wavelength of the preset spectrum corresponding to the preset spectral intensity with the spectral response image coordinates corresponding to the target spectral response intensity to obtain a target data set composed of the wavelength of the preset spectrum and the spectral response image coordinates. For example, suppose the preset spectral data is (λ, z), where λ represents the wavelength of the preset spectrum and z represents the preset spectral intensity corresponding to the wavelength of the preset spectrum; suppose the target spectral response data is (x, z′), where x represents the spectral response image coordinates and z′ represents the target spectral response intensity corresponding to the spectral response image coordinates. The terminal acquires the preset spectral intensity z in each preset spectral data (λ, z), identifies the target spectral response data (x, z′) whose target spectral response intensity is equal to the preset spectral intensity (i.e., z′ = z), and constructs a target data group (x, λ) based on the wavelength λ of the preset spectrum in the preset spectral data and the spectral response image coordinates x in the target spectral response data. It can be understood that since the number of target spectral response data is a second preset number, the target data group (x, λ) also has a second preset number of groups. The terminal performs data fitting on all target data groups and calculates the correspondence between the spectral response image coordinates and the wavelength of the preset spectrum. In one embodiment, the preset spectrum can be a standard light source spectrum. In one embodiment, the data fitting method is least squares fitting. Specifically, the correspondence between the spectral response image coordinates and the wavelength of the preset spectrum is shown in the following formula (1).
[0095] S(x) = a0 + a1·x + a2·x 2 (1)
[0096] Where S(x) is the wavelength of the preset spectrum, a0 is a constant, a1 is the coefficient of the first term, a2 is the coefficient of the second term, and x is the coordinate of the spectral response image.
[0097] In this embodiment, the terminal determines the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum based on the target spectral response data and the preset spectral data, thereby achieving the calibration of the spectral response image.
[0098] In one embodiment, the calibration method for the above-mentioned spectral response image further includes:
[0099] If every spectral response data in the spectral response image has been sampled, but the number of target spectral response data does not yet meet the preset number condition, then a new spectral response image is obtained.
[0100] In this embodiment of the application, during step 102, the spectral response data collected by the terminal each time are different, and the spectral response data collected multiple times are also different. That is, assuming that the terminal collects spectral response data (x... i y i If (x) appears again in the same spectral response data acquisition, then (x) will not appear again. i y i (x) will not appear in other acquired spectral response data. i y i If the terminal recognizes that each spectral response data point in the spectral response image has been sampled, but the number of target spectral response data points does not yet meet the preset number condition, the terminal acquires a new spectral response image. This new spectral response image is a re-acquired spectral response image after the external environment surrounding the previous spectral response image has changed. The external environment includes the device for acquiring the spectral response image (i.e., the calibration device for the spectral response image) and the space where the calibration device for the spectral response image is located (this space is affected by temperature, humidity, etc.). Optionally, the change in the external environment can be a replacement of a component in the calibration device for the spectral response image, or a change in the environment of the space where the calibration device for the spectral response image is located (e.g., a change in temperature or humidity).
[0101] In this embodiment, when the terminal performs calibration based on a spectral response image, if every spectral response data point in the spectral response image has been sampled, but the number of target spectral response data points does not yet meet a preset number condition, a new spectral response image is acquired. Therefore, it can be ensured that the target spectral response data points used to determine the correspondence between the coordinates of the spectral response image and the wavelengths of the preset spectrum all meet the preset number condition. Since the number of target spectral response data points must be the same as the number of spectral response signals corresponding to the preset spectrum during calibration, the possibility of calibration is guaranteed when the target spectral response data points meet the preset number condition.
[0102] In one embodiment, step 106 includes:
[0103] If the initial spectral response intensity in the initial spectral response data is greater than or equal to the preset intensity, the initial spectral response data is used as the target spectral response data, and it is determined whether the number of target spectral response data has reached the second preset number. If not, the process returns to the steps according to the preset sampling strategy until the number of target spectral response data reaches the second preset number.
[0104] In this embodiment, for each initial spectral response data, if the initial spectral response intensity in the initial spectral response data is greater than or equal to a preset intensity, the terminal uses that initial spectral response data as the target spectral response data. The target spectral response data includes spectral response image coordinates and the target spectral response intensity corresponding to those coordinates. The terminal counts the number of target spectral response data and determines if the number reaches a second preset number. If not, the terminal returns to step 102 until the number of target spectral response data reaches the second preset number; if so, the terminal continues to step 108. The second preset number is the number of spectral response signals corresponding to a preset spectrum.
[0105] In this embodiment, the terminal filters initial spectral response data whose initial spectral response intensity is greater than or equal to a preset intensity to obtain target spectral response data, and counts the number of target spectral response data until the number of target spectral response data equals a preset number. Since the target spectral response intensity of all target spectral response data is greater than or equal to the preset intensity, erroneous response data can be filtered out, improving the accuracy of calibration. Furthermore, since the number of target spectral response data must be the same as the number of spectral response signals corresponding to the preset spectrum during calibration, the possibility of calibration is guaranteed when the target spectral response data meets the preset number condition.
[0106] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0107] Based on the same inventive concept, this application also provides a spectral response image calibration apparatus for implementing the above-described spectral response image calibration method. The solution provided by this apparatus is similar to the implementation described in the above-described method; therefore, the specific limitations in one or more spectral response image calibration apparatus embodiments provided below can be found in the limitations of the spectral response image calibration method described above, and will not be repeated here.
[0108] In one embodiment, such as Figure 4As shown, a calibration device for a spectral response image is provided, comprising:
[0109] The first determining module 402 is used to acquire data from the spectral response image according to a preset sampling strategy to obtain a spectral response dataset; the spectral response data in the spectral response dataset includes the coordinates of the spectral response image and the sampled spectral response intensity corresponding to the coordinates of the spectral response image.
[0110] The second determining module 404 is used to group the fused spectral response data according to a preset coordinate interval length to obtain a spectral response data group corresponding to each coordinate interval, and to determine the initial spectral response data corresponding to each coordinate interval based on the spectral response data group; the fused spectral response data is determined based on the spectral response data.
[0111] The judgment module 406 is used to, when the initial spectral response intensity in the initial spectral response data meets the preset intensity condition, take the initial spectral response data as the target spectral response data, and determine whether the number of the target spectral response data meets the preset number condition. If not, it returns to the step of executing the preset sampling strategy until the number of the target spectral response data meets the preset number condition.
[0112] The third determining module 408 is used to determine the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum based on the target spectral response data and the preset spectral data.
[0113] In one embodiment, the first determining module 402 is specifically used for:
[0114] Obtain a first preset number of spectral response intensities to obtain the sampled spectral response intensity;
[0115] The spectral response data corresponding to each sampled spectral response intensity in the spectral response image are obtained to obtain a spectral response dataset; there are a first preset number of spectral response data corresponding to the same sampled spectral response intensity; the spectral response image coordinates corresponding to each spectral response data corresponding to the same sampled spectral response intensity are different.
[0116] In one embodiment, the apparatus further includes:
[0117] The fusion module is used to perform fusion processing on the spectral response data corresponding to each spectral response image coordinate for each spectral response image coordinate, so as to obtain fused spectral response data.
[0118] In one embodiment, the second determining module 404 is specifically used for:
[0119] For each spectral response data group, data fitting is performed on each fused spectral response data in the spectral response data group to obtain a first correspondence between the spectral response image coordinates and the fused spectral response intensity.
[0120] Based on the first correspondence between each set of spectral response data, the maximum value of the fused spectral response intensity corresponding to each coordinate interval is determined, and the fused spectral response data corresponding to the maximum value is used as the initial spectral response data to obtain the initial spectral response data corresponding to each coordinate interval.
[0121] In one embodiment, the third determining module 408 is specifically used for:
[0122] Acquire preset spectral data; the preset spectral data includes the wavelength of the preset spectrum and the preset spectral intensity corresponding to the wavelength of the preset spectrum;
[0123] If the preset spectral intensity corresponding to the preset spectral data is equal to the target spectral response intensity corresponding to the target spectral response data, the preset spectral data and the target spectral response data are paired to obtain a target data group;
[0124] Data fitting is performed on all the target data sets to obtain the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum.
[0125] In one embodiment, the apparatus further includes:
[0126] The acquisition module is used to acquire a new spectral response image if each spectral response data in the spectral response image has been sampled, but the number of target spectral response data does not yet meet the preset number condition.
[0127] In one embodiment, the determining module 406 is specifically used for:
[0128] If the initial spectral response intensity in the initial spectral response data is greater than or equal to a preset intensity, the initial spectral response data is used as the target spectral response data, and it is determined whether the number of the target spectral response data reaches a second preset number. If not, the process returns to the step of executing the preset sampling strategy until the number of the target spectral response data reaches the second preset number.
[0129] Each module in the aforementioned calibration device for spectral response images can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0130] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores spectral response data. The network interface communicates with external terminals via a network connection. When executed by the processor, the computer program implements a calibration method for a spectral response image.
[0131] In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, communication interface, display screen, and input devices connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, NFC (Near Field Communication), or other technologies. When executed by the processor, the computer program implements a calibration method for a spectral response image. The display screen can be an LCD screen or an e-ink display. The input devices can be a touch layer covering the display screen, buttons, a trackball, or a touchpad mounted on the computer device casing, or an external keyboard, touchpad, or mouse.
[0132] Those skilled in the art will understand that Figure 5 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0133] In one embodiment, a computer device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0134] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0135] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[0136] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0137] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0138] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0139] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A calibration method for a spectral response image, characterized in that, The method includes: According to a preset sampling strategy, data is collected from the spectral response image to obtain a spectral response dataset; the spectral response data in the spectral response dataset includes the coordinates of the spectral response image and the sampled spectral response intensity corresponding to the coordinates of the spectral response image; For each spectral response image coordinate, extract the spectral response data corresponding to the same spectral response image coordinate from the spectral response dataset, and perform a weighted summation of the sampled spectral response intensities corresponding to the extracted spectral response data to obtain the fused spectral response intensity. Based on a preset coordinate interval length, the fused spectral response data are grouped to obtain spectral response data groups corresponding to each coordinate interval. For each spectral response data group, data fitting is performed on each fused spectral response data in the spectral response data group to obtain a first correspondence between the spectral response image coordinates and the fused spectral response intensity. Based on the first correspondence corresponding to each spectral response data group, the maximum value of the fused spectral response intensity corresponding to each coordinate interval is determined, and the fused spectral response data corresponding to the maximum value is used as the initial spectral response data to obtain the initial spectral response data corresponding to each coordinate interval. If the initial spectral response intensity in the initial spectral response data meets the preset intensity condition, the initial spectral response data is used as the target spectral response data, and it is determined whether the number of the target spectral response data meets the preset number condition. If not, the process returns to the step of executing the preset sampling strategy until the number of the target spectral response data meets the preset number condition. Based on the target spectral response data and the preset spectral data, the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum is determined.
2. The method according to claim 1, characterized in that, The step of acquiring data from the spectral response image according to a preset sampling strategy to obtain a spectral response dataset includes: Obtain a first preset number of spectral response intensities to obtain the sampled spectral response intensity; The spectral response data corresponding to each sampled spectral response intensity in the spectral response image are obtained to obtain a spectral response dataset; there are a first preset number of spectral response data corresponding to the same sampled spectral response intensity; the coordinates of the spectral response image corresponding to each spectral response data corresponding to the same sampled spectral response intensity are different.
3. The method according to any one of claims 1 to 2, characterized in that, The step of determining the correspondence between the coordinates of the spectral response image and the wavelengths of the preset spectrum based on the target spectral response data and preset spectral data includes: Acquire preset spectral data; the preset spectral data includes the wavelength of the preset spectrum and the preset spectral intensity corresponding to the wavelength of the preset spectrum; If the preset spectral intensity corresponding to the preset spectral data is equal to the target spectral response intensity corresponding to the target spectral response data, the preset spectral data and the target spectral response data are paired to obtain a target data group; Data fitting is performed on all the target data sets to obtain the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum.
4. The method according to any one of claims 1 to 2, characterized in that, The method further includes: If each spectral response data in the spectral response image has been sampled, but the number of target spectral response data does not yet meet the preset number condition, then a new spectral response image is obtained.
5. The method according to claim 1, characterized in that, If the initial spectral response intensity in the initial spectral response data meets a preset intensity condition, the initial spectral response data is used as the target spectral response data, and it is determined whether the number of the target spectral response data meets a preset number condition. If not, the process returns to the step of executing the preset sampling strategy until the number of the target spectral response data meets the preset number condition, including: If the initial spectral response intensity in the initial spectral response data is greater than or equal to a preset intensity, the initial spectral response data is used as the target spectral response data, and it is determined whether the number of the target spectral response data reaches a second preset number. If not, the process returns to the step of executing the preset sampling strategy until the number of the target spectral response data reaches the second preset number.
6. A calibration device for a spectral response image, characterized in that, The device includes: The first determining module is used to acquire data from the spectral response image according to a preset sampling strategy to obtain a spectral response dataset; the spectral response data in the spectral response dataset includes the coordinates of the spectral response image and the sampled spectral response intensity corresponding to the coordinates of the spectral response image. The fusion module is used to extract the spectral response data corresponding to the same spectral response image coordinates from the spectral response dataset for each spectral response image coordinate, and to perform a weighted summation of the sampled spectral response intensities corresponding to the extracted spectral response data to obtain the fused spectral response intensity. The second determining module is used to group the fused spectral response data according to a preset coordinate interval length to obtain spectral response data groups corresponding to each coordinate interval, and for each spectral response data group, perform data fitting on each fused spectral response data in the spectral response data group to obtain a first correspondence between the spectral response image coordinates and the fused spectral response intensity; based on the first correspondence corresponding to each spectral response data group, determine the maximum value of the fused spectral response intensity corresponding to each coordinate interval, and use the fused spectral response data corresponding to the maximum value as the initial spectral response data to obtain the initial spectral response data corresponding to each coordinate interval. The judgment module is used to determine whether the number of the initial spectral response data meets the preset intensity condition, and to determine whether the number of the target spectral response data meets the preset number condition. If not, it returns to the step of executing the preset sampling strategy until the number of the target spectral response data meets the preset number condition. The third determining module is used to determine the correspondence between the coordinates of the spectral response image and the wavelength of the preset spectrum based on the target spectral response data and the preset spectral data.
7. The apparatus according to claim 6, characterized in that, The first determining module is specifically used for: Obtain a first preset number of spectral response intensities to obtain the sampled spectral response intensity; The spectral response data corresponding to each sampled spectral response intensity in the spectral response image are obtained to obtain a spectral response dataset; there are a first preset number of spectral response data corresponding to the same sampled spectral response intensity; the coordinates of the spectral response image corresponding to each spectral response data corresponding to the same sampled spectral response intensity are different.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 5.