neuralib.imglib.io

neuralib.imglib.io.read_sequences(avi_file, grey_scale=True)[source]

Read an sequences file (i.e., AVI/MP4) into an array, converting to grayscale if specified.

Parameters:
  • avi_file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – Path to the AVI file.

  • grey_scale (bool) – Whether to convert frames to grayscale.

Returns:

Sequences array. Array[uint8, [F, W, H]|[F, W, H, 3]]

Return type:

ndarray

neuralib.imglib.io.read_pdf(file, single_image=True, poppler_path=None, **kwargs)[source]

Read pdf as an image array

Parameters:
Returns:

Image array

Return type:

np.ndarray

neuralib.imglib.io.write_avi(file_path, frames, fps=30.0)[source]

Write a sequence of frames to an AVI file.

Parameters:
  • file_path (str) – The path where the AVI file will be saved.

  • frames (ndarray) – Array[uint, [F, W, H]|[F, W, H, 3]] containing the frames.

  • fps (int) – The frames per second (frame rate) of the output video.

Return type:

None

neuralib.imglib.io.tif_to_gif(image_file, output_path, fps=30, **kwargs)[source]

Convert tif sequences to GIF

Parameters:
  • image_file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader)

  • output_path (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader)

  • fps (int)

Return type:

None

neuralib.imglib.io.gif_show(file)[source]

Display GIF file in a cv2 window

Parameters:

file (str | Path | bytes | BinaryIO | BufferedIOBase | BufferedReader) – Path to the GIF file to be displayed.

Raises:

ValueError – If the provided file is not a GIF.

Return type:

None