iCub-main
PinholeCalibTool.h
Go to the documentation of this file.
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 /*
4  * Copyright (C) 2007 Lijin Aryananda, Jonas Ruesch
5  * CopyPolicy: Released under the terms of the GNU GPL v2.0.
6  *
7  */
8 
9 #ifndef __PINHOLECALIBTOOL__
10 #define __PINHOLECALIBTOOL__
11 
12 #include <iostream>
13 #include <string>
14 #include <stdlib.h>
15 #include <stdio.h>
16 #include <math.h>
17 
18 // opencv
19 #include <opencv2/core/core_c.h>
20 #include <opencv2/calib3d/calib3d_c.h>
21 #include <opencv2/calib3d.hpp>
22 
23 // yarp
24 //#include <yarp/sig/Image.h>
25 #include <yarp/sig/all.h>
26 #include <yarp/os/Bottle.h>
27 #include <yarp/os/Value.h>
28 
29 // iCub
30 #include <iCub/ICalibTool.h>
31 
32 
38 class PinholeCalibTool : public ICalibTool
39 {
40  private:
41 
42  CvMat *_intrinsic_matrix;
43  CvMat *_intrinsic_matrix_scaled;
44  CvMat *_distortion_coeffs;;
45 
46  IplImage *_mapUndistortX;
47  IplImage *_mapUndistortY;
48 
49  bool _needInit;
50 
51  CvSize _calibImgSize;
52  CvSize _oldImgSize;
53 
54  bool _drawCenterCross;
55 
56  bool init(CvSize currImgSize, CvSize calibImgSize);
57 
58 public:
59 
61  virtual ~PinholeCalibTool();
62 
64  virtual bool open (yarp::os::Searchable &config);
65  virtual bool close ();
91  virtual bool configure (yarp::os::Searchable &config);
92 
94  void stopConfig( std::string val );
95 
100  void apply(const yarp::sig::ImageOf<yarp::sig::PixelRgb> & in,
101  yarp::sig::ImageOf<yarp::sig::PixelRgb> & out);
102 
103 };
104 
105 
106 #endif
107 
108 
109 
110 
Interface to calibrate and project input image based on camera's internal parameters and projection m...
Definition: ICalibTool.h:19
Class to calibrate input image based on camera's internal parameters Configuration: See PinholeCalibT...
virtual bool configure(yarp::os::Searchable &config)
The PinholeCalibTool expects a configuration file as show below.
virtual ~PinholeCalibTool()
virtual bool close()
void apply(const yarp::sig::ImageOf< yarp::sig::PixelRgb > &in, yarp::sig::ImageOf< yarp::sig::PixelRgb > &out)
Apply calibration, in = rgb image, out = calibrated rgb image.
virtual bool open(yarp::os::Searchable &config)
open() passes on to configure()
void stopConfig(std::string val)
Stop module if there is a wrong value.
out
Definition: sine.m:8