#include <visp/vpDisplayX.h>
#include <visp/vpDisplayGDI.h>
#include <visp/vpAROgre.h>
#include <visp/vpFeatureBuilder.h>
#include <visp/vpPose.h>
#include <visp/vpServo.h>
#include <visp/vpServoDisplay.h>
#include <visp/vpSimulatorCamera.h>
void display_trajectory(
const vpImage<unsigned char> &I,
const std::vector<vpDot2> &dot,
unsigned int thickness)
{
static std::vector<vpImagePoint> traj[4];
for (unsigned int i=0; i<4; i++) {
traj[i].push_back(dot[i].getCog());
}
for (unsigned int i=0; i<4; i++) {
for (unsigned int j=1; j<traj[i].size(); j++) {
}
}
}
#if defined(VISP_HAVE_OGRE)
#if VISP_VERSION_INT > VP_VERSION_INT(2,7,0)
const
#endif
{
vpImageTools::binarise(I, (
unsigned char)254, (
unsigned char)255, (
unsigned char)0, (
unsigned char)255, (
unsigned char)255);
}
#endif
int main()
{
#if defined(VISP_HAVE_OGRE) && (defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
unsigned int thickness = 3;
std::vector<vpPoint> point(4) ;
point[0].setWorldCoordinates(-0.1,-0.1, 0);
point[1].setWorldCoordinates( 0.1,-0.1, 0);
point[2].setWorldCoordinates( 0.1, 0.1, 0);
point[3].setWorldCoordinates(-0.1, 0.1, 0);
ogre.
init(background,
false,
true);
std::vector<std::string> name(4);
for (int i=0; i<4; i++) {
std::ostringstream s; s << "Sphere" << i; name[i] = s.str();
ogre.
load(name[i],
"Sphere.mesh");
ogre.
setScale(name[i], 0.02f, 0.02f, 0.02f);
}
light->setDiffuseColour(1, 1, 1);
light->setSpecularColour(1, 1, 1);
light->setPosition((Ogre::Real)cdMo[0][3], (Ogre::Real)cdMo[1][3], (Ogre::Real)(-cdMo[2][3]));
light->setType(Ogre::Light::LT_POINT);
ogre_get_render_image(ogre, background, cdMo, I);
#if defined(VISP_HAVE_X11)
vpDisplayX d(I, 0, 0,
"Camera view at desired position");
#elif defined(VISP_HAVE_GDI)
#else
std::cout << "No image viewer is available..." << std::endl;
#endif
std::vector<vpDot2> dot(4);
for (int i = 0 ; i < 4 ; i++) {
dot[i].setGraphics(true);
dot[i].setGraphicsThickness(thickness);
dot[i].initTracking(I);
}
ogre_get_render_image(ogre, background, cMo, I);
for (int i = 0 ; i < 4 ; i++) {
dot[i].setGraphics(true);
dot[i].initTracking(I);
}
for (int i = 0 ; i < 4 ; i++) {
point[i].changeFrame(cMo, cP) ;
}
wMo = wMc * cMo;
for (; ; ) {
ogre_get_render_image(ogre, background, cMo, I);
for (int i = 0 ; i < 4 ; i++) {
dot[i].track(I);
}
for (int i = 0 ; i < 4 ; i++) {
point[i].changeFrame(cMo, cP) ;
}
display_trajectory(I, dot, thickness);
break;
}
#endif
}