我需要将RGB图像映射到ColorChecker的sRGB,并使用由此获得的系数来校正数据库中其他(舌头图像)图像的颜色
我已经尝试了线性回归,但是不确定多元线性回归是否正确,文献建议多项式回归是更好的预测
df=pd.read_csv("colorchart_photo_strobo_linear.csv")
df=pd.read_csv("colorchart_photo_strobo_linear.csv")
y=df.iloc[:,1:4].values
yr=df.iloc[:,1:2].values
yg=df.iloc[:,2:3].values
yb=df.iloc[:,3:4].values
df1=pd.read_csv("colorchart_rendered_strobo_linear.csv")
x=df.iloc[:,1:4].values
plt.scatter(x, y, color='red')
plt.grid(True)
regr1 = linear_model.LinearRegression()
regr.fit(x, yr)
print('Intercept: \n', regr.intercept_)
print('Coefficients: \n', regr.coef_)
plt.plot(x,y,color='blue')
plt.show()
regr2 = linear_model.LinearRegression()
regr.fit(x, yg)
print('Intercept: \n', regr.intercept_)
print('Coefficients: \n', regr.coef_)
plt.plot(x,y,color='green')
plt.show()
regr3 = linear_model.LinearRegression()
regr.fit(x, yb)
print('Intercept: \n', regr.intercept_)
print('Coefficients: \n', regr.coef_)
plt.plot(x,y,color='magenta')
plt.show()
#prediction with sklearn
x = [[0.14703, 0.10224, 0.0319]]
print ('printyr: \n', regr.predict(x))
所需的是Xout = [A] Transpose.Xin