K
khaleel.alyasini
Hello sirs & madams,
I'm currently working on DCT compression algorithm as my project. My
knowledge on C++ and DSP is rather weak/moderate. I was wondering if
any could help me and teach me the guidelines of DCT image compression.
Basically, this is my coding in C++ on extracting pixels values from a
RAW image file. It has errors, anyone could help me?
#include <iostream.h>
#include <stdio.h>
#include <math.h>
#include <fstream.h>
#include <conio.h>
#include <malloc.h>
#include <iomanip.h>
#define pix 256
int v[pix][pix];
void main()
{
unsigned char pixelvalues[pix][pix];
/********************/
/* READ */
ifstream rawimage("lena.raw");
if(!rawimage)
{
cerr<<"Error in reading file\n";
}
for(int i=0; i<pix; i++)
{
for(int j=0; j<pix; j++)
{
rawimage>>pixelvalues[j];
}
}
rawimage.close();
/********************/
/* DISPLAY */
for(int m=0; m<pix; m++)
{
for(int n=0; n<pix; n++)
{
cout<<pixelvalues[n][m]<<" ";
}
cout<<"\n";
}
}
by the way, when i run this program, the output shows the values in
unsigned char, how to convert to decimal values in C++? anyway, what's
the next step in image compression by using DCT algorithm?
thanks in advance,
Khaleel alyasini
Final year student of KUTKM, Malaysia.
Electronic & Computer Engineering.
I'm currently working on DCT compression algorithm as my project. My
knowledge on C++ and DSP is rather weak/moderate. I was wondering if
any could help me and teach me the guidelines of DCT image compression.
Basically, this is my coding in C++ on extracting pixels values from a
RAW image file. It has errors, anyone could help me?
#include <iostream.h>
#include <stdio.h>
#include <math.h>
#include <fstream.h>
#include <conio.h>
#include <malloc.h>
#include <iomanip.h>
#define pix 256
int v[pix][pix];
void main()
{
unsigned char pixelvalues[pix][pix];
/********************/
/* READ */
ifstream rawimage("lena.raw");
if(!rawimage)
{
cerr<<"Error in reading file\n";
}
for(int i=0; i<pix; i++)
{
for(int j=0; j<pix; j++)
{
rawimage>>pixelvalues[j];
}
}
rawimage.close();
/********************/
/* DISPLAY */
for(int m=0; m<pix; m++)
{
for(int n=0; n<pix; n++)
{
cout<<pixelvalues[n][m]<<" ";
}
cout<<"\n";
}
}
by the way, when i run this program, the output shows the values in
unsigned char, how to convert to decimal values in C++? anyway, what's
the next step in image compression by using DCT algorithm?
thanks in advance,
Khaleel alyasini
Final year student of KUTKM, Malaysia.
Electronic & Computer Engineering.