#include <visp3/core/vpPixelMeterConversion.h>
#include <visp3/gui/vpDisplayOpenCV.h>
#include <visp3/io/vpVideoReader.h>
#include <visp3/vision/vpHomography.h>
int main(int argc, const char **argv)
{
#if defined(VISP_HAVE_OPENCV_NONFREE) && (VISP_HAVE_OPENCV_VERSION < 0x030000)
int method = 0;
if (argc > 1)
method = atoi(argv[1]);
if (method == 0)
std::cout << "Uses Ransac to estimate the homography" << std::endl;
else
std::cout << "Uses a robust scheme to estimate the homography" << std::endl;
vpKeyPointSurf surf;
surf.buildReference(I);
corner_ref[0].
set_ij(115, 64);
corner_ref[1].
set_ij(83, 253);
corner_ref[2].
set_ij(282, 307);
corner_ref[3].
set_ij(330, 72);
for (unsigned int i = 0; i < 4; i++) {
}
unsigned int nbMatch = surf.matchPoint(I);
std::vector<vpImagePoint> iPref(nbMatch),
iPcur(nbMatch);
std::vector<double> mPref_x(nbMatch), mPref_y(nbMatch);
std::vector<double> mPcur_x(nbMatch), mPcur_y(nbMatch);
std::vector<bool> inliers(nbMatch);
for (unsigned int i = 0; i < nbMatch; i++) {
surf.getMatchedPoints(i, matched_ref, matched_cur);
iPref[i] = matched_ref;
iPcur[i] = matched_cur;
}
double residual;
if (method == 0)
(
unsigned int)mPref_x.
size() / 2, 2.0 / cam.
get_px(),
true);
else
for (int i = 0; i < 4; i++) {
}
for (int i = 0; i < 4; i++) {
}
for (unsigned int i = 0; i < nbMatch; i++) {
if (inliers[i] == true)
else
}
break;
}
#else
(void)argc;
(void)argv;
#endif
return EXIT_SUCCESS;
}
unsigned int size() const
Return the number of elements of the 2D array.
Generic class defining intrinsic camera parameters.
static const vpColor white
static const vpColor blue
static const vpColor green
The vpDisplayOpenCV allows to display image using the OpenCV library. Thus to enable this class OpenC...
static bool getClick(const vpImage< unsigned char > &I, bool blocking=true)
static void display(const vpImage< unsigned char > &I)
static void displayLine(const vpImage< unsigned char > &I, const vpImagePoint &ip1, const vpImagePoint &ip2, const vpColor &color, unsigned int thickness=1, bool segment=true)
static void displayCross(const vpImage< unsigned char > &I, const vpImagePoint &ip, unsigned int size, const vpColor &color, unsigned int thickness=1)
static void flush(const vpImage< unsigned char > &I)
Implementation of an homography and operations on homographies.
static void robust(const std::vector< double > &xb, const std::vector< double > &yb, const std::vector< double > &xa, const std::vector< double > &ya, vpHomography &aHb, std::vector< bool > &inlier, double &residual, double weights_threshold=0.4, unsigned int niter=4, bool normalization=true)
static vpImagePoint project(const vpCameraParameters &cam, const vpHomography &bHa, const vpImagePoint &iPa)
static bool ransac(const std::vector< double > &xb, const std::vector< double > &yb, const std::vector< double > &xa, const std::vector< double > &ya, vpHomography &aHb, std::vector< bool > &inliers, double &residual, unsigned int nbInliersConsensus, double threshold, bool normalization=true)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
void set_ij(double ii, double jj)
unsigned int getWidth() const
void resize(unsigned int h, unsigned int w)
resize the image : Image initialization
void insert(const vpImage< Type > &src, const vpImagePoint &topLeft)
unsigned int getHeight() const
static void convertPoint(const vpCameraParameters &cam, const double &u, const double &v, double &x, double &y)
Class that enables to manipulate easily a video file or a sequence of images. As it inherits from the...
void acquire(vpImage< vpRGBa > &I)
void setFileName(const std::string &filename)
Class that implements the SURF key points and technics thanks to the OpenCV library.