class that is used to interact with a sqlite database that stores image information. More...
Public Member Functions | |
def | __init__ |
def | add_image |
add information about a new image to the database | |
def | get_images |
returns a list of image information from the database | |
def | load_file |
try to load the sqlite database with the given file name. | |
Public Attributes | |
bridge | |
cv_bridge that is used to convert images | |
connection | |
a sqlite Connection object - the connection to the image database. | |
Private Member Functions | |
def | _apply_filter |
apply the filters on image and return the result image | |
def | _create_tables |
Create on self.connection the two tables. |
class that is used to interact with a sqlite database that stores image information.
The image information are stored in a sqlite database with two tables: one holding the images itself. For an image we save its brightness, the standard deviation of the brightness and the user raiting. There's also an id field used as primary key. The second tables hold information about image areas. For each area we save the image id this area belongs to, the name of the area and parameter values for the blur and canny filter. The ER-diagram looks like this (not with the exact names as used in the tables):
Definition at line 24 of file sql_database.py.
def face_contour_detector.image_information.sql_database.SQLImageDatabase.__init__ | ( | self, | |
bridge = None |
|||
) |
Definition at line 25 of file sql_database.py.
def face_contour_detector.image_information.sql_database.SQLImageDatabase._apply_filter | ( | self, | |
image, | |||
areas | |||
) | [private] |
apply the filters on image and return the result image
Definition at line 152 of file sql_database.py.
def face_contour_detector.image_information.sql_database.SQLImageDatabase._create_tables | ( | self | ) | [private] |
Create on self.connection the two tables.
self | the object pointer |
Definition at line 72 of file sql_database.py.
def face_contour_detector.image_information.sql_database.SQLImageDatabase.add_image | ( | self, | |
image, | |||
raiting, | |||
areas | |||
) |
add information about a new image to the database
self | the object pointer |
image,: | a cvMat (RGB color) the image to store information about |
raiting | the raiting of the image (between 1 and 6) |
areas | the image areas with their settings |
Definition at line 99 of file sql_database.py.
returns a list of image information from the database
self | the object pointer |
The return value is a list of dictionaries. Each dictionary stores data about an image. The keys of the dictionary are: "AveragePixelBrightness" : float, "StandardBrightnessDeviation" : float, "Raiting" : int between 1 and 6, "Areas" : a new dictionary. "Areas" is a dictionary that stores the areas. Each entry of this dictionary is again a dictionary with the filter settings of this area. It's values are: "blurwidth", "blurheight", "threshold1", "threshold2"
Definition at line 165 of file sql_database.py.
def face_contour_detector.image_information.sql_database.SQLImageDatabase.load_file | ( | self, | |
file_name = None |
|||
) |
try to load the sqlite database with the given file name.
self | the object pointer |
file_name | the file name of the database. If the file_name is None a default path is used as file name. The path is package_dir/data/image_information.db |
If file_name does not exists a new database is created on that location. May throw an exception if something went wrong.
Definition at line 43 of file sql_database.py.
cv_bridge that is used to convert images
Definition at line 25 of file sql_database.py.
a sqlite Connection object - the connection to the image database.
Is initially set to None
Definition at line 25 of file sql_database.py.