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<iostream.h>
#include<fstream.h>
#include<malloc.h>
#include<conio.h>
#include<stdlib.h>
int **CreateImage(int , int);
int main(void)
{
char buffer[1200];
ifstream inFile("22354.bmp");
if (!inFile);
{
cout << "Unable to open the file\n";
return 1;
}
while (inFile >> buffer)
cout << buffer << endl;
inFile.close();
return 0;
int **myImage = NULL;
myImage = CreateImage(1200,1200);
}
int **CreateImage(int m, int n)
{
int **pt = (int ** ) malloc (n * sizeof (int));
if (pt == NULL)
{
cout << "not enough memory";
getch();
exit(0);
}
return pt;
}
int **CreateImage(int m, int n)
{
int **pt = (int ** ) malloc (n * sizeof (int*));
if (pt == NULL)
{
cout << "not enough memory";
getch();
exit(0);
}
for(int i = 0; i<n; i++)
{
pt[i] = (int * ) malloc (m * sizeof (int*));
if (pt[i] == NULL)
{
cout << "not enough memory";
getch();
exit(0);
}
}
return pt;
}
char buffer[1200];
ifstream inFile("image.bmp");
if (!inFile);
{
cout << "Unable to open the file\n";
return 1;
}
while (inFile >> buffer)
cout << buffer << endl;
inFile.close();
return 0;
void Threshold (int **in_image, int x_max, int y_max, int threshold)
{
for(int x=0; x<x_max; x++)
{
for(int y=0; y<y_max; y++)
{
if (in_image[x][y] >= threshold)
in_image[x][y] = 255;
else
in_image[x][y] = 0;
}
}
}
what is the header information?You need to read the header information from the file first
typedef struct tagBITMAPFILEHEADER { /* bmfh */
UINT bfType;
DWORD bfSize;
UINT bfReserved1;
UINT bfReserved2;
DWORD bfOffBits;
} BITMAPFILEHEADER;