#include <opencv2/opencv.hpp>
enum MyShape{MyCIRCLE=0,MyRECTANGLE,MyELLIPSE};
struct ParamColorMar {
int iColormap;
};
static void TrackColorMap(int x, void *r)
{
ParamColorMar *p = (ParamColorMar*)r;
p->iColormap= x;
{
if (!lutRND)
{
}
}
else
switch (p->iColormap) {
colorMapName = "Colormap : Autumn";
break;
colorMapName = "Colormap : Bone";
break;
colorMapName = "Colormap : Jet";
break;
colorMapName = "Colormap : Winter";
break;
colorMapName = "Colormap : Rainbow";
break;
colorMapName = "Colormap : Ocean";
break;
colorMapName = "Colormap : Summer";
break;
colorMapName = "Colormap : Spring";
break;
colorMapName = "Colormap : Cool";
break;
colorMapName = "Colormap : HSV";
break;
colorMapName = "Colormap : Pink";
break;
colorMapName = "Colormap : Hot";
break;
colorMapName = "Colormap : Parula";
break;
default:
colorMapName = "User colormap : random";
break;
}
}
static Mat DrawMyImage(
int thickness,
int nbShape)
{
int offsetx = 50, offsety = 25;
int lineLenght = 50;
for (int i=0;i<256;i++)
line(img,
Point(thickness*i+ offsetx, offsety),
Point(thickness*i+ offsetx, offsety+ lineLenght),
Scalar(i), thickness);
int radius;
int width,height;
int angle;
for (int i=1;i<=nbShape;i++)
{
int typeShape = r.
uniform(MyCIRCLE, MyELLIPSE+1);
switch (typeShape) {
case MyCIRCLE:
break;
case MyRECTANGLE:
rc =
Rect(center-
Point(width ,height )/2, center +
Point(width , height )/2);
break;
case MyELLIPSE:
break;
}
}
return img;
}
int main(int argc, char** argv)
{
ParamColorMar p;
if (argc > 1)
else
img = DrawMyImage(2,256);
p.img=img;
p.iColormap=0;
createTrackbar(
"colormap", winName,&p.iColormap,1,TrackColorMap,(
void*)&p);
TrackColorMap(0,(void*)&p);
return 0;
}