Merge pull request #21005 from nikpappas:bug-samples-falsecolor-trackbar

pull/21025/head
Alexander Alekhin 3 years ago
commit 1ac7baceff
  1. 10
      samples/cpp/falsecolor.cpp

@ -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…
Cancel
Save