All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends
Public Member Functions | Public Attributes | Private Member Functions
face_contour_detector.gui.image_settings_frame.ImageSettingsFrame Class Reference

Frame to modify filter parameters. More...

List of all members.

Public Member Functions

def __init__
 Constructor method.

Public Attributes

 area_selection
 A Tkinter.StringVar that stores the name of the selected area.
 areas
 All areas of this image - but packed in a python dictionary to speedup the lookup the filter settings when the currently selected area is used as identifier of the area.
 as_py_image
 stores the image (original image with applied filters) as python image (in RGB format)
 blur_height
 Tkinter variable that stores the blur height parameter value.
 blur_width
 Tkinter variable that stores the blur width parameter value.
 bridge
 a cv_bridge that is used to transform images from sensor_msgs/Image to cvMat and vice versa
 c_threshold1
 Tkinter variable that stores the canny threshold1 parameter value.
 c_threshold2
 Tkinter variable that stores the canny threshold2 parameter value.
 image_frame
 The Tkinter.LabelFrame that contains the preview label and raiting stuff.
 image_label
 The Tkinter.Label that is used to display the preview image.
 immediately_apply
 Tkinter variable that stores if changes of the filter values should always cause the preview image to update.
 list_areas
 All areas of this image - it's list of msg/image_area.
 min_length
 Tkinter variable that stores the min_length parameter value for delete short lines.
 original_image
 the original image as passed from the proposals as sensor_msgs/Image
 orignal_image_as_cvM
 also save the original image as cvMat - this is required to add information about the image in the database.
 raiting
 Tkinter variable the stores the currently selected raiting value (in range 1 to 6)
 s_radius
 Tkinter variable that stores the search radius paramter value for the edge connector.
 sql_db
 When the frame is generated it tries to connectoct to the image information database (class image_information.SQLImageDatabase) - however if opening the database failed it is set to None.
 tk_img
 We have to keep a pointer to the Tk.PhotoImage (preview image) or python will destroy it even it is used in a frame...

Private Member Functions

def _adjust_positions
def _apply_and_display
 Apply filter with current settings and display the resulting image.
def _apply_filters
 Just apply the filters with current settings and update the pointers of the images that are used in this class.
def _area_selection_callback
 Callback function for the OptionMenu (selected area has changed).
def _commit
 Callback function when the "Commit" button is pressed.
def _draw_area
 Draw in img a rectangle from positon x, y with respective width and height in color.
def _draw_selected_area
def _immediately_callback
 callback function if the immediately apply changes value changed
def _init_area_values
 This method checks which image area is selected and sets the value of the sliders according to the values stored in the settings of the selected area.
def _mouse_click_callback
 Callback function when the users clicks inside the preview image.
def _mouse_motion_callback
 Callback function whe the users moves the mouse inside the preview image.
def _parameter_value_changed
 Callback function if on of the sliders or the text field content changed.
def _rate_callback
 This method is called when the users presses the "Rate" Button.
def _set_display_image
 Set the preview image.
def _set_parameter_values
 For the selected area save all parameter values (from the sliders) and set the fields of the filter objects.

Detailed Description

Frame to modify filter parameters.

Author:
Fabian Wenzelmann

This frame is used to modify the arguments for the filter. Each filter is grouped together with sliders and text fields for all its parameters. The text fields and sliders are linked together so you can modify both. The filters and its parameters are:

The resulting image using the current filter settings (as a "preview") is displayed on the right side of the frame. Since each image is seperated in areas (for mouth, eyes and so on) the values of the filters can be set for each of those areas. All areas are accessible through a OptionMenu. The areas can be adjusted by hand to correct the position. The selected area is surrounded by a red rectangle (in the preview). If the mouse moves over the image also a blue rectangle is drawn which marks the new position of this area when the users presses the left mouse key. There is a button "apply" which updates the preview image by applying the filter-settings on the original image. There's also the option "Immediately apply changes". If this value is set to yes (by activating a check button) the preview image is updated each time the user changes one of the filter settings. Hower this can become very slow depending on the image and the current settings... The user presses the "Commit" button to commit the current settings and edge image to the main gui. Below the preview image there is a group of six RadioButtons. The user can rate the image with the current settings. The raitings are saved in a database and are used for our "learning" algorithm (well lets say it tries to do something useful according to the collected data). 1 is the worste and 6 is the best raiting. Below there's an example image:

image_settings_frame.png

Definition at line 128 of file image_settings_frame.py.


Constructor & Destructor Documentation

def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame.__init__ (   self,
  master,
  filter_settings 
)

Constructor method.

Parameters:
selfthe object pointer
masterthe Tkinter master widget (usually a Tkinter.Toplevel)
filter_settingsis of type autoselect_result (message type)

Definition at line 133 of file image_settings_frame.py.


Member Function Documentation

def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._adjust_positions (   self,
  x_center,
  y_center 
) [private]

Definition at line 383 of file image_settings_frame.py.

Apply filter with current settings and display the resulting image.

Parameters:
selfthe object pointer
*argswhatever arguments are also passed

Definition at line 498 of file image_settings_frame.py.

Just apply the filters with current settings and update the pointers of the images that are used in this class.

Parameters:
selfthe object pointer
*argswhatever arguments are also passed

Definition at line 506 of file image_settings_frame.py.

Callback function for the OptionMenu (selected area has changed).

Parameters:
selfthe object pointer
*argswhatever arguments are passed

Set the slider values to the values of the new area and display the image again to draw the rectangles and so on

