Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

  • PyFlink Table
  • PyFlink DataFrame
  • PyFlink Multimodal
    • Image
    • Video
    • Utilities
  • PyFlink DataStream
  • PyFlink Common

pyflink.multimodal.operators.image_crop_black_border#

image_crop_black_border(*columns, threshold=None, detect_algorithm='auto', black_threshold=None, edge_sensitivity=1.0, min_border_size=1, concurrency=None)[source]#

Detect and remove black borders from an image.

If every pixel is treated as border (e.g. an all-black image), the original decoded image value is returned unchanged.

Parameters
  • *columns – Optional image columns. When provided, the UDF is applied directly instead of returning a factory.

  • threshold – Legacy alias for black_threshold. Cannot be combined with an explicit black_threshold.

  • detect_algorithm – Detection strategy — "auto" (default), "threshold", "histogram", or "edge". "auto" tries threshold, histogram, and edge detection in order and uses the first effective crop box.

  • black_threshold – Pixel luminance value (0-255) at or below which content is treated as black border. Default 10. Detection converts the image to 8-bit luminance first, so this scale applies even for L16/RGB16 inputs.

  • edge_sensitivity – Sensitivity for the "edge" detector, in [0.1, 2.0]. Higher values detect subtler borders. Default 1.0.

  • min_border_size – Minimum border width in pixels before a crop is applied. Default 1.

  • concurrency – UDF concurrency. None uses the framework default.

Returns

A UDF producing decoded image values.

Example::
>>> # As a reusable variable
>>> crop_border = image_crop_black_border(black_threshold=15)
>>> df = df.with_columns("clean", crop_border(col("img")))
>>>
>>> # Inline
>>> df = df.with_columns("clean", image_crop_black_border(col("img"), black_threshold=15))

previous

pyflink.multimodal.operators.image_crop

next

pyflink.multimodal.operators.image_flip

Show Source

Created using Sphinx 4.5.0.