-
Notifications
You must be signed in to change notification settings - Fork 1
delta_t_display
Alexandre Marcireau edited this page Apr 16, 2019
·
6 revisions
In header "../third_party/chameleon/source/delta_t_display.hpp"
chameleon::delta_t_display
displays a stream of exposure measurements encoded as time differences.
namespace chameleon {
class delta_t_display : public QQuickItem {
Q_OBJECT
Q_INTERFACES(QQmlParserStatus)
Q_PROPERTY(QSize canvas_size READ canvas_size WRITE set_canvas_size)
Q_PROPERTY(QVector2D discards READ discards WRITE set_discards NOTIFY discards_changed)
Q_PROPERTY(float discard_ratio READ discard_ratio WRITE set_discard_ratio)
Q_PROPERTY(colormap colormap READ colormap WRITE set_colormap)
Q_PROPERTY(QRectF paint_area READ paint_area)
Q_ENUMS(Colormap)
public:
/// Colormap defines the colormap used by the display.
enum Colormap { Grey, Hot, Jet };
delta_t_display();
/// set_canvas_size defines the display coordinates.
/// The canvas size will be passed to the openGL renderer, therefore it should only be set during qml
/// construction.
virtual void set_canvas_size(QSize canvas_size);
/// canvas_size returns the currently used canvas_size.
virtual QSize canvas_size() const;
/// set_discards defines the discards.
/// if both the black and white discards are zero (default), the discards are computed automatically.
virtual void set_discards(QVector2D discards);
/// discards returns the currently used discards.
virtual QVector2D discards() const;
/// set_discard_ratio defines the discards ratio.
/// The discards ratio will be passed to the openGL renderer, therefore it should only be set during qml
/// construction.
virtual void set_discard_ratio(float discard_ratio);
/// discard_ratio returns the currently used discard_ratio.
virtual float discard_ratio();
/// set_colormap defines the colormap.
/// The colormap will be passed to the openGL renderer, therefore it should only be set during qml construction.
virtual void set_colormap(Colormap colormap);
/// colormap returns the currently used colormap.
virtual Colormap colormap();
/// paint_area returns the paint area in window coordinates.
virtual QRectF paint_area() const;
/// push adds an event to the display.
template <typename Event>
void push(Event event);
/// assign sets all the pixels at once.
template <typename Iterator>
void assign(Iterator begin, Iterator end);
/// componentComplete is called when all the qml values are bound.
virtual void componentComplete() override;
signals:
/// discards_changed notifies a change in the discards.
void discards_changed(QVector2D discards);
/// paintAreaChanged notifies a paint area change.
void paintAreaChanged(QRectF paint_area);
public slots:
/// sync adapts the renderer to external changes.
void sync();
/// cleanup frees the owned renderer.
void cleanup();
/// trigger_draw requests a window refresh.
void trigger_draw();
/// update_discards updates the discards from a signal.
void update_discards(QVector2D discards);
};
}
-
canvas_size
is the pixel array size. As an example, ifx
is in the range[0, 319]
andy
is in the range[0, 239]
,canvas_size
must beQSize(320, 240)
. -
discards
contains the black discard and the white discard (exposure measurement saturation boundaries). Setting both the black and white discards to zero switches on the discards auto-computation. -
discard_ratio
is the relative amount of extremum values removed before the auto-computation of the discards (used only if both the black and white discards are zero). -
colormap
determines how exposure measurements are mapped to pixel colors. The following values are available:-
Colormap::Grey
maps the values to grey levels (all components are equal in RGB space). -
Colormap::Hot
mimics MATLAB's hot colormap. -
Colormap::Jet
mimics MATLAB's jet colormap.
-
-
Event
must have at least the propertiesx
,y
, anddelta_t
. -
begin
andend
are the begin and past-the-end iterators to a range ofcanvas_size.width() * canvas_size.height()
objects with at least the propertydelta_t
. The object associated with the pixel at coordinates[x, y]
must be at the indexx + y * canvas_size.width()
in the range. -
paint_area
is the rectangle in which the events will actually be drawn.paint_area
has the same shape (ratio of width over height) ascanvas_size
.
chameleon::delta_t_display
is associated with a chameleon::delta_t_display_renderer
to handle OpenGL calls.
namespace chameleon {
class delta_t_display_renderer : public QObject, public QOpenGLFunctions_3_3_Core {
Q_OBJECT
public:
delta_t_display_renderer(
QSize canvas_size,
float discard_ratio,
std::size_t colormap);
/// set_rendering_area defines the rendering area.
virtual void set_rendering_area(QRectF clear_area, QRectF paint_area, int window_height);
/// set_discards defines the discards.
/// if both the black and white discards are zero (default), the discards are computed automatically.
virtual void set_discards(QVector2D discards);
/// push adds an event to the display.
template <typename Event>
void push(Event event);
/// assign sets all the pixels at once.
template <typename Iterator>
void assign(Iterator begin, Iterator end);
signals:
/// discards_changed notifies a change in the discards.
void discards_changed(QVector2D discards);
public slots:
/// paint sends commands to the GPU.
void paint();
};
}
-
clear_area
is the rectangle in which the display must be drawn, in screen coordinates. -
window_height
is the total window height (used to convert from Qt coordinates to OpenGL coordinates).
A typical QML instantiation has the following syntax:
DeltaTDisplay {
canvas_size: "320x240" // required
discards: Qt.vector2d(0, 0) // optional, defaults to Qt.vector2d(0, 0)
discard_ratio: 0.01 // optional, defaults to 0.01
colormap: DeltaTDisplay.Grey // optional, defaults to DeltaTDisplay.Grey
}