Fawkes API  Fawkes Development Version
ColorTrainWidget Class Reference

This widget implements the complete color training process. More...

#include "color_train_widget.h"

Public Member Functions

 ColorTrainWidget (Gtk::Window *parent)
 Constructor. More...
 
virtual ~ColorTrainWidget ()
 Destructor. More...
 
void set_fg_object (firevision::hint_t fg_object)
 Set the current foreground object. More...
 
void set_src_buffer (unsigned char *buffer, unsigned int img_width, unsigned int img_height)
 Set the buffer containing the image data. More...
 
void set_draw_buffer (unsigned char *buffer)
 Set the buffer to draw the selection into. More...
 
void click (unsigned int x, unsigned int y, unsigned int button=MOUSE_BUTTON_LEFT)
 The user clicked into the image. More...
 
void reset_selection ()
 Reset the selection. More...
 
void load_histograms ()
 Open a dialog to load a histogram. More...
 
void save_histograms ()
 Open a dialog to save a histogram. More...
 
void add_to_colormap ()
 Generate a new colormap by adding the current histograms. More...
 
void reset_colormap ()
 Reset the colormap. More...
 
void load_colormap ()
 Open a dialog to load a colormap. More...
 
void save_colormap ()
 Open a dialog to save a colormap. More...
 
firevision::YuvColormapget_colormap () const
 Get the current colormap. More...
 
void draw_segmentation_result ()
 Render the result of segmenting the image in the source buffer considering the current colormap into the specified Image. More...
 
void set_reset_selection_btn (Gtk::Button *btn)
 Set the button to reset the selection. More...
 
void set_add_to_colormap_btn (Gtk::Button *btn)
 Set the button to trigger the generation of the colormap. More...
 
void set_reset_colormap_btn (Gtk::Button *btn)
 Set the button to reset the colormap. More...
 
void set_load_histos_btn (Gtk::Button *btn)
 Set the buffon to open a dialog to load histograms. More...
 
void set_save_histos_btn (Gtk::Button *btn)
 Set the buffon to open a dialog to save histograms. More...
 
void set_load_colormap_btn (Gtk::Button *btn)
 Set the buffon to open a dialog to load a colormap. More...
 
void set_save_colormap_btn (Gtk::Button *btn)
 Set the buffon to open a dialog to save a colormap. More...
 
void set_colormap_img (Gtk::Image *img)
 Set the image to render the colormap into. More...
 
void set_segmentation_img (Gtk::Image *img)
 Set the image to render the segmented image into. More...
 
void set_threshold_scl (Gtk::Scale *scl)
 Set the scale to control the selection threshold. More...
 
void set_min_prob_scl (Gtk::Scale *scl)
 Set the scale to control the minimum probability. More...
 
void set_filechooser_dlg (Gtk::FileChooserDialog *dlg)
 Set the filechooser dialog to be used by this widget. More...
 
void set_cm_layer_selector (Gtk::Scale *scl)
 Set the widget to choose the layer of the colormap to display. More...
 
void set_cm_selector (Gtk::SpinButton *depth, Gtk::SpinButton *width=0, Gtk::SpinButton *height=0)
 Set the widget to adjust the depth of the colormap. More...
 
Glib::Dispatcher & update_image ()
 Access the signal that is emitted whenever a redraw of the image is necessary. More...
 
Glib::Dispatcher & colormap_updated ()
 Access the signal that is emitted whenever the colormap has changed. More...
 

Static Public Attributes

static const unsigned int MOUSE_BUTTON_LEFT = 1
 constant for left mouse button id More...
 
static const unsigned int MOUSE_BUTTON_RIGHT = 3
 constant for right mouse button id More...
 

Detailed Description

This widget implements the complete color training process.

Author
Daniel Beck

Definition at line 38 of file color_train_widget.h.

Constructor & Destructor Documentation

◆ ColorTrainWidget()

ColorTrainWidget::ColorTrainWidget ( Gtk::Window *  parent)

Constructor.

Parameters
parentthe parent window

Definition at line 52 of file color_train_widget.cpp.

