1. Computer Project for Chapter 1
1. (a) Obtain a set of YCrCb images for the set of 256x256 RGB Lena
Images (Lena256C.bmp is a color input image)
(b) Obtain a set of HIS images for the set of RGB images
2. Obtain images subsampled with (2:1)x(2:1), (4:1)x(4:1) from 512x512
Lena image. Display the original image and the subsampled ones with
the same size and compare their qualities (Le512.raw is a gray input
image).
3. Obtain 1-, 2-, 4-, 6-bit images from 8-bit 512x512 Lena image.
Display the original image and the outputs, and compare their
qualities (Le512.raw is a gray input image).
Note:
1. Lena256C is a bitmap color image. You should read it out in your
program using the following referenced function in C++, and then RGB
images will be stored in * * * array for further processing
======
unsigned char*** ReadRGB(char *str, int &height, int &width, int &bit)
{
unsigned char ***rgb=NULL;
FILE *fp;
if((fp=fopen(str,"rb"))==NULL)
{
// AfxMessageBox("file open error");
return(rgb);
}
BITMAPFILEHEADER bmpfileheader;
fread(&bmpfileheader,sizeof(BITMAPFILEHEADER),1,fp);
3. for(int y=0;y<height;y++)
for(int x=0;x<width;x++)
{
for(i=0;i<byte_count;i++)
{
rgb[byte_count-i-1][x][y]=getc(fp);
}
}
fclose(fp);
return(rgb);
}
======
2. Lena.raw is a 8-bit gray scale image. You may refer the following code:
======
float x[256][256], y[256][256]; //x array for in put, y array for output
FILE *fo ,*fs ;
int i,j;
fo=fopen("lena.raw","rb");//for reading raw image
for(i=0;i<256;i++)
{
for(j=0; j<256; j++)
{
x[i][j]=(float)getc(fo);
}
}
fs=fopen("output.raw","wb");// for writing raw image
for(i=0;i<256;i++)
{