CN113095368B - A spectral color representative sample selection method and system - Google Patents
A spectral color representative sample selection method and system Download PDFInfo
- Publication number
- CN113095368B CN113095368B CN202110281047.XA CN202110281047A CN113095368B CN 113095368 B CN113095368 B CN 113095368B CN 202110281047 A CN202110281047 A CN 202110281047A CN 113095368 B CN113095368 B CN 113095368B
- Authority
- CN
- China
- Prior art keywords
- sample
- color
- spectral
- representative
- sample set
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/21—Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
- G06F18/214—Generating training patterns; Bootstrap methods, e.g. bagging or boosting
-
- G—PHYSICS
- G01—MEASURING; TESTING
- G01N—INVESTIGATING OR ANALYSING MATERIALS BY DETERMINING THEIR CHEMICAL OR PHYSICAL PROPERTIES
- G01N21/00—Investigating or analysing materials by the use of optical means, i.e. using sub-millimetre waves, infrared, visible or ultraviolet light
- G01N21/17—Systems in which incident light is modified in accordance with the properties of the material investigated
- G01N21/25—Colour; Spectral properties, i.e. comparison of effect of material on the light at two or more different wavelengths or wavelength bands
- G01N21/31—Investigating relative effect of material at wavelengths characteristic of specific elements or molecules, e.g. atomic absorption spectrometry
Landscapes
- Physics & Mathematics (AREA)
- Engineering & Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Spectroscopy & Molecular Physics (AREA)
- Theoretical Computer Science (AREA)
- General Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- Health & Medical Sciences (AREA)
- Evolutionary Biology (AREA)
- Computer Vision & Pattern Recognition (AREA)
- Bioinformatics & Computational Biology (AREA)
- Bioinformatics & Cheminformatics (AREA)
- Artificial Intelligence (AREA)
- Evolutionary Computation (AREA)
- Chemical & Material Sciences (AREA)
- Analytical Chemistry (AREA)
- Biochemistry (AREA)
- General Health & Medical Sciences (AREA)
- Immunology (AREA)
- Pathology (AREA)
- Spectrometry And Color Measurement (AREA)
- Color Image Communication Systems (AREA)
Abstract
Description
技术领域technical field
本发明属于彩色成像和信息处理技术领域,具体涉及一种光谱颜色代表性样本选择方法和系统。The invention belongs to the technical field of color imaging and information processing, and in particular relates to a method and system for selecting representative samples of spectral colors.
背景技术Background technique
随着彩色成像技术的发展进步,数码相机因具有快速成像、高空间分辨率、以及便携灵活等多方面优势,越来越广泛地应用于各领域的科学分析,例如在颜色复制、文物保护、医疗诊断、计算机视觉、遥感探测、以及其它相关领域。利用数码相机拍摄获取物体表面的数字图像,然后基于光谱重建理论和颜色特性化校正理论,重建物体表面的高精度多光谱图像和色度图像,可开展高保真颜色复制、颜料原位无损分析、辅助医疗诊断、物体识别、农业病虫害检测、目标分类等科学应用,为上述各领域的应用提供了新的技术和方法支撑。With the development and progress of color imaging technology, digital cameras are more and more widely used in scientific analysis in various fields due to their advantages of fast imaging, high spatial resolution, portability and flexibility, such as color reproduction, cultural relics protection, Medical diagnosis, computer vision, remote sensing detection, and other related fields. Use digital cameras to capture digital images of the surface of the object, and then reconstruct high-precision multispectral images and chromaticity images of the surface of the object based on spectral reconstruction theory and color characterization theory. Scientific applications such as auxiliary medical diagnosis, object recognition, agricultural pest detection, and target classification provide new technical and method support for the applications in the above fields.
在数码相机的上述科学应用中,无论是开展高精度的光谱重建还是颜色校正,都需要首先采用一组代表性的训练样本,对数码相机进行光谱和颜色特性化建模,然后利用构建的光谱和颜色特性化模型计算物体表面的光谱和颜色图像。现阶段,数码相机的光谱和颜色特性化建模多采用标准色卡,而研究表明训练样本与测试对象之间的光谱和颜色相似性,直接影响光谱和颜色计算的准确性。对于不同类型的物体而言,采用标准色卡作为训练样本,无法保证其对目标物体的光谱和颜色代表性,因而无法获得最优的计算精度。In the above-mentioned scientific applications of digital cameras, whether it is to carry out high-precision spectral reconstruction or color correction, it is necessary to first use a set of representative training samples to model the spectrum and color characteristics of the digital camera, and then use the constructed spectrum. and color characterization models to compute spectral and color images of object surfaces. At this stage, the spectral and color characterization modeling of digital cameras mostly uses standard color cards, and studies have shown that the spectral and color similarity between training samples and test objects directly affects the accuracy of spectral and color calculations. For different types of objects, using a standard color card as a training sample cannot guarantee the spectral and color representation of the target object, so the optimal calculation accuracy cannot be obtained.
目前,在文化遗产保护、计算机视觉、色彩科学、纺织生产、以及其它相关应用领域都积累了大量的样本集或者开放数据库,为数码相机在这些领域的具体应用提供了充分的训练样本支撑。然而,这些样本集或数据都包含了成千上百的样本,在实际应用中,若是直接采用这些样本集或者数据库作为训练样本,将会给实际应用带来巨大的工作量,严重降低光谱和颜色特性化建模的效率。研究表明,在面向数码相机光谱和颜色特性化建模时,现有这些样本集或者数据库本身存在大量信息冗余,没有必要采用所有的样本作为训练样本。因此,针对数码相机的光谱和颜色特性化建模应用,如何从样本集或数据库中选择能够同时适用于数码相机光谱和颜色特性化建模的代表性样本,构建便携式应用色卡,在保证应用效果和鲁棒性的同时有效提升光谱和颜色特性化建模效率,是目前本领域面临的一项关键难题。At present, a large number of sample sets or open databases have been accumulated in cultural heritage protection, computer vision, color science, textile production, and other related application fields, providing sufficient training sample support for the specific application of digital cameras in these fields. However, these sample sets or data all contain hundreds of samples. In practical applications, if these sample sets or databases are directly used as training samples, it will bring a huge workload to the practical application and seriously reduce the spectral and spectral density. Efficiency of color characterization modeling. Studies have shown that there is a lot of information redundancy in the existing sample sets or the database itself when modeling the spectrum and color characteristics of digital cameras, and it is not necessary to use all the samples as training samples. Therefore, for the spectral and color characterization modeling application of digital cameras, how to select representative samples from the sample set or database that can be applied to the spectral and color characterization modeling of digital cameras at the same time, build a portable application color card, and ensure the application Effectively improving the efficiency of spectral and color characterization modeling at the same time of effect and robustness is a key problem currently faced in the field.
发明内容SUMMARY OF THE INVENTION
本发明的目的是为了解决背景技术中所述问题,提出一种光谱颜色代表性样本选择方法。The purpose of the present invention is to provide a method for selecting a representative sample of spectral color in order to solve the problem described in the background art.
针对采用现有样本集或数据库作为训练样本所存在的数据冗余问题,本发明提出一种光谱颜色代表性样本选择方法,方法能从成千上百的总样本集中选择少量代表性样本,构建便携式应用色卡,能够同时适用于数码相机的光谱和颜色特性化建模,并且在实际应用中能够保证便携色卡对总样本集的等效性和鲁棒性,有效提升光谱重建或颜色校正的工作效率。本发明的技术方案为一种光谱颜色代表性样本选择方法,具体包括以下步骤:Aiming at the data redundancy problem of using existing sample sets or databases as training samples, the present invention proposes a spectral color representative sample selection method. Portable application color card, which can be applied to the spectral and color characterization modeling of digital cameras at the same time, and can ensure the equivalence and robustness of the portable color card to the total sample set in practical applications, effectively improving spectral reconstruction or color correction work efficiency. The technical solution of the present invention is a method for selecting a representative sample of spectral color, which specifically includes the following steps:
步骤1,针对给定的总样本集,利用分光光度计测量获得总样本集光谱数据;
步骤2,选定颜色匹配函数,计算得到总样本集颜色数据;Step 2, select a color matching function, and calculate the color data of the total sample set;
步骤3,利用基于主成分分析的光谱重构选择光谱代表性样本,直至光谱重构误差收敛,完成光谱代表性样本选择;Step 3: Select spectral representative samples by using the spectral reconstruction based on principal component analysis, until the spectral reconstruction error converges, and complete the selection of spectral representative samples;
步骤4,利用最大最小准则选择颜色代表性样本,并进行颜色校正测试,直至颜色校正色差收敛,完成颜色代表性样本选择;Step 4, select a representative color sample using the maximum and minimum criteria, and perform a color correction test until the color correction chromatic aberration converges, and complete the selection of color representative samples;
步骤5,对选择的光谱代表性样本和颜色代表性样本进行融合去重,得到光谱颜色代表性样本集。Step 5: Perform fusion and deduplication on the selected spectral representative samples and color representative samples to obtain a spectral color representative sample set.
进一步的,步骤2中,通常采用国际照明委员会推荐的CIE D50标准照明体和CIE1931标准观察者条件下的颜色匹配函数,计算总样本集在CIELab颜色空间中颜色数据,计算方法如式(1)和式(2)所示:Further, in step 2, the CIE D50 standard illuminator recommended by the International Commission on Illumination and the color matching function under the CIE1931 standard observer condition are usually used to calculate the color data of the total sample set in the CIELab color space, and the calculation method is as formula (1) And formula (2) shows:
其中,X、Y和Z为样本三刺激值,r(λ)为物质表面的光谱反射率,l(λ)为光源相对光谱功率分布,x(λ)、y(λ)和z(λ)为颜色匹配函数,λ表示范围为380nm-780nm的可见光波长,k为调整因数,是将光源的亮度值Y调整为100时计算得出的。Among them, X, Y and Z are the sample tristimulus values, r(λ) is the spectral reflectance of the material surface, l(λ) is the relative spectral power distribution of the light source, x(λ), y(λ) and z(λ) is the color matching function, λ represents the wavelength of visible light in the range of 380nm-780nm, and k is the adjustment factor, which is calculated when the brightness value Y of the light source is adjusted to 100.
其中,X、Y和Z为样本三刺激值,Xn、Yn和Zn为参考白点三刺激值,L、a和b为样本在CIELab颜色空间中颜色数据,而且计算L、a和b时存在如式(3)所示约束条件,其中item表示三刺激值X、Y和Z。Among them, X, Y and Z are the sample tristimulus values, X n , Y n and Zn are the reference white point tristimulus values, L, a and b are the color data of the sample in the CIELab color space, and L, a and When b, there are constraints as shown in formula (3), where item represents the tristimulus values X, Y and Z.
进一步的,步骤3中,利用基于主成分分析的光谱重构选择光谱代表性样本的具体方法如下:首先,计算总样本集中任一样本的光谱模值,选择模值最大的样本作为第一个选定样本s1,如式(4)所示,其中,norm(·)为本发明中计算模值的函数,ri表示总样本集中第i个样本的光谱向量,max(·)为求最大值函数,Θ表示总样本集,Ω1为包含第一个光谱代表样本的样本子集。Further, in step 3, the specific method for selecting spectral representative samples by using the spectral reconstruction based on principal component analysis is as follows: First, calculate the spectral modulus value of any sample in the total sample set, and select the sample with the largest modulus value as the first sample. The sample s 1 is selected, as shown in formula (4), where norm(·) is the function of calculating the modulus value in the present invention, ri represents the spectral vector of the ith sample in the total sample set, and max(·) is the Maximum function, Θ is the total sample set, Ω 1 is the sample subset containing the first spectrally representative sample.
Ω1=s1=max(norm(ri)),ri∈Θ, (4)Ω 1 =s 1 =max(norm(ri )), ri ∈Θ , (4)
然后,利用基于主成分分析的光谱重构选择剩余的光谱代表性样本。假设当前需要选择第m个样本(m≥2),那么需要将已选的m-1个光谱代表样本子集Ωm-1,与总样本集Θ中所有的未选样本rm进行遍历组合,得到光谱重构训练样本子集Ωm,表示如下:Then, the remaining spectrally representative samples are selected using principal component analysis-based spectral reconstruction. Assuming that the mth sample (m≥2) needs to be selected at present, it is necessary to traverse and combine the selected m-1 spectrum representative sample subset Ω m-1 with all unselected samples r m in the total sample set Θ , obtain the spectral reconstruction training sample subset Ω m , which is expressed as follows:
Ωm=Ωm-1∪rm,rm∈Θ, (5)Ω m =Ω m-1 ∪r m , r m ∈Θ, (5)
对Ωm进行主成分分析,获得训练样本子集Ωm的特征值和特征向量,如式(6)所示,其中,princomp(·)为主成分分析函数,U为正交矩阵特征向量,S为特征值矩阵,V为得分矩阵,T为矩阵转置操作符。Perform principal component analysis on Ω m to obtain the eigenvalues and eigenvectors of the training sample subset Ω m , as shown in formula (6), where princomp( ) is the principal component analysis function, U is the orthogonal matrix eigenvector, S is the eigenvalue matrix, V is the score matrix, and T is the matrix transpose operator.
USVT=princomp(Ωm), (6)USV T =princomp(Ω m ), (6)
选定主成分分析的前j组特征量对总样本集Θ进行光谱重构,如式(7)所示,其中,R为总样本集光谱矩阵,Rrec为总样本集的重构光谱矩阵,+为伪逆算子,并计算重构总样本集与原始总样本集之间的光谱均方根误差(root-mean-square error,RMSE),如式(8)所示,其中,E‖·‖为本发明中计算光谱均方根误差RMSE的函数。The first j groups of feature quantities of PCA are selected to perform spectral reconstruction on the total sample set Θ, as shown in formula (7), where R is the spectral matrix of the total sample set, and R rec is the reconstructed spectral matrix of the total sample set , + is the pseudo-inverse operator, and calculates the spectral root-mean-square error (RMSE) between the reconstructed total sample set and the original total sample set, as shown in Equation (8), where E‖ ·‖ is the function for calculating the spectral root mean square error RMSE in the present invention.
RMSEm=E||Rrec-R||, (8)RMSE m = E||R rec -R||, (8)
以RMSE为评价指标,选则RMSEm最小的样本sm作为第m个光谱代表样本,如式(9)所示,并将其加入到光谱代表性样本集子集中,确定光谱代表性样本子集Ωm。Taking RMSE as the evaluation index, select the sample s m with the smallest RMSE m as the m-th spectral representative sample, as shown in formula (9), and add it to the spectral representative sample set subset to determine the spectral representative sample subset. Set Ω m .
sm=min(RMSEm), (9)s m =min(RMSE m ), (9)
最后,重复式(5)至式(8)继续选择其余光谱代表样本,直至选择的光谱代表性样本对于总样本集的光谱重构误差RMSE达到收敛水平,完成光谱代表性样本的选择。Finally, formulas (5) to (8) are repeated to continue to select the remaining spectral representative samples, until the spectral reconstruction error RMSE of the selected spectral representative samples for the total sample set reaches a convergence level, and the selection of spectral representative samples is completed.
进一步的,步骤4中,利用最大最小准则选择颜色代表性样本的具体方法如下。首先,计算总样本集中任一样本的颜色数据方差,选择方差最小的样本作为第一个选定样本v1,如式(10)所示,其中为本发明中var(·)计算方差函数,Labi表示总样本集中第i个样本的颜色值向量,min(·)为求最小值函数,Θ表示总样本集,Φ1为包含第一个颜色代表样本的样本子集。Further, in step 4, the specific method for selecting color representative samples using the maximum and minimum criteria is as follows. First, calculate the color data variance of any sample in the total sample set, and select the sample with the smallest variance as the first selected sample v 1 , as shown in formula (10), where the variance function is calculated for var(·) in the present invention, Lab i represents the color value vector of the ith sample in the total sample set, min( ) is the minimum function, Θ represents the total sample set, and Φ 1 is the sample subset containing the first color representative sample.
Φ1=v1=min(var(Labi)),Labi∈Θ, (10)Φ 1 =v 1 =min(var(Lab i )), Lab i ∈Θ, (10)
其次,选择第二个颜色代表性样本v2时,确保v2与v1在CIELab颜色空间的欧式距离最大化,得到包含第一和第二个颜色代表样本的样本子集Φ2。Second, when selecting the second color representative sample v 2 , ensure that the Euclidean distance between v 2 and v 1 in the CIELab color space is maximized, and obtain a sample subset Φ 2 containing the first and second color representative samples.
然后,从选择第三个代表颜色样本开始,按照最大最小准则逐个选择剩余颜色代表性样本,并进行颜色校正测试。假设当前需要选择第q个样本(q≥3),那么需要首先在CIELab颜色空间内,计算所有剩余未选样本与已选q-1个样本之间的欧式距离,获得每个剩余未选样本与已选样本的欧式距离最小值,然后从这些最小值中选择欧式距离最大的一个样本作为第q个颜色代表样本,表示如式(11)所示,其中,dist(·)为本发明中求解欧氏距离的函数,Φq-1为已选颜色代表样本子集,Labq为第q个待选颜色样本。Then, starting from the selection of the third representative color sample, the remaining color representative samples are selected one by one according to the maximum and minimum criteria, and the color correction test is carried out. Assuming that the qth sample (q≥3) needs to be selected currently, it is necessary to first calculate the Euclidean distance between all the remaining unselected samples and the selected q-1 samples in the CIELab color space, and obtain each remaining unselected sample. The minimum value of the Euclidean distance from the selected sample, and then select a sample with the largest Euclidean distance from these minimum values as the qth color representative sample, which is shown in formula (11), where dist( ) is in the present invention To solve the function of Euclidean distance, Φ q-1 is the selected color representative sample subset, and Lab q is the qth color sample to be selected.
vq=max(min(dist(Φq-1,Labq))),Labq∈Θ且 v q =max(min(dist(Φ q-1 ,Lab q ))), Lab q ∈Θ and
获得第q个颜色代表样本之后,将其加入到已选颜色代表样本子集Φq-1,得到包含q个颜色代表样本的样本子集Φq,如式(12)所示。After the qth color representative sample is obtained, it is added to the selected color representative sample subset Φ q-1 to obtain a sample subset Φ q containing q color representative samples, as shown in formula (12).
Φq=Φq-1∪Labq, (12)Φ q =Φ q-1 ∪Lab q , (12)
利用Φq作为训练样本,按照文献【Hong G,Luo M R,Rhodes P A.A study ofdigital camera colorimetric characterization based on polynomial modeling[J].Color Research&Application,2001,26(1):76-84.】中的方法,对总样本集进行颜色校正测试,并计算颜色校正色差,如式(13)所示,其中,C为总样本集颜色矩阵,Crec为总样本集校正后颜色矩阵,ΔEq为色差,F‖·‖为本发明中计算色差的函数。Using Φ q as a training sample, according to the method in the literature [Hong G, Luo MR, Rhodes P AA study of digital camera colorimetric characterization based on polynomial modeling [J]. Color Research & Application, 2001, 26(1): 76-84.] , perform the color correction test on the total sample set, and calculate the color correction color difference, as shown in formula (13), where C is the color matrix of the total sample set, C rec is the color matrix after correction of the total sample set, ΔE q is the color difference, F‖·‖ is the function for calculating the color difference in the present invention.
ΔEq=F||Crec∪C||, (13)ΔE q =F||C rec ∪C||, (13)
最后,重复式(11)至式(13)过程,继续选择其余颜色代表样本,直至选择的颜色代表性样本对于总样本集的颜色校正色差ΔE达到收敛,完成颜色代表性样本的选择。Finally, the process of formula (11) to formula (13) is repeated, and the remaining color representative samples are continued to be selected until the selected color representative samples converge to the color correction color difference ΔE of the total sample set, and the selection of color representative samples is completed.
进一步的,步骤5中,对选择的光谱代表性样本和颜色代表性样本进行融合去重,是指对选择的两部分样本取并集,得到最终光谱颜色代表性样本集。Further, in step 5, the fusion and deduplication of the selected spectral representative samples and the color representative samples refers to taking the union of the two selected samples to obtain the final spectral color representative sample set.
本发明还提供一种光谱颜色代表性样本选择系统,包括如下模块:The present invention also provides a spectral color representative sample selection system, comprising the following modules:
总样本集光谱数据获取模块,用于针对给定的总样本集,获得总样本集光谱数据;The total sample set spectral data acquisition module is used to obtain the total sample set spectral data for a given total sample set;
总样本集颜色数据获取模块,用于选定颜色匹配函数,计算得到总样本集颜色数据;The color data acquisition module of the total sample set is used to select the color matching function, and calculate the color data of the total sample set;
光谱代表性样本选择模块,用于利用基于主成分分析的光谱重构选择光谱代表性样本,直至光谱重构误差收敛,完成光谱代表性样本选择;The spectral representative sample selection module is used to select spectral representative samples by using the spectral reconstruction based on principal component analysis, until the spectral reconstruction error converges, and the spectral representative sample selection is completed;
颜色代表性样本选择模块,用于利用最大最小准则选择颜色代表性样本,并进行颜色校正测试,直至颜色校正色差收敛,完成颜色代表性样本选择;The color representative sample selection module is used to select the color representative sample using the maximum and minimum criteria, and perform the color correction test until the color correction chromatic aberration converges, and the color representative sample selection is completed;
光谱颜色代表性样本集获取模块,用于对选择的光谱代表性样本和颜色代表性样本进行融合去重,得到光谱颜色代表性样本集。The spectral color representative sample set acquisition module is used to fuse and deduplicate the selected spectral representative samples and color representative samples to obtain a spectral color representative sample set.
进一步的,总样本集颜色数据获取模块中采用国际照明委员会推荐的CIE D50标准照明体和CIE 1931标准观察者条件下的颜色匹配函数,计算总样本集在CIELab颜色空间中颜色数据,计算方法如式(1)和式(2)所示:Further, the color data acquisition module of the total sample set adopts the CIE D50 standard illuminator recommended by the International Commission on Illumination and the color matching function under the CIE 1931 standard observer condition to calculate the color data of the total sample set in the CIELab color space. The calculation method is as follows: Formulas (1) and (2) are shown as:
其中,X、Y和Z为样本三刺激值,r(λ)为物质表面的光谱反射率,l(λ)为光源相对光谱功率分布,x(λ)、y(λ)和z(λ)为颜色匹配函数,λ表示范围为380nm-780nm的可见光波长,k为调整因数,是将光源的亮度值Y调整为100时计算得出的;Among them, X, Y and Z are the sample tristimulus values, r(λ) is the spectral reflectance of the material surface, l(λ) is the relative spectral power distribution of the light source, x(λ), y(λ) and z(λ) is the color matching function, λ represents the wavelength of visible light in the range of 380nm-780nm, and k is the adjustment factor, which is calculated when the brightness value Y of the light source is adjusted to 100;
其中,X、Y和Z为样本三刺激值,Xn、Yn和Zn为参考白点三刺激值,L、a和b为样本在CIELab颜色空间中颜色数据,而且计算L、a和b时存在如式(3)所示约束条件,其中item表示三刺激值X、Y和Z;Among them, X, Y and Z are the sample tristimulus values, X n , Y n and Zn are the reference white point tristimulus values, L, a and b are the color data of the sample in the CIELab color space, and L, a and When b, there are constraints as shown in formula (3), where item represents the tristimulus values X, Y and Z;
进一步的,光谱代表性样本选择模块中利用基于主成分分析的光谱重构选择光谱代表性样本的具体方法如下;Further, in the spectral representative sample selection module, the specific method for selecting spectral representative samples by using the spectral reconstruction based on principal component analysis is as follows;
首先,计算总样本集中任一样本的光谱模值,选择模值最大的样本作为第一个选定样本s1,如式(4)所示,其中,norm(·)为计算模值的函数,ri表示总样本集中第i个样本的光谱向量,max(·)为求最大值函数,Θ表示总样本集,Ω1为包含第一个光谱代表样本的样本子集;First, calculate the spectral modulus value of any sample in the total sample set, and select the sample with the largest modulus value as the first selected sample s 1 , as shown in formula (4), where norm(·) is the function of calculating the modulus value , ri represents the spectral vector of the ith sample in the total sample set, max( ) is the maximum value function, Θ represents the total sample set, Ω 1 is the sample subset containing the first spectral representative sample;
Ω1=s1=max(norm(ri)),ri∈Θ, (4)Ω 1 =s 1 =max(norm(ri )), ri ∈Θ , (4)
然后,利用基于主成分分析的光谱重构选择剩余的光谱代表性样本,假设当前需要选择第m个样本,m≥2,那么将已选的m-1个光谱代表样本子集Ωm-1,与总样本集Θ中所有的未选样本rm进行遍历组合,得到光谱重构训练样本子集Ωm,表示如下:Then, use the spectral reconstruction based on principal component analysis to select the remaining spectral representative samples. Assuming that the mth sample needs to be selected at present, m≥2, then the selected m-1 spectral representative sample subset Ω m-1 , and all unselected samples rm in the total sample set Θ are traversed and combined to obtain the spectral reconstruction training sample subset Ω m , which is expressed as follows:
Ωm=Ωm-1∪rm,rm∈Θ, (5)Ω m =Ω m-1 ∪r m , r m ∈Θ, (5)
对Ωm进行主成分分析,获得训练样本子集Ωm的特征值和特征向量,如式(6)所示,其中,princomp(·)为主成分分析函数,U为正交矩阵特征向量,S为特征值矩阵,V为得分矩阵,T为矩阵转置操作符;Perform principal component analysis on Ω m to obtain the eigenvalues and eigenvectors of the training sample subset Ω m , as shown in formula (6), where princomp( ) is the principal component analysis function, U is the orthogonal matrix eigenvector, S is the eigenvalue matrix, V is the score matrix, and T is the matrix transpose operator;
USVT=princomp(Ωm), (6)USV T =princomp(Ω m ), (6)
选定主成分分析的前j组特征量对总样本集Θ进行光谱重构,如式(7)所示,其中,R为总样本集光谱矩阵,Rrec为总样本集的重构光谱矩阵,+为伪逆算子,并计算重构总样本集与原始总样本集之间的光谱均方根误差,如式(8)所示,其中,E‖·‖是用于计算光谱均方根误差RMSE的函数;The first j groups of feature quantities of PCA are selected to perform spectral reconstruction on the total sample set Θ, as shown in formula (7), where R is the spectral matrix of the total sample set, and R rec is the reconstructed spectral matrix of the total sample set , + is the pseudo-inverse operator, and calculates the spectral root mean square error between the reconstructed total sample set and the original total sample set, as shown in formula (8), where E‖·‖ is used to calculate the spectral root mean square function of error RMSE;
RMSEm=E||Rrec-R||, (8)RMSE m = E||R rec -R||, (8)
以RMSE为评价指标,选则RMSEm最小的样本sm作为第m个光谱代表样本,如式(9)所示,并将其加入到光谱代表性样本集子集中,确定光谱代表性样本子集Ωm;Taking RMSE as the evaluation index, select the sample s m with the smallest RMSE m as the m-th spectral representative sample, as shown in formula (9), and add it to the spectral representative sample set subset to determine the spectral representative sample subset. set Ω m ;
sm=min(RMSEm), (9)s m =min(RMSE m ), (9)
最后,重复式(5)至式(8)继续选择其余光谱代表样本,直至选择的光谱代表性样本对于总样本集的光谱重构误差RMSE达到收敛水平,完成光谱代表性样本的选择。Finally, formulas (5) to (8) are repeated to continue to select the remaining spectral representative samples, until the spectral reconstruction error RMSE of the selected spectral representative samples for the total sample set reaches a convergence level, and the selection of spectral representative samples is completed.
进一步的,颜色代表性样本选择模块中利用最大最小准则选择颜色代表性样本的具体方法如下;Further, in the color representative sample selection module, the specific method for selecting color representative samples using the maximum and minimum criteria is as follows;
首先,计算总样本集中任一样本的颜色数据方差,选择方差最小的样本作为第一个选定样本v1,如式(10)所示,其中var(·)表示方差函数,Labi表示总样本集中第i个样本的颜色值向量,min(·)为求最小值函数,Θ表示总样本集,Φ1为包含第一个颜色代表样本的样本子集;First, calculate the color data variance of any sample in the total sample set, and select the sample with the smallest variance as the first selected sample v 1 , as shown in formula (10), where var(·) represents the variance function, and Lab i represents the total The color value vector of the ith sample in the sample set, min( ) is the minimum value function, Θ represents the total sample set, and Φ 1 is the sample subset containing the first color representative sample;
Φ1=v1=min(var(Labi)),Labi∈Θ, (10)Φ 1 =v 1 =min(var(Lab i )), Lab i ∈Θ, (10)
其次,选择第二个颜色代表性样本v2时,确保v2与v1在CIELab颜色空间的欧式距离最大化,得到包含第一和第二个颜色代表样本的样本子集Φ2;Secondly, when selecting the second color representative sample v 2 , ensure that the Euclidean distance between v 2 and v 1 in the CIELab color space is maximized, and obtain a sample subset Φ 2 containing the first and second color representative samples;
然后,从选择第三个代表颜色样本开始,按照最大最小准则逐个选择剩余颜色代表性样本,并进行颜色校正测试;假设当前需要选择第q个样本,q≥3,那么首先在CIELab颜色空间内,计算所有剩余未选样本与已选q-1个样本之间的欧式距离,获得每个剩余未选样本与已选样本的欧式距离最小值,然后从这些最小值中选择欧式距离最大的一个样本作为第q个颜色代表样本,表示如式(11)所示,其中,dist(·)为求解欧氏距离的函数,Φq-1为已选颜色代表样本子集,Labq为第q个待选颜色样本;Then, starting from the selection of the third representative color sample, the remaining color representative samples are selected one by one according to the maximum and minimum criteria, and the color correction test is performed; assuming that the qth sample needs to be selected at present, q≥3, then first in the CIELab color space , calculate the Euclidean distance between all the remaining unselected samples and the selected q-1 samples, obtain the minimum value of the Euclidean distance between each remaining unselected sample and the selected sample, and then select the one with the largest Euclidean distance from these minimum values The sample is used as the qth color to represent the sample, which is shown in formula (11), where dist( ) is the function to solve the Euclidean distance, Φ q-1 is the selected color to represent the sample subset, and Lab q is the qth a color sample to be selected;
vq=max(min(dist(Φq-1,Labq))),Labq∈Θ且 v q =max(min(dist(Φ q-1 ,Lab q ))), Lab q ∈Θ and
获得第q个颜色代表样本之后,将其加入到已选颜色代表样本子集Φq-1,得到包含q个颜色代表样本的样本子集Φq,如式(12)所示;After obtaining the qth color representative sample, add it to the selected color representative sample subset Φ q-1 to obtain a sample subset Φ q containing q color representative samples, as shown in formula (12);
Φq=Φq-1∪Labq, (12)Φ q =Φ q-1 ∪Lab q , (12)
利用Φq作为训练样本,然后对总样本集进行颜色校正测试,并计算颜色校正色差,如式(13)所示,其中,C为总样本集颜色矩阵,Crec为总样本集校正后颜色矩阵,ΔEq为色差,F‖·‖为本发明中计算色差的函数;Use Φ q as a training sample, then perform a color correction test on the total sample set, and calculate the color correction color difference, as shown in formula (13), where C is the color matrix of the total sample set, and C rec is the corrected color of the total sample set matrix, ΔE q is the color difference, and F‖·‖ is the function for calculating the color difference in the present invention;
ΔEq=F||Crec∪C||, (13)ΔE q =F||C rec ∪C||, (13)
最后,重复式(11)至式(13)过程,继续选择其余颜色代表样本,直至选择的颜色代表性样本对于总样本集的颜色校正色差ΔE达到收敛,完成颜色代表性样本的选择。Finally, the process of formula (11) to formula (13) is repeated, and the remaining color representative samples are continued to be selected until the selected color representative samples converge to the color correction color difference ΔE of the total sample set, and the selection of color representative samples is completed.
本发明针对现有样本集或数据库在数码相机光谱和颜色特性化建模应用时,存在数据冗余、严重影响建模工作效率的问题,提出了基于光谱和颜色代表性样本选择与融合的样本集优化方法,为构建同时适用于数码相机光谱和颜色特性化建模应用的便携色卡提供了方法支撑,在保证应用效果和鲁棒性的同时,有效提升了数码相机建模效率。The invention proposes a sample selection and fusion based on spectrum and color representative sample selection, aiming at the problem of data redundancy and serious influence on modeling work efficiency when the existing sample set or database is applied in the digital camera spectrum and color characterization modeling application. The set optimization method provides method support for the construction of a portable color card suitable for both spectral and color characterization modeling applications of digital cameras, which effectively improves the modeling efficiency of digital cameras while ensuring the application effect and robustness.
附图说明Description of drawings
图1为本发明实施例的流程图。FIG. 1 is a flowchart of an embodiment of the present invention.
图2为本发明实施例中总样本集的光谱分布;Fig. 2 is the spectral distribution of the total sample set in the embodiment of the present invention;
图3为本发明实施例中总样本集的色度分布;Fig. 3 is the chromaticity distribution of the total sample set in the embodiment of the present invention;
图4为本发明实施例中所选光谱和颜色代表样本的光谱和色度分布:(a)代表样本的光谱分布,(b)代表样本的色度分布。FIG. 4 is the spectrum and chromaticity distribution of the selected spectrum and color representative sample in the embodiment of the present invention: (a) represents the spectral distribution of the sample, (b) represents the chromaticity distribution of the sample.
具体实施方式Detailed ways
本发明技术方案具体实施时可由本领域技术人员采用计算机软件技术运行。结合附图,提供本发明实施例具体描述如下。The technical solutions of the present invention can be run by those skilled in the art using computer software technology. In conjunction with the accompanying drawings, a specific description of the embodiments of the present invention is provided as follows.
如图1所示,实施例提供了一种光谱颜色代表性样本选择方法,可以有效解决现有包含大量样本的样本集或数据库,在实际应用中存在的数据冗余问题,构建同时适用于数码相机光谱和颜色特性化建模应用的便携式色卡提供支撑,在保证应用效果和鲁棒性的同时,有效提升了建模效率。实施例采用包含784个颜色样本的矿物颜料样本集、尼康D7200数码相机,X-rite i1-pro分光光度计、以及颜色科学工具箱optprop,在Matlab 2016a软件平台上,对本发明方法进行具体说明。需要说明的是,本发明并不仅仅局限于上述设备和样本的应用支持,对于任意能实现上述设备功能的同等性质的设备同样适用。As shown in FIG. 1 , the embodiment provides a method for selecting representative samples of spectral colors, which can effectively solve the problem of data redundancy in practical applications in existing sample sets or databases containing a large number of samples. The portable color card for camera spectrum and color characterization modeling applications provides support, which effectively improves the modeling efficiency while ensuring the application effect and robustness. The embodiment uses a mineral pigment sample set containing 784 color samples, a Nikon D7200 digital camera, an X-rite i1-pro spectrophotometer, and a color science toolbox optprop, on the Matlab 2016a software platform, to specifically illustrate the method of the present invention. It should be noted that the present invention is not limited to the application support of the above-mentioned devices and samples, and is also applicable to any device of the same nature that can realize the functions of the above-mentioned devices.
实施例主要包括以下步骤:The embodiment mainly includes the following steps:
1)针对给定的总样本集,利用分光光度计测量获得总样本集光谱数据。1) For a given total sample set, use a spectrophotometer to measure and obtain the spectral data of the total sample set.
实施例中,利用美国X-rite公司的i1-pro分光光度计,对包含784个矿物颜料样本总样本集进行光谱测量,获得总样本集光谱数据,总样本集的光谱分布如图2所示。In the embodiment, the i1-pro spectrophotometer of X-rite company in the United States is used to perform spectral measurement on the total sample set containing 784 mineral pigment samples to obtain the spectral data of the total sample set. The spectral distribution of the total sample set is shown in Figure 2. .
2)选定颜色匹配函数,计算得到总样本集颜色数据。2) Select the color matching function, and calculate the color data of the total sample set.
实施例中,采用国际照明委员会推荐的CIE D50标准照明体和CIE 1931标准观察者条件下的颜色匹配函数,按照式(1)和式(2)所示方法,在式(3)所示约束条件下,计算总样本集在CIELab颜色空间中颜色数据,总样本集的色度分布如图3所示。In the embodiment, using the CIE D50 standard illuminator recommended by the International Commission on Illumination and the color matching function under the CIE 1931 standard observer condition, according to the methods shown in formula (1) and formula (2), the constraints shown in formula (3) are used. Under the conditions, the color data of the total sample set in the CIELab color space is calculated, and the chromaticity distribution of the total sample set is shown in Figure 3.
其中,X、Y和Z为样本三刺激值,r(λ)为物质表面的光谱反射率,l(λ)为光源相对光谱功率分布,x(λ)、y(λ)和z(λ)为颜色匹配函数,λ表示范围为380nm-780nm的可见光波长,k为调整因数,是将光源的亮度值Y调整为100时计算得出的。Among them, X, Y and Z are the sample tristimulus values, r(λ) is the spectral reflectance of the material surface, l(λ) is the relative spectral power distribution of the light source, x(λ), y(λ) and z(λ) is the color matching function, λ represents the wavelength of visible light in the range of 380nm-780nm, and k is the adjustment factor, which is calculated when the brightness value Y of the light source is adjusted to 100.
其中,X、Y和Z为样本三刺激值,Xn、Yn和Zn为参考白点三刺激值,L、a和b为样本在CIELab颜色空间中颜色数据,而且计算L、a和b时存在如式(3)所示约束条件,其中item表示三刺激值X、Y和Z。Among them, X, Y and Z are the sample tristimulus values, X n , Y n and Zn are the reference white point tristimulus values, L, a and b are the color data of the sample in the CIELab color space, and L, a and When b, there are constraints as shown in formula (3), where item represents the tristimulus values X, Y and Z.
3)利用基于主成分分析的光谱重构选择光谱代表性样本,直至光谱重构误差收敛,完成光谱代表性样本选择。3) Select spectral representative samples by using the spectral reconstruction based on principal component analysis, until the spectral reconstruction error converges, and complete the spectral representative sample selection.
实施例中,以步骤1)中测量获得的总样本集光谱数据为基础,利用基于主成分分析的光谱重构选择光谱代表性样本,具体如下。首先,计算矿物颜料样本集中任一样本的光谱模值,选择模值最大的样本作为第一个选定样本s1,如式(4)所示,其中,norm(·)为本发明中计算模值的函数,ri表示矿物颜料样本集中第i个样本的光谱向量,max(·)为求最大值函数,Θ表示矿物颜料样本集,Ω1为包含第一个光谱代表样本的样本子集。In the embodiment, based on the spectral data of the total sample set obtained by the measurement in step 1), a spectral representative sample is selected by spectral reconstruction based on principal component analysis, as follows. First, the spectral modulus value of any sample in the mineral pigment sample set is calculated, and the sample with the largest modulus value is selected as the first selected sample s 1 , as shown in formula (4), where norm(·) is calculated in the present invention The function of the modulus value, ri represents the spectral vector of the i -th sample in the mineral pigment sample set, max( ) is the maximum value function, Θ represents the mineral pigment sample set, Ω 1 is the sample sub-sample containing the first spectral representative sample set.
Ω1=s1=max(norm(ri)),ri∈Θ, (4)Ω 1 =s 1 =max(norm(ri )), ri ∈Θ , (4)
然后,利用基于主成分分析的光谱重构选择剩余的光谱代表性样本。假设当前需要选择第m个样本(m≥2),那么需要将已选的m-1个光谱代表样本子集Ωm-1,与矿物颜料样本集Θ中所有的未选样本光谱rm进行遍历组合,得到光谱重构训练样本子集Ωm,表示如下:Then, the remaining spectrally representative samples are selected using principal component analysis-based spectral reconstruction. Assuming that the mth sample (m≥2) needs to be selected at present, then the selected m -1 spectra representing the sample subset Ω m-1 need to be compared with all the unselected sample spectra rm in the mineral pigment sample set Θ Traverse the combination to obtain the spectral reconstruction training sample subset Ω m , which is expressed as follows:
Ωm=Ωm-1∪rm,rm∈Θ, (5)Ω m =Ω m-1 ∪r m , r m ∈Θ, (5)
对光谱重构训练样本子集Ωm进行主成分分析,获得训练样本子集Ωm的特征值和特征向量,如式(6)所示,其中,princomp(·)为主成分分析函数,U为正交矩阵特征向量,S为特征值矩阵,V为得分矩阵,T为矩阵转置操作符。Perform principal component analysis on the spectral reconstruction training sample subset Ω m to obtain the eigenvalues and eigenvectors of the training sample subset Ω m , as shown in equation (6), where princomp( ) is the principal component analysis function, U is the eigenvector of an orthogonal matrix, S is the eigenvalue matrix, V is the score matrix, and T is the matrix transpose operator.
USVT=princomp(Ωm), (6)USV T =princomp(Ω m ), (6)
选定主成分分析的前10组特征量对矿物颜料样本集Θ进行光谱重构,如式(7)所示,其中,R为矿物颜料样本集光谱矩阵,Rrec为矿物颜料样本集的重构光谱矩阵,+为伪逆算子,并计算重构矿物颜料样本集与原始矿物颜料样本集之间的光谱均方根误差(root-mean-square error,RMSE),如式(8)所示,其中,E‖·‖为本发明中计算光谱均方根误差RMSE的函数。The first 10 groups of feature quantities of the principal component analysis are selected to perform spectral reconstruction on the mineral pigment sample set Θ, as shown in formula (7), where R is the spectral matrix of the mineral pigment sample set, and R rec is the weight of the mineral pigment sample set. construct the spectral matrix, + is the pseudo-inverse operator, and calculate the spectral root mean square error (root-mean-square error, RMSE) between the reconstructed mineral pigment sample set and the original mineral pigment sample set, as shown in formula (8) , where E‖·‖ is the function of calculating the spectral root mean square error RMSE in the present invention.
RMSEm=E||Rrec-R‖, (8)RMSE m = E||R rec -R‖, (8)
以RMSE为评价指标,选则RMSEm最小的样本sm作为第m个光谱代表样本,如式(9)所示,并将其加入到光谱代表性样本集子集中,确定光谱代表性样本子集Ωm。Taking RMSE as the evaluation index, select the sample s m with the smallest RMSE m as the m-th spectral representative sample, as shown in formula (9), and add it to the spectral representative sample set subset to determine the spectral representative sample subset. Set Ω m .
sm=min(RMSEm), (9)s m =min(RMSE m ), (9)
最后,重复式(5)至式(8)继续选择其余光谱代表样本,直至选择的光谱代表性样本对于矿物颜料样本集的光谱重构误差RMSE达到收敛水平,完成光谱代表性样本的选择。本实施例中,当选择的光谱代表性样本数量达到35时,光谱重构误差开始达到收敛水平,因此共选择出光谱代表性样本集35个。Finally, formulas (5) to (8) are repeated to continue to select the remaining spectral representative samples, until the spectral reconstruction error RMSE of the selected spectral representative samples for the mineral pigment sample set reaches a convergence level, and the selection of spectral representative samples is completed. In this embodiment, when the number of selected spectral representative samples reaches 35, the spectral reconstruction error begins to reach a convergence level, so a total of 35 spectral representative sample sets are selected.
4)利用最大最小准则选择颜色代表性样本,并进行颜色校正测试,直至颜色校正色差收敛,完成颜色代表性样本选择。4) Use the maximum and minimum criteria to select a representative color sample, and perform a color correction test until the color correction chromatic aberration converges, and the selection of a representative color sample is completed.
实施例中,以步骤2)中计算得到的矿物颜料颜色数据为基础,利用最大最小准则选择颜色代表性样本,具体如下。首先,计算总样本集中任一样本的颜色数据方差,选择方差最小的样本作为第一个选定样本v1,如式(10)所示,其中为本发明中var(·)计算方差函数,Labi表示矿物颜料样本集中第i个样本的颜色值向量,min(·)为求最小值函数,Θ表示矿物颜料样本集,Φ1为包含第一个颜色代表样本的样本子集。In the embodiment, based on the mineral pigment color data calculated in step 2), a color representative sample is selected using the maximum and minimum criteria, as follows. First, calculate the color data variance of any sample in the total sample set, and select the sample with the smallest variance as the first selected sample v 1 , as shown in formula (10), where the variance function is calculated for var(·) in the present invention, Lab i represents the color value vector of the ith sample in the mineral pigment sample set, min( ) is the minimum function, Θ represents the mineral pigment sample set, and Φ 1 is the sample subset containing the first color representative sample.
Φ1=v1=min(var(Labi)),Labi∈Θ, (10)Φ 1 =v 1 =min(var(Lab i )), Lab i ∈Θ, (10)
其次,选择第二个颜色代表性样本v2时,确保v2与v1在CIELab颜色空间的欧式距离最大化,得到包含第一和第二个颜色代表样本的样本子集Φ2。Second, when selecting the second color representative sample v 2 , ensure that the Euclidean distance between v 2 and v 1 in the CIELab color space is maximized, and obtain a sample subset Φ 2 containing the first and second color representative samples.
然后,从选择第三个代表颜色样本开始,按照最大最小准则逐个选择剩余颜色代表性样本,并进行颜色校正测试。假设当前需要选择第q个样本(q≥3),那么需要首先在CIELab颜色空间内,计算第所有剩余未选样本与已选q-1个样本之间的欧式距离,获得每个剩余未选样本与已选样本的欧式距离最小值,然后从这些最小值中选择欧式距离最大的一个样本作为第q个颜色代表样本,表示如式(11)所示,其中,dist(·)为本发明中求解欧氏距离的函数,Φq-1为已选颜色代表样本子集,Labq为第q个待选颜色样本。Then, starting from the selection of the third representative color sample, the remaining color representative samples are selected one by one according to the maximum and minimum criteria, and the color correction test is carried out. Assuming that the qth sample (q≥3) needs to be selected at present, it is necessary to first calculate the Euclidean distance between all the remaining unselected samples and the selected q-1 samples in the CIELab color space, and obtain each remaining unselected sample. The minimum value of the Euclidean distance between the sample and the selected sample, and then select a sample with the largest Euclidean distance from these minimum values as the qth color representative sample, which is shown in formula (11), where dist( ) is the present invention The function to solve the Euclidean distance in Φ q-1 is the selected color representative sample subset, and Lab q is the qth color sample to be selected.
vq=max(min(dist(Φq-1,Labq))),Labq∈Θ且 v q =max(min(dist(Φ q-1 ,Lab q ))), Lab q ∈Θ and
获得第q个颜色代表样本之后,将其加入到已选颜色代表样本子集Φq-1,得到包含q个颜色代表样本的样本子集Φq,如式(12)所示。After the qth color representative sample is obtained, it is added to the selected color representative sample subset Φ q-1 to obtain a sample subset Φ q containing q color representative samples, as shown in formula (12).
Φq=Φq-1∪Labq, (12)Φ q =Φ q-1 ∪Lab q , (12)
利用Φq作为训练样本,按照文献【Hong G,Luo M R,Rhodes P A.A study ofdigital camera colorimetric characterization based on polynomial modeling[J].Color Research&Application,2001,26(1):76-84.】中的方法,对矿物颜料样本集进行颜色校正测试,并计算颜色校正色差,如式(13)所示,其中,C为矿物颜料样本集颜色矩阵,Crec为矿物颜料样本集校正后颜色矩阵,ΔEq为色差,F‖·‖为本发明中计算色差的函数。Using Φ q as a training sample, according to the method in the literature [Hong G, Luo MR, Rhodes P AA study of digital camera colorimetric characterization based on polynomial modeling [J]. Color Research & Application, 2001, 26(1): 76-84.] , perform the color correction test on the mineral pigment sample set, and calculate the color correction chromatic aberration, as shown in formula (13), where C is the color matrix of the mineral pigment sample set, C rec is the corrected color matrix of the mineral pigment sample set, ΔE q is the color difference, and F‖·‖ is the function for calculating the color difference in the present invention.
ΔEq=F||Crec∪C||, (13)ΔE q =F||C rec ∪C||, (13)
最后,重复式(11)至式(13)过程,继续选择其余颜色代表样本,直至选择的颜色代表性样本对于矿物颜料样本集的颜色校正色差ΔE达到收敛,完成颜色代表性样本的选择。本实施例中,当选择的颜色代表性样本数量达到60时,颜色校正色差开始达到收敛水平,因此共选择出颜色代表性样本集60个。Finally, the process of formula (11) to formula (13) is repeated, and the remaining color representative samples are continued to be selected until the selected color representative sample reaches the convergence of the color correction chromatic aberration ΔE of the mineral pigment sample set, and the selection of color representative samples is completed. In this embodiment, when the number of selected color representative samples reaches 60, the color correction chromatic aberration begins to reach a convergence level, so a total of 60 color representative sample sets are selected.
5)对选择的光谱代表性样本和颜色代表性样本进行融合去重,得到光谱颜色代表性样本集。5) Fusion and deduplication are performed on the selected spectral representative samples and color representative samples to obtain a spectral color representative sample set.
实施例中,通过对选择的35个光谱代表样本和,60个颜色代表样本进行取并集,去除重复的7个样本之后,共得到88个光谱颜色代表样本,相对于矿物颜料样本集原始的784个样本,数量大大减少。代表样本的光谱分布和色度分布分别如图4(a)和图4(b)所示,由图中结果可知,本发明方法所选择的光谱颜色代表样本,在光谱和色度空间局具有良好的分布,能够有效覆盖原始矿物颜料样本集的光谱和色度分布。In the embodiment, by taking the sum of the selected 35 spectral representative samples and the 60 color representative samples, after removing the repeated 7 samples, a total of 88 spectral color representative samples are obtained, which is compared with the original mineral pigment sample set. 784 samples, the number is greatly reduced. The spectral distribution and chromaticity distribution of the representative sample are shown in Fig. 4(a) and Fig. 4(b) respectively. From the results in the figure, it can be seen that the spectral color selected by the method of the present invention represents the sample, which has Good distribution that effectively covers the spectral and chromatic distribution of the original mineral pigment sample set.
本发明实施例还提供一种光谱颜色代表性样本选择系统,包括如下模块:The embodiment of the present invention also provides a spectral color representative sample selection system, including the following modules:
总样本集光谱数据获取模块,用于针对给定的总样本集,获得总样本集光谱数据;The total sample set spectral data acquisition module is used to obtain the total sample set spectral data for a given total sample set;
总样本集颜色数据获取模块,用于选定颜色匹配函数,计算得到总样本集颜色数据;The color data acquisition module of the total sample set is used to select the color matching function, and calculate the color data of the total sample set;
光谱代表性样本选择模块,用于利用基于主成分分析的光谱重构选择光谱代表性样本,直至光谱重构误差收敛,完成光谱代表性样本选择;The spectral representative sample selection module is used to select spectral representative samples by using the spectral reconstruction based on principal component analysis, until the spectral reconstruction error converges, and the spectral representative sample selection is completed;
颜色代表性样本选择模块,用于利用最大最小准则选择颜色代表性样本,并进行颜色校正测试,直至颜色校正色差收敛,完成颜色代表性样本选择;The color representative sample selection module is used to select the color representative sample using the maximum and minimum criteria, and perform the color correction test until the color correction chromatic aberration converges, and the color representative sample selection is completed;
光谱颜色代表性样本集获取模块,用于对选择的光谱代表性样本和颜色代表性样本进行融合去重,得到光谱颜色代表性样本集。The spectral color representative sample set acquisition module is used to fuse and deduplicate the selected spectral representative samples and color representative samples to obtain a spectral color representative sample set.
进一步的,总样本集颜色数据获取模块中采用国际照明委员会推荐的CIE D50标准照明体和CIE 1931标准观察者条件下的颜色匹配函数,计算总样本集在CIELab颜色空间中颜色数据,计算方法如式(1)和式(2)所示:Further, the color data acquisition module of the total sample set adopts the CIE D50 standard illuminator recommended by the International Commission on Illumination and the color matching function under the CIE 1931 standard observer condition to calculate the color data of the total sample set in the CIELab color space. The calculation method is as follows: Formulas (1) and (2) are shown as:
其中,X、Y和Z为样本三刺激值,r(λ)为物质表面的光谱反射率,l(λ)为光源相对光谱功率分布,x(λ)、y(λ)和z(λ)为颜色匹配函数,λ表示范围为380nm-780nm的可见光波长,k为调整因数,是将光源的亮度值Y调整为100时计算得出的;Among them, X, Y and Z are the sample tristimulus values, r(λ) is the spectral reflectance of the material surface, l(λ) is the relative spectral power distribution of the light source, x(λ), y(λ) and z(λ) is the color matching function, λ represents the wavelength of visible light in the range of 380nm-780nm, and k is the adjustment factor, which is calculated when the brightness value Y of the light source is adjusted to 100;
其中,X、Y和Z为样本三刺激值,Xn、Yn和Zn为参考白点三刺激值,L、a和b为样本在CIELab颜色空间中颜色数据,而且计算L、a和b时存在如式(3)所示约束条件,其中item表示三刺激值X、Y和Z;Among them, X, Y and Z are the sample tristimulus values, X n , Y n and Zn are the reference white point tristimulus values, L, a and b are the color data of the sample in the CIELab color space, and L, a and When b, there are constraints as shown in formula (3), where item represents the tristimulus values X, Y and Z;
进一步的,光谱代表性样本选择模块中利用基于主成分分析的光谱重构选择光谱代表性样本的具体方法如下;Further, in the spectral representative sample selection module, the specific method for selecting spectral representative samples by using the spectral reconstruction based on principal component analysis is as follows;
首先,计算总样本集中任一样本的光谱模值,选择模值最大的样本作为第一个选定样本s1,如式(4)所示,其中,norm(·)为计算模值的函数,ri表示总样本集中第i个样本的光谱向量,max(·)为求最大值函数,Θ表示总样本集,Ω1为包含第一个光谱代表样本的样本子集;First, calculate the spectral modulus value of any sample in the total sample set, and select the sample with the largest modulus value as the first selected sample s 1 , as shown in formula (4), where norm(·) is the function of calculating the modulus value , ri represents the spectral vector of the ith sample in the total sample set, max( ) is the maximum value function, Θ represents the total sample set, Ω 1 is the sample subset containing the first spectral representative sample;
Ω1=s1=max(norm(ri)),ri∈Θ, (4)Ω 1 =s 1 =max(norm(ri )), ri ∈Θ , (4)
然后,利用基于主成分分析的光谱重构选择剩余的光谱代表性样本,假设当前需要选择第m个样本,m≥2,那么将已选的m-1个光谱代表样本子集Ωm-1,与总样本集Θ中所有的未选样本rm进行遍历组合,得到光谱重构训练样本子集Ωm,表示如下:Then, use the spectral reconstruction based on principal component analysis to select the remaining spectral representative samples. Assuming that the mth sample needs to be selected at present, m≥2, then the selected m-1 spectral representative sample subset Ω m-1 , and all unselected samples rm in the total sample set Θ are traversed and combined to obtain the spectral reconstruction training sample subset Ω m , which is expressed as follows:
Ωm=Ωm-1∪rm,rm∈Θ, (5)Ω m =Ω m-1 ∪r m , r m ∈Θ, (5)
对Ωm进行主成分分析,获得训练样本子集Ωm的特征值和特征向量,如式(6)所示,其中,princomp(·)为主成分分析函数,U为正交矩阵特征向量,S为特征值矩阵,V为得分矩阵,T为矩阵转置操作符;Perform principal component analysis on Ω m to obtain the eigenvalues and eigenvectors of the training sample subset Ω m , as shown in formula (6), where princomp( ) is the principal component analysis function, U is the orthogonal matrix eigenvector, S is the eigenvalue matrix, V is the score matrix, and T is the matrix transpose operator;
USVT=princomp(Ωm), (6)USV T =princomp(Ω m ), (6)
选定主成分分析的前j组特征量对总样本集Θ进行光谱重构,如式(7)所示,其中,R为总样本集光谱矩阵,Rrec为总样本集的重构光谱矩阵,+为伪逆算子,并计算重构总样本集与原始总样本集之间的光谱均方根误差,如式(8)所示,其中,E‖·‖是用于计算光谱均方根误差RMSE的函数;The first j groups of feature quantities of PCA are selected to perform spectral reconstruction on the total sample set Θ, as shown in formula (7), where R is the spectral matrix of the total sample set, and R rec is the reconstructed spectral matrix of the total sample set , + is the pseudo-inverse operator, and calculates the spectral root mean square error between the reconstructed total sample set and the original total sample set, as shown in formula (8), where E‖·‖ is used to calculate the spectral root mean square function of error RMSE;
RMSEm=E||Rrec-R||, (8)RMSE m = E||R rec -R||, (8)
以RMSE为评价指标,选则RMSEm最小的样本sm作为第m个光谱代表样本,如式(9)所示,并将其加入到光谱代表性样本集子集中,确定光谱代表性样本子集Ωm;Taking RMSE as the evaluation index, select the sample s m with the smallest RMSE m as the m-th spectral representative sample, as shown in formula (9), and add it to the spectral representative sample set subset to determine the spectral representative sample subset. set Ω m ;
sm=min(RMSEm), (9)s m =min(RMSE m ), (9)
最后,重复式(5)至式(8)继续选择其余光谱代表样本,直至选择的光谱代表性样本对于总样本集的光谱重构误差RMSE达到收敛水平,完成光谱代表性样本的选择。Finally, formulas (5) to (8) are repeated to continue to select the remaining spectral representative samples, until the spectral reconstruction error RMSE of the selected spectral representative samples for the total sample set reaches a convergence level, and the selection of spectral representative samples is completed.
进一步的,颜色代表性样本选择模块中利用最大最小准则选择颜色代表性样本的具体方法如下;Further, in the color representative sample selection module, the specific method for selecting color representative samples using the maximum and minimum criteria is as follows;
首先,计算总样本集中任一样本的颜色数据方差,选择方差最小的样本作为第一个选定样本v1,如式(10)所示,其中var(·)表示方差函数,Labi表示总样本集中第i个样本的颜色值向量,min(·)为求最小值函数,Θ表示总样本集,Φ1为包含第一个颜色代表样本的样本子集;First, calculate the color data variance of any sample in the total sample set, and select the sample with the smallest variance as the first selected sample v 1 , as shown in formula (10), where var(·) represents the variance function, and Lab i represents the total The color value vector of the ith sample in the sample set, min( ) is the minimum value function, Θ represents the total sample set, and Φ 1 is the sample subset containing the first color representative sample;
Φ1=v1=min(var(Labi)),Labi∈Θ, (10)Φ 1 =v 1 =min(var(Lab i )), Lab i ∈Θ, (10)
其次,选择第二个颜色代表性样本v2时,确保v2与v1在CIELab颜色空间的欧式距离最大化,得到包含第一和第二个颜色代表样本的样本子集Φ2;Secondly, when selecting the second color representative sample v 2 , ensure that the Euclidean distance between v 2 and v 1 in the CIELab color space is maximized, and obtain a sample subset Φ 2 containing the first and second color representative samples;
然后,从选择第三个代表颜色样本开始,按照最大最小准则逐个选择剩余颜色代表性样本,并进行颜色校正测试;假设当前需要选择第q个样本,q≥3,那么首先在CIELab颜色空间内,计算所有剩余未选样本与已选q-1个样本之间的欧式距离,获得每个剩余未选样本与已选样本的欧式距离最小值,然后从这些最小值中选择欧式距离最大的一个样本作为第q个颜色代表样本,表示如式(11)所示,其中,dist(·)为求解欧氏距离的函数,Φq-1为已选颜色代表样本子集,Labq为第q个待选颜色样本;Then, starting from the selection of the third representative color sample, the remaining color representative samples are selected one by one according to the maximum and minimum criteria, and the color correction test is performed; assuming that the qth sample needs to be selected at present, q≥3, then first in the CIELab color space , calculate the Euclidean distance between all the remaining unselected samples and the selected q-1 samples, obtain the minimum value of the Euclidean distance between each remaining unselected sample and the selected sample, and then select the one with the largest Euclidean distance from these minimum values The sample is used as the qth color to represent the sample, which is shown in formula (11), where dist( ) is the function to solve the Euclidean distance, Φ q-1 is the selected color to represent the sample subset, and Lab q is the qth color samples to be selected;
vq=max(min(dist(Φq-1,Labq))),Labq∈Θ且 v q =max(min(dist(Φ q-1 ,Lab q ))), Lab q ∈Θ and
获得第q个颜色代表样本之后,将其加入到已选颜色代表样本子集Φq-1,得到包含q个颜色代表样本的样本子集Φq,如式(12)所示;After obtaining the qth color representative sample, add it to the selected color representative sample subset Φ q-1 to obtain a sample subset Φ q containing q color representative samples, as shown in formula (12);
Φq=Φq-1∪Labq, (12)Φ q =Φ q-1 ∪Lab q , (12)
利用Φq作为训练样本,然后对总样本集进行颜色校正测试,并计算颜色校正色差,如式(13)所示,其中,C为总样本集颜色矩阵,Crec为总样本集校正后颜色矩阵,ΔEq为色差,F‖·‖为本发明中计算色差的函数;Use Φ q as a training sample, then perform a color correction test on the total sample set, and calculate the color correction color difference, as shown in formula (13), where C is the color matrix of the total sample set, and C rec is the corrected color of the total sample set matrix, ΔE q is the color difference, and F‖·‖ is the function for calculating the color difference in the present invention;
ΔEq=F||Crec∪C||, (13)ΔE q =F||C rec ∪C||, (13)
最后,重复式(11)至式(13)过程,继续选择其余颜色代表样本,直至选择的颜色代表性样本对于总样本集的颜色校正色差ΔE达到收敛,完成颜色代表性样本的选择。Finally, the process of formula (11) to formula (13) is repeated, and the remaining color representative samples are continued to be selected until the selected color representative samples converge to the color correction color difference ΔE of the total sample set, and the selection of color representative samples is completed.
各模块的具体实现方式和各步骤相应,本发明实施例不予撰述。The specific implementation manner of each module corresponds to each step, and will not be described in this embodiment of the present invention.
本文中所描述的具体实施例仅仅是对本发明精神作举例说明。本发明所属技术领域的技术人员可以对所描述的具体实施例做各种各样的修改或补充或采用类似的方式替代,但并不会偏离本发明的精神或者超越所附权利要求书所定义的范围。The specific embodiments described herein are merely illustrative of the spirit of the invention. Those skilled in the art to which the present invention pertains can make various modifications or additions to the described specific embodiments or substitute in similar manners, but will not deviate from the spirit of the present invention or go beyond the definitions of the appended claims range.
Claims (10)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110281047.XA CN113095368B (en) | 2021-03-16 | 2021-03-16 | A spectral color representative sample selection method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110281047.XA CN113095368B (en) | 2021-03-16 | 2021-03-16 | A spectral color representative sample selection method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113095368A CN113095368A (en) | 2021-07-09 |
CN113095368B true CN113095368B (en) | 2022-06-28 |
Family
ID=76668237
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110281047.XA Active CN113095368B (en) | 2021-03-16 | 2021-03-16 | A spectral color representative sample selection method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113095368B (en) |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101953148A (en) * | 2008-02-22 | 2011-01-19 | 日本电气株式会社 | Method for processing color image, color processing device and color processing program |
CN104359556A (en) * | 2014-11-14 | 2015-02-18 | 武汉大学 | Optimal training sample selection method for broad band spectrum imaging system |
CN106570136A (en) * | 2016-11-02 | 2017-04-19 | 中国科学院深圳先进技术研究院 | A remote sensing image semantic retrieval method and device based on pixel-level association rules |
CN109596543A (en) * | 2018-11-25 | 2019-04-09 | 西安建筑科技大学 | The spectral reflectance recovery method of particle group optimizing multicore support vector regression |
EP3608701A1 (en) * | 2018-08-09 | 2020-02-12 | Olympus Soft Imaging Solutions GmbH | Method for providing at least one evaluation method for samples |
CN111047539A (en) * | 2019-12-27 | 2020-04-21 | 上海工程技术大学 | A Color Calibration Algorithm for Fabric Image Based on Spectral Reflectance Reconstruction |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7421018B2 (en) * | 2003-10-23 | 2008-09-02 | Texas Instruments Incorporated | System and method for selecting precursor equalizer coefficients and serializer deserializer incorporating the same |
-
2021
- 2021-03-16 CN CN202110281047.XA patent/CN113095368B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101953148A (en) * | 2008-02-22 | 2011-01-19 | 日本电气株式会社 | Method for processing color image, color processing device and color processing program |
CN104359556A (en) * | 2014-11-14 | 2015-02-18 | 武汉大学 | Optimal training sample selection method for broad band spectrum imaging system |
CN106570136A (en) * | 2016-11-02 | 2017-04-19 | 中国科学院深圳先进技术研究院 | A remote sensing image semantic retrieval method and device based on pixel-level association rules |
EP3608701A1 (en) * | 2018-08-09 | 2020-02-12 | Olympus Soft Imaging Solutions GmbH | Method for providing at least one evaluation method for samples |
CN109596543A (en) * | 2018-11-25 | 2019-04-09 | 西安建筑科技大学 | The spectral reflectance recovery method of particle group optimizing multicore support vector regression |
CN111047539A (en) * | 2019-12-27 | 2020-04-21 | 上海工程技术大学 | A Color Calibration Algorithm for Fabric Image Based on Spectral Reflectance Reconstruction |
Non-Patent Citations (4)
Title |
---|
Hui-Liang Shen 等.Estimation of spectral reflectance of object surfaces with the consideration of perceptual color space.《OPTICS LETTERS》.2007,第32卷(第1期), * |
任澳 等.基于加权欧氏距离的光谱重构训练样本选择.《包装工程》.2020,第41卷(第15期), * |
张显斗.数字图像颜色复现理论与方法研究.《中国优秀博士学位论文全文数据库 信息科技辑》.2011,(第08期), * |
李婵 等.基于主成分分析的光谱重建训练样本选择方法研究.《光谱学与光谱分析》.2016,第36卷(第5期), * |
Also Published As
Publication number | Publication date |
---|---|
CN113095368A (en) | 2021-07-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Barnard et al. | A comparison of computational color constancy algorithms. ii. experiments with image data | |
US9076068B2 (en) | Method and apparatus for evaluating color in an image | |
CN109596543B (en) | Spectral reflectivity reconstruction method for particle swarm optimization multi-core support vector regression | |
US20230349765A1 (en) | Apparatus and Method for Effect Pigment Identification | |
CN110222903A (en) | A kind of Rice Yield Prediction method and system based on unmanned aerial vehicle remote sensing | |
CN109373918B (en) | An efficient optical measurement method for thin film thickness measurement of two-dimensional materials | |
CN105069234B (en) | The spectrum dimension reduction method and system of a kind of view-based access control model Perception Features | |
KR20190035476A (en) | Hyperspectral Imaging Reconstruction Method Using Prism and System Therefor | |
CN110717485B (en) | Hyperspectral image sparse representation classification method based on local retention projection | |
CN109191560A (en) | Monocular based on scattered information correction polarizes three-dimensional rebuilding method | |
CN108051376A (en) | A kind of spectrum reconstruction method based on RGB color camera image | |
Geng et al. | A small target detection method for the hyperspectral image based on higher order singular value decomposition (HOSVD) | |
CN113506235A (en) | An Adaptive Weighted Spectral Reconstruction Method Against Exposure Variation | |
CN111126463B (en) | Spectral image classification method and system based on local information constraints and sparse representation | |
CN113095368B (en) | A spectral color representative sample selection method and system | |
CN112785693B (en) | Method, system and device for generating intrinsic hyperspectral point cloud | |
CN103955711A (en) | Mode recognition method in imaging spectrum object recognition analysis | |
CN111750993B (en) | Open measurement environment spectrum measurement method based on imaging condition correction | |
Li et al. | A multispectral remote sensing data spectral unmixing algorithm based on variational Bayesian ICA | |
CN111795742B (en) | A Dimensionality Reduction Method for Spectral Reconstruction from a Single RGB Image | |
CN103198478A (en) | Light spectrum matching detection method based on co-integration theory | |
Cao et al. | Multi-atlas based image selection with label image constraint | |
CN116071241B (en) | Hyperspectral Image Stitching Method Based on Optimal Stitching Line and Graph Cut Model Solution | |
CN119131045B (en) | A non-contact method for correcting external phenotypic parameters and spectra of single soybean leaves | |
Zhang et al. | Reflectance estimation using local regression methods |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |