【发布时间】:2021-12-10 18:48:21
【问题描述】:
我尝试将下面的解决方案实现到 C++ 并将其用作我自己问题的参考。
Automatic White Balancing with Grayworld assumption
这是我的进步:
cap>>frame;
cvtColor(frame, res, COLOR_BGR2Lab);
Point3_<uchar> pixelData;
int step = frame.step;
int channels = res. channels();
for( int i = 0; i< res.rows; i++){
for(int j= 0 ; j<res.cols; j++){
//*L
pixelData.x = res.data[step*i + channels*j + 0];
pixelData.x *= 100/255.0;
//*a
pixelData.y = res.data[step*i + channels*j + 1];
pixelData.y *= (frame.data[step*i + channels*j + 1] ) - ((pixelData.y - 128) * (pixelData.x/100) * 1.1);
//*b
pixelData.z = res.data[step*i + channels*j + 2];
pixelData.z *= (frame.data[step*i + channels*j + 2] ) - ((pixelData.z - 128) * (pixelData.x/100) * 1.1);
}
res.at<Mat>(1) = pixelData.y; //HOW TO DO THIS PART???
res.at<Mat>(2) = pixelData.z;
}
cvtColor(res, res, COLOR_Lab2BGR);
我有 2 个问题
-
我想,方法是将 l,a,b 参数安排到适当的比例,然后更新 LAB Mat 向量。 我坚持更新 res
中的 L A B 参数 -
如何将参考链接中的
final = np.hstack((img, white_balance_loops(img)))部分转换为C++?
【问题讨论】: