CameraCalibration 中的一些错误

邹缪文
2023-12-01

CameraCalibration 依赖于Pangolin,后者的代码目前有些大小写的问题,由此导致CameraCalibration工程也有类似的问题。要将工程代码中的Pangolin改成pangolin。

此外,还有一处涉及Pangolin编译报错:

/home/yasi/opencv/Pangolin-master/pangolin/../pangolin/display.h: In constructor ‘pangolin::Handler2D::Handler2D()’:
/home/yasi/opencv/Pangolin-master/pangolin/../pangolin/display.h:478: error: ‘pangolin::Handler2D::in_view’ will be initialized after
/home/yasi/opencv/Pangolin-master/pangolin/../pangolin/display.h:477: error:   ‘bool pangolin::Handler2D::pressed’
/home/yasi/opencv/Pangolin-master/pangolin/../pangolin/display.h:465: error:   when initialized here

明明是合乎C++语法规范的代码,确报错。将Pangolin中的pangolin/display.h中的下面代码

struct PANGOLIN_API Handler2D : Handler
{

	Handler2D():in_view(false), pressed(false){};

	void Keyboard(View&, unsigned char key, int x, int y, bool pressed);
	void Mouse(View&, MouseButton button, int x, int y, bool pressed, int button_state);
	void MouseMotion(View&, int x, int y, int button_state);

	bool IsInsideView() const { return in_view; }
	bool IsPressed() const { return pressed; }
	GLint const* GetLastPos() const { return last_pos; }

protected:
	MouseButton button;
	bool pressed;
	bool in_view;
	GLint last_pos[2];
};

改成

struct PANGOLIN_API Handler2D : Handler
{
	Handler2D() {
			in_view = false;
			pressed = false;
	}

	void Keyboard(View&, unsigned char key, int x, int y, bool pressed);
	void Mouse(View&, MouseButton button, int x, int y, bool pressed, int button_state);
	void MouseMotion(View&, int x, int y, int button_state);

	bool IsInsideView() const { return in_view; }
	bool IsPressed() const { return pressed; }
	GLint const* GetLastPos() const { return last_pos; }

protected:
	MouseButton button;
	bool pressed;
	bool in_view;
	GLint last_pos[2];
};
就不再报错了,但还是不解。


 类似资料: