void operation::addColorCast(IplImage pFrame, int color)
{
switch (color)
{
case 0://偏红
{
cout<<"blue "<<endl;
uchar data = (uchar*)pFrame->imageData;
int row = pFrame->height;
int col = pFrame->width;
for(int i = 0;i < row;i++)
{
for(int j = 0;j < col;j++)
{
data[i * pFrame->widthStep + j * pFrame->nChannels + 0] = 255;
}
}
break;
}
case 1://偏绿
{
cout<<"green "<<endl;
uchar* data = (uchar*)pFrame->imageData;
int row = pFrame->height;
int col = pFrame->width;
for(int i = 0;i < row;i++)
{
for(int j = 0;j < col;j++)
{
data[i * pFrame->widthStep + j * pFrame->nChannels + 1] = 255;
}
}
break;
}
中的data[i * pFrame->widthStep + j * pFrame->nChannels + 0] = 255;
是基于什么原理的 ,为什么要为什么这么写算式