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/IConfig.h>
27 #include <yarp/os/Bottle.h>
28 #include <yarp/os/Value.h>
29 
30 // iCub
31 #include <iCub/ICalibTool.h>
32 
33 
40 {
41  private:
42 
43  CvMat *_intrinsic_matrix;
44  CvMat *_intrinsic_matrix_scaled;
45  CvMat *_distortion_coeffs;;
46 
47  IplImage *_mapUndistortX;
48  IplImage *_mapUndistortY;
49 
50  bool _needInit;
51 
52  CvSize _calibImgSize;
53  CvSize _oldImgSize;
54 
55  bool _drawCenterCross;
56 
57  bool init(CvSize currImgSize, CvSize calibImgSize);
58 
59 public:
60 
62  virtual ~PinholeCalibTool();
63 
65  virtual bool open (yarp::os::Searchable &config);
66  virtual bool close ();
92  virtual bool configure (yarp::os::Searchable &config);
93 
95  void stopConfig( std::string val );
96 
101  void apply(const yarp::sig::ImageOf<yarp::sig::PixelRgb> & in,
102  yarp::sig::ImageOf<yarp::sig::PixelRgb> & out);
103 
104 };
105 
106 
107 #endif
108 
109 
110 
111 
PinholeCalibTool
Class to calibrate input image based on camera's internal parameters Configuration: See PinholeCalibT...
Definition: PinholeCalibTool.h:39
out
out
Definition: sine.m:8
PinholeCalibTool::stopConfig
void stopConfig(std::string val)
Stop module if there is a wrong value.
Definition: PinholeCalibTool.cpp:48
PinholeCalibTool::open
virtual bool open(yarp::os::Searchable &config)
open() passes on to configure()
math.h
PinholeCalibTool::~PinholeCalibTool
virtual ~PinholeCalibTool()
Definition: PinholeCalibTool.cpp:27
PinholeCalibTool::close
virtual bool close()
Definition: PinholeCalibTool.cpp:31
PinholeCalibTool::PinholeCalibTool
PinholeCalibTool()
Definition: PinholeCalibTool.cpp:16
ICalibTool
Interface to calibrate and project input image based on camera's internal parameters and projection m...
Definition: ICalibTool.h:19
string
string(REPLACE "-rdynamic" "" CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "${CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS}") include_directories($
Definition: CMakeLists.txt:9
PinholeCalibTool::apply
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.
PinholeCalibTool::configure
virtual bool configure(yarp::os::Searchable &config)
The PinholeCalibTool expects a configuration file as show below.