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_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. Corrupt or undecodable images raise; use is_valid_image first when invalid inputs should be filtered instead of failing the task.

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.