Shows how to build a task with a segment visual feature.
#include <fstream>
#include <iostream>
#include <vector>
#include <numeric>
#include <visp/vpConfig.h>
#include <visp/vpCameraParameters.h>
#include <visp/vpDisplay.h>
#include <visp/vpDisplayGDI.h>
#include <visp/vpDisplayX.h>
#include <visp/vpFeatureBuilder.h>
#include <visp/vpFeatureSegment.h>
#include <visp/vpHomogeneousMatrix.h>
#include <visp/vpImage.h>
#include <visp/vpMath.h>
#include <visp/vpParseArgv.h>
#include <visp/vpPlot.h>
#include <visp/vpPoint.h>
#include <visp/vpRobotCamera.h>
#include <visp/vpServo.h>
int main(int argc, const char **argv)
{
try {
#if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
int opt_no_display = 0;
int opt_curves = 1;
#endif
int opt_normalized = 1;
vpParseArgv::vpArgvInfo argTable[] =
{
#if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
"Disable display and graphics viewer."},
#endif
"1 to use normalized features, 0 for non normalized."},
"Print the help."},
} ;
return (false);
}
std::cout << "Used options: " << std::endl;
#if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
opt_curves = (opt_no_display == 0) ? 1 : 0;
std::cout << " - no display: " << opt_no_display << std::endl;
std::cout << " - curves : " << opt_curves << std::endl;
#endif
std::cout << " - normalized: " << opt_normalized << std::endl;
#if defined(VISP_HAVE_X11) || defined(VISP_HAVE_GDI)
if (!opt_no_display) {
#if defined(VISP_HAVE_X11)
#elif defined VISP_HAVE_GDI
#endif
}
#endif
#if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
if (!opt_no_display)
#endif
for (int i=0; i<4; i++) {
Pd[i] = P[i];
}
for (int i=0; i<4; i++) {
Pc[i] = P[i];
}
for (int i=0; i <2; i++)
{
if (opt_normalized) {
}
else {
}
}
for (int i=0; i <2; i++)
#if (defined (VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
if (!opt_no_display) {
for (int i=0; i <2; i++) {
}
}
#endif
#if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
if (opt_curves)
{
graph =
new vpPlot(2, 500, 500, 700, 10,
"Curves...");
}
#endif
float sampling_time = 0.010f ;
int iter=0;
do{
for (int i=0; i <4; i++)
Pc[i].project(cMo);
for (int i=0; i <2; i++)
#if (defined (VISP_HAVE_X11) || defined(VISP_HAVE_GDI))
if (!opt_no_display) {
for (int i=0; i <2; i++) {
}
}
#endif
#if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
if (opt_curves)
{
}
#endif
iter ++;
}
while(( task.
getError() ).sumSquare() > 0.0005);
#if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
if (graph != NULL)
delete graph;
#endif
#if (defined (VISP_HAVE_X11) || defined (VISP_HAVE_GDI))
if (!opt_no_display && display != NULL)
delete display;
#endif
std::cout <<
"final error=" << ( task.
getError() ).sumSquare() << std::endl;
return 0;
}
std::cout << "Catch an exception: " << e << std::endl;
return 1;
}
}