2

I am using CImg for a few different things in a project and have a grey-scale image that I need to apply a jet_LUT256 color map to. I am not sure if I am on the right path or not. Any guidance would be appreciated.

#include "CImg.h"

using namespace std;
using namespace cimg_library;

int main()
{
    CImg<uint8_t> image("test.jpg");

    // Color mapping using: jet_LUT256

    image.map(jet_LUT256());

    CImgDisplay main_disp(image, "Thank you!");
    while (!main_disp.is_closed())
    {
        main_disp.wait();
    }

    return 0;
}
Logan Fawcett
  • 41
  • 2
  • 8

1 Answers1

1

I think it needs to look more like this:

#include "CImg.h"

using namespace std;
using namespace cimg_library;

int main()
{
    CImg<unsigned char> image("test.jpg");

    // Color mapping using: jet_LUT256

    image.map(CImg<>::jet_LUT256());

    CImgDisplay main_disp(image, "Thank you!");
    while (!main_disp.is_closed())
    {
        main_disp.wait();
    }

    return 0;
}

If you make a grey gradient with ImageMagick like this:

convert -size 256x256 gradient: test.jpg

enter image description here

and run the program you get:

enter image description here

Mark Setchell
  • 191,897
  • 31
  • 273
  • 432