Image Analysis

droppy.imageanalysis.auto_crop(image, pad=25, σ=1, low=None, high=None)

Automatically identify where the crop should be placed within the original image

This function utilizes the skimage circular Hough transfrom implementation to identify the most circular object in the image (the droplet), and center it within a frame that extends by ‘pad’ to each side.

Parameters
  • image – 2D numpy array of [x,y] coordinates of the edges of the image

  • pad – width in pixels of space around the automatically identified cropping box

  • σ – Gaussian filter used for the Canny detection algorithm

  • low – Value of the weak pixels in the dual thresholding

  • high – value of the strong pixels in the dual thresholding

Returns

list of [left, right, top, bottom] values for the edges of the bounding box

droppy.imageanalysis.crop_points(image, bounds, f=None)

Return a cropped image with points only lying inside the bounds

Parameters
  • image – numpy array of [x,y] coordinates of detected edges

  • bounds – list of [left, right, top, bottom] image bounds - because of the way that images are read, bottom > top numerically

Returns

abbreviated numpy array of [x,y] coordinates that are within bounds

droppy.imageanalysis.get_crop(image)

Show the original image to allow the user to crop any extraneous information out of the frame.

Parameters

image – 2D numpy array grayscale image

Returns

list of [left, right, top, bottom] values for the edges of the bounding box

droppy.imageanalysis.output_fits(images, fits, baselines, bounds, linear=False, savefile=None)

Plot the original images with the overlaid fits

Parameters
  • images – List of 2D numpy grayscale images

  • fits – List of 2D numpy [x,y] coordinates that specify the fit locations

  • baselines – List of 2D numpy [x,y] coordinates that specify baseline

  • bounds – list of [left, right, top, bottom]

  • linear – boolean to tell whether the fittype was linear or not

Returns

None outputs plots comparing the original images to the best fits

droppy.imageanalysis.output_text(time, φ, baseline_width, volume)

Show the results of the frame analyzed on the command line

>>> output_text(1.0, (90, 90), 100, 100000)
At time 1.0 Contact angle left (deg): 90 Contact angle right (deg): 90
contact angle average (deg): 90 Baseline width (px): 100
Parameters
  • time – float time in seconds to be reported

  • ϕ – tuple of contact angles at the left and right droplet edges

  • baseline_width – float distance in pixels between the contact points of the droplet

  • volume – volume of the droplet in pixels**3

Returns

None, outputs a line of text to the terminal