#include "opencv2/imgproc.hpp"
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
enum MyShape{MyCIRCLE=0,MyRECTANGLE,MyELLIPSE};
struct ParamColorMap {
int iColormap;
};
static const String ColorMaps[] = {
"Autumn",
"Bone",
"Jet",
"Winter",
"Rainbow",
"Ocean",
"Summer",
"Spring", "Cool", "HSV", "Pink", "Hot", "Parula", "User defined (random)"};
static void TrackColorMap(int x, void *r)
{
ParamColorMap *p = (ParamColorMap*)r;
p->iColormap= x;
{
}
else
}
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)
{
cout << "This program demonstrates the use of applyColorMap function.\n\n";
ParamColorMap 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);
cout << "Press a key to exit" << endl;
return 0;
}