1 | initial version |
May be No answer=no error. Check your data
I have just copy your program with my own data and everything is good using opencv 3.1
Mat data(256,256,CV_32FC1);
double xc=data.cols/2,yc=data.rows/2,pi=acos(-1.0);
double minVal,maxVal;
for (int i = 0; i<data.rows; i++)
for (int j = 0; j < data.cols; j++)
{
float d= (xc - j)*(xc - j) +(yc - i)*(yc - i) ;
data.at<float>(i,j)=sin(2*pi/32*sqrt(d));
}
minMaxLoc(data,&minVal,&maxVal);
Mat data8uc;
data.convertTo(data8uc,CV_8UC1,255/(maxVal-minVal),-255*minVal / (maxVal - minVal));
cv::Mat resultMap;
applyColorMap(data8uc, resultMap, cv::COLORMAP_AUTUMN);
cv::imshow("Out", resultMap);
waitKey();
applyColorMap(data8uc, resultMap, cv::COLORMAP_JET);
cv::imshow("Out", resultMap);
waitKey();
results are :