Commit 26005a19 authored by Ozan Tonkal's avatar Ozan Tonkal

add license headers

parent c7730614
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
// the use of this software, even if advised of the possibility of such damage. // the use of this software, even if advised of the possibility of such damage.
// //
// Authors: // Authors:
// * Ozan Tonkal // * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com // * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
// //
// OpenCV Viz module is complete rewrite of // OpenCV Viz module is complete rewrite of
...@@ -49,12 +49,10 @@ ...@@ -49,12 +49,10 @@
#ifndef __OPENCV_VIZ_HPP__ #ifndef __OPENCV_VIZ_HPP__
#define __OPENCV_VIZ_HPP__ #define __OPENCV_VIZ_HPP__
#include <opencv2/viz/types.hpp> #include <opencv2/viz/types.hpp>
#include <opencv2/viz/widgets.hpp> #include <opencv2/viz/widgets.hpp>
#include <opencv2/viz/viz3d.hpp> #include <opencv2/viz/viz3d.hpp>
namespace cv namespace cv
{ {
namespace viz namespace viz
...@@ -121,6 +119,4 @@ namespace cv ...@@ -121,6 +119,4 @@ namespace cv
} /* namespace viz */ } /* namespace viz */
} /* namespace cv */ } /* namespace cv */
#endif /* __OPENCV_VIZ_HPP__ */ #endif /* __OPENCV_VIZ_HPP__ */
#pragma once /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#ifndef __OPENCV_VIZ_TYPES_HPP__
#define __OPENCV_VIZ_TYPES_HPP__
#include <string> #include <string>
#include <opencv2/core.hpp> #include <opencv2/core.hpp>
...@@ -55,17 +104,17 @@ namespace cv ...@@ -55,17 +104,17 @@ namespace cv
//! Create a keyboard event //! Create a keyboard event
//! - Note that action is true if key is pressed, false if released //! - Note that action is true if key is pressed, false if released
KeyboardEvent (bool action, const std::string& key_sym, unsigned char key, bool alt, bool ctrl, bool shift); KeyboardEvent(bool action, const std::string& key_sym, unsigned char key, bool alt, bool ctrl, bool shift);
bool isAltPressed () const; bool isAltPressed() const;
bool isCtrlPressed () const; bool isCtrlPressed() const;
bool isShiftPressed () const; bool isShiftPressed() const;
unsigned char getKeyCode () const; unsigned char getKeyCode() const;
const String& getKeySym () const; const String& getKeySym() const;
bool keyDown () const; bool keyDown() const;
bool keyUp () const; bool keyUp() const;
protected: protected:
...@@ -81,7 +130,7 @@ namespace cv ...@@ -81,7 +130,7 @@ namespace cv
enum Type { MouseMove = 1, MouseButtonPress, MouseButtonRelease, MouseScrollDown, MouseScrollUp, MouseDblClick } ; enum Type { MouseMove = 1, MouseButtonPress, MouseButtonRelease, MouseScrollDown, MouseScrollUp, MouseDblClick } ;
enum MouseButton { NoButton = 0, LeftButton, MiddleButton, RightButton, VScroll } ; enum MouseButton { NoButton = 0, LeftButton, MiddleButton, RightButton, VScroll } ;
MouseEvent (const Type& type, const MouseButton& button, const Point& p, bool alt, bool ctrl, bool shift); MouseEvent(const Type& type, const MouseButton& button, const Point& p, bool alt, bool ctrl, bool shift);
Type type; Type type;
MouseButton button; MouseButton button;
...@@ -125,3 +174,5 @@ namespace cv ...@@ -125,3 +174,5 @@ namespace cv
} /* namespace viz */ } /* namespace viz */
} /* namespace cv */ } /* namespace cv */
#endif
#pragma once /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#ifndef __OPENCV_VIZ_VIZ3D_HPP__
#define __OPENCV_VIZ_VIZ3D_HPP__
#if !defined YES_I_AGREE_THAT_VIZ_API_IS_NOT_STABLE_NOW_AND_BINARY_COMPARTIBILITY_WONT_BE_SUPPORTED #if !defined YES_I_AGREE_THAT_VIZ_API_IS_NOT_STABLE_NOW_AND_BINARY_COMPARTIBILITY_WONT_BE_SUPPORTED
//#error "Viz is in beta state now. Please define macro above to use it" //#error "Viz is in beta state now. Please define macro above to use it"
...@@ -38,7 +87,7 @@ namespace cv ...@@ -38,7 +87,7 @@ namespace cv
Affine3f getViewerPose(); Affine3f getViewerPose();
void setViewerPose(const Affine3f &pose); void setViewerPose(const Affine3f &pose);
void resetCameraViewpoint (const String &id); void resetCameraViewpoint(const String &id);
void resetCamera(); void resetCamera();
void convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord); void convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord);
...@@ -47,9 +96,9 @@ namespace cv ...@@ -47,9 +96,9 @@ namespace cv
Size getWindowSize() const; Size getWindowSize() const;
void setWindowSize(const Size &window_size); void setWindowSize(const Size &window_size);
String getWindowName() const; String getWindowName() const;
void saveScreenshot (const String &file); void saveScreenshot(const String &file);
void setWindowPosition (int x, int y); void setWindowPosition(int x, int y);
void setFullScreen (bool mode); void setFullScreen(bool mode);
void setBackgroundColor(const Color& color = Color::black()); void setBackgroundColor(const Color& color = Color::black());
void spin(); void spin();
...@@ -78,5 +127,4 @@ namespace cv ...@@ -78,5 +127,4 @@ namespace cv
} /* namespace viz */ } /* namespace viz */
} /* namespace cv */ } /* namespace cv */
#endif
#pragma once /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#ifndef __OPENCV_VIZ_WIDGET_ACCESSOR_HPP__
#define __OPENCV_VIZ_WIDGET_ACCESSOR_HPP__
#include <opencv2/core/cvdef.h> #include <opencv2/core/cvdef.h>
#include <vtkSmartPointer.h> #include <vtkSmartPointer.h>
...@@ -19,3 +68,5 @@ namespace cv ...@@ -19,3 +68,5 @@ namespace cv
}; };
} }
} }
#endif
\ No newline at end of file
#pragma once /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#ifndef __OPENCV_VIZ_WIDGETS_HPP__
#define __OPENCV_VIZ_WIDGETS_HPP__
#include <opencv2/viz/types.hpp> #include <opencv2/viz/types.hpp>
...@@ -305,4 +354,6 @@ namespace cv ...@@ -305,4 +354,6 @@ namespace cv
template<> CV_EXPORTS MeshWidget Widget::cast<MeshWidget>(); template<> CV_EXPORTS MeshWidget Widget::cast<MeshWidget>();
} /* namespace viz */ } /* namespace viz */
} /* namespace cv */ } /* namespace cv */
\ No newline at end of file
#endif
This diff is collapsed.
This diff is collapsed.
#pragma once /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#ifndef __OPENCV_VIZ_INTERACTOR_STYLE_H__
#define __OPENCV_VIZ_INTERACTOR_STYLE_H__
#include <opencv2/viz/types.hpp> #include <opencv2/viz/types.hpp>
...@@ -6,27 +55,6 @@ namespace cv ...@@ -6,27 +55,6 @@ namespace cv
{ {
namespace viz namespace viz
{ {
/** \brief InteractorStyle defines an unique, custom VTK based interactory style Viz applications.
* Besides defining the rendering style, we also create a list of custom actions
* that are triggered on different keys being pressed:
*
* - p, P : switch to a point-based representation
* - w, W : switch to a wireframe-based representation (where available)
* - s, S : switch to a surface-based representation (where available)
* - j, J : take a .PNG snapshot of the current window view
* - c, C : display current camera/window parameters
* - f, F : fly to point mode
* - e, E : exit the interactor
* - q, Q : stop and call VTK's TerminateApp
* - + / - : increment/decrement overall point size
* - r, R [+ ALT] : reset camera [to viewpoint = {0, 0, 0} -> center_{x, y, z}]
* - ALT + s, S : turn stereo mode on/off
* - ALT + f, F : switch between maximized window mode and original size
* -
* - SHIFT + left click : select a point
*
* \author Radu B. Rusu
*/
class InteractorStyle : public vtkInteractorStyleTrackballCamera class InteractorStyle : public vtkInteractorStyleTrackballCamera
{ {
public: public:
...@@ -38,37 +66,31 @@ namespace cv ...@@ -38,37 +66,31 @@ namespace cv
KB_MOD_SHIFT KB_MOD_SHIFT
}; };
static InteractorStyle *New (); static InteractorStyle *New();
InteractorStyle () {} InteractorStyle() {}
virtual ~InteractorStyle () {} virtual ~InteractorStyle() {}
// this macro defines Superclass, the isA functionality and the safe downcast method // this macro defines Superclass, the isA functionality and the safe downcast method
vtkTypeMacro (InteractorStyle, vtkInteractorStyleTrackballCamera) vtkTypeMacro(InteractorStyle, vtkInteractorStyleTrackballCamera)
/** \brief Initialization routine. Must be called before anything else. */ /** \brief Initialization routine. Must be called before anything else. */
virtual void Initialize (); virtual void Initialize();
inline void setWidgetActorMap (const Ptr<WidgetActorMap>& actors) { widget_actor_map_ = actors; } inline void setWidgetActorMap(const Ptr<WidgetActorMap>& actors) { widget_actor_map_ = actors; }
void setRenderer (vtkSmartPointer<vtkRenderer>& ren) { renderer_ = ren; } void setRenderer(vtkSmartPointer<vtkRenderer>& ren) { renderer_ = ren; }
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 saveScreenshot (const std::string &file); void saveScreenshot(const std::string &file);
/** \brief Change the default keyboard modified from ALT to a different special key. /** \brief Change the default keyboard modified from ALT to a different special key.*/
* Allowed values are: inline void setKeyboardModifier(const KeyboardModifier &modifier) { modifier_ = modifier; }
* - KB_MOD_ALT
* - KB_MOD_CTRL
* - KB_MOD_SHIFT
* \param[in] modifier the new keyboard modifier
*/
inline void setKeyboardModifier (const KeyboardModifier &modifier) { modifier_ = modifier; }
protected: protected:
/** \brief Set to true after initialization is complete. */ /** \brief Set to true after initialization is complete. */
bool init_; bool init_;
/** \brief Collection of vtkRenderers stored internally. */ /** \brief Collection of vtkRenderers stored internally. */
//vtkSmartPointer<vtkRendererCollection> rens_;
vtkSmartPointer<vtkRenderer> renderer_; vtkSmartPointer<vtkRenderer> renderer_;
/** \brief Actor map stored internally. */ /** \brief Actor map stored internally. */
...@@ -85,32 +107,33 @@ namespace cv ...@@ -85,32 +107,33 @@ namespace cv
/** \brief A PNG writer for screenshot captures. */ /** \brief A PNG writer for screenshot captures. */
vtkSmartPointer<vtkPNGWriter> snapshot_writer_; vtkSmartPointer<vtkPNGWriter> snapshot_writer_;
/** \brief Internal window to image filter. Needed by \a snapshot_writer_. */ /** \brief Internal window to image filter. Needed by \a snapshot_writer_. */
vtkSmartPointer<vtkWindowToImageFilter> wif_; vtkSmartPointer<vtkWindowToImageFilter> wif_;
/** \brief Interactor style internal method. Gets called whenever a key is pressed. */ /** \brief Interactor style internal method. Gets called whenever a key is pressed. */
virtual void OnChar (); virtual void OnChar();
// Keyboard events // Keyboard events
virtual void OnKeyDown (); virtual void OnKeyDown();
virtual void OnKeyUp (); virtual void OnKeyUp();
// mouse button events // mouse button events
virtual void OnMouseMove (); virtual void OnMouseMove();
virtual void OnLeftButtonDown (); virtual void OnLeftButtonDown();
virtual void OnLeftButtonUp (); virtual void OnLeftButtonUp();
virtual void OnMiddleButtonDown (); virtual void OnMiddleButtonDown();
virtual void OnMiddleButtonUp (); virtual void OnMiddleButtonUp();
virtual void OnRightButtonDown (); virtual void OnRightButtonDown();
virtual void OnRightButtonUp (); virtual void OnRightButtonUp();
virtual void OnMouseWheelForward (); virtual void OnMouseWheelForward();
virtual void OnMouseWheelBackward (); virtual void OnMouseWheelBackward();
/** \brief Interactor style internal method. Gets called periodically if a timer is set. */ /** \brief Interactor style internal method. Gets called periodically if a timer is set. */
virtual void OnTimer (); virtual void OnTimer();
void zoomIn (); void zoomIn();
void zoomOut (); void zoomOut();
/** \brief True if we're using red-blue colors for anaglyphic stereo, false if magenta-green. */ /** \brief True if we're using red-blue colors for anaglyphic stereo, false if magenta-green. */
bool stereo_anaglyph_mask_default_; bool stereo_anaglyph_mask_default_;
...@@ -125,3 +148,5 @@ namespace cv ...@@ -125,3 +148,5 @@ namespace cv
}; };
} }
} }
#endif
#include "precomp.hpp" /*M///////////////////////////////////////////////////////////////////////////////////////
\ No newline at end of file //
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#include "precomp.hpp"
#pragma once /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#ifndef __OPENCV_VIZ_PRECOMP_HPP__
#define __OPENCV_VIZ_PRECOMP_HPP__
#include <map> #include <map>
#include <ctime> #include <ctime>
...@@ -89,3 +138,5 @@ namespace cv ...@@ -89,3 +138,5 @@ namespace cv
#include <opencv2/viz.hpp> #include <opencv2/viz.hpp>
#include <opencv2/viz/types.hpp> #include <opencv2/viz/types.hpp>
#include "opencv2/viz/widget_accessor.hpp" #include "opencv2/viz/widget_accessor.hpp"
#endif
This diff is collapsed.
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#include "precomp.hpp" #include "precomp.hpp"
////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////
...@@ -23,8 +71,8 @@ cv::viz::Color cv::viz::Color::gray() { return Color(128, 128, 128); } ...@@ -23,8 +71,8 @@ cv::viz::Color cv::viz::Color::gray() { return Color(128, 128, 128); }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
/// cv::viz::KeyboardEvent /// cv::viz::KeyboardEvent
cv::viz::KeyboardEvent::KeyboardEvent (bool _action, const std::string& _key_sym, unsigned char key, bool alt, bool ctrl, bool shift) cv::viz::KeyboardEvent::KeyboardEvent(bool _action, const std::string& _key_sym, unsigned char key, bool alt, bool ctrl, bool shift)
: action_ (_action), modifiers_ (0), key_code_(key), key_sym_ (_key_sym) : action_(_action), modifiers_(0), key_code_(key), key_sym_(_key_sym)
{ {
if (alt) if (alt)
modifiers_ = Alt; modifiers_ = Alt;
...@@ -36,18 +84,18 @@ cv::viz::KeyboardEvent::KeyboardEvent (bool _action, const std::string& _key_sym ...@@ -36,18 +84,18 @@ cv::viz::KeyboardEvent::KeyboardEvent (bool _action, const std::string& _key_sym
modifiers_ |= Shift; modifiers_ |= Shift;
} }
bool cv::viz::KeyboardEvent::isAltPressed () const { return (modifiers_ & Alt) != 0; } bool cv::viz::KeyboardEvent::isAltPressed() const { return (modifiers_ & Alt) != 0; }
bool cv::viz::KeyboardEvent::isCtrlPressed () const { return (modifiers_ & Ctrl) != 0; } bool cv::viz::KeyboardEvent::isCtrlPressed() const { return (modifiers_ & Ctrl) != 0; }
bool cv::viz::KeyboardEvent::isShiftPressed () const { return (modifiers_ & Shift) != 0; } bool cv::viz::KeyboardEvent::isShiftPressed() const { return (modifiers_ & Shift) != 0; }
unsigned char cv::viz::KeyboardEvent::getKeyCode () const { return key_code_; } unsigned char cv::viz::KeyboardEvent::getKeyCode() const { return key_code_; }
const cv::String& cv::viz::KeyboardEvent::getKeySym () const { return key_sym_; } const cv::String& cv::viz::KeyboardEvent::getKeySym() const { return key_sym_; }
bool cv::viz::KeyboardEvent::keyDown () const { return action_; } bool cv::viz::KeyboardEvent::keyDown() const { return action_; }
bool cv::viz::KeyboardEvent::keyUp () const { return !action_; } bool cv::viz::KeyboardEvent::keyUp() const { return !action_; }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
/// cv::viz::MouseEvent /// cv::viz::MouseEvent
cv::viz::MouseEvent::MouseEvent (const Type& _type, const MouseButton& _button, const Point& _p, bool alt, bool ctrl, bool shift) cv::viz::MouseEvent::MouseEvent(const Type& _type, const MouseButton& _button, const Point& _p, bool alt, bool ctrl, bool shift)
: type(_type), button(_button), pointer(_p), key_state(0) : type(_type), button(_button), pointer(_p), key_state(0)
{ {
if (alt) if (alt)
...@@ -73,19 +121,19 @@ struct cv::viz::Mesh3d::loadMeshImpl ...@@ -73,19 +121,19 @@ struct cv::viz::Mesh3d::loadMeshImpl
reader->SetFileName(file.c_str()); reader->SetFileName(file.c_str());
reader->Update(); reader->Update();
vtkSmartPointer<vtkPolyData> poly_data = reader->GetOutput (); vtkSmartPointer<vtkPolyData> poly_data = reader->GetOutput();
CV_Assert("File does not exist or file format is not supported." && poly_data); CV_Assert("File does not exist or file format is not supported." && poly_data);
vtkSmartPointer<vtkPoints> mesh_points = poly_data->GetPoints (); vtkSmartPointer<vtkPoints> mesh_points = poly_data->GetPoints();
vtkIdType nr_points = mesh_points->GetNumberOfPoints (); vtkIdType nr_points = mesh_points->GetNumberOfPoints();
mesh.cloud.create(1, nr_points, CV_32FC3); mesh.cloud.create(1, nr_points, CV_32FC3);
Vec3f *mesh_cloud = mesh.cloud.ptr<Vec3f>(); Vec3f *mesh_cloud = mesh.cloud.ptr<Vec3f>();
for (vtkIdType i = 0; i < mesh_points->GetNumberOfPoints (); i++) for (vtkIdType i = 0; i < mesh_points->GetNumberOfPoints(); i++)
{ {
Vec3d point; Vec3d point;
mesh_points->GetPoint (i, point.val); mesh_points->GetPoint(i, point.val);
mesh_cloud[i] = point; mesh_cloud[i] = point;
} }
...@@ -94,15 +142,15 @@ struct cv::viz::Mesh3d::loadMeshImpl ...@@ -94,15 +142,15 @@ struct cv::viz::Mesh3d::loadMeshImpl
if (poly_data->GetPointData()) if (poly_data->GetPointData())
poly_colors = vtkUnsignedCharArray::SafeDownCast(poly_data->GetPointData()->GetScalars()); poly_colors = vtkUnsignedCharArray::SafeDownCast(poly_data->GetPointData()->GetScalars());
if (poly_colors && (poly_colors->GetNumberOfComponents () == 3)) if (poly_colors && (poly_colors->GetNumberOfComponents() == 3))
{ {
mesh.colors.create(1, nr_points, CV_8UC3); mesh.colors.create(1, nr_points, CV_8UC3);
Vec3b *mesh_colors = mesh.colors.ptr<cv::Vec3b>(); Vec3b *mesh_colors = mesh.colors.ptr<cv::Vec3b>();
for (vtkIdType i = 0; i < mesh_points->GetNumberOfPoints (); i++) for (vtkIdType i = 0; i < mesh_points->GetNumberOfPoints(); i++)
{ {
Vec3b point_color; Vec3b point_color;
poly_colors->GetTupleValue (i, point_color.val); poly_colors->GetTupleValue(i, point_color.val);
std::swap(point_color[0], point_color[2]); // RGB -> BGR std::swap(point_color[0], point_color[2]); // RGB -> BGR
mesh_colors[i] = point_color; mesh_colors[i] = point_color;
...@@ -114,17 +162,17 @@ struct cv::viz::Mesh3d::loadMeshImpl ...@@ -114,17 +162,17 @@ struct cv::viz::Mesh3d::loadMeshImpl
// Now handle the polygons // Now handle the polygons
vtkIdType* cell_points; vtkIdType* cell_points;
vtkIdType nr_cell_points; vtkIdType nr_cell_points;
vtkCellArray * mesh_polygons = poly_data->GetPolys (); vtkCellArray * mesh_polygons = poly_data->GetPolys();
mesh_polygons->InitTraversal (); mesh_polygons->InitTraversal();
mesh.polygons.create(1, mesh_polygons->GetSize(), CV_32SC1); mesh.polygons.create(1, mesh_polygons->GetSize(), CV_32SC1);
int* polygons = mesh.polygons.ptr<int>(); int* polygons = mesh.polygons.ptr<int>();
while (mesh_polygons->GetNextCell (nr_cell_points, cell_points)) while (mesh_polygons->GetNextCell(nr_cell_points, cell_points))
{ {
*polygons++ = nr_cell_points; *polygons++ = nr_cell_points;
for (int i = 0; i < nr_cell_points; ++i) for (int i = 0; i < nr_cell_points; ++i)
*polygons++ = static_cast<int> (cell_points[i]); *polygons++ = static_cast<int>(cell_points[i]);
} }
return mesh; return mesh;
...@@ -257,4 +305,4 @@ cv::viz::Camera cv::viz::Camera::KinectCamera(const Size &window_size) ...@@ -257,4 +305,4 @@ cv::viz::Camera cv::viz::Camera::KinectCamera(const Size &window_size)
K(1,2) = 2.6748068171871557e+02; K(1,2) = 2.6748068171871557e+02;
K(2,2) = 1.0f; K(2,2) = 1.0f;
return Camera(K, window_size); return Camera(K, window_size);
} }
\ No newline at end of file
#include "precomp.hpp" /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#include "precomp.hpp"
cv::Affine3f cv::viz::makeTransformToGlobal(const Vec3f& axis_x, const Vec3f& axis_y, const Vec3f& axis_z, const Vec3f& origin) cv::Affine3f cv::viz::makeTransformToGlobal(const Vec3f& axis_x, const Vec3f& axis_y, const Vec3f& axis_z, const Vec3f& origin)
{ {
...@@ -44,7 +91,7 @@ cv::Affine3f cv::viz::makeCameraPose(const Vec3f& position, const Vec3f& focal_p ...@@ -44,7 +91,7 @@ cv::Affine3f cv::viz::makeCameraPose(const Vec3f& position, const Vec3f& focal_p
return pose_mat; return pose_mat;
} }
vtkSmartPointer<vtkMatrix4x4> cv::viz::convertToVtkMatrix (const cv::Matx44f &m) vtkSmartPointer<vtkMatrix4x4> cv::viz::convertToVtkMatrix(const cv::Matx44f &m)
{ {
vtkSmartPointer<vtkMatrix4x4> vtk_matrix = vtkSmartPointer<vtkMatrix4x4>::New(); vtkSmartPointer<vtkMatrix4x4> vtk_matrix = vtkSmartPointer<vtkMatrix4x4>::New();
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
...@@ -58,7 +105,7 @@ cv::Matx44f cv::viz::convertToMatx(const vtkSmartPointer<vtkMatrix4x4>& vtk_matr ...@@ -58,7 +105,7 @@ cv::Matx44f cv::viz::convertToMatx(const vtkSmartPointer<vtkMatrix4x4>& vtk_matr
cv::Matx44f m; cv::Matx44f m;
for (int i = 0; i < 4; i++) for (int i = 0; i < 4; i++)
for (int k = 0; k < 4; k++) for (int k = 0; k < 4; k++)
m(i, k) = vtk_matrix->GetElement (i, k); m(i, k) = vtk_matrix->GetElement(i, k);
return m; return m;
} }
...@@ -165,4 +212,4 @@ void cv::viz::VizAccessor::generateWindowName(const String &window_name, String ...@@ -165,4 +212,4 @@ void cv::viz::VizAccessor::generateWindowName(const String &window_name, String
cv::viz::Viz3d cv::viz::get(const String &window_name) cv::viz::Viz3d cv::viz::get(const String &window_name)
{ {
return cv::viz::VizAccessor::getInstance().get(window_name); return cv::viz::VizAccessor::getInstance().get(window_name);
} }
\ No newline at end of file
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#include <opencv2/viz/viz3d.hpp> #include <opencv2/viz/viz3d.hpp>
#include "viz3d_impl.hpp" #include "viz3d_impl.hpp"
cv::viz::Viz3d::Viz3d(const String& window_name) : impl_(0) { create(window_name); } cv::viz::Viz3d::Viz3d(const String& window_name) : impl_(0) { create(window_name); }
cv::viz::Viz3d::Viz3d(const Viz3d& other) : impl_(other.impl_) cv::viz::Viz3d::Viz3d(const Viz3d& other) : impl_(other.impl_)
...@@ -45,7 +92,7 @@ void cv::viz::Viz3d::release() ...@@ -45,7 +92,7 @@ void cv::viz::Viz3d::release()
} }
void cv::viz::Viz3d::spin() { impl_->spin(); } void cv::viz::Viz3d::spin() { impl_->spin(); }
void cv::viz::Viz3d::spinOnce (int time, bool force_redraw) { impl_->spinOnce(time, force_redraw); } void cv::viz::Viz3d::spinOnce(int time, bool force_redraw) { impl_->spinOnce(time, force_redraw); }
bool cv::viz::Viz3d::wasStopped() const { return impl_->wasStopped(); } bool cv::viz::Viz3d::wasStopped() const { return impl_->wasStopped(); }
void cv::viz::Viz3d::registerKeyboardCallback(KeyboardCallback callback, void* cookie) void cv::viz::Viz3d::registerKeyboardCallback(KeyboardCallback callback, void* cookie)
...@@ -67,7 +114,7 @@ cv::viz::Camera cv::viz::Viz3d::getCamera() const { return impl_->getCamera(); } ...@@ -67,7 +114,7 @@ cv::viz::Camera cv::viz::Viz3d::getCamera() const { return impl_->getCamera(); }
void cv::viz::Viz3d::setViewerPose(const Affine3f &pose) { impl_->setViewerPose(pose); } void cv::viz::Viz3d::setViewerPose(const Affine3f &pose) { impl_->setViewerPose(pose); }
cv::Affine3f cv::viz::Viz3d::getViewerPose() { return impl_->getViewerPose(); } cv::Affine3f cv::viz::Viz3d::getViewerPose() { return impl_->getViewerPose(); }
void cv::viz::Viz3d::resetCameraViewpoint (const String &id) { impl_->resetCameraViewpoint(id); } void cv::viz::Viz3d::resetCameraViewpoint(const String &id) { impl_->resetCameraViewpoint(id); }
void cv::viz::Viz3d::resetCamera() { impl_->resetCamera(); } void cv::viz::Viz3d::resetCamera() { impl_->resetCamera(); }
void cv::viz::Viz3d::convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord) { impl_->convertToWindowCoordinates(pt, window_coord); } void cv::viz::Viz3d::convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord) { impl_->convertToWindowCoordinates(pt, window_coord); }
...@@ -76,9 +123,9 @@ void cv::viz::Viz3d::converTo3DRay(const Point3d &window_coord, Point3d &origin, ...@@ -76,9 +123,9 @@ void cv::viz::Viz3d::converTo3DRay(const Point3d &window_coord, Point3d &origin,
cv::Size cv::viz::Viz3d::getWindowSize() const { return impl_->getWindowSize(); } cv::Size cv::viz::Viz3d::getWindowSize() const { return impl_->getWindowSize(); }
void cv::viz::Viz3d::setWindowSize(const Size &window_size) { impl_->setWindowSize(window_size.width, window_size.height); } void cv::viz::Viz3d::setWindowSize(const Size &window_size) { impl_->setWindowSize(window_size.width, window_size.height); }
cv::String cv::viz::Viz3d::getWindowName() const { return impl_->getWindowName(); } cv::String cv::viz::Viz3d::getWindowName() const { return impl_->getWindowName(); }
void cv::viz::Viz3d::saveScreenshot (const String &file) { impl_->saveScreenshot(file); } void cv::viz::Viz3d::saveScreenshot(const String &file) { impl_->saveScreenshot(file); }
void cv::viz::Viz3d::setWindowPosition (int x, int y) { impl_->setWindowPosition(x,y); } void cv::viz::Viz3d::setWindowPosition(int x, int y) { impl_->setWindowPosition(x,y); }
void cv::viz::Viz3d::setFullScreen (bool mode) { impl_->setFullScreen(mode); } void cv::viz::Viz3d::setFullScreen(bool mode) { impl_->setFullScreen(mode); }
void cv::viz::Viz3d::setBackgroundColor(const Color& color) { impl_->setBackgroundColor(color); } void cv::viz::Viz3d::setBackgroundColor(const Color& color) { impl_->setBackgroundColor(color); }
void cv::viz::Viz3d::setRenderingProperty(const String &id, int property, double value) { getWidget(id).setRenderingProperty(property, value); } void cv::viz::Viz3d::setRenderingProperty(const String &id, int property, double value) { getWidget(id).setRenderingProperty(property, value); }
......
This diff is collapsed.
#pragma once /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#ifndef __OPENCV_VIZ_VIZ3D_IMPL_HPP__
#define __OPENCV_VIZ_VIZ3D_IMPL_HPP__
#include <opencv2/viz.hpp> #include <opencv2/viz.hpp>
#include "interactor_style.h" #include "interactor_style.h"
...@@ -12,8 +61,8 @@ public: ...@@ -12,8 +61,8 @@ public:
int ref_counter; int ref_counter;
VizImpl (const String &name); VizImpl(const String &name);
virtual ~VizImpl (); virtual ~VizImpl();
void showWidget(const String &id, const Widget &widget, const Affine3f &pose = Affine3f::Identity()); void showWidget(const String &id, const Widget &widget, const Affine3f &pose = Affine3f::Identity());
void removeWidget(const String &id); void removeWidget(const String &id);
...@@ -28,19 +77,19 @@ public: ...@@ -28,19 +77,19 @@ public:
double getDesiredUpdateRate(); double getDesiredUpdateRate();
/** \brief Returns true when the user tried to close the window */ /** \brief Returns true when the user tried to close the window */
bool wasStopped () const { if (interactor_ != NULL) return (stopped_); else return true; } bool wasStopped() const { if (interactor_ != NULL) return (stopped_); else return true; }
/** \brief Set the stopped flag back to false */ /** \brief Set the stopped flag back to false */
void resetStoppedFlag () { if (interactor_ != NULL) stopped_ = false; } void resetStoppedFlag() { if (interactor_ != NULL) stopped_ = false; }
/** \brief Stop the interaction and close the visualizaton window. */ /** \brief Stop the interaction and close the visualizaton window. */
void close () void close()
{ {
stopped_ = true; stopped_ = true;
if (interactor_) if (interactor_)
{ {
interactor_->GetRenderWindow()->Finalize(); interactor_->GetRenderWindow()->Finalize();
interactor_->TerminateApp (); // This tends to close the window... interactor_->TerminateApp(); // This tends to close the window...
} }
} }
...@@ -49,8 +98,7 @@ public: ...@@ -49,8 +98,7 @@ public:
void setCamera(const Camera &camera); void setCamera(const Camera &camera);
Camera getCamera() const; Camera getCamera() const;
/** \brief Reset the camera direction from {0, 0, 0} to the center_{x, y, z} of a given dataset. /** \brief Reset the camera to a given widget */
* \param[in] id the point cloud object id (default: cloud) */
void resetCameraViewpoint(const String& id); void resetCameraViewpoint(const String& id);
void resetCamera(); void resetCamera();
...@@ -60,16 +108,16 @@ public: ...@@ -60,16 +108,16 @@ public:
void convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord); void convertToWindowCoordinates(const Point3d &pt, Point3d &window_coord);
void converTo3DRay(const Point3d &window_coord, Point3d &origin, Vec3d &direction); void converTo3DRay(const Point3d &window_coord, Point3d &origin, Vec3d &direction);
void saveScreenshot (const String &file); void saveScreenshot(const String &file);
void setWindowPosition (int x, int y); void setWindowPosition(int x, int y);
Size getWindowSize() const; Size getWindowSize() const;
void setWindowSize (int xw, int yw); void setWindowSize(int xw, int yw);
void setFullScreen (bool mode); void setFullScreen(bool mode);
String getWindowName() const; String getWindowName() const;
void setBackgroundColor (const Color& color); void setBackgroundColor(const Color& color);
void spin (); void spin();
void spinOnce (int time = 1, bool force_redraw = false); void spinOnce(int time = 1, bool force_redraw = false);
void registerKeyboardCallback(KeyboardCallback callback, void* cookie = 0); void registerKeyboardCallback(KeyboardCallback callback, void* cookie = 0);
void registerMouseCallback(MouseCallback callback, void* cookie = 0); void registerMouseCallback(MouseCallback callback, void* cookie = 0);
...@@ -88,12 +136,12 @@ private: ...@@ -88,12 +136,12 @@ private:
if (event_id != vtkCommand::TimerEvent) if (event_id != vtkCommand::TimerEvent)
return; return;
int timer_id = *reinterpret_cast<int*> (call_data); int timer_id = *reinterpret_cast<int*>(call_data);
if (timer_id != right_timer_id) if (timer_id != right_timer_id)
return; return;
// Stop vtk loop and send notification to app to wake it up // Stop vtk loop and send notification to app to wake it up
viz_->interactor_->TerminateApp (); viz_->interactor_->TerminateApp();
} }
int right_timer_id; int right_timer_id;
VizImpl* viz_; VizImpl* viz_;
...@@ -101,17 +149,17 @@ private: ...@@ -101,17 +149,17 @@ private:
struct ExitCallback : public vtkCommand struct ExitCallback : public vtkCommand
{ {
static ExitCallback* New () static ExitCallback* New()
{ {
return new ExitCallback; return new ExitCallback;
} }
virtual void Execute (vtkObject*, unsigned long event_id, void*) virtual void Execute(vtkObject*, unsigned long event_id, void*)
{ {
if (event_id == vtkCommand::ExitEvent) if (event_id == vtkCommand::ExitEvent)
{ {
viz_->stopped_ = true; viz_->stopped_ = true;
viz_->interactor_->GetRenderWindow()->Finalize(); viz_->interactor_->GetRenderWindow()->Finalize();
viz_->interactor_->TerminateApp (); viz_->interactor_->TerminateApp();
} }
} }
VizImpl* viz_; VizImpl* viz_;
...@@ -141,14 +189,14 @@ private: ...@@ -141,14 +189,14 @@ private:
/** \brief Boolean that holds whether or not the camera parameters were manually initialized*/ /** \brief Boolean that holds whether or not the camera parameters were manually initialized*/
bool camera_set_; bool camera_set_;
bool removeActorFromRenderer (const vtkSmartPointer<vtkProp> &actor); bool removeActorFromRenderer(const vtkSmartPointer<vtkProp> &actor);
/** \brief Internal method. Creates a vtk actor from a vtk polydata object. /** \brief Internal method. Creates a vtk actor from a vtk polydata object.
* \param[in] data the vtk polydata object to create an actor for * \param[in] data the vtk polydata object to create an actor for
* \param[out] actor the resultant vtk actor object * \param[out] actor the resultant vtk actor object
* \param[in] use_scalars set scalar properties to the mapper if it exists in the data. Default: true. * \param[in] use_scalars set scalar properties to the mapper if it exists in the data. Default: true.
*/ */
void createActorFromVTKDataSet (const vtkSmartPointer<vtkDataSet> &data, vtkSmartPointer<vtkLODActor> &actor, bool use_scalars = true); void createActorFromVTKDataSet(const vtkSmartPointer<vtkDataSet> &data, vtkSmartPointer<vtkLODActor> &actor, bool use_scalars = true);
/** \brief Updates a set of cells (vtkIdTypeArray) if the number of points in a cloud changes /** \brief Updates a set of cells (vtkIdTypeArray) if the number of points in a cloud changes
* \param[out] cells the vtkIdTypeArray object (set of cells) to update * \param[out] cells the vtkIdTypeArray object (set of cells) to update
...@@ -158,7 +206,7 @@ private: ...@@ -158,7 +206,7 @@ private:
* \param[in] nr_points the number of points in the new cloud. This dictates how many cells we need to * \param[in] nr_points the number of points in the new cloud. This dictates how many cells we need to
* generate * generate
*/ */
void updateCells (vtkSmartPointer<vtkIdTypeArray> &cells, vtkSmartPointer<vtkIdTypeArray> &initcells, vtkIdType nr_points); void updateCells(vtkSmartPointer<vtkIdTypeArray> &cells, vtkSmartPointer<vtkIdTypeArray> &initcells, vtkIdType nr_points);
}; };
...@@ -167,7 +215,7 @@ namespace cv ...@@ -167,7 +215,7 @@ namespace cv
{ {
namespace viz namespace viz
{ {
vtkSmartPointer<vtkMatrix4x4> convertToVtkMatrix (const cv::Matx44f &m); vtkSmartPointer<vtkMatrix4x4> convertToVtkMatrix(const cv::Matx44f &m);
cv::Matx44f convertToMatx(const vtkSmartPointer<vtkMatrix4x4>& vtk_matrix); cv::Matx44f convertToMatx(const vtkSmartPointer<vtkMatrix4x4>& vtk_matrix);
struct NanFilter struct NanFilter
...@@ -186,12 +234,12 @@ namespace cv ...@@ -186,12 +234,12 @@ namespace cv
int s_chs = source.channels(); int s_chs = source.channels();
int m_chs = nan_mask.channels(); int m_chs = nan_mask.channels();
for(int y = 0; y < source.rows; ++y) for (int y = 0; y < source.rows; ++y)
{ {
const _Tp* srow = source.ptr<_Tp>(y); const _Tp* srow = source.ptr<_Tp>(y);
const _Msk* mrow = nan_mask.ptr<_Msk>(y); const _Msk* mrow = nan_mask.ptr<_Msk>(y);
for(int x = 0; x < source.cols; ++x, srow += s_chs, mrow += m_chs) for (int x = 0; x < source.cols; ++x, srow += s_chs, mrow += m_chs)
if (!isNan(mrow[0]) && !isNan(mrow[1]) && !isNan(mrow[2])) if (!isNan(mrow[0]) && !isNan(mrow[1]) && !isNan(mrow[2]))
*output++ = _Out(srow); *output++ = _Out(srow);
} }
...@@ -207,12 +255,12 @@ namespace cv ...@@ -207,12 +255,12 @@ namespace cv
int s_chs = source.channels(); int s_chs = source.channels();
int m_chs = nan_mask.channels(); int m_chs = nan_mask.channels();
for(int y = 0; y < source.rows; ++y) for (int y = 0; y < source.rows; ++y)
{ {
const _Tp* srow = source.ptr<_Tp>(y); const _Tp* srow = source.ptr<_Tp>(y);
const _Msk* mrow = nan_mask.ptr<_Msk>(y); const _Msk* mrow = nan_mask.ptr<_Msk>(y);
for(int x = 0; x < source.cols; ++x, srow += s_chs, mrow += m_chs) for (int x = 0; x < source.cols; ++x, srow += s_chs, mrow += m_chs)
if (!isNan(mrow[0]) && !isNan(mrow[1]) && !isNan(mrow[2])) if (!isNan(mrow[0]) && !isNan(mrow[1]) && !isNan(mrow[2]))
{ {
*output = _Out(srow); *output = _Out(srow);
...@@ -338,6 +386,6 @@ namespace cv ...@@ -338,6 +386,6 @@ namespace cv
} }
}; };
} }
} }
#endif
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#include "precomp.hpp" #include "precomp.hpp"
/////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////
......
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
// Authors:
// * Ozan Tonkal, ozantonkal@gmail.com
// * Anatoly Baksheev, Itseez Inc. myname.mysurname <> mycompany.com
//
// OpenCV Viz module is complete rewrite of
// PCL visualization module (www.pointclouds.org)
//
//M*/
#ifdef __GNUC__ #ifdef __GNUC__
# pragma GCC diagnostic ignored "-Wmissing-declarations" # pragma GCC diagnostic ignored "-Wmissing-declarations"
# if defined __clang__ || defined __APPLE__ # if defined __clang__ || defined __APPLE__
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment