Ctrl+K
Logo image Logo image

Site Navigation

  • API Reference
  • Examples

Site Navigation

  • API Reference
  • Examples

Section Navigation

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

pyflink.multimodal.operators.image_detect_subplot#

image_detect_subplot(*columns, threshold=0.5, concurrency=None)[source]#

Create a subplot / mosaic detection UDF (OpenCV Hough-based).

Requires pip install opencv-python-headless. This is a scalar UDF.

Detects whether an image is a composite (mosaic / subplot / screenshot collage) by looking for strong horizontal/vertical grid lines. Images smaller than 20px on either axis always return (False, 1) because the Hough line detector cannot accumulate enough votes at that resolution. Input must be a decoded image; encoded bytes raise TypeError. Decode raw bytes first with image_decode(on_error="null") when invalid inputs should become null. Corrupt decoded images still raise. is_valid_image can be used as a lightweight pre-filter but does not guarantee full pixel materialization.

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

  • threshold – Edge detection sensitivity in [0, 1]. Higher values require stronger edges. Default 0.5.

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

Returns

A UDF that returns an object with is_subplot (bool) and count (int).

Example:

>>> # As a reusable variable
>>> subplot = image_detect_subplot(threshold=0.5)
>>> df = df.with_column("subplot", subplot(col("img")))
>>>
>>> # Inline
>>> df = df.with_column("subplot", image_detect_subplot(col("img")))

previous

pyflink.multimodal.operators.image_ocr

next

pyflink.multimodal.operators.image_face_detect

Show Source

Created using Sphinx 4.5.0.