void SharpenInt(unsigned int *_src, unsigned int *_dst, int _width, int _height)
{
int *Ix = tmpBuff;
int *Iy = tmpBuff + _width * _height * sizeof(int);
// 求梯度
for (int y = 0; y < _height; y++)
{
int offset = y * _width;
Ix[offset] = abs((int)_src[offset + 1] - (int)_src[offset]) * 2;
for (int x = 1; x < _width - 1; x++)
Ix[offset + x] = abs((int)_src[offset + x + 1] - (int)_src[offset + x - 1]);
Ix[offset + _width - 1] = abs((int)_src[offset + _width - 1] - (int)_src[offset + _width - 2]) * 2;
}
for (int x = 0; x < _width; x++)
{
Iy[x] = abs((int)_src[_width + x] - (int)_src[x]) * 2;
for (int y = 1; y < _height - 1; y++)
Iy[y * _width + x] = abs((int)_src[(y + 1) * _width + x] - (int)_src[(y - 1) * _width + x]);
Iy[(_height - 1) * _width + x] = abs((int)_src[(_height - 1) * _width + x] - (int)_src[(_height - 2) * _width + x]) * 2;
}
for (int y = 0; y < _height; y++)
{
int offset = y * _width;
for (int x = 0; x < _width; x++)
{
int temp = _src[offset + x] + Ix[offset + x] + Iy[offset + x];
//CUTOFF(temp, 0, 255);
_dst[offset + x] = (unsigned int)temp;
}
}
}