create_test_image

laserbeamsize.image_tools.create_test_image(h: int, v: int, xc_px: float, yc_px: float, d_major: float, d_minor: float, phi: float, noise: float = 0, ntype: str = 'poisson', max_value: int = 255) ndarray[tuple[Any, ...], dtype[floating]][source]

Create a 2D test image with an elliptical beam and possible noise.

Create a v x h image with an elliptical beam with specified center and beam dimensions. By default the values in the image will range from 0 to 255. The default image will have no background and no noise.

Parameters:
  • h – number of columns in 2D test image

  • v – number of rows in 2D test image

  • xc_px – horizontal center of beam

  • yc_px – vertical center of beam

  • d_major – major axis (i.e, major diameter)

  • d_minor – minor axis (i.e, minor diameter)

  • phi – angle between major axis and horizontal axis [radians]

  • noise – (optional) magnitude of pixel noise to add

  • ntype – (optional) type of noise — one of “poisson” (default), “gaussian”/”normal”, “flat”/”uniform”, or “constant”

  • max_value – (optional) all values in image fall between 0 and max_value

Returns:

image – an unsigned 2D integer array of a Gaussian elliptical spot