Ask Your Question
0

LUT didn't work [closed]

asked 2018-01-28 03:52:39 -0600

rangora gravatar image

updated 2018-01-28 03:56:54 -0600

LBerger gravatar image

Mat applyLookUp(const Mat& image, const Mat& lookup) { Mat result; LUT(image, lookup, result); return result; }

 int main(int argc, char** argv) {

Mat image = imread("cat.jpg", 0);
if (!image.data) return -1;

Histogram1D h;
int dim(256);
Mat lut(1, &dim, CV_8U);
for (int i = 0; i < 256; ++i) {
    lut.at<uchar>(i) = 255 - 1;
    std::cout << lut.at<char>(i) << "\n";
}

namedWindow("cat");
imshow("cat", image);
namedWindow("Simple");
imshow("Simple", h.applyLookUp(image, lut));

returning value from 'applyLookUp' did't show correct window.

it's only show empty white window screen.

and i found another example to tried, but it didn't work neither.

i use window10, visual studio2017 and openCV 3.4

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by LBerger
close date 2018-01-28 12:14:17.414849

Comments

1

oh, i miss that one.. i sould 255-i not 255-1 so it make white screen,, my mistake x(

rangora gravatar imagerangora ( 2018-01-28 07:54:14 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-01-28 03:58:07 -0600

LBerger gravatar image

updated 2018-01-28 04:05:13 -0600

Have you insert waitKey after imshow ?

lut.at<uchar>(i) = 255 - 1; do you mean 255-i?

lut.at<uchar>(i) = 255 - 1;
std::cout << lut.at<char>(i) << "\n";

please uchar or char ? check your code

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-01-28 03:52:39 -0600

Seen: 209 times

Last updated: Jan 28 '18