Commit a8355170 authored by Alexander Alekhin's avatar Alexander Alekhin

Merge pull request #9369 from alalek:cpp_refactor_gtk

parents 5c325466 9e239c7a
This diff is collapsed.
......@@ -15,6 +15,7 @@ String winName="False color";
static void TrackColorMap(int x, void *r)
{
std::cout << "selected: " << x << std::endl;
ParamColorMar *p = (ParamColorMar*)r;
Mat dst;
p->iColormap= x;
......@@ -23,9 +24,8 @@ static void TrackColorMap(int x, void *r)
if (!lutRND)
{
RNG ra;
Mat *palette = new Mat(256, 1, CV_8UC3);
ra.fill(*palette, RNG::UNIFORM, 0, 256);
lutRND = Ptr<Mat>(palette);
lutRND = makePtr<Mat>(256, 1, CV_8UC3);
ra.fill(*lutRND, RNG::UNIFORM, 0, 256);
}
applyColorMap(p->img, dst, *lutRND.get());
}
......@@ -77,6 +77,7 @@ static void TrackColorMap(int x, void *r)
colorMapName = "User colormap : random";
break;
}
std::cout << "> " << colorMapName << std::endl;
putText(dst, colorMapName, Point(10, 20), cv::FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 255, 255));
imshow(winName, dst);
}
......@@ -144,7 +145,10 @@ int main(int argc, char** argv)
setTrackbarMax("colormap", winName, cv::COLORMAP_PARULA+1);
setTrackbarPos("colormap", winName, -1);
TrackColorMap(0,(void*)&p);
waitKey(0);
TrackColorMap((int)getTrackbarPos("colormap", winName),(void*)&p);
while (waitKey(0) != 27)
{
std::cout << "Press 'ESC' to exit" << std::endl;
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment