Currently I got a thermal image mapping program which converts grayscale pictures to RGB. Now, what I need to do is to convert those 3 RGB colors into other three colours. The choice of colours are white, black, red, green and blue.
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.
This one deals with the RGB conversion.
Can anyone help?
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.
Code:
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; }
Code:
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; }
Comment