I have some legacy code that was writing to a NITF file to display some images. In the legacy code, it appears as if there was a LUT being used, and there was a section of code that wrote out a row at a time to the NITF file , and the values of that row were calculated like so:
// convert RGB to LUT values
unsigned char *lutData = new unsigned char[numBytes/3];
for (unsigned j = 0 ; j < numBytes/3 ; j++)
lutData[j] = (unsigned char) stuff;
Where data was my original array of unsigned chars.
So now I am trying to take that data array and output it into a QImage in my GUI.
It would seem to me in the NITF, there was a block of LUT data that was "rows x cols" in size, right? So I created an array of that lut data:
unsigned char *lutData = new unsigned char[imwidth * imheight];
QImage *qi = new QImage(imwidth,imheight, QImage::Format_Indexed8);
for (int i = 0 ; i < imheight ; i++)
{
#pragma omp parallel for
for (int j = 0 ; j < imwidth ; j++)
{
lutData[i*imwidth + j] = stuff;
}
}
and then I tried to populate the qimage like this:
for (int i = 0 ; i < imheight ; i++)
{
#pragma omp parallel for
for (int j = 0 ; j < imwidth ; j++)
{
qi->setPixel(j,i,qRgb(lutData[i*imwidth + j],lutData[i*imwidth + j],lutData[i*imwidth + j]));
}
}
However, this seems to more or less just give me a grayscale image, instead of my actual data.
What am I doing wrong?
Thanks!