L
lmeagle01
Unregistered / Unconfirmed
GUEST, unregistred user!
我在做图像不变矩的时候遇到了点问题,就是
double *WINAPI GetMomentFeatures (LPSTR lpDIBBits, LONG lWidth, LONG lHeight)
{
LONG lLineBytes; //每行的字节数
lLineBytes = WIDTHBYTES(lWidth * 8);
unsigned char **cTemp;
cTemp = cmatrix(0, lHeight-1, 0, lLineBytes-1);//具体函数在下面给出了
unsigned char* pmid = (unsigned char *) lpDIBBits;
long i,j;
for(i = 0;
i < lHeight;
i++)
{
for(j = 0;
j < lLineBytes;
j++)
{
cTemp[j] = *pmid;//[red]这里出错[/red]
pmid++;
}
}
。。。。。。。。
。。。。。。。。
。。。。。。。。
}
/*****************************************************************************
* 函数名称:cmatrix
* 功能:申请一个无符号字符型二维数组(矩阵)
* 参数:nrl:数组的行最低下标
* nrh:数组的行最高下标
* ncl:数组的列最低下标
* nch:数组的列最高下标
* 返回:数组地址
*/
unsigned char **cmatrix(long nrl,long nrh,long ncl,long nch)
{
int i;
unsigned char **m;
m=(unsigned char **) calloc((unsigned) (nrh-nrl+1),sizeof(unsigned char*));
if (!m) MessageBox(NULL,"allocation failure 1 in dmatrix()", "错误提示" , MB_ICONINFORMATION | MB_OK);
//nrerror("allocation failure 1 in dmatrix()");
m -= nrl;
for(i=nrl;i<=nrh;i++) {
m=(unsigned char *) calloc((unsigned) (nch-ncl+1),sizeof(unsigned char));
if (!m) MessageBox(NULL,"allocation failure 2 in dmatrix()", "错误提示" , MB_ICONINFORMATION | MB_OK);//nrerror("allocation failure 2 in dmatrix()");
m -= ncl;
}
return m;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
请高手帮忙,或者谁有现成的关于vc的图像处理的不变矩代码发给我也行,分不是问题
double *WINAPI GetMomentFeatures (LPSTR lpDIBBits, LONG lWidth, LONG lHeight)
{
LONG lLineBytes; //每行的字节数
lLineBytes = WIDTHBYTES(lWidth * 8);
unsigned char **cTemp;
cTemp = cmatrix(0, lHeight-1, 0, lLineBytes-1);//具体函数在下面给出了
unsigned char* pmid = (unsigned char *) lpDIBBits;
long i,j;
for(i = 0;
i < lHeight;
i++)
{
for(j = 0;
j < lLineBytes;
j++)
{
cTemp[j] = *pmid;//[red]这里出错[/red]
pmid++;
}
}
。。。。。。。。
。。。。。。。。
。。。。。。。。
}
/*****************************************************************************
* 函数名称:cmatrix
* 功能:申请一个无符号字符型二维数组(矩阵)
* 参数:nrl:数组的行最低下标
* nrh:数组的行最高下标
* ncl:数组的列最低下标
* nch:数组的列最高下标
* 返回:数组地址
*/
unsigned char **cmatrix(long nrl,long nrh,long ncl,long nch)
{
int i;
unsigned char **m;
m=(unsigned char **) calloc((unsigned) (nrh-nrl+1),sizeof(unsigned char*));
if (!m) MessageBox(NULL,"allocation failure 1 in dmatrix()", "错误提示" , MB_ICONINFORMATION | MB_OK);
//nrerror("allocation failure 1 in dmatrix()");
m -= nrl;
for(i=nrl;i<=nrh;i++) {
m=(unsigned char *) calloc((unsigned) (nch-ncl+1),sizeof(unsigned char));
if (!m) MessageBox(NULL,"allocation failure 2 in dmatrix()", "错误提示" , MB_ICONINFORMATION | MB_OK);//nrerror("allocation failure 2 in dmatrix()");
m -= ncl;
}
return m;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
请高手帮忙,或者谁有现成的关于vc的图像处理的不变矩代码发给我也行,分不是问题