mirror of
https://github.com/opencv/opencv.git
synced 2024-12-18 11:28:02 +08:00
highgui: refactor GTK backend
- eliminate legacy C code, used fields - fix mutex synchronization issues - set trackbar min/max without unnecessary truncation; allow negative values
This commit is contained in:
parent
19270103ec
commit
9e239c7a1e
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user