mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 20:50:25 +08:00
Fix trackbar in falsecolor cpp sample
This commit is contained in:
parent
2ce47fda88
commit
968d94d417
@ -16,14 +16,14 @@ struct ParamColorMap {
|
||||
String winName="False color";
|
||||
static const String ColorMaps[] = { "Autumn", "Bone", "Jet", "Winter", "Rainbow", "Ocean", "Summer", "Spring",
|
||||
"Cool", "HSV", "Pink", "Hot", "Parula", "Magma", "Inferno", "Plasma", "Viridis",
|
||||
"Cividis", "Twilight", "Twilight Shifted", "Turbo", "User defined (random)" };
|
||||
"Cividis", "Twilight", "Twilight Shifted", "Turbo", "Deep Green", "User defined (random)" };
|
||||
|
||||
static void TrackColorMap(int x, void *r)
|
||||
{
|
||||
ParamColorMap *p = (ParamColorMap*)r;
|
||||
Mat dst;
|
||||
p->iColormap= x;
|
||||
if (x == COLORMAP_TURBO + 1)
|
||||
if (x == COLORMAP_DEEPGREEN + 1)
|
||||
{
|
||||
Mat lutRND(256, 1, CV_8UC3);
|
||||
randu(lutRND, Scalar(0, 0, 0), Scalar(255, 255, 255));
|
||||
@ -97,10 +97,10 @@ int main(int argc, char** argv)
|
||||
|
||||
imshow("Gray image",img);
|
||||
namedWindow(winName);
|
||||
createTrackbar("colormap", winName,&p.iColormap,1,TrackColorMap,(void*)&p);
|
||||
createTrackbar("colormap", winName, NULL, COLORMAP_DEEPGREEN + 1, TrackColorMap, (void*)&p);
|
||||
setTrackbarMin("colormap", winName, COLORMAP_AUTUMN);
|
||||
setTrackbarMax("colormap", winName, COLORMAP_TURBO+1);
|
||||
setTrackbarPos("colormap", winName, -1);
|
||||
setTrackbarMax("colormap", winName, COLORMAP_DEEPGREEN + 1);
|
||||
setTrackbarPos("colormap", winName, COLORMAP_AUTUMN);
|
||||
|
||||
TrackColorMap(0, (void*)&p);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user