TMS320C6748 design digital of image processing image data, how to read image data? what have function for CCS Read "BMP" information. as below code for can't work .why?
#include"stdio.h"
#include"stdlib.h"
typedef char ElemType;
struct ImgInfo
{unsigned short ImgBitType; //
unsigned short BmpHeight; //
unsigned short BmpWidth; //
unsigned short BmpDataPos; //
unsigned long BmpSize; //
unsigned long BmpCompression; //
};
void GetBmpInfo(FILE *fpBmp,struct ImgInfo *ImgInfo1) //
{
fseek(fpBmp,0,0); //
fread(&ImgInfo1->BmpDataPos,2,1,fpBmp);
getchar();
}
void ReadImgData(FILE *fpBmp,struct ImgInfo *ImgInfo1,char *BmpData) //
{
fseek(fpBmp,ImgInfo1->BmpDataPos,0); //
fread(BmpData,ImgInfo1->BmpSize,1,fpBmp);
}
void Cnvt24bit()
{
FILE *fpBmp; //
struct ImgInfo ImgInfo1; //
char *BmpData; //
fpBmp=fopen("C:/ti/examples/sim62xx/xdais/firtest/xiaotu.bmp","rb"); if(fpBmp==NULL) {printf("Err open file");getchar();} //
GetBmpInfo(fpBmp,&ImgInfo1); //
BmpData =(char *)malloc(ImgInfo1.BmpSize); if(BmpData==NULL) {printf("Err Malloc");getchar();} //
ReadImgData(fpBmp,&ImgInfo1,BmpData); //
fclose(fpBmp);
getchar();
}
void main()
{
Cnvt24bit();
}