spyderlove
Newbie level 1
can anyone suggest book having Digital Image Processing using Visual C++?
Its very urgent..
Its very urgent..
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#include<iostream.h>
#include<stdlib.h>
#include <fstream.h>
#include<math.h>
void main()
{
unsigned char buffer;
int width=0,height=0,i=0,y=0,s=0,temp;
char inputFile[]="test2.bmp"; //This is the input image
char ouputFile[]="C:\\outdata.bmp"; //This is the output image
float j=1.75,s1=0,temp1=0;
double gamma;
ifstream input(inputFile,ios::in|ios::binary);
ofstream output(ouputFile,ios::out|ios::binary);
cout<<"Gamma Correction Example"<<endl;
cout<<"Type value for gamma = "<<endl;
cin>>gamma;
if (!input)
cout << "Error in file name"<<endl;
else
{
cout << "File: " << inputFile << endl;
//Calculate Image width
for(i=0;i<=3;i++)
{
input.seekg(18+i,ios::beg);
input.get(buffer);
width += (buffer<<8*i);
}
//Calculate Image height
for(i=0;i<=3;i++)
{
input.seekg(22+i,ios::beg);
input.get(buffer);
height += (buffer<<8*i);
}
cout<<"Width of image in pixels = "<<width<<endl;
cout<<"Height of image in pixels = "<<height<<endl;
if (gamma < 1)
{
while(y <= 254)
{
y = pow(255,gamma)*j;
j = j + 0.01;
}
}
//Copy same header and color table for the output image
for(i=0;i<=(54+1024+width*height-1);i++)
{
input.seekg(i,ios::beg);
input.get(buffer);//Here we read input data from input image
if (i > 1077)
{
////////////////////////////////////////////////////
//HERE YOU WRITE THE CODE FOR PROCESSING INPUT DATA
///////////////////////////////////////////////////
if (gamma >= 1)
{
temp = buffer;
s = pow(temp,gamma)/pow(255,(gamma-1));
buffer = s;
output.put(buffer);
//cout<<s<<endl;
}
else
{
temp1 = buffer;
s1 = pow(temp1,gamma)*j;
buffer = s1;
output.put(buffer);//Here you copy data to the output image
//cout<<s1<<endl;
}
////////////////////////////////////////////////////
//HERE ENDS IMAGE PROCESSING CODE
///////////////////////////////////////////////////
}
else
output.put(buffer);//Here you copy data to the output image
}
}
}