64,654
社区成员
发帖
与我相关
我的任务
分享
( abs(pGrayscale[i*(Width-2)+j] - pGrayscale[(i+1)*(Width-2)+j+1])
+ abs(pGrayscale[(i+1)*(Width-2)+j] - pGrayscale[i*(Width-2)+j+1]) )
int ProcessingFunc(UCHAR *pBayerBuffer, int nBayerWidth, int nBayerHeight, \
UCHAR *pFrameBuffer, int nFrameBufferPitch, int nFrameBufferHeight, \
void *pMiscellaneousArg)
int ProcessingFunc(UCHAR *pBayerBuffer, int nBayerWidth, int nBayerHeight, \
UCHAR *pFrameBuffer, int nFrameBufferPitch, int nFrameBufferHeight, \
void *pMiscellaneousArg)
{
UCHAR *pGrayscaleBuffer = new UCHAR[(nBayerWidth-2)*(nBayerHeight-2)];
Bayer2Rgb(pBayerBuffer, pFrameBuffer, pGrayscaleBuffer, nBayerWidth, nBayerHeight, 1);//给pGrayscaleBuffer赋值
UINT sum = GetGrayscaleSubtract(pGrayscaleBuffer, nBayerWidth, nBayerHeight);
delete []pGrayscaleBuffer;
return 0;
}
UINT GetGrayscaleSubtract(unsigned char *pGrayscale, int Width, int Height)
{
unsigned int sum = 0;
int i, j;
for (i=0; i<Height-3; i++) {
for (j=0; j<Width-3; j++) {
//屏蔽下面语句后不会触发断点
sum += (abs(pGrayscale[i*(Width-2)+j] - pGrayscale[(i+1)*(Width-2)+j+1]) + abs(pGrayscale[(i+1)*(Width-2)+j] - pGrayscale[i*(Width-2)+j+1]));
}
}
return sum;
}
int ProcessingFunc(UCHAR *pBayerBuffer, int nBayerWidth, int nBayerHeight, \
UCHAR *pFrameBuffer, int nFrameBufferPitch, int nFrameBufferHeight, \
void *pMiscellaneousArg)
{
UCHAR *pGrayscaleBuffer = new UCHAR[(nBayerWidth-2)*(nBayerHeight-2)];
Bayer2Rgb(pBayerBuffer, pFrameBuffer, pGrayscaleBuffer, nBayerWidth, nBayerHeight, 1);//给pGrayscaleBuffer赋值
UINT sum = GetGrayscaleSubtract(pGrayscaleBuffer, nBayerWidth, nBayerHeight);
delete []pGrayscaleBuffer;
return 0;
}
UINT GetGrayscaleSubtract(unsigned char *pGrayscale, int Width, int Height)
{
unsigned int sum = 0;
int i, j;
for (i=0; i<Height-3; i++) {
for (j=0; j<Width-3; j++) {
//屏蔽下面语句后不会触发断点
sum += (abs(pGrayscale[i*(Width-2)+j] - pGrayscale[(i+1)*(Width-2)+j+1]) + abs(pGrayscale[(i+1)*(Width-2)+j] - pGrayscale[i*(Width-2)+j+1]));
}
}
return sum;
}