visioncpp.util
Utility functions for Python VisionCpp interface.
-
visioncpp.util.
call_if_attribute
(obj, attr, *args, **kwargs)[source]
Call object method, if it exists.
- Arguments:
- obj (object): The object.
attr (str): The name of the object method.
*args (optional): Arguments for method.
**kwargs (optional): Keyword arguments for method.
- Returns:
- Return value of calling method, or None if object does not have method.
-
visioncpp.util.
foreach
(func, iterable)[source]
Call function for each element of an iterable. Basically, it’s a list
comprehension without a return value.
- Arguments:
- func (function): Function to call.
iterable (iterable): Sequence of items.
-
visioncpp.util.
get_attribute
(obj, attr)[source]
Return object attribute value, if it exists.
- Arguments:
- obj (object): The object.
attr (str): The name of the object attribute.
-
visioncpp.util.
get_image_size
(fname)[source]
Return the size of an image, in pixels.
- Arguments:
- fname (str): Path to image, either png, gif, or jpeg type.
- Returns:
- (int, int): The dimensions of the image, width x height.