1
/*M///////////////////////////////////////////////////////////////////////////////////////
3
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
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.
11
// For Open Source Computer Vision Library
13
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
14
// Third party copyrights are property of their respective owners.
16
// Redistribution and use in source and binary forms, with or without modification,
17
// are permitted provided that the following conditions are met:
19
// * Redistribution's of source code must retain the above copyright notice,
20
// this list of conditions and the following disclaimer.
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.
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.
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.
41
// * Ozan Tonkal, ozantonkal@gmail.com
42
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
46
#ifndef __OPENCV_VIZ_VIZ3D_IMPL_HPP__
47
#define __OPENCV_VIZ_VIZ3D_IMPL_HPP__
49
struct cv::viz::Viz3d::VizImpl
52
typedef Viz3d::KeyboardCallback KeyboardCallback;
53
typedef Viz3d::MouseCallback MouseCallback;
57
VizImpl(const String &name);
60
bool wasStopped() const;
64
void spinOnce(int time = 1, bool force_redraw = false);
65
void setOffScreenRendering();
67
void removeAllLights();
68
void addLight(Vec3d position, Vec3d focalPoint, Color color, Color diffuseColor, Color ambientColor, Color specularColor);
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();
75
void showImage(InputArray image, const Size& window_size);
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;
81
void setRepresentation(int representation);
83
void setCamera(const Camera &camera);
84
Camera getCamera() const;
86
/** \brief Reset the camera to a given widget */
87
void resetCameraViewpoint(const String& id);
90
void setViewerPose(const Affine3d &pose);
91
Affine3d getViewerPose();
93
void convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord);
94
void converTo3DRay(const Point3d &window_coord, Point3d &origin, Vec3d &direction);
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();
107
void registerKeyboardCallback(KeyboardCallback callback, void* cookie = 0);
108
void registerMouseCallback(MouseCallback callback, void* cookie = 0);
111
struct TimerCallback : public vtkCommand
113
static TimerCallback* New() { return new TimerCallback; }
114
virtual void Execute(vtkObject* caller, unsigned long event_id, void* cookie);
118
struct ExitCallback : public vtkCommand
120
static ExitCallback* New() { return new ExitCallback; }
121
virtual void Execute(vtkObject*, unsigned long event_id, void*);
125
mutable bool spin_once_state_;
126
vtkSmartPointer<vtkRenderWindowInteractor> interactor_;
128
vtkSmartPointer<vtkRenderWindow> window_;
130
Vec2i window_position_;
132
vtkSmartPointer<TimerCallback> timer_callback_;
133
vtkSmartPointer<ExitCallback> exit_callback_;
135
vtkSmartPointer<vtkRenderer> renderer_;
136
vtkSmartPointer<vtkVizInteractorStyle> style_;
137
Ptr<WidgetActorMap> widget_actor_map_;
141
bool removeActorFromRenderer(vtkSmartPointer<vtkProp> actor);
142
void recreateRenderWindow();