28 namespace visualization {
31 unsigned int position_x_,
unsigned int position_y_,
32 unsigned int width_ ,
unsigned int height_) :
33 Window(name_, position_x_, position_y_, width_, height_)
46 LOG(LTRACE) <<
"WindowMNISTDigit::Display handler of window " << glutGetWindow();
49 APP_DATA_SYNCHRONIZATION_SCOPED_LOCK();
52 glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
53 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
61 size_t w_window = glutGet(GLUT_WINDOW_WIDTH);
62 size_t h_window = glutGet(GLUT_WINDOW_HEIGHT);
65 float w_scale = (float) w_window / w_tensor;
66 float h_scale = (float) h_window / h_tensor;
67 float scale_min = (w_scale < h_scale) ? w_scale : h_scale;
75 for (
size_t y = 0; y < h_tensor; y++) {
76 for (
size_t x = 0; x < w_tensor; x++) {
83 draw_filled_rectangle(
float(x) * w_scale,
float(y) * h_scale, h_scale, w_scale, r, g, b, (
float)1.0f);
88 r = 0.0; g = 0.0; b = 0.0;
89 draw_cross((
float(x) + 0.5)* w_scale, (
float(y) + 0.5)* h_scale, scale_min/4, 4.0, r, g, b, (
float)1.0f);
90 r = 1.0; g = 0.0; b = 0.0;
91 draw_cross((
float(x) + 0.5)* w_scale, (
float(y) + 0.5)* h_scale, scale_min/4, 2.0, r, g, b, (
float)1.0f);
97 r = 0.0; g = 0.0; b = 0.0;
98 draw_circle((
float(x) + 0.5)* w_scale, (
float(y) + 0.5)* h_scale, scale_min/4, 4.0, r, g, b, (
float)1.0f);
99 r = 1.0; g = 1.0; b = 1.0;
100 draw_circle((
float(x) + 0.5)* w_scale, (
float(y) + 0.5)* h_scale, scale_min/4, 2.0, r, g, b, (
float)1.0f);
107 draw_grid(0.5f, 0.3f, 0.3f, 0.3f, w_tensor, h_tensor);
117 Position2D prev = (*saccadic_path)[i-1];
118 Position2D next = (*saccadic_path)[i];
121 glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
124 glVertex2i((
float(prev.x) + 0.5) * w_scale, (
float(prev.y) + 0.5) * h_scale);
125 glVertex2i((
float(next.x) + 0.5) * w_scale, (
float(next.y) + 0.5) * h_scale);
129 draw_circle((
float(next.x) + 0.5)* w_scale, (
float(next.y) + 0.5)* h_scale, 2.0, 1.0, 1.0, 1.0, 1.0, 1.0);
138 Position2D prev = (*saccadic_path)[i-1];
139 Position2D next = (*saccadic_path)[i];
143 glColor4f(0.0f, g, 0.0f, 1.0f);
144 glVertex2i((
float(prev.x) + 0.5) * w_scale, (
float(prev.y) + 0.5) * h_scale);
145 glVertex2i((
float(next.x) + 0.5) * w_scale, (
float(next.y) + 0.5) * h_scale);
165 APP_DATA_SYNCHRONIZATION_SCOPED_LOCK();
173 APP_DATA_SYNCHRONIZATION_SCOPED_LOCK();
void draw_circle(float x, float y, float size, float line_width, float r, float g, float b, float a)
mic::types::TensorXfPtr displayed_digit
void draw_filled_rectangle(float x, float y, float h, float w, float r, float g, float b, float a)
Channel storing the agent position.
std::shared_ptr< std::vector< mic::types::Position2D > > saccadic_path
Saccadic path to be displayed - a sequence of consecutive agent positions.
void setPathPointer(std::shared_ptr< std::vector< mic::types::Position2D > > saccadic_path_)
void displayHandler(void)
virtual ~WindowMNISTDigit()
Parent class of all OpenGL-based windows (abstract).
void draw_cross(float x, float y, float size, float line_width, float r, float g, float b, float a)
Channel storing image intensities (this is a grayscale image)
void draw_grid(float r, float g, float b, float a, float cells_h, float cells_v, float line_width_=1.0)
WindowMNISTDigit(std::string name_="MNISTDigit", unsigned int position_x_=0, unsigned int position_y_=0, unsigned int width_=512, unsigned int height_=512)
Declaration of WindowManager class along with a bunch of helpful types and macros.
void setDigitPointer(mic::types::TensorXfPtr displayed_digit_)