Challenge

The client’s project involved standard utility packages where P&IDs often repeated the same control loop structure: a valve, bypass line, and pressure transmitter — repeated with minor variations across hundreds of drawings.

Despite this repetition, engineers were manually reviewing every loop, due to:

  • No metadata in the PDFs
  • Slight differences in tag positions or line angles
  • Inconsistent vendor drawing practices

With 5,000+ such arrangements to verify, manual review became a bottleneck.

“We knew these loops were repeating — but we had no way to programmatically recognize them.”

Solution

Storm Consulting implemented a template matching system that allowed the client to:

  • Select and save 3 known control loop patterns as templates
  • Automatically scan new P&IDs (PDF or image) for visual matches
  • Annotate matched blocks with predefined metadata (loop ID, components)
  • Flag unmatched regions for manual review

Implementation Highlights

  • Used OpenCV’s matchTemplate + non-max suppression to locate all matches per P&ID
  • Incorporated rotation and scale invariance for higher match accuracy
  • Allowed engineers to upload new templates as needed (no coding required)
  • Matched loops were annotated as bounding boxes + component list
  • Matching results were exported as both images and CSV data

Results

MetricManual Review EstimateTemplate Matching Output
Repeated control loop instances~5,2005,120 detected
Engineer-hours saved180–200~20 (for review only)
Template creation time (3 total)~45 minutesOne-time effort
False positive rate~3%Corrected via review UI
Integration with annotation workflowN/AFully integrated

“Once the first match came through, our team’s confidence skyrocketed. It was like a ‘find and fill’ function for our P&IDs.” — Instrumentation Lead, Client Project Team

Why It Worked

  • Most control loop structures varied only in tag and orientation — perfect for template recognition
  • Engineers could expand the template library themselves — no dev cycles needed
  • Matched results retained visual + semantic context (not just boxes)
  • Minimal tuning — high match accuracy out of the box with grayscale + threshold preprocessing

Share

Like this? Share it with your network!