#include <visp3/core/vpConfig.h>
#ifdef VISP_HAVE_MODULE_AR
#include <visp3/ar/vpAROgre.h>
#endif
#include <visp3/gui/vpDisplayX.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/gui/vpDisplayGDI.h>
#include <visp3/visual_features/vpFeatureBuilder.h>
#include <visp3/vision/vpPose.h>
#include <visp3/vs/vpServo.h>
#include <visp3/vs/vpServoDisplay.h>
#include <visp3/robot/vpSimulatorCamera.h>
#include <visp3/blob/vpDot2.h>
void display_trajectory(
const vpImage<unsigned char> &I,
const std::vector<vpDot2> &dot,
unsigned int thickness);
#if defined(VISP_HAVE_OGRE)
#endif
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)
{
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) || defined(VISP_HAVE_OPENCV))
try {
unsigned int thickness = 3;
std::vector<vpPoint> point;
point.push_back(
vpPoint(-0.1,-0.1, 0) );
point.push_back(
vpPoint( 0.1,-0.1, 0) );
point.push_back(
vpPoint( 0.1, 0.1, 0) );
point.push_back(
vpPoint(-0.1, 0.1, 0) );
ogre.
init(background,
false,
true);
std::vector<std::string> name(4);
for (unsigned 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)
#elif defined(VISP_HAVE_OPENCV)
#else
std::cout << "No image viewer is available..." << std::endl;
#endif
std::vector<vpDot2> dot(4);
for (unsigned 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 (unsigned int i = 0 ; i < 4 ; i++) {
dot[i].setGraphics(true);
dot[i].initTracking(I);
}
for (unsigned int i = 0 ; i < 4 ; i++) {
point[i].changeFrame(cMo, cP) ;
}
wMo = wMc * cMo;
for (; ; ) {
ogre_get_render_image(ogre, background, cMo, I);
for (unsigned int i = 0 ; i < 4 ; i++) {
dot[i].track(I);
}
for (unsigned int i = 0 ; i < 4 ; i++) {
point[i].changeFrame(cMo, cP) ;
}
display_trajectory(I, dot, thickness);
break;
}
}
std::cout << "Catch a ViSP exception: " << e << std::endl;
}
catch(...) {
std::cout << "Catch an exception " << std::endl;
return 1;
}
#endif
}