◆ ~ColorTrainWidget()

ColorTrainWidget::~ColorTrainWidget ( )
virtual

Destructor.

Definition at line 79 of file color_train_widget.cpp.

Member Function Documentation

◆ add_to_colormap()

void ColorTrainWidget::add_to_colormap ( )

Generate a new colormap by adding the current histograms.

Definition at line 452 of file color_train_widget.cpp.

Referenced by set_add_to_colormap_btn().

◆ click()

void ColorTrainWidget::click ( unsigned int  x,
unsigned int  y,
unsigned int  button = MOUSE_BUTTON_LEFT 
)

The user clicked into the image.

Parameters
xthe x-coordinate
ythe y-coordinate
button1 for left click, 3 for right click
See also
GdkEventButton

Definition at line 140 of file color_train_widget.cpp.

References firevision::Drawer::draw_rectangle_inverted(), firevision::Drawer::set_buffer(), and firevision::ZRegion::slices.

◆ colormap_updated()

Glib::Dispatcher & ColorTrainWidget::colormap_updated ( )

Access the signal that is emitted whenever the colormap has changed.

Returns
reference to a Dispatcher.

Definition at line 366 of file color_train_widget.cpp.

◆ draw_segmentation_result()

◆ get_colormap()

YuvColormap * ColorTrainWidget::get_colormap ( ) const

Get the current colormap.

Returns
the current colormap

Definition at line 627 of file color_train_widget.cpp.

◆ load_colormap()

void ColorTrainWidget::load_colormap ( )

◆ load_histograms()

void ColorTrainWidget::load_histograms ( )

Open a dialog to load a histogram.

Definition at line 373 of file color_train_widget.cpp.

References firevision::YuvColormap::depth(), firevision::YuvColormap::height(), and firevision::YuvColormap::width().

Referenced by set_load_histos_btn().

◆ reset_colormap()

void ColorTrainWidget::reset_colormap ( )

Reset the colormap.

Definition at line 508 of file color_train_widget.cpp.

Referenced by set_reset_colormap_btn().

◆ reset_selection()

void ColorTrainWidget::reset_selection ( )

Reset the selection.

Definition at line 186 of file color_train_widget.cpp.

Referenced by set_reset_selection_btn().

◆ save_colormap()

void ColorTrainWidget::save_colormap ( )

◆ save_histograms()

void ColorTrainWidget::save_histograms ( )

Open a dialog to save a histogram.

Definition at line 419 of file color_train_widget.cpp.

Referenced by set_save_histos_btn().

◆ set_add_to_colormap_btn()

void ColorTrainWidget::set_add_to_colormap_btn ( Gtk::Button *  btn)

Set the button to trigger the generation of the colormap.

Parameters
btna Button

Definition at line 211 of file color_train_widget.cpp.

References add_to_colormap().

◆ set_cm_layer_selector()

void ColorTrainWidget::set_cm_layer_selector ( Gtk::Scale *  scl)

Set the widget to choose the layer of the colormap to display.

Parameters
scla Scale

Definition at line 335 of file color_train_widget.cpp.

◆ set_cm_selector()

void ColorTrainWidget::set_cm_selector ( Gtk::SpinButton *  depth,
Gtk::SpinButton *  width = 0,
Gtk::SpinButton *  height = 0 
)

Set the widget to adjust the depth of the colormap.

Parameters
depthSpinButton to set the Y-resolution of the color map
widthSpinButton to set the U-resolution of the color map
heightSpinButton to set the V-resolution of the color map

Definition at line 346 of file color_train_widget.cpp.

◆ set_colormap_img()

void ColorTrainWidget::set_colormap_img ( Gtk::Image *  img)

Set the image to render the colormap into.

Parameters
imgan Image

Definition at line 271 of file color_train_widget.cpp.

◆ set_draw_buffer()

void ColorTrainWidget::set_draw_buffer ( unsigned char *  buffer)

Set the buffer to draw the selection into.

It is assumed that this buffer has the same dimensions as the buffer holding the soruce image.

Parameters
bufferthe draw buffer

Definition at line 129 of file color_train_widget.cpp.

