Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
fb7e74c5
Commit
fb7e74c5
authored
Feb 16, 2014
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iteractor work
parent
03bd8279
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
90 additions
and
40 deletions
+90
-40
precomp.hpp
modules/viz/src/precomp.hpp
+3
-2
vizcore.cpp
modules/viz/src/vizcore.cpp
+1
-0
vizimpl.cpp
modules/viz/src/vizimpl.cpp
+1
-2
vizimpl.hpp
modules/viz/src/vizimpl.hpp
+1
-1
vtkCocoaInteractorFix.mm
modules/viz/src/vtk/vtkCocoaInteractorFix.mm
+1
-2
vtkOBJWriter.cpp
modules/viz/src/vtk/vtkOBJWriter.cpp
+1
-1
vtkVizInteractorStyle.cpp
modules/viz/src/vtk/vtkVizInteractorStyle.cpp
+0
-0
vtkVizInteractorStyle.hpp
modules/viz/src/vtk/vtkVizInteractorStyle.hpp
+82
-32
No files found.
modules/viz/src/precomp.hpp
View file @
fb7e74c5
...
@@ -130,6 +130,7 @@
...
@@ -130,6 +130,7 @@
#include <vtkElevationFilter.h>
#include <vtkElevationFilter.h>
#include <vtkColorTransferFunction.h>
#include <vtkColorTransferFunction.h>
#include <vtkStreamingDemandDrivenPipeline.h>
#include <vtkStreamingDemandDrivenPipeline.h>
#include "vtkCallbackCommand.h"
#if !defined(_WIN32) || defined(__CYGWIN__)
#if !defined(_WIN32) || defined(__CYGWIN__)
# include <unistd.h>
/* unlink */
# include <unistd.h>
/* unlink */
...
@@ -145,6 +146,7 @@
...
@@ -145,6 +146,7 @@
#include <vtk/vtkTrajectorySource.h>
#include <vtk/vtkTrajectorySource.h>
#include <vtk/vtkImageMatSource.h>
#include <vtk/vtkImageMatSource.h>
#include <opencv2/core/core.hpp>
#include <opencv2/core/core.hpp>
#include <opencv2/viz/vizcore.hpp>
#include <opencv2/viz/vizcore.hpp>
#include <opencv2/viz/widget_accessor.hpp>
#include <opencv2/viz/widget_accessor.hpp>
...
@@ -332,8 +334,7 @@ namespace cv
...
@@ -332,8 +334,7 @@ namespace cv
}
}
}
}
#include "
interactor_s
tyle.hpp"
#include "
vtk/vtkVizInteractorS
tyle.hpp"
#include "vizimpl.hpp"
#include "vizimpl.hpp"
#endif
#endif
modules/viz/src/vizcore.cpp
View file @
fb7e74c5
...
@@ -87,6 +87,7 @@ cv::Affine3d cv::viz::makeCameraPose(const Vec3d& position, const Vec3d& focal_p
...
@@ -87,6 +87,7 @@ cv::Affine3d cv::viz::makeCameraPose(const Vec3d& position, const Vec3d& focal_p
#else
#else
void
register_console_handler
();
void
register_console_handler
()
{}
void
register_console_handler
()
{}
#endif
#endif
...
...
modules/viz/src/vizimpl.cpp
View file @
fb7e74c5
...
@@ -60,10 +60,9 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name) : spin_once_state_(false),
...
@@ -60,10 +60,9 @@ cv::viz::Viz3d::VizImpl::VizImpl(const String &name) : spin_once_state_(false),
window_
->
AddRenderer
(
renderer_
);
window_
->
AddRenderer
(
renderer_
);
// Create the interactor style
// Create the interactor style
style_
=
vtkSmartPointer
<
InteractorStyle
>::
New
();
style_
=
vtkSmartPointer
<
vtkViz
InteractorStyle
>::
New
();
style_
->
setWidgetActorMap
(
widget_actor_map_
);
style_
->
setWidgetActorMap
(
widget_actor_map_
);
style_
->
UseTimersOn
();
style_
->
UseTimersOn
();
style_
->
Initialize
();
timer_callback_
=
vtkSmartPointer
<
TimerCallback
>::
New
();
timer_callback_
=
vtkSmartPointer
<
TimerCallback
>::
New
();
exit_callback_
=
vtkSmartPointer
<
ExitCallback
>::
New
();
exit_callback_
=
vtkSmartPointer
<
ExitCallback
>::
New
();
...
...
modules/viz/src/vizimpl.hpp
View file @
fb7e74c5
...
@@ -128,7 +128,7 @@ private:
...
@@ -128,7 +128,7 @@ private:
vtkSmartPointer
<
ExitCallback
>
exit_callback_
;
vtkSmartPointer
<
ExitCallback
>
exit_callback_
;
vtkSmartPointer
<
vtkRenderer
>
renderer_
;
vtkSmartPointer
<
vtkRenderer
>
renderer_
;
vtkSmartPointer
<
InteractorStyle
>
style_
;
vtkSmartPointer
<
vtkViz
InteractorStyle
>
style_
;
Ptr
<
WidgetActorMap
>
widget_actor_map_
;
Ptr
<
WidgetActorMap
>
widget_actor_map_
;
bool
removeActorFromRenderer
(
vtkSmartPointer
<
vtkProp
>
actor
);
bool
removeActorFromRenderer
(
vtkSmartPointer
<
vtkProp
>
actor
);
...
...
modules/viz/src/vtk/vtkCocoaInteractorFix.mm
View file @
fb7e74c5
...
@@ -40,8 +40,7 @@
...
@@ -40,8 +40,7 @@
// Authors:
// Authors:
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
//
// OpenCV Viz module is complete rewrite of
// This workaround code was taken from PCL library(www.pointclouds.org)
// PCL visualization module (www.pointclouds.org)
//
//
//M*/
//M*/
...
...
modules/viz/src/vtk/vtkOBJWriter.cpp
View file @
fb7e74c5
...
@@ -84,7 +84,7 @@ void cv::viz::vtkOBJWriter::WriteData()
...
@@ -84,7 +84,7 @@ void cv::viz::vtkOBJWriter::WriteData()
std
::
ostream
&
outfile
=
*
outfilep
;
std
::
ostream
&
outfile
=
*
outfilep
;
//write header
//write header
outfile
<<
"# wavefront obj file written by
the visualization toolkit
"
<<
std
::
endl
<<
std
::
endl
;
outfile
<<
"# wavefront obj file written by
opencv viz module
"
<<
std
::
endl
<<
std
::
endl
;
outfile
<<
"mtllib NONE"
<<
std
::
endl
<<
std
::
endl
;
outfile
<<
"mtllib NONE"
<<
std
::
endl
<<
std
::
endl
;
// write out the points
// write out the points
...
...
modules/viz/src/
interactor_s
tyle.cpp
→
modules/viz/src/
vtk/vtkVizInteractorS
tyle.cpp
View file @
fb7e74c5
This diff is collapsed.
Click to expand it.
modules/viz/src/
interactor_s
tyle.hpp
→
modules/viz/src/
vtk/vtkVizInteractorS
tyle.hpp
View file @
fb7e74c5
...
@@ -46,64 +46,101 @@
...
@@ -46,64 +46,101 @@
#ifndef __OPENCV_VIZ_INTERACTOR_STYLE_H__
#ifndef __OPENCV_VIZ_INTERACTOR_STYLE_H__
#define __OPENCV_VIZ_INTERACTOR_STYLE_H__
#define __OPENCV_VIZ_INTERACTOR_STYLE_H__
#include <vtkInteractorStyle.h>
namespace
cv
namespace
cv
{
{
namespace
viz
namespace
viz
{
{
class
InteractorStyle
:
public
vtkInteractorStyleTrackballCamera
class
vtkVizInteractorStyle
:
public
vtkInteractorStyle
{
{
public
:
public
:
static
InteractorStyle
*
New
();
static
vtkVizInteractorStyle
*
New
();
virtual
~
InteractorStyle
()
{}
vtkTypeMacro
(
vtkVizInteractorStyle
,
vtkInteractorStyle
)
void
PrintSelf
(
ostream
&
os
,
vtkIndent
indent
);
// this macro defines Superclass, the isA functionality and the safe downcast method
virtual
void
OnChar
();
vtkTypeMacro
(
InteractorStyle
,
vtkInteractorStyleTrackballCamera
)
virtual
void
OnKeyDown
();
virtual
void
OnKeyUp
();
/** \brief Initialization routine. Must be called before anything else. */
virtual
void
OnMouseMove
();
virtual
void
Initialize
();
virtual
void
OnLeftButtonDown
();
virtual
void
OnLeftButtonUp
();
virtual
void
OnMiddleButtonDown
();
virtual
void
OnMiddleButtonUp
();
virtual
void
OnRightButtonDown
();
virtual
void
OnRightButtonUp
();
virtual
void
OnMouseWheelForward
();
virtual
void
OnMouseWheelBackward
();
virtual
void
OnTimer
();
virtual
void
Rotate
();
virtual
void
Spin
();
virtual
void
Pan
();
virtual
void
Dolly
();
vtkSetMacro
(
FlyMode
,
bool
)
vtkGetMacro
(
FlyMode
,
bool
)
vtkSetMacro
(
MotionFactor
,
double
)
vtkGetMacro
(
MotionFactor
,
double
)
void
setWidgetActorMap
(
const
Ptr
<
WidgetActorMap
>&
actors
)
{
widget_actor_map_
=
actors
;
}
void
registerMouseCallback
(
void
(
*
callback
)(
const
MouseEvent
&
,
void
*
),
void
*
cookie
=
0
);
void
registerMouseCallback
(
void
(
*
callback
)(
const
MouseEvent
&
,
void
*
),
void
*
cookie
=
0
);
void
registerKeyboardCallback
(
void
(
*
callback
)(
const
KeyboardEvent
&
,
void
*
),
void
*
cookie
=
0
);
void
registerKeyboardCallback
(
void
(
*
callback
)(
const
KeyboardEvent
&
,
void
*
),
void
*
cookie
=
0
);
void
setWidgetActorMap
(
const
Ptr
<
WidgetActorMap
>&
actors
)
{
widget_actor_map_
=
actors
;
}
void
saveScreenshot
(
const
String
&
file
);
void
saveScreenshot
(
const
String
&
file
);
void
exportScene
(
const
String
&
file
);
void
exportScene
(
const
String
&
file
);
void
exportScene
();
void
changePointsSize
(
float
delta
);
void
setRepresentationToPoints
();
void
printCameraParams
();
void
toggleFullScreen
();
void
resetViewerPose
();
void
toggleStereo
();
void
printHelp
();
// Set the basic unit step size : by default 1/250 of bounding diagonal
vtkSetMacro
(
MotionStepSize
,
double
)
vtkGetMacro
(
MotionStepSize
,
double
)
// Set acceleration factor when shift key is applied : default 10
vtkSetMacro
(
MotionAccelerationFactor
,
double
)
vtkGetMacro
(
MotionAccelerationFactor
,
double
)
// Set the basic angular unit for turning : efault 1 degree
vtkSetMacro
(
AngleStepSize
,
double
)
vtkGetMacro
(
AngleStepSize
,
double
)
private
:
private
:
/** \brief Set to true after initialization is complete. */
bool
init_
;
Ptr
<
WidgetActorMap
>
widget_actor_map_
;
Ptr
<
WidgetActorMap
>
widget_actor_map_
;
Vec2i
win_size_
;
Vec2i
win_size_
;
Vec2i
win_pos_
;
Vec2i
win_pos_
;
Vec2i
max_win_size_
;
Vec2i
max_win_size_
;
/** \brief Interactor style internal method. Gets called whenever a key is pressed. */
void
zoomIn
();
v
irtual
void
OnChar
();
v
oid
zoomOut
();
// Keyboard events
protected
:
v
irtual
void
OnKeyDown
();
v
tkVizInteractorStyle
();
virtual
void
OnKeyUp
();
~
vtkVizInteractorStyle
();
// mouse button events
virtual
void
Dolly
(
double
factor
);
virtual
void
OnMouseMove
();
virtual
void
OnLeftButtonDown
();
virtual
void
OnLeftButtonUp
();
virtual
void
OnMiddleButtonDown
();
virtual
void
OnMiddleButtonUp
();
virtual
void
OnRightButtonDown
();
virtual
void
OnRightButtonUp
();
virtual
void
OnMouseWheelForward
();
virtual
void
OnMouseWheelBackward
();
/** \brief Interactor style internal method. Gets called periodically if a timer is set. */
void
Fly
();
virtual
void
OnTimer
();
void
FlyByMouse
();
void
FlyByKey
();
void
SetupMotionVars
();
void
MotionAlongVector
(
const
Vec3d
&
vector
,
double
amount
,
vtkCamera
*
cam
);
void
zoomIn
();
private
:
void
zoomOut
();
vtkVizInteractorStyle
(
const
vtkVizInteractorStyle
&
);
vtkVizInteractorStyle
&
operator
=
(
const
vtkVizInteractorStyle
&
);
/
** \brief True if we're using red-blue colors for anaglyphic stereo, false if magenta-green. */
/
/! True for red-blue colors, false for magenta-green.
bool
stereo_anaglyph_
mask_default
_
;
bool
stereo_anaglyph_
redblue
_
;
void
(
*
keyboardCallback_
)(
const
KeyboardEvent
&
,
void
*
);
void
(
*
keyboardCallback_
)(
const
KeyboardEvent
&
,
void
*
);
void
*
keyboard_callback_cookie_
;
void
*
keyboard_callback_cookie_
;
...
@@ -111,7 +148,20 @@ namespace cv
...
@@ -111,7 +148,20 @@ namespace cv
void
(
*
mouseCallback_
)(
const
MouseEvent
&
,
void
*
);
void
(
*
mouseCallback_
)(
const
MouseEvent
&
,
void
*
);
void
*
mouse_callback_cookie_
;
void
*
mouse_callback_cookie_
;
bool
FlyMode
;
double
MotionFactor
;
int
getModifiers
();
int
getModifiers
();
// from fly
unsigned
char
KeysDown
;
double
DiagonalLength
;
double
MotionStepSize
;
double
MotionUserScale
;
double
MotionAccelerationFactor
;
double
AngleStepSize
;
double
DeltaYaw
;
double
DeltaPitch
;
};
};
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment