compositor f1-f10/j/p shortcuts, opencv upgrade, new stylize,puzzle opencv plugins
[goodguy/history.git] / cinelerra-5.1 / plugins / stylizeobj / stylizeobj.h
1 /*
2  * CINELERRA
3  * Copyright (C) 1997-2014 Adam Williams <broadcast at earthling dot net>
4  * 
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  * 
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  * 
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  */
19
20 #ifndef STYLIZEOBJ_H
21 #define STYLIZEOBJ_H
22
23 #include "pluginvclient.h"
24 #include "loadbalance.h"
25 #include "mutex.inc"
26
27 #include "opencv2/core/types.hpp"
28 #include "opencv2/core/mat.hpp"
29 #include "opencv2/calib3d.hpp"
30 #include "opencv2/photo.hpp"
31 #include "opencv2/video/video.hpp"
32
33 #include <vector>
34
35 using namespace std;
36 using namespace cv;
37
38 enum {
39  MODE_EDGE_SMOOTH,
40  MODE_EDGE_RECURSIVE,
41  MODE_DETAIL_ENHANCE,
42  MODE_PENCIL_SKETCH,
43  MODE_COLOR_SKETCH,
44  MODE_STYLIZATION,
45 };
46
47 class StylizeObjConfig;
48 class StylizeObj;
49
50
51 class StylizeObjConfig
52 {
53 public:
54         StylizeObjConfig();
55         int mode;
56         float smoothing, edge_strength, shade_factor;
57
58         int equivalent(StylizeObjConfig &that);
59         void copy_from(StylizeObjConfig &that);
60         void interpolate(StylizeObjConfig &prev, StylizeObjConfig &next, 
61                 long prev_frame, long next_frame, long current_frame);
62         void limits();
63 };
64
65 class StylizeObj : public PluginVClient
66 {
67 public:
68         StylizeObj(PluginServer *server);
69         ~StylizeObj();
70         PLUGIN_CLASS_MEMBERS2(StylizeObjConfig)
71         int is_realtime();
72         void update_gui();
73         void save_data(KeyFrame *keyframe);
74         void read_data(KeyFrame *keyframe);
75         int process_buffer(VFrame *frame, int64_t start_position, double frame_rate);
76         void to_mat(Mat &mat, int mcols, int mrows,
77                 VFrame *inp, int ix,int iy, int mcolor_model);
78         void from_mat(VFrame *out, int ox, int oy, int ow, int oh,
79                 Mat &mat, int mcolor_model);
80
81         int width, height, color_model;
82         VFrame *input, *output;
83
84         Mat next_img;
85 };
86
87 #endif