iCub-main
DualCamCalibModule.h
Go to the documentation of this file.
1 // -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2 
3 // Copyright (C) 2015 Istituto Italiano di Tecnologia - iCub Facility
4 // Author: Marco Randazzo <marco.randazzo@iit.it>
5 // CopyPolicy: Released under the terms of the GNU GPL v2.0.
6 
7 #ifndef __DUALCAMCALIBMODULE__
8 #define __DUALCAMCALIBMODULE__
9 
10 // opencv
11 #include <opencv2/core/core_c.h>
12 
13 // yarp
14 #include <yarp/os/BufferedPort.h>
15 #include <yarp/os/RFModule.h>
16 #include <yarp/os/Time.h>
17 #include <yarp/os/Log.h>
18 #include <yarp/os/LogStream.h>
19 #include <yarp/sig/Image.h>
20 
21 // iCub
22 #include <iCub/PinholeCalibTool.h>
23 #include <iCub/SphericalCalibTool.h>
24 #include <iCub/CalibToolFactory.h>
25 #include <iCub/ICalibTool.h>
26 
27 class CamCalibModule : public yarp::os::RFModule {
28 
29 private:
30 
31  bool verboseExecTime;
32  enum align_type
33  {
34  ALIGN_WIDTH=0,
35  ALIGN_HEIGHT=1
36  } align;
37 
38  // dualImage_mode: if true, the input port will read a single image with both frames together, left one
39  // on the left side, right one on the right side. In this case imageInLeft port will read the frame and the right
40  // port will be inactive.
41  bool dualImage_mode;
42  yarp::sig::ImageOf<yarp::sig::PixelRgb>* leftImage;
43  yarp::sig::ImageOf<yarp::sig::PixelRgb>* rightImage;
44 
45  yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > imageInLeft;
46  yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > imageInRight;
47  yarp::os::BufferedPort<yarp::sig::ImageOf<yarp::sig::PixelRgb> > imageOut;
48  yarp::os::Port configPort;
49 
50  ICalibTool * calibToolLeft;
51  ICalibTool * calibToolRight;
52  double requested_fps;
53  double time_lastOut;
54 
55  yarp::sig::ImageOf<yarp::sig::PixelRgb> calibratedImgLeft;
56  yarp::sig::ImageOf<yarp::sig::PixelRgb> calibratedImgRight;
57 
58 
59 public:
60 
63 
64  virtual bool configure(yarp::os::ResourceFinder &rf);
65  virtual bool close();
66  virtual bool interruptModule();
67  virtual bool updateModule();
68  virtual bool respond(const yarp::os::Bottle& command, yarp::os::Bottle& reply);
69  virtual double getPeriod();
70 };
71 
72 
73 #endif
Camera Calibration Module class.
virtual bool interruptModule()
virtual double getPeriod()
virtual bool close()
virtual bool respond(const yarp::os::Bottle &command, yarp::os::Bottle &reply)
virtual bool updateModule()
virtual bool configure(yarp::os::ResourceFinder &rf)
Interface to calibrate and project input image based on camera's internal parameters and projection m...
Definition: ICalibTool.h:19