All Projects
Battery Tab Vision Inspection Pipeline

Battery Tab Vision Inspection Pipeline

An OpenCV-based computer vision pipeline that detects a battery reference body and inspects foil-tab position, size, and shape.

Role

Computer Vision Developer

Date

July 2026

Team

Independent engineering project

43 Labeled Images

Validation Dataset

5 Inspection States

Output Classes

Annotated Images + CSV

Report Outputs

PythonOpenCVComputer VisionQuality InspectionManufacturing AutomationNumPyImage ProcessingHough TransformsContour Analysis

Overview

This OpenCV pipeline analyzes camera images of battery tabs. It detects the printed battery-body reference, locates the foil tab, measures normalized tab position and dimensions, and assigns one of five results: GOOD, BAD_TAB, SHIFTED_TAB, BODY_NOT_FOUND, or TAB_NOT_FOUND.

Problem

Battery-tab inspection must distinguish the intended foil geometry from shadows, registration marks, tape, and reflections. These visual artifacts can resemble valid edges or contours, making simple thresholding unreliable.

Approach

The pipeline uses long-line geometry from edge and Hough-line analysis to establish the printed battery body as a reference. Within the expected tab region, thresholding, morphological operations, and contour analysis isolate the foil. Measurements are normalized against the detected body so tab width, height, and position can be evaluated consistently.

Inspection workflow

Input image → Battery-body detection → Foil-tab segmentation → Geometric measurements → Classification → Annotated image and CSV report

  1. Detect the battery body: Apply edge detection and Hough-line analysis to recover the long printed reference boundaries.
  2. Segment the foil tab: Use thresholding, morphology, and contour filtering within the expected tab region.
  3. Measure geometry: Calculate tab width, height, and position relative to the detected battery body.
  4. Classify and report: Assign an inspection state, render the result on the image, and export measurements to CSV.

Results

The pipeline produces annotated images that show the detected battery body, foil-tab bounds, measured dimensions, and pass/fail result. It also exports a CSV inspection report for downstream analysis.

Annotated battery inspection image showing a detected battery body and foil tab classified as GOOD

GOOD result with the detected reference body and foil-tab measurements.

Annotated battery inspection image showing a detected battery body and foil tab classified as BAD_TAB

BAD_TAB result with the measured foil-tab region highlighted.

The current thresholds were calibrated and validated against the included 43-image labeled dataset. This establishes performance on the available samples but does not imply production readiness.

Technologies

  • Python and NumPy
  • OpenCV
  • Edge detection and Hough transforms
  • Thresholding and morphological image processing
  • Contour analysis and geometric measurement
  • CSV report generation

Future improvements

  • Evaluate performance on a larger dataset covering additional lighting, material, and camera variations
  • Replace fixed thresholds with adaptive calibration where appropriate
  • Add repeatability studies and per-class accuracy reporting
  • Package camera capture, inspection, and reporting into a controlled deployment workflow