This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS320C6748 design digital of image processing image data, how to read image data? what have function for CCS Read "BMP" information.

Other Parts Discussed in Thread: TMS320C6748

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();
}

  • Hi,

    Thanks for your post.

    I think, C674x devices are a part of c64x+ devices which does supports DSP IMG library package and you can download the same from the below link:

    http://www.ti.com/tool/sprc264

    May be, you could try optimized general-purpose image/video processing library routines in the above package and with these routines, you can achieve higher performance than equivalent code written in standard C language. By providing ready-to-use DSP functions with source code, IMGLIB can significantly shorten your application development time

    Even

    After installing, you could use the c64x+ DSP image library functions in your code by adding the IMGLIB path into your project, sothat, it could make your CPU execution more optimized & faster.

    Even you could refer the c64x app. report & library ref. guide as below:

    http://www.ti.com/lit/an/spra887/spra887.pdf

    http://www.ti.com/lit/ug/spru023b/spru023b.pdf

    Thanks & regards,

    Sivaraj K

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.

    -------------------------------------------------------------------------------------------------------

  • Never rely on struct to give you the correct offset of the fields in a file.
    You never know what's happening inside.
    For C6000, shorts are 16 bits but takes 32 bits in a struct, and longs are 40 bits but takes 64 bits.
    Easy solution is to use something like python or matlab to convert bmp to raw and fread in ccs.
  • you think the issue wich how to  do for TMS320C6748 read "BMP" of image datas?

  • I'm not quite into the idea of using libraries to load BMPs in a C environment.

    Like I said, I usually convert images to raw data and use plain "fopen/fread/fclose" functions.

    Actually I my work-related images are saved as raw data so I hardly have accesses to other image formats.