unsigned char* getDirectionGray( unsigned char** ptrCenterRow, int j)
{
unsigned char p[4]; //如果修改成*p则出现段错误,还没搞懂
p[0] = abs(ptrCenterRow[-1][(j-1)] -ptrCenterRow[0][j]) +
abs(ptrCenterRow[1][(j+1)]-ptrCenterRow[0][j]);
cout << "d0:" << p[0] << endl;
printf("%d
", p[0]);
p[1] = abs(ptrCenterRow[-1][j]-ptrCenterRow[0][j])+
abs(ptrCenterRow[1][j]-ptrCenterRow[0][j]);
cout << "d1:" << p[1] << endl;
printf("%d
", p[1]);
p[2] = abs(ptrCenterRow[1][(j+1)]-ptrCenterRow[0][j]) +
abs(ptrCenterRow[1][(j-1)]-ptrCenterRow[0][j]);
cout << "d2:" << p[2] << endl;
printf("%d
", p[2]);
p[3] = abs(ptrCenterRow[0][(j-1)]-ptrCenterRow[0][j]) +
abs(ptrCenterRow[0][(j+1)] - ptrCenterRow[0][j]);
cout << "d3:" << p[3] << endl;
printf("%d
", p[3]);
cout << "getDirectionGray()" << endl;
return p;
}
The Safest Way to Get what you Want is to Try and Deserve What you Want.