Choreonoid  1.8
FisheyeLensConverter.h
Go to the documentation of this file.
1 
6 #ifndef CNOID_BODYPLUGIN_FISHEYE_LENS_CONVERTER_H
7 #define CNOID_BODYPLUGIN_FISHEYE_LENS_CONVERTER_H
8 
9 #include <cnoid/Image>
10 #include <vector>
11 #include <memory>
12 
13 namespace cnoid {
14 
16 {
17 public:
18  enum ScreenId {
20  };
21 
23  void initialize(int width, int height, double fov, int screenWidth);
24  void addScreenImage(std::shared_ptr<Image> image);
25  void setImageRotationEnabled(bool on);
26  void setAntiAliasingEnabled(bool on);
27  void convertImage(Image* image);
28 
29 private:
30  int width;
31  int height;
32  double fov;
33  int screenWidth;
34  std::vector<std::shared_ptr<Image>> screenImages;
35 
36  bool isImageRotationEnabled;
37  bool isAntiAliasingEnabled;
38 
39  struct ScreenIndex{
40  int screenId;
41  int ix;
42  int iy;
43  };
44  std::vector<std::vector<ScreenIndex>> fisheyeLensMap;
45 
46  // for Interpolation
47  int screenId[4];
48  int npx[4],npy[4];
49  struct ScreenIndex4 {
50  ScreenIndex screenIndex[4];
51  double bias[4];
52  };
53  std::vector<std::vector<ScreenIndex4>> fisheyeLensInterpolationMap;
54 
55  enum Corner {
56  FRONT_UR, FRONT_UL, FRONT_DR, FRONT_DL,
57  LEFT_UR, LEFT_UL, LEFT_DR, LEFT_DL,
58  RIGHT_UR, RIGHT_UL, RIGHT_DR, RIGHT_DL,
59  BOTTOM_UR, BOTTOM_UL, BOTTOM_DR, BOTTOM_DL,
60  TOP_UR, TOP_UL, TOP_DR, TOP_DL,
61  BACK_UR, BACK_UL, BACK_DR, BACK_DL
62  };
63 
64  void setCornerPoint(int i, Corner corner);
65  void setCubeCorner(Corner corner0, Corner corner1, Corner corner2, Corner corner3);
66  void setCenter(int id, double sx, double sy);
67  void setVerticalBorder(int id0, int id1, double sy);
68  void setHorizontalBorder(int id0, int id1, double sx);
69  void convertImageWithoutAntiAliasing(Image* image);
70  void convertImageWithAntiAliasing(Image* image);
71 };
72 
73 }
74 
75 #endif
cnoid::FisheyeLensConverter
Definition: FisheyeLensConverter.h:15
cnoid::FisheyeLensConverter::ScreenId
ScreenId
Definition: FisheyeLensConverter.h:18
cnoid::FisheyeLensConverter::TOP_SCREEN
@ TOP_SCREEN
Definition: FisheyeLensConverter.h:19
cnoid::FisheyeLensConverter::RIGHT_SCREEN
@ RIGHT_SCREEN
Definition: FisheyeLensConverter.h:19
cnoid::FisheyeLensConverter::setImageRotationEnabled
void setImageRotationEnabled(bool on)
Definition: FisheyeLensConverter.cpp:52
cnoid::FisheyeLensConverter::BOTTOM_SCREEN
@ BOTTOM_SCREEN
Definition: FisheyeLensConverter.h:19
cnoid::FisheyeLensConverter::LEFT_SCREEN
@ LEFT_SCREEN
Definition: FisheyeLensConverter.h:19
cnoid::FisheyeLensConverter::addScreenImage
void addScreenImage(std::shared_ptr< Image > image)
Definition: FisheyeLensConverter.cpp:46
cnoid::FisheyeLensConverter::FisheyeLensConverter
FisheyeLensConverter()
Definition: FisheyeLensConverter.cpp:25
cnoid
Definition: AbstractSceneLoader.h:11
cnoid::FisheyeLensConverter::BACK_SCREEN
@ BACK_SCREEN
Definition: FisheyeLensConverter.h:19
cnoid::FisheyeLensConverter::initialize
void initialize(int width, int height, double fov, int screenWidth)
Definition: FisheyeLensConverter.cpp:33
cnoid::FisheyeLensConverter::convertImage
void convertImage(Image *image)
Definition: FisheyeLensConverter.cpp:200
cnoid::Image
Definition: Image.h:16
cnoid::FisheyeLensConverter::FRONT_SCREEN
@ FRONT_SCREEN
Definition: FisheyeLensConverter.h:19
cnoid::FisheyeLensConverter::NO_SCREEN
@ NO_SCREEN
Definition: FisheyeLensConverter.h:19
cnoid::FisheyeLensConverter::setAntiAliasingEnabled
void setAntiAliasingEnabled(bool on)
Definition: FisheyeLensConverter.cpp:62