LUT for 16bit image
Hi,
I want to do lookuptable for 16 bit image. I have image of 16 bit(CV_16UC1), then i naormalize image with RGB give value and store in Mat variable called lut(type - CV_16UC3). After that, i split Mat lut and store in lut_channels.
int planes = 3;
vector<mat> lut_channels(planes);
vector<mat> merge_elem;
int glevl = 65535;
int dim(glevl + 1);
Mat lut(1, &dim, CV_16UC3);
for (double j = 0; j <= glevl; ++j)
{
double color = j / glevl;
lut.at<Vec3s>(j)[0] = glevl*color*r;
lut.at<Vec3s>(j)[1] = glevl*color*g;
lut.at<Vec3s>(j)[2] = glevl*color*b;
}
split(lut, lut_channels);
for (int k = 0; k < planes; ++k)
{
Mat Plane_images = Mat(Mat::zeros(image.size(), image.type()));
LUT(image, lut_channels[k], Plane_images); //crash here
merge_elem.push_back(Plane_images);
}
It is crashes in LUT function.
Can someone help me to solve this problem.
Thanks in advance.
sorry, but that's not possible with CV_16U input, please have another look at the docs ,
input is restricted to CV_8U/S
can you take another look at your example code ? it does not compile, there are unknown variables, typos, etc.
it gets much better here, if we can reproduce it !