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.

dm6437 image processing

Dear sir,

I have a C code for image processing where i have binary data of image generated by Matlab,

,i got to know that we can see the ouput of processed image in CCS IDE itself,

if so,can you tell me how to see the image in CCS IDE itself,what all the settings i need to do for that in CCS,

Am using CCS3.3,PLEASE GO THROUGH MY CODE and tell me how can i see the output.

thank you.NAS_ticcs.rar

  • If you know the address of the processed image buffer, you can open the Image window in one of the menu options in CCS V3.3 and can provide the RGB/YUV start address as your processed image buffer base address. Accordingly fill other parameters like width, height of the image in the pop up window.
  • Hi All,
    I have shared the code ,please can you help me to take the image on the CCS IDE itself.
    Requesting to go through the program.
    thank you.
  • Hi Texas Team,
    waiting for your reply.
    thank you.
  • Use the following code in your CCS project

    #include <stdio.h>
    #include <stdlib.h>
    
    #define WIDTH	176
    #define HEIGHT	144
    
    void NearestNeighbor(unsigned char *in, unsigned char *out, unsigned int width, unsigned int height);
    void Process(unsigned char *in, unsigned char *out, unsigned int width, unsigned int height);
    
    unsigned char *yIn, *cbIn, *crIn;
    unsigned char *yOut, *cbOut, *crOut;
    
    int main(void)
    {
    	FILE *fin, *fout;
    	unsigned char *inbuf, *outbuf;
    	unsigned int NoOfFrames, filesize, frame, Framesize;
    
    	if ((fin = fopen("C:\\Input.yuv", "rb")) == NULL) {
    		printf ("Error: Opening YUV file...\n");
    		return -1;
    	}
    	if ((fout = fopen("Output.yuv", "wb")) == NULL) {
    		printf ("Error: Opening output YUV file...\n");
    		return -1;
    	}
    
    	Framesize = WIDTH * HEIGHT * 3 / 2;
    	inbuf = (unsigned char*) malloc(Framesize);
    	outbuf = (unsigned char*) malloc((2 * WIDTH) * (2 * HEIGHT) * 3 / 2);
    
    	if (inbuf == NULL) {
    		printf ("Error: Memory allocation of Input buffer.\n");
    		return -1;
    	}
    	if (outbuf == NULL) {
    		printf ("Error: Memory allocation of Output buffer.\n");
    		return -1;
    	}
    
    	yIn = inbuf;
    	cbIn = yIn + WIDTH * HEIGHT;
    	crIn = cbIn + (WIDTH >> 1) * (HEIGHT >> 1);
    
    	yOut = outbuf;
    	cbOut = yOut + WIDTH * HEIGHT * 4;
    	crOut = cbOut + WIDTH * HEIGHT;
    
    	//	Finding the Number of Frames
    	fseek(fin, 0, SEEK_END);
    	filesize = ftell(fin);
    	rewind(fin);
    	NoOfFrames = filesize / Framesize;
    	printf ("Number of Frames = %d\n", NoOfFrames);
    
    	/************************************************************************
    	 * Read one frame & upscale the frame									*
    	 * Repeat the above process for all the frames in the file				*
    	 ************************************************************************/
    	for (frame = 0; frame < NoOfFrames; frame++) {
    		fread(inbuf, sizeof(unsigned char), Framesize, fin);
    		NearestNeighbor(inbuf, outbuf, (unsigned int) WIDTH, (unsigned int) HEIGHT);
    		// fwrite(outbuf, sizeof(unsigned char), Framesize * 4, fout);
    		printf ("Processed Frame %d.\n", frame);
    	}
    
    	fclose(fin);
    	fclose(fout);
    	return 0;
    }
    
    void NearestNeighbor(unsigned char *in, unsigned char *out, unsigned int width, unsigned int height)
    {
    	unsigned char *inY, *inCb, *inCr, *outY, *outCb, *outCr;
    
    	// Calculation of Input & Output YCbCr positions
    	inY = in;
    	inCb = inY + WIDTH * HEIGHT;
    	inCr = inCb + (WIDTH >> 1) * (HEIGHT >> 1);
    	outY = out;
    	outCb = outY + 4 * WIDTH * HEIGHT;
    	outCr = outCb + WIDTH * HEIGHT;
    
    	//	Processing the Luminance(Y)
    	Process(inY, outY, width, height);
    	//	Process the Chrominance(CbCr)
    	Process(inCb, outCb, width >> 1, height >> 1);
    	Process(inCr, outCr, width >> 1, height >> 1);
    
    	return;
    }
    
    void Process(unsigned char *in, unsigned char *out, unsigned int width, unsigned int height)
    {
    	unsigned int row, col;
    
    	for (row = 0; row < height; row++) {
    		for (col = 0; col < width; col++) {
    			*out++					= *in;
    			*(out + 2 * width)		= *in;
    			*(out + 2 * width - 1)	= *in;
    			*out++					= *in++;
    		}
    		out += 2 * width;
    	}
    
    	return;
    }

    Use the pointers *yIn, *cbIn, *crIn in the image window in CCS. Select YUV420 format. Download any QCIF (176*144)YUV video from and provide that as input to this program

  • Hi Karthik,

    Thanks for your help ,i ll try in our company on Monday and update you on the same day.I want your support .

    thank you.

  • Hi Kartheek,

    I have generated .out file in ccs6.1 and i loaded that .out file in CCS3.3.Am not getting where to do all the settings as you told about pointers and where to add the input file.

    "Use the pointers *yIn, *cbIn, *crIn in the image window in CCS. Select YUV420 format. Download any QCIF (176*144)YUV video from

    and provide that as input to this program".......
    when i open the graph and image ,it was showing this settings as shown in attachment.....but not getting where to do pointer settings and when i run the program,it was showing "cant read memory at the adress,change the address.........requesting to sort it out.
    thank you.
  • You can fill the window with the following details

    Start Address - Y Source - yIn
    Start Address - U Source - cbIn
    Start Address - V Source - crIn
    Lines Per Display - 144
    Pixels Per Line - 176
    Byte Packing to Fill 32 Bits - No
    Image Row 4-Byte Aligned - No
    YUV Ratio - 4:2:0
    Image Origin - Top Left
  • Add a breakpoint towards the end of the main() function or at the end of the for loop and refresh the image window. Your input image will be displayed in the image window. For more details you will have to learn about image and video color space basics.
  • Hi Kartheek ,

    thanks for your support,i know something about image and video processing as i did on OMAPL137/138,but i have not done on DM6437 and in CCSv3.3.

    i am only following the steps what and all you are telling,i did that configuration but i got like this..........see the attachment ........how to overcome from this.

    thank you.

  • I need your support badly,please sort it out
  • What are you trying to do with DM6437? Could you please let me know your requirements?
  • Hi,

    Is this issue resolved?

    Regards,
    Shwetha