#ifndef DOXYGEN_SHOULD_SKIP_THIS
#import "ViewController.h"
#ifdef __cplusplus
#import <visp3/visp.h>
#endif
@interface ViewController ()
@end
@implementation ViewController
#pragma mark - Example of a function that uses ViSP
- (void)processViSPHomography{
std::vector<vpPoint> oP(4), aP(4), bP(4);
double L = 0.1;
oP[0].setWorldCoordinates( -L,-L, 0);
oP[1].setWorldCoordinates(2*L,-L, 0);
oP[2].setWorldCoordinates( L, 3*L, 0);
oP[3].setWorldCoordinates( -L, 4*L, 0);
std::vector<double> xa(4), ya(4), xb(4), yb(4);
for(int i=0 ; i < 4; i++){
}
std::cout << "Homography:\n" << aHb << std::endl;
std::cout <<
"atb: " << atb.
t() << std::endl;
std::cout << "Ground truth:" << std::endl;
std::cout << " Point 3 in pixels in frame b: " << iPb << std::endl;
std::cout << " Point 3 in pixels in frame a: " << iPa << std::endl;
vpMatrix H = cam.get_K() * aHb * cam.get_K_inverse();
std::cout << "Estimation from homography:" << std::endl;
}
- (void)viewDidLoad {
[super viewDidLoad];
[self processViSPHomography];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
@end
#endif
Generic class defining intrinsic camera parameters.
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.
In this sample, we first import the headers to use