how to create a heat map using opencv instead of one color degrees
I have a function that generates a data from 0 to 1 .. I am drawing the data but it gives me the degrees of white or black but I want to have a the heat map scale. The output is shown in the image
I want to have a dark red in the middle and blue in the outside boundries as I said the heat map colors..
The code I used is the following:
cv::Mat img(numberOfPixels,numberOfPixels, CV_8UC3, cv::Scalar(0,0,0));
cv::Mat image = img;
for(int x=0;x<img.cols;x++)
{
for(int y=0;y<img.rows;y++)
{
obstX = (x - img.cols/2.0)*8;
obstY = (img.rows/2.0 - y)*8;
f = this->getF(param1,param2 );
double F = sqrt(f(0)*f(0) + f(1)*f(1) + f(2)*f(2));
Vec3b color = image.at<cv::Vec3b>(cv::Point(x,y));
color.val[0] = uchar(F * 255.0);
color.val[1] = uchar(F * 255.0);
color.val[2] = uchar(F * 255.0);
image.at<cv::Vec3b>(cv::Point(x,y)) = color;
}
}
imwrite(img);
}