/*
Read a 808 x 627 colour image in raw format into C
A raw image contains successive 24 bits. The first 8 bits is red. The second 8 bits is blue.
The last 8 bits is blue.
*/
#include
#include
#include
#include
#include
/* Global Declarations */
#define IW 808 // Image Width
#define IH 627 // Image Height
unsigned char InputImage [IW][IH][4];
// Read an input image from a .raw file with double
void ReadRawImage ( unsigned char Image[][IH][4] )
{
FILE *fp;
int i, j, k;
char filename[50];
unsigned char temp;
printf (“Input filename (e.g. test.raw): “);
scanf (“%s”, filename);
printf (“\n”);
if (fopen_s (&fp, filename, “rb”) != 0)
{
printf(“Error (ReadImage) : Cannot read the file!!\n”);
exit(1);
}
for ( i=0; i