sksurgeryimage.processing.interlace module

Functions to support deinterlacing, reinterlacing and vertical destacking of 2D video frames.

sksurgeryimage.processing.interlace.deinterlace_to_new(interlaced)[source]

Takes the interlaced image, and splits into two new images of even_rows and odd_rows.

Returns:even_rows, odd_rows images
sksurgeryimage.processing.interlace.deinterlace_to_preallocated(interlaced, even_rows, odd_rows)[source]

Deinterlaces the interlaced image into even_rows and odd_rows images, which must be pre-allocated, and the correct size.

sksurgeryimage.processing.interlace.deinterlace_to_view(interlaced)[source]

Takes the interlaced image, and returns two new views of even_rows and odd_rows.

Returns:even_rows, odd_rows images
sksurgeryimage.processing.interlace.interlace_to_new(even_rows, odd_rows)[source]

Interlaces even_rows and odd_rows images into a new output image.

sksurgeryimage.processing.interlace.interlace_to_preallocated(even_rows, odd_rows, interlaced)[source]

Interlaces even_rows and odd_rows images into the interlaced image, where all inputs must be pre-allocated to the correct size.

sksurgeryimage.processing.interlace.split_stacked_to_new(stacked)[source]

Takes the input stacked image, and extracts the top and bottom half.

Useful if you have stereo 1080x1920 inputs, into an AJA Hi5-3D which stacks them vertically into 2 frames of 540x1920 in the same image.

Returns:top_half and bottom_half images
sksurgeryimage.processing.interlace.split_stacked_to_preallocated(stacked, top, bottom)[source]

Splits a vertically stacked image, extracting the top and bottom halves, assuming images are the right size and pre-allocated.

Useful if you have stereo 1080x1920 inputs, into an AJA Hi5-3D which stacks them vertically into 2 frames of 540x1920 in the same image.

sksurgeryimage.processing.interlace.split_stacked_to_view(stacked)[source]

Takes the input stacked image, and returns views that refer to the top and bottom half.

Returns:top_half, bottom_half images
sksurgeryimage.processing.interlace.stack_to_new(left, right)[source]

Vertically stack left and right array into single output array. Left and right images should have the same dimensions.

Parameters:
  • left (numpy array) – left image
  • right (numpy array.) – right image
sksurgeryimage.processing.interlace.validate_interlaced_image_sizes(even_rows, odd_rows, interlaced)[source]

Validates the sizes of the even_rows, odd_rows and interlaced images.

  1. Inputs must all be numpy images.
  2. Inputs must all have the same number of columns.
  3. Inputs must all have an even number of rows.
  4. even_rows and odd_rows must have the same number of rows.
  5. even_rows and odd_rows must have half the number of rows as interlaced.