To explain more, for the thermal mapping using grayscale converted to RGB, red denotes hot areas, green-zero, and blue-cold. What I want to do is to make a program that enables you to choose the colours from the five I mentioned above to represent the hot, zero and cold areas. This is the program, using Microsoft visual Studio C++ .
This program reads from the text file map24 and puts it in the RGB variable.
Expand|Select|Wrap|Line Numbers
- int readmappingFile()
- {
- FILE *fp;
- int i;
- fp = fopen("C:\\map24.txt", "r");
- if(fp != NULL)
- {
- for(i=0; i<256; i++)
- {
- fscanf(fp, "%d %d %d", &R[i], &G[i], &B[i]);
- }
- }
- return OK;
- }
Expand|Select|Wrap|Line Numbers
- int temperatureMappingCore()
- {
- byte index;
- int w, h;
- int gWStep, cWStep;
- gWStep = inImg->widthStep;
- cWStep = outImg->widthStep;
- for(h=0; h<inImg->height; h++)
- {
- for(w=0; w<inImg->width; w++)
- {
- index = (byte)inImg->imageData[h*gWStep + w];
- outImg->imageData[h*cWStep + w*3] = B[index];
- outImg->imageData[h*cWStep + w*3 + 1] = G[index];
- outImg->imageData[h*cWStep + w*3 + 2] = R[index];
- }
- }
- return OK;
- }