46 #include <visp3/sensor/vpOpenCVGrabber.h> 47 #include <visp3/sensor/vpV4l2Grabber.h> 48 #include <visp3/sensor/vp1394TwoGrabber.h> 49 #include <visp3/core/vpHomogeneousMatrix.h> 50 #include <visp3/core/vpImage.h> 51 #include <visp3/core/vpCameraParameters.h> 52 #include <visp3/ar/vpAROgre.h> 54 #if defined(VISP_HAVE_OGRE) 56 #ifndef DOXYGEN_SHOULD_SKIP_THIS 58 class vpAROgreAdvanced :
public vpAROgre 62 Ogre::AnimationState * mAnimationState;
66 unsigned int width = 640,
unsigned int height = 480)
69 mAnimationState = NULL;
76 Ogre::Entity* robot = mSceneMgr->createEntity(
"Robot",
"robot.mesh");
78 Ogre::SceneNode* RobotNode = mSceneMgr->getRootSceneNode()->createChildSceneNode(
"Robot");
79 RobotNode->
setPosition((Ogre::Real)-0.3, (Ogre::Real)0.2, (Ogre::Real)0);
80 RobotNode->attachObject(robot);
81 RobotNode->scale((Ogre::Real)0.001,(Ogre::Real)0.001,(Ogre::Real)0.001);
82 RobotNode->pitch(Ogre::Degree(180));
83 RobotNode->yaw(Ogre::Degree(-90));
87 mAnimationState = robot->getAnimationState(
"Idle" );
89 mAnimationState->setLoop(
true );
91 mAnimationState->setEnabled(
true );
98 mAnimationState->addTime( evt.timeSinceLastFrame );
109 #if defined(VISP_HAVE_OGRE) 110 #if defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_DC1394) || (VISP_HAVE_OPENCV_VERSION >= 0x020100) 119 #if defined(VISP_HAVE_V4L2) 127 #elif defined(VISP_HAVE_DC1394) 135 #elif defined(VISP_HAVE_OPENCV) 137 cv::VideoCapture grabber(0);
138 if(!grabber.isOpened()) {
139 std::cout <<
"Failed to open the camera" << std::endl;
163 while(ogre.continueRendering()){
165 #if defined(VISP_HAVE_V4L2) || defined(VISP_HAVE_DC1394) 167 #elif defined(VISP_HAVE_OPENCV) 175 ogre.display(I, cMo);
178 std::cout <<
"You need an available framegrabber to run this example" << std::endl;
181 std::cout <<
"You need Ogre3D to run this example" << std::endl;
186 std::cout <<
"Catch an exception: " << e << std::endl;
190 std::cout <<
"Catch an exception " << std::endl;
void setPosition(const vpHomogeneousMatrix &wMc)
void acquire(vpImage< unsigned char > &I)
void open(vpImage< unsigned char > &I)
unsigned int getWidth() const
static void convert(const vpImage< unsigned char > &src, vpImage< vpRGBa > &dest)
Implementation of an homogeneous matrix and operations on such kind of matrices.
virtual bool customframeEnded(const Ogre::FrameEvent &evt)
error that can be emited by ViSP classes.
Implementation of an augmented reality viewer.
void acquire(vpImage< unsigned char > &I)
void open(vpImage< unsigned char > &I)
vp_deprecated void init()
Generic class defining intrinsic camera parameters.
Class for the Video4Linux2 video device.
virtual void createScene(void)
unsigned int getHeight() const
Class for firewire ieee1394 video devices using libdc1394-2.x api.