Mat src =imread("F:/code/images/wm.jpg");if(src.empty()){printf("fail to read");return-1;}namedWindow("input", WINDOW_AUTOSIZE);imshow("input", src);//製作查詢表 lut
Mat color =imread("F:/code/images/rainbow.png");//色卡
Mat lut = Mat::zeros(256,1, CV_8UC3);//將 color 對映到 畫素 0~255
Mat dst;for(int i =0; i <256; i++){
lut.at<Vec3b>(i,0)= color.at<Vec3b>(11, i);}LUT(src, lut, dst);imshow("color", color);imshow("lut", lut);imshow("lut demo", dst);