44 #include <visp3/ar/vpAROgre.h>
45 #include <visp3/core/vpCameraParameters.h>
46 #include <visp3/core/vpHomogeneousMatrix.h>
47 #include <visp3/core/vpImage.h>
48 #include <visp3/sensor/vp1394TwoGrabber.h>
49 #include <visp3/sensor/vpV4l2Grabber.h>
51 #if defined(HAVE_OPENCV_VIDEOIO)
52 #include <opencv2/videoio.hpp>
55 #if defined(VISP_HAVE_OGRE)
57 #ifndef DOXYGEN_SHOULD_SKIP_THIS
59 class vpAROgreAdvanced :
public vpAROgre
63 Ogre::AnimationState *mAnimationState;
67 unsigned int height = 480)
70 mAnimationState =
nullptr;
77 Ogre::Entity *robot = mSceneMgr->createEntity(
"Robot",
"robot.mesh");
79 Ogre::SceneNode *RobotNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(
"Robot");
82 RobotNode->attachObject(robot);
83 RobotNode->scale((Ogre::Real)0.001, (Ogre::Real)0.001, (Ogre::Real)0.001);
84 RobotNode->pitch(Ogre::Degree(180));
85 RobotNode->yaw(Ogre::Degree(-90));
89 mAnimationState = robot->getAnimationState(
"Idle");
91 mAnimationState->setLoop(
true);
93 mAnimationState->setEnabled(
true);
100 mAnimationState->addTime(evt.timeSinceLastFrame);
111 #if defined(VISP_HAVE_OGRE)
112 #if defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_DC1394) || defined(HAVE_OPENCV_VIDEOIO)
121 #if defined(VISP_HAVE_V4L2)
129 #elif defined(VISP_HAVE_DC1394)
137 #elif defined(HAVE_OPENCV_VIDEOIO)
139 cv::VideoCapture grabber(0);
140 if (!grabber.isOpened()) {
141 std::cout <<
"Failed to open the camera" << std::endl;
165 while (ogre.continueRendering()) {
167 #if defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_DC1394)
169 #elif defined(HAVE_OPENCV_VIDEOIO)
177 ogre.display(I, cMo);
180 std::cout <<
"You need an available framegrabber to run this example" << std::endl;
183 std::cout <<
"You need Ogre3D to run this example" << std::endl;
188 std::cout <<
"Catch an exception: " << e << std::endl;
192 std::cout <<
"Catch an exception " << std::endl;
Class for firewire ieee1394 video devices using libdc1394-2.x api.
void acquire(vpImage< unsigned char > &I)
void open(vpImage< unsigned char > &I)
Implementation of an augmented reality viewer using Ogre3D 3rd party.
virtual bool customframeEnded(const Ogre::FrameEvent &evt)
virtual void createScene(void)
Generic class defining intrinsic camera parameters.
error that can be emitted by ViSP classes.
Implementation of an homogeneous matrix and operations on such kind of matrices.
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
unsigned int getWidth() const
unsigned int getHeight() const
Class that is a wrapper over the Video4Linux2 (V4L2) driver.
void open(vpImage< unsigned char > &I)
void acquire(vpImage< unsigned char > &I)