Definition at line 442 of file image_settings_frame.py.

Callback function when the "Commit" button is pressed.

Parameters:
selfthe object pointer

Destroys the master of this frame (usually a Tkinter.Toplevel). The gui_serivce now calls the main gui and transfers the edge image.

Definition at line 450 of file image_settings_frame.py.

def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._draw_area (   self,
  img,
  x,
  y,
  width,
  height,
  color 
) [private]

Draw in img a rectangle from positon x, y with respective width and height in color.

Parameters:
selfthe object pointer
imgPIL image in which the area is drawn
xx-position of the start point
yy-position of the start point
widthwidth of the rectangle
heightheight of the rectangle
colorRGB color (three tuple) defining the color of the rectangle
Returns:
A copy of this image containing the rectangle

Definition at line 538 of file image_settings_frame.py.

Definition at line 552 of file image_settings_frame.py.

callback function if the immediately apply changes value changed

Parameters:
selfthe object pointer
*argswhatever arguments are also passed

If the immediately apply value changed to True we should apply the filters right now and display the new image.

Definition at line 525 of file image_settings_frame.py.

This method checks which image area is selected and sets the value of the sliders according to the values stored in the settings of the selected area.

Parameters:
selfthe object pointer

Definition at line 353 of file image_settings_frame.py.

Callback function when the users clicks inside the preview image.

Parameters:
selfthe object pointer
evtthe mouse event

Calculates the new position of the selected area and sets its values. It also forces a redraw of the preview.

Definition at line 408 of file image_settings_frame.py.

Callback function whe the users moves the mouse inside the preview image.

Parameters:
selfthe object pointer
evtthe mouse event

Function is used to update the preview image so that the blue box, indicating the new position of the area, is displayed correctly. Draws the blue box inside the current image without decoration (as_py_image).

Definition at line 420 of file image_settings_frame.py.

Callback function if on of the sliders or the text field content changed.

Parameters:
selfthe object pointer
parameter_namethe name of the parameter that has changed
*argswhatever arguments are also passed

Updates all parameters, calculates the corresponding image (and sets current_image to the new image), draws area squares and displays the image

Definition at line 490 of file image_settings_frame.py.

This method is called when the users presses the "Rate" Button.

Parameters:
selfthe object pointer

If there's an open connection to the sql database the new information is stored. If anything wents wrong an Error message is displayed.

Definition at line 340 of file image_settings_frame.py.

Set the preview image.

Parameters:
selfthe object pointer
imgthe new image as python image

Converts the python image to a Tk Image and keeps a reference to the image so that it is not destroyed by python.

Definition at line 430 of file image_settings_frame.py.

For the selected area save all parameter values (from the sliders) and set the fields of the filter objects.

Parameters:
selfthe object pointer
parameter_namethe new of the parameter that has changed and so called this method to set the parameters.

This method is used to copy the values from the sliders to the filter objects.

Definition at line 458 of file image_settings_frame.py.


Member Data Documentation

A Tkinter.StringVar that stores the name of the selected area.

Definition at line 133 of file image_settings_frame.py.

All areas of this image - but packed in a python dictionary to speedup the lookup the filter settings when the currently selected area is used as identifier of the area.

Definition at line 133 of file image_settings_frame.py.

stores the image (original image with applied filters) as python image (in RGB format)

Definition at line 506 of file image_settings_frame.py.

Tkinter variable that stores the blur height parameter value.

Definition at line 133 of file image_settings_frame.py.

Tkinter variable that stores the blur width parameter value.

Definition at line 133 of file image_settings_frame.py.

a cv_bridge that is used to transform images from sensor_msgs/Image to cvMat and vice versa

Definition at line 133 of file image_settings_frame.py.

Tkinter variable that stores the canny threshold1 parameter value.

Definition at line 133 of file image_settings_frame.py.

Tkinter variable that stores the canny threshold2 parameter value.

Definition at line 133 of file image_settings_frame.py.

The Tkinter.LabelFrame that contains the preview label and raiting stuff.

Definition at line 133 of file image_settings_frame.py.

The Tkinter.Label that is used to display the preview image.

Definition at line 133 of file image_settings_frame.py.

Tkinter variable that stores if changes of the filter values should always cause the preview image to update.

Definition at line 133 of file image_settings_frame.py.

All areas of this image - it's list of msg/image_area.

Definition at line 133 of file image_settings_frame.py.

Tkinter variable that stores the min_length parameter value for delete short lines.

Definition at line 133 of file image_settings_frame.py.

the original image as passed from the proposals as sensor_msgs/Image

Definition at line 133 of file image_settings_frame.py.

also save the original image as cvMat - this is required to add information about the image in the database.

Definition at line 133 of file image_settings_frame.py.

Tkinter variable the stores the currently selected raiting value (in range 1 to 6)

Definition at line 133 of file image_settings_frame.py.

Tkinter variable that stores the search radius paramter value for the edge connector.

Definition at line 133 of file image_settings_frame.py.

When the frame is generated it tries to connectoct to the image information database (class image_information.SQLImageDatabase) - however if opening the database failed it is set to None.

Definition at line 133 of file image_settings_frame.py.

We have to keep a pointer to the Tk.PhotoImage (preview image) or python will destroy it even it is used in a frame...

Definition at line 430 of file image_settings_frame.py.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends


face_contour_detector
Author(s): Fabian Wenzelmann and Julian Schmid
autogenerated on Wed Dec 26 2012 16:18:18