mirror of
https://github.com/opencv/opencv.git
synced 2025-08-06 06:26:29 +08:00
Merge pull request #9369 from alalek:cpp_refactor_gtk
This commit is contained in:
commit
a835517049
File diff suppressed because it is too large
Load Diff
@ -15,6 +15,7 @@ String winName="False color";
|
|||||||
|
|
||||||
static void TrackColorMap(int x, void *r)
|
static void TrackColorMap(int x, void *r)
|
||||||
{
|
{
|
||||||
|
std::cout << "selected: " << x << std::endl;
|
||||||
ParamColorMar *p = (ParamColorMar*)r;
|
ParamColorMar *p = (ParamColorMar*)r;
|
||||||
Mat dst;
|
Mat dst;
|
||||||
p->iColormap= x;
|
p->iColormap= x;
|
||||||
@ -23,9 +24,8 @@ static void TrackColorMap(int x, void *r)
|
|||||||
if (!lutRND)
|
if (!lutRND)
|
||||||
{
|
{
|
||||||
RNG ra;
|
RNG ra;
|
||||||
Mat *palette = new Mat(256, 1, CV_8UC3);
|
lutRND = makePtr<Mat>(256, 1, CV_8UC3);
|
||||||
ra.fill(*palette, RNG::UNIFORM, 0, 256);
|
ra.fill(*lutRND, RNG::UNIFORM, 0, 256);
|
||||||
lutRND = Ptr<Mat>(palette);
|
|
||||||
}
|
}
|
||||||
applyColorMap(p->img, dst, *lutRND.get());
|
applyColorMap(p->img, dst, *lutRND.get());
|
||||||
}
|
}
|
||||||
@ -77,6 +77,7 @@ static void TrackColorMap(int x, void *r)
|
|||||||
colorMapName = "User colormap : random";
|
colorMapName = "User colormap : random";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
std::cout << "> " << colorMapName << std::endl;
|
||||||
putText(dst, colorMapName, Point(10, 20), cv::FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 255, 255));
|
putText(dst, colorMapName, Point(10, 20), cv::FONT_HERSHEY_SIMPLEX, 1, Scalar(255, 255, 255));
|
||||||
imshow(winName, dst);
|
imshow(winName, dst);
|
||||||
}
|
}
|
||||||
@ -144,7 +145,10 @@ int main(int argc, char** argv)
|
|||||||
setTrackbarMax("colormap", winName, cv::COLORMAP_PARULA+1);
|
setTrackbarMax("colormap", winName, cv::COLORMAP_PARULA+1);
|
||||||
setTrackbarPos("colormap", winName, -1);
|
setTrackbarPos("colormap", winName, -1);
|
||||||
|
|
||||||
TrackColorMap(0,(void*)&p);
|
TrackColorMap((int)getTrackbarPos("colormap", winName),(void*)&p);
|
||||||
waitKey(0);
|
while (waitKey(0) != 27)
|
||||||
|
{
|
||||||
|
std::cout << "Press 'ESC' to exit" << std::endl;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user