iCub-main
CamCalibModule.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 Jonas Ruesch
5  * CopyPolicy: Released under the terms of the GNU GPL v2.0.
6  *
7  */
8 
9 #ifndef __CAMCALIBMODULE__
10 #define __CAMCALIBMODULE__
11 
12  // std
13 #include <stdio.h>
14 
15 // opencv
16 #include <opencv2/core/core_c.h>
17 
18 // yarp
19 #include <yarp/os/all.h>
20 #include <yarp/sig/all.h>
21 
22 // iCub
23 #include <iCub/PinholeCalibTool.h>
24 #include <iCub/SphericalCalibTool.h>
25 #include <iCub/CalibToolFactory.h>
26 #include <iCub/ICalibTool.h>
27 
33 class CamCalibPort : public yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> >
34 {
35 private:
36  yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > *portImgOut;
37  ICalibTool *calibTool;
38 
39  bool verbose;
40  double t0;
41  double currSat;
42 
43  virtual void onRead(yarp::sig::ImageOf<yarp::sig::PixelRgb> &yrpImgIn);
44 
45 public:
46  CamCalibPort();
47 
48  void setSaturation(double satVal);
49  void setPointers(yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > *_portImgOut, ICalibTool *_calibTool);
50  void setVerbose(const bool sw) { verbose=sw; }
51 };
52 
53 
61 class CamCalibModule : public yarp::os::RFModule {
62 
63 private:
64 
65  CamCalibPort _prtImgIn;
66  yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > _prtImgOut;
67  yarp::os::Port _configPort;
68 
69  ICalibTool * _calibTool;
70 
71 public:
72 
75 
77  virtual bool configure(yarp::os::ResourceFinder &rf);
78  virtual bool close();
79  virtual bool interruptModule();
80  virtual bool updateModule();
81  virtual bool respond(const yarp::os::Bottle& command, yarp::os::Bottle& reply);
82  virtual double getPeriod();
83 
84 };
85 
86 
87 #endif
Camera Calibration Module class.
virtual bool interruptModule()
virtual bool respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply)
virtual bool configure(yarp::os::ResourceFinder &rf)
Passes config on to CalibTool.
virtual bool updateModule()
virtual double getPeriod()
virtual bool close()
Camera Calibration Port class.
void setSaturation(double satVal)
void setVerbose(const bool sw)
void setPointers(yarp::os::BufferedPort< yarp::sig::ImageOf< yarp::sig::PixelRgb > > *_portImgOut, ICalibTool *_calibTool)
Interface to calibrate and project input image based on camera's internal parameters and projection m...
Definition: ICalibTool.h:19