Frame to modify filter parameters. More...
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. |
Frame to modify filter parameters.
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:
Definition at line 128 of file image_settings_frame.py.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame.__init__ | ( | self, | |
master, | |||
filter_settings | |||
) |
Constructor method.
self | the object pointer |
master | the Tkinter master widget (usually a Tkinter.Toplevel) |
filter_settings | is of type autoselect_result (message type) |
Definition at line 133 of file image_settings_frame.py.
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.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._apply_and_display | ( | self, | |
args | |||
) | [private] |
Apply filter with current settings and display the resulting image.
self | the object pointer |
*args | whatever arguments are also passed |
Definition at line 498 of file image_settings_frame.py.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._apply_filters | ( | self, | |
args | |||
) | [private] |
Just apply the filters with current settings and update the pointers of the images that are used in this class.
self | the object pointer |
*args | whatever arguments are also passed |
Definition at line 506 of file image_settings_frame.py.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._area_selection_callback | ( | self, | |
args | |||
) | [private] |
Callback function for the OptionMenu (selected area has changed).
self | the object pointer |
*args | whatever 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.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._commit | ( | self | ) | [private] |
Callback function when the "Commit" button is pressed.
self | the 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.
self | the object pointer |
img | PIL image in which the area is drawn |
x | x-position of the start point |
y | y-position of the start point |
width | width of the rectangle |
height | height of the rectangle |
color | RGB color (three tuple) defining the color of the rectangle |
Definition at line 538 of file image_settings_frame.py.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._draw_selected_area | ( | self | ) | [private] |
Definition at line 552 of file image_settings_frame.py.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._immediately_callback | ( | self, | |
args | |||
) | [private] |
callback function if the immediately apply changes value changed
self | the object pointer |
*args | whatever 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.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._init_area_values | ( | self | ) | [private] |
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.
self | the object pointer |
Definition at line 353 of file image_settings_frame.py.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._mouse_click_callback | ( | self, | |
evt | |||
) | [private] |
Callback function when the users clicks inside the preview image.
self | the object pointer |
evt | the 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.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._mouse_motion_callback | ( | self, | |
evt | |||
) | [private] |
Callback function whe the users moves the mouse inside the preview image.
self | the object pointer |
evt | the 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.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._parameter_value_changed | ( | self, | |
parameter_name, | |||
args | |||
) | [private] |
Callback function if on of the sliders or the text field content changed.
self | the object pointer |
parameter_name | the name of the parameter that has changed |
*args | whatever 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.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._rate_callback | ( | self | ) | [private] |
This method is called when the users presses the "Rate" Button.
self | the 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.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._set_display_image | ( | self, | |
img | |||
) | [private] |
Set the preview image.
self | the object pointer |
img | the 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.
def face_contour_detector.gui.image_settings_frame.ImageSettingsFrame._set_parameter_values | ( | self, | |
parameter_name | |||
) | [private] |
For the selected area save all parameter values (from the sliders) and set the fields of the filter objects.
self | the object pointer |
parameter_name | the 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.
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.