text to image conversion

Hi Everybody,

thes days I'm trying to do something that I totaly ignore how to satrt it, thus I hope you could help me acheive my goal. here's my problem:

I wanna transforme a text file containing data of type double into an image.i.e. the firsr line of my file represents the x-coordinates information and the first column represents the y-coordinates information, and the i would like to represent the rest of data as coulours depending on their intensity. the figure bellow shows a representation of the data in my text file:

0	1	2	3	4	5	6	7	8	9	10
1	12.544	13.458	15.325	11.985	9.244	1.245	3.3858	1.315028571	-0.755742857	-2.826514286
2	-22.356	-11.352	-0.348	10.656	21.66	32.664	43.668	54.672	65.676	76.68
3	-57.256	-36.162	-16.021	9.327	34.076	64.083	83.9502	108.0289714	132.1077429	156.1865143
4	124.2324	-60.972	-31.694	7.998	46.492	95.502	-92.156	161.3859429	198.5394857	-47.367
5	-127.056	-85.782	124.352	6.669	58.908	126.921	164.5146	214.7429143	264.9712286	315.1995429
6	394.7060571	-110.592	-63.04	5.34	71.324	158.34	204.7968	268.0998857	331.4029714	-161.956


How would you advice me to proceed to represent this text in an image format (.raw or .im6) for exemple?

thanks in advance for your help

Here is an example of using the EasyBMP header to create a bitmap image. You will have to change the image size, and read in the values from your text file and set the pixel values accordingly.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include "EasyBMP.h"
int main()
{
BMP AnImage;
// Set size to 640 × 480
AnImage.SetSize(640,480);
// Set its color depth to 32-bits
AnImage.SetBitDepth(32);

 for (int i=1;i<100;i++)
	  {
	    for (int j=1; j<100; j++)
	      {
                  // Set one of the pixels
                 AnImage(i,j)->Red = 0;
                 AnImage(i,j)->Green = 0;
                 AnImage(i,j)->Blue = 0;
                 AnImage(i,j)->Alpha = 0;
	      }
}
AnImage.WriteToFile("Output.bmp");
 return 0;
}
Thank you for the answer,

Concerning "EasyBMP.h" is it included in my C++ compiler ? or shall i download it?

thanks
You shall download it.
Topic archived. No new replies allowed.