Main Page · Modules · All Classes · Class Hierarchy
MECalibration.hpp
1 /*
2  * This file is part of the AiBO+ project
3  *
4  * Copyright (C) 2005-2016 Csaba Kertész (csaba.kertesz@gmail.com)
5  *
6  * AiBO+ is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * AiBO+ is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
19  *
20  */
21 
22 #pragma once
23 
24 #include <MCDefs.hpp>
25 #include <MCTypes.hpp>
26 
27 #include <boost/scoped_ptr.hpp>
28 #include <boost/shared_ptr.hpp>
29 #include <boost/serialization/access.hpp>
30 #include <boost/serialization/split_member.hpp>
31 
32 class MCBinaryData;
33 class MECalibrationWrapper;
34 class MECalibration;
35 class MEImage;
36 
42 namespace ME
43 {
45 typedef boost::shared_ptr<MECalibration> CalibrationSPtr;
46 }
47 
52 {
53  friend class boost::serialization::access;
54 
56 
57 private:
58 
60  MECalibration();
61 
62 public:
63 
72  MECalibration(unsigned int chessboard_width, unsigned int chessboard_height);
73 
86  MECalibration(unsigned int image_width, unsigned int image_height,
87  const MC::FloatTable& intrinsics, const MC::FloatList& distortion);
88 
90  ~MECalibration();
91 
99  unsigned int GetImageWidth() const;
100 
108  unsigned int GetImageHeight() const;
109 
117  MC::FloatTable GetIntrinsicMatrix() const;
118 
126  MC::FloatList GetDistortionVector() const;
127 
135  bool IsCalibrated() const;
136 
149  bool AddImage(MEImage& new_image);
150 
158  float Commit();
159 
170  void Undistort(MEImage& image);
171 
179  void Dump() const;
180 
195  bool SearchChessboardCorners(MEImage& image, bool draw_results) const;
196 
213  static void BlackNormalize(MEImage& source_image, const MEImage& black_image);
214 
222  MCBinaryData* Encode() const;
223 
233  static MECalibration* Decode(const MCBinaryData& data);
234 
235 private:
236 
237  template<class Archive>
238  void load(Archive& archive, const unsigned int version);
239  template<class Archive>
240  void save(Archive& archive, const unsigned int version) const;
241  BOOST_SERIALIZATION_SPLIT_MEMBER();
242 
243 protected:
245  unsigned int ImageWidth;
247  unsigned int ImageHeight;
249  unsigned int ChessboardCornerWidth;
255  boost::scoped_ptr<MECalibrationWrapper> Wrapper;
256 };
257 
Binary data class.
unsigned int ImageWidth
Image width of calibration image sequence.
boost::scoped_ptr< MECalibrationWrapper > Wrapper
OpenCV data.
unsigned int ChessboardCornerHeight
The corner count inside the calibration chessboard vertically.
#define MC_DISABLE_COPY(class_name)
Helper macro to disable the copy constructor and assignment operator of a class (object copying) ...
Definition: MCDefs.hpp:604
unsigned int ImageHeight
Image height of calibration image sequence.
Image.
Definition: MEImage.hpp:112
unsigned int ChessboardCornerWidth
The corner count inside the calibration chessboard horizontally.
bool Calibrated
Whenever the calibration process is finished.
Calibration for a single camera.