operations

ApertureData Platform allows for operations to be performed to an image and videos at insertion and/or query time. The supported operations are listed below for images and videos. These operations were chosen as samples or that were needed for some of the applications we were building. But given that we wrap around OpenCV for performing operations to videos and images, any operation supported by OpenCV can be easily added. More operations will be added in the future.

The operations block is composed by an array of operation objects. Each operation has a “type” (which is the name of the operation) and the parameters of that operations

At least one operation must be defined in the array.

All the parameters are required for each operation. Below we detail the operations supported for Images (AddImage, FindImage), those operations supported for Videos (AddVideo, FindVideo), and the operations that are common for both Images and Videos.

Common Operations and Parameters

  • threshold:
    • “type”: “threshold”,
    • “value”: is the value of the threshold above which all pixel values are returned and below which all pixel values are zeroed
  • crop:
    • “type”: “crop”,
    • “x”, “y”: specify the starting position x and y.
    • “width”, “height”: specify the width and height of the crop.
  • resize:
    • “type”: “resize”
    • “width”, “height”: give the new expected width and height of the image, performs bilinear interpolation entity (entities).

Extra Operations for Images

  • flip:
    • “type”: “flip”,
    • “code”: Follows OpenCV convention: 0 for Vertical flip, >0 for Horizontal flip, <0 for both.
  • rotate:
    • “type”: “rotate”
    • “angle”: Rotation angle.
    • “resize”: Flag to specify whether the image will be resized so that the rotated image fits (resize = true), or if the image will be kept the same size (resize = false).

Extra Operations for Videos

  • interval:
    • “type”: “interval”,
    • “unit”: number of frames in between
    • “start”: first frame
    • “end” : last frame

Example

# resize and threshold
"operations": [
    {
        "type": "resize",
        "width": 200, "height": 200,
    }
    {
        "type": "threshold",
        "value": 155,
    }
],

# Crop and threshold
"operations": [
    {
        "type": "crop",
        "x": 255, "y": 155,
        "width": 15, "height": 10,
    },
    {
        "type": "threshold",
        "value": 155,
    }
],

# Interval
"operations": [
    {
        "type": "flip",
        "code": 1 # Horizontal Flip
    },
    {
      "type": "interval", # Interval Operation
      "start": 20,        # Start from the 20th frame
      "stop": 200,        # Stop at the 200th frame
      "step": 5           # Pick 1 every 5 frames.
    }
],