◆ set_fg_object()

void ColorTrainWidget::set_fg_object ( firevision::hint_t  fg_object)

Set the current foreground object.

Parameters
fg_objectthe foreground object

Definition at line 90 of file color_train_widget.cpp.

◆ set_filechooser_dlg()

void ColorTrainWidget::set_filechooser_dlg ( Gtk::FileChooserDialog *  dlg)

Set the filechooser dialog to be used by this widget.

Parameters
dlga FileChooserDialog

Definition at line 326 of file color_train_widget.cpp.

◆ set_load_colormap_btn()

void ColorTrainWidget::set_load_colormap_btn ( Gtk::Button *  btn)

Set the buffon to open a dialog to load a colormap.

Parameters
btna Button

Definition at line 251 of file color_train_widget.cpp.

References load_colormap().

◆ set_load_histos_btn()

void ColorTrainWidget::set_load_histos_btn ( Gtk::Button *  btn)

Set the buffon to open a dialog to load histograms.

Parameters
btna Button

Definition at line 231 of file color_train_widget.cpp.

References load_histograms().

◆ set_min_prob_scl()

void ColorTrainWidget::set_min_prob_scl ( Gtk::Scale *  scl)

Set the scale to control the minimum probability.

Parameters
scla Scale

Definition at line 316 of file color_train_widget.cpp.

◆ set_reset_colormap_btn()

void ColorTrainWidget::set_reset_colormap_btn ( Gtk::Button *  btn)

Set the button to reset the colormap.

Parameters
btna Button

Definition at line 221 of file color_train_widget.cpp.

References reset_colormap().

◆ set_reset_selection_btn()

void ColorTrainWidget::set_reset_selection_btn ( Gtk::Button *  btn)

Set the button to reset the selection.

Parameters
btnthe reset selection button

Definition at line 201 of file color_train_widget.cpp.

References reset_selection().

◆ set_save_colormap_btn()

void ColorTrainWidget::set_save_colormap_btn ( Gtk::Button *  btn)

Set the buffon to open a dialog to save a colormap.

Parameters
btna Button

Definition at line 261 of file color_train_widget.cpp.

References save_colormap().

◆ set_save_histos_btn()

void ColorTrainWidget::set_save_histos_btn ( Gtk::Button *  btn)

Set the buffon to open a dialog to save histograms.

Parameters
btna Button

Definition at line 241 of file color_train_widget.cpp.

References save_histograms().

◆ set_segmentation_img()

void ColorTrainWidget::set_segmentation_img ( Gtk::Image *  img)

Set the image to render the segmented image into.

Parameters
imgan Image

Definition at line 280 of file color_train_widget.cpp.

◆ set_src_buffer()

void ColorTrainWidget::set_src_buffer ( unsigned char *  yuv422_buffer,
unsigned int  img_width,
unsigned int  img_height 
)

Set the buffer containing the image data.

Parameters
yuv422_bufferthe YUV422_PLANAR buffer holding the image data
img_widththe width of the image
img_heightthe height of the image

Definition at line 101 of file color_train_widget.cpp.

◆ set_threshold_scl()

void ColorTrainWidget::set_threshold_scl ( Gtk::Scale *  scl)

Set the scale to control the selection threshold.

Parameters
scla Scale

Definition at line 306 of file color_train_widget.cpp.

◆ update_image()

Glib::Dispatcher & ColorTrainWidget::update_image ( )

Access the signal that is emitted whenever a redraw of the image is necessary.

Returns
reference to a Dispatcher.

Definition at line 357 of file color_train_widget.cpp.

Member Data Documentation

◆ MOUSE_BUTTON_LEFT

const unsigned int ColorTrainWidget::MOUSE_BUTTON_LEFT = 1
static

constant for left mouse button id

Definition at line 41 of file color_train_widget.h.

◆ MOUSE_BUTTON_RIGHT

const unsigned int ColorTrainWidget::MOUSE_BUTTON_RIGHT = 3
static

constant for right mouse button id

Definition at line 42 of file color_train_widget.h.


The documentation for this class was generated from the following files: