quick_block

imagepypelines.quick_block(process_fn, io_map, name=None)[source]

convienence function to make simple blocks

Parameters:
  • process_fn (func) – function that takes in and processes exactly one datum
  • io_map (IoMap,dict) – dictionary of input-output mappings for this Block
  • name (str) – name for this block, it will be automatically created/modified to make sure it is unique
Returns:

simple block that applies the given function

Return type:

block(ip.SimpleBlock)

Example

>>> import imagepypelines as ip
>>> import cv2
>>> def calculate_orb_features(datum):
...     _,des = cv2.ORB_create().detectAndCompute(datum,None)
...     return des
>>>
>>> io_map = {ip.GRAY:ip.GRAY}
>>> block = ip.quick_block(calculate_orb_features, io_map)
>>> block.name
'calculate_orb_features:1'