How AI Detects Manga Speech Bubbles: Computer Vision & Bubble Masking Explained

Nov 20, 2026AI Manga Translator

Learn how computer vision isolates manga speech balloons. Deep dive into YOLO segmentation, polygon boundary masks, tail tracing, and off-bubble whispers.

How AI Detects Manga Speech Bubbles: Computer Vision & Bubble Masking Explained

In the visual storytelling of manga, speech balloons are far more than containers for text—they are emotional instruments. A smooth rounded oval conveys calm narration, an explosive spiky starburst signals a battle cry, and an undulating cloud balloon represents a secret inner thought.

For an automated comic translation system, correctly detecting and masking these bubbles is the foundational first step. A single detection error cascades down the entire pipeline: miss a bubble, and you leave Japanese text untranslated; overestimate a bubble boundary, and you accidentally erase a character's face.

Here is how modern computer vision solves speech balloon segmentation.


The Diversity of Manga Balloon Anatomy

Unlike Western comic books that rely on fairly uniform rounded rectangular balloons, Japanese manga and Korean manhwa employ an extensive taxonomy of visual dialogue containers:

Manga Speech Balloon Anatomy

  • Normal speech uses an oval balloon. The tail points to the speaker.
  • Shouting uses a burst with sharp points.
  • Inner thoughts use a rounded thought balloon.
  1. Regular Elliptical Balloons: Smooth, continuous stroke contours.
  2. Explosive Shout / Spiky Balloons: High-frequency sharp vertices, often overlapping panel gutters.
  3. Cloud & Soft Thought Balloons: Dotted, dashed, or undulating curved outlines.
  4. Border-less Rectangular Narration Boxes: Often transparent or semi-shaded with vertical dividers.
  5. Direct Overlay Text (Whispers / Tsukkomi): Raw handwritten text scribbled directly on screentone art with zero enclosing border.

The Computer Vision Challenge: Tails, Hair, and Panel Gutters

Why can't simple edge detection (like Canny or Hough transforms) find manga bubbles?

  • Character Occlusion: Characters frequently lean over bubbles, overlapping speech borders with detailed hair strands or sword blades.
  • Speech Balloon Tails: Tails extend toward a speaker's mouth. Erasing the tail ruins the visual link of who is speaking.
  • Open-Ended Balloons: Mangaka frequently leave the bottom or side of a balloon open, allowing speech to blend into the white margin of the panel gutter.

Modern Detection Architecture: Semantic Instance Segmentation

Three views show an original speech balloon, its traced outline around a strand of hair, and a text mask inside the balloon.
Segmentation illustration. The contour follows the visible balloon, and the smaller text mask stays inside its edge.

State-of-the-art manga translators rely on deep convolutional and transformer-based instance segmentation (such as specialized variants of YOLOv8-Seg, Mask R-CNN, and SegFormer).

Detection Pipeline

A manga page feeds into a feature pyramid. One branch predicts the bubble's bounding box, and the other predicts a mask. The two branches join at the traced bubble outline.
How bounding-box and mask predictions combine to trace a speech balloon.
  1. Raw Manga Page
  2. Feature Pyramid Network (FPN). Extracts multi-scale visual features.
  3. Parallel prediction.
    • The Bounding Box Head predicts the bubble class and box.
    • The Mask Prototype Head computes pixel-level mask prototypes.
  4. Polygon Boundary Synthesis. Produces an accurate contour excluding tails and hair.

1. Multi-Scale Feature Extraction

Manga pages feature balloons ranging from gigantic two-page scream bursts to microscopic side comments. Feature Pyramid Networks (FPN) ensure that small whisper crops receive equal detection sensitivity as dominant dialogue boxes.

2. Tail Tracing & Protection

The neural model is explicitly trained to segment balloon bodies and balloon tails as distinct sub-classes. When sending the mask to the inpainting and typesetting engines, the system protects the tail's directional vector while only clearing the interior chamber where text resides.

3. Whispers & Off-Bubble Text Identification

For handwritten quips drawn without enclosing frames, the detector uses localized character stroke density clustering. Instead of expecting a white circle, it identifies high-contrast ink stroke clusters sitting on screentone backgrounds.


From Detection to Inpainting: Generating the Perfect Mask

Once a balloon is detected, the system creates a high-precision binary mask for the inpainting step:

  1. Raw Bounding Box. Contains the speech bubble and its dialogue, such as 「こんにちは!」.
  2. Character Stroke Mask. Keeps only the text strokes.
  3. Dilated Inpaint Mask. Expands the masked strokes by 2–3 pixels.
  • Text Binarization: Isolates the exact ink stroke pixels of the Japanese characters.
  • Adaptive Dilation: Expands the stroke mask by 2 to 3 pixels outward to catch antialiased boundary artifacts, ensuring no faint shadow of the original Japanese text remains visible after inpainting.

This precision is why AI Manga Translator produces scanlation-grade pages without blurry artifacts or missing dialogue.


References & Authoritative Sources