step.p是一個數組,每個元素計算公式
element=channel*depth;
total=channel*depth;
for(i=dims-1;i>=0;i--)
{
step.p[i]=total;
total=total*size[i];
}
而step1是一個函數
inline
size_t Mat::step1(int i) const
{
return step.p[i] / elemSize1();
}
舉例:
int matDims[] = {4,5,6};
Mat Mat456(3,matDims, CV_16UC3, Scalar::all(0));
則channel=3,depth=2; element=6;
所以step[0]=6*6*5=180;step[1]=6*6=36;step[2]=6;