ADCompVision area detector plugin Input/output manual/guide

author:Jakub Wlodek, Brookhaven National Laboratory
date:November 21, 2018

Introduction

This is a manual that documents the input and output types of each WRAPPER function supported by ADCompVision

Wrapper function inputs/outputs

Below is a table that details the inputs and outputs used by each function, along with descriptions for each function

Input/Output values for each ADCompVision Function
Function Name Num inputs Input value format Num outputs Output value format
gaussian_blur 1 [blurDegree (Int)] 0 None
ThresholdImage 3 [Threshhold Value (Int), Max Pixel Value (Int)] 0 None
LaplacianEdgeDetector 1 [Blur degree (Int)] 0 None
Sharpen 4 [Gaussian blurr (Int), Laplacian kernel size (Int), Laplacian scale (Int), Laplacian delat (Int) ] 0 []
CannyEdgeDetector 3 [Threshold value (Int), Threshold ratio (Int), Blur degree (Int), Kernel Size (Int)] 8 [Horizontal Center, Horizontal Size, Vertical Center, Vertical Size, Top Pixel, Bottom Pixel, Left Pixel, Right Pixel]
SubtractConsecutiveImages 0 0
compute_image_stats 0 [] 9 [total, min, min x, min y, max, max x, max y, mean, sigma]
FindObjectCentroids 5 [Num Largest Contours (Int), Blur Degree (Int), Threshold Value (Int), Upper Size Threshold (Int), Lower Size Threshold (Int)] 2-10 [CentroidX (Int), CentroidY (Int) ... ]
movement_vectors 2 [Frames Between Images (Int), Num Vectors (Int)] 0-8 [Vector 1 Start X (Int), Vector 1 Start Y (Int), Vector 1 End X, Vector 1 End Y ...]
ObjectIdentification 4 [Param1 (Int), Param2 (Double) ...] 10 [Param1 (Int), Param2 (Double) ...]
UserFunction n [Param1 (Int), Param2 (Double) ...] n [Param1 (Int), Param2 (Double) ...]
Distancebetweencontours 5 [[Distance Threshold (Int), Blur Kernel Size (Int), Threshold (Int), Apply Blur (Toggle), Pixel Size Threshold (Int)] 2 [Is Within Threshold (Binary Int), Distance in Pixels (Int)]

Function descriptions

gaussian_blur

Blurs image based on a gaussian kernel. A gaussian kernel is simply a matrix of a set size that fills Gaussian properties.

ThresholdImage

Function that thresholds an image based on a certain pixel value. First, the image is converted to grayscale. RGB images cannot be thresholded. For each pixel, if the grayscale value is larger than the threshold, set it to white, otherwise set it to black. Creates a binary image

LaplacianEdgeDetector

Function for laplacian-based edge detection. First, the image is converted to grayscale if it is not already. Next, the image is blurred using a gaussian kernel to emphasize edges. Then a laplacian kernel runs over the images assigning a ‘sharpness’ value to each pixel. The sharpest values are hard edges from black to white.

Sharpen

Sharpens image by sutracting Laplacian from blurred image

CannyEdgeDetector

Function for canny-based edge detection. First, we ensure that the image is grayscale. Then, the image is blurred, so that only strong edges remain. Then, a threshold is applied to the image in order to further reinforce strong edges. Finally, the canny algorithm is applied to the image, and the edges are displayed. The function outputs some information based on the detected edges that can assist with object detection/identification: the top, bottom, left, and right pixels are the min and max X and Y pixel values that appear on one of the edges. The horizontal and vertical size and center give you the spacing between these min and max values and their midpoint.

SubtractConsecutiveImages

Function that allows the user to take consecutive images recieved from area detector and subtract them in pairs. Reads first image into memory, then waits for second one, when it receives the second one, subtract them.

compute_image_stats

OpenCV accelerated computation of Image statistics

FindObjectCentroids

Function for finding centroids of objects in an image. Useful for alignment of objects First, blur the object based on a certain blur degree (kernel size). Then threshold the image based on a certain threshold value. Then find contours in the image using the findContours() function. Then get the centroids from the contour objects. Draw the contours and centroids on the image. Set the first 5 centroid coordinates to the output values. A size filter can also be used to remove contours that are too large, removing contours that span the entire size of the image. Any contour with area > upper threshold is removed, and any lower than lower threshold

movement_vectors

Function that does feature detection on images a set number of frames apart, and attempts to calculate the movement vector for the calculated key points. It uses ORB feature detection and vector flow NOT YET IMPLEMENTED/TESTED

ObjectIdentification

Function that detects contours in an image and returns information regarding said contours NOT YET IMPLEMENTED/TESTED

UserFunction

This is an unimplemented wrapper function that has already been added to the PV database in order to simplify creating user defined functions. Simply implement this function and its description function, and then select ‘User Function’ in function set 3.

Distancebetweencontours

Function that computes bounding boxes between the two largest computed contours in the image, checks the distance between them and sends an alarm if they are within a distance threshold.