~paparazzi-uav/paparazzi/v5.0-manual

« back to all changes in this revision

Viewing changes to sw/ext/opencv_bebop/opencv/modules/viz/src/vizimpl.hpp

  • Committer: Paparazzi buildbot
  • Date: 2016-05-18 15:00:29 UTC
  • Revision ID: felix.ruess+docbot@gmail.com-20160518150029-e8lgzi5kvb4p7un9
Manual import commit 4b8bbb730080dac23cf816b98908dacfabe2a8ec from v5.0 branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*M///////////////////////////////////////////////////////////////////////////////////////
 
2
//
 
3
//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
 
4
//
 
5
//  By downloading, copying, installing or using the software you agree to this license.
 
6
//  If you do not agree to this license, do not download, install,
 
7
//  copy or use the software.
 
8
//
 
9
//
 
10
//                           License Agreement
 
11
//                For Open Source Computer Vision Library
 
12
//
 
13
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
 
14
// Third party copyrights are property of their respective owners.
 
15
//
 
16
// Redistribution and use in source and binary forms, with or without modification,
 
17
// are permitted provided that the following conditions are met:
 
18
//
 
19
//   * Redistribution's of source code must retain the above copyright notice,
 
20
//     this list of conditions and the following disclaimer.
 
21
//
 
22
//   * Redistribution's in binary form must reproduce the above copyright notice,
 
23
//     this list of conditions and the following disclaimer in the documentation
 
24
//     and/or other materials provided with the distribution.
 
25
//
 
26
//   * The name of the copyright holders may not be used to endorse or promote products
 
27
//     derived from this software without specific prior written permission.
 
28
//
 
29
// This software is provided by the copyright holders and contributors "as is" and
 
30
// any express or implied warranties, including, but not limited to, the implied
 
31
// warranties of merchantability and fitness for a particular purpose are disclaimed.
 
32
// In no event shall the Intel Corporation or contributors be liable for any direct,
 
33
// indirect, incidental, special, exemplary, or consequential damages
 
34
// (including, but not limited to, procurement of substitute goods or services;
 
35
// loss of use, data, or profits; or business interruption) however caused
 
36
// and on any theory of liability, whether in contract, strict liability,
 
37
// or tort (including negligence or otherwise) arising in any way out of
 
38
// the use of this software, even if advised of the possibility of such damage.
 
39
//
 
40
// Authors:
 
41
//  * Ozan Tonkal, ozantonkal@gmail.com
 
42
//  * Anatoly Baksheev, Itseez Inc.  myname.mysurname <> mycompany.com
 
43
//
 
44
//M*/
 
45
 
 
46
#ifndef __OPENCV_VIZ_VIZ3D_IMPL_HPP__
 
47
#define __OPENCV_VIZ_VIZ3D_IMPL_HPP__
 
48
 
 
49
struct cv::viz::Viz3d::VizImpl
 
50
{
 
51
public:
 
52
    typedef Viz3d::KeyboardCallback KeyboardCallback;
 
53
    typedef Viz3d::MouseCallback MouseCallback;
 
54
 
 
55
    int ref_counter;
 
56
 
 
57
    VizImpl(const String &name);
 
58
    virtual ~VizImpl();
 
59
 
 
60
    bool wasStopped() const;
 
61
    void close();
 
62
 
 
63
    void spin();
 
64
    void spinOnce(int time = 1, bool force_redraw = false);
 
65
    void setOffScreenRendering();
 
66
 
 
67
    void removeAllLights();
 
68
    void addLight(Vec3d position, Vec3d focalPoint, Color color, Color diffuseColor, Color ambientColor, Color specularColor);
 
69
 
 
70
    void showWidget(const String &id, const Widget &widget, const Affine3d &pose = Affine3d::Identity());
 
71
    void removeWidget(const String &id);
 
72
    Widget getWidget(const String &id) const;
 
73
    void removeAllWidgets();
 
74
 
 
75
    void showImage(InputArray image, const Size& window_size);
 
76
 
 
77
    void setWidgetPose(const String &id, const Affine3d &pose);
 
78
    void updateWidgetPose(const String &id, const Affine3d &pose);
 
79
    Affine3d getWidgetPose(const String &id) const;
 
80
 
 
81
    void setRepresentation(int representation);
 
82
 
 
83
    void setCamera(const Camera &camera);
 
84
    Camera getCamera() const;
 
85
 
 
86
    /** \brief Reset the camera to a given widget */
 
87
    void resetCameraViewpoint(const String& id);
 
88
    void resetCamera();
 
89
 
 
90
    void setViewerPose(const Affine3d &pose);
 
91
    Affine3d getViewerPose();
 
92
 
 
93
    void convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord);
 
94
    void converTo3DRay(const Point3d &window_coord, Point3d &origin, Vec3d &direction);
 
95
 
 
96
    Mat getScreenshot() const;
 
97
    void saveScreenshot(const String &file);
 
98
    void setWindowPosition(const Point& position);
 
99
    Size getWindowSize() const;
 
100
    void setWindowSize(const Size& window_size);
 
101
    void setFullScreen(bool mode);
 
102
    String getWindowName() const;
 
103
    void setBackgroundColor(const Color& color, const Color& color2);
 
104
    void setBackgroundTexture(InputArray image);
 
105
    void setBackgroundMeshLab();
 
106
 
 
107
    void registerKeyboardCallback(KeyboardCallback callback, void* cookie = 0);
 
108
    void registerMouseCallback(MouseCallback callback, void* cookie = 0);
 
109
 
 
110
private:
 
111
    struct TimerCallback : public vtkCommand
 
112
    {
 
113
        static TimerCallback* New() { return new TimerCallback; }
 
114
        virtual void Execute(vtkObject* caller, unsigned long event_id, void* cookie);
 
115
        int timer_id;
 
116
    };
 
117
 
 
118
    struct ExitCallback : public vtkCommand
 
119
    {
 
120
        static ExitCallback* New() { return new ExitCallback; }
 
121
        virtual void Execute(vtkObject*, unsigned long event_id, void*);
 
122
        VizImpl* viz;
 
123
    };
 
124
 
 
125
    mutable bool spin_once_state_;
 
126
    vtkSmartPointer<vtkRenderWindowInteractor> interactor_;
 
127
 
 
128
    vtkSmartPointer<vtkRenderWindow> window_;
 
129
    String window_name_;
 
130
    Vec2i window_position_;
 
131
 
 
132
    vtkSmartPointer<TimerCallback> timer_callback_;
 
133
    vtkSmartPointer<ExitCallback> exit_callback_;
 
134
 
 
135
    vtkSmartPointer<vtkRenderer> renderer_;
 
136
    vtkSmartPointer<vtkVizInteractorStyle> style_;
 
137
    Ptr<WidgetActorMap> widget_actor_map_;
 
138
 
 
139
    bool offScreenMode_;
 
140
 
 
141
    bool removeActorFromRenderer(vtkSmartPointer<vtkProp> actor);
 
142
    void recreateRenderWindow();
 
143
};
 
144
 
 
145
#endif