33 #ifndef DOXYGEN_SHOULD_SKIP_THIS
35 #import "ViewController.h"
37 #import <visp3/visp.h>
40 @interface ViewController ()
43 @implementation ViewController
44 #pragma mark - Example of a function that uses ViSP
45 - (void)processViSPHomography{
47 std::vector<vpPoint> oP(4), aP(4), bP(4);
50 oP[0].setWorldCoordinates( -L,-L, 0);
51 oP[1].setWorldCoordinates(2*L,-L, 0);
52 oP[2].setWorldCoordinates( L, 3*L, 0);
53 oP[3].setWorldCoordinates( -L, 4*L, 0);
60 std::vector<double> xa(4), ya(4), xb(4), yb(4);
62 for(
int i=0 ; i < 4; i++){
64 xa[i] = oP[i].get_x();
65 ya[i] = oP[i].get_y();
67 xb[i] = oP[i].get_x();
68 yb[i] = oP[i].get_y();
76 std::cout <<
"Homography:\n" << aHb << std::endl;
85 std::cout <<
"atb: " << atb.
t() << std::endl;
93 std::cout <<
"Ground truth:" << std::endl;
94 std::cout <<
" Point 3 in pixels in frame b: " << iPb << std::endl;
95 std::cout <<
" Point 3 in pixels in frame a: " << iPa << std::endl;
101 std::cout <<
"Estimation from homography:" << std::endl;
104 - (void)viewDidLoad {
107 [
self processViSPHomography];
109 - (void)didReceiveMemoryWarning {
110 [
super didReceiveMemoryWarning];
Generic class defining intrinsic camera parameters.
vpMatrix get_K_inverse() const
Implementation of column vector and the associated operations.
Implementation of an homogeneous matrix and operations on such kind of matrices.
Implementation of an homography and operations on homographies.
static void DLT(const std::vector< double > &xb, const std::vector< double > &yb, const std::vector< double > &xa, const std::vector< double > &ya, vpHomography &aHb, bool normalization=true)
void computeDisplacement(vpRotationMatrix &aRb, vpTranslationVector &atb, vpColVector &n)
static vpImagePoint project(const vpCameraParameters &cam, const vpHomography &bHa, const vpImagePoint &iPa)
Class that defines a 2D point in an image. This class is useful for image processing and stores only ...
static double rad(double deg)
Implementation of a matrix and operations on matrices.
static void convertPoint(const vpCameraParameters &cam, const double &x, const double &y, double &u, double &v)
Implementation of a rotation matrix and operations on such kind of matrices.
Class that consider the case of a translation vector.