模拟色偏的问题 给图像视频添加色偏

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;
        是基于什么原理的  ,为什么要为什么这么写算式

和之前回答你的问题一样,rgb(红绿蓝),所以不加是红色,+1是绿色,+2是蓝色。