Edge Measurement in Industrial Vision: Counting Saw Blade Teeth
Edge measurement is a fundamental technique in industrial vision systems, enabling precise detection and analysis of object boundaries. This tutorial demonstrates edge measurement principles through a practical application: automatically counting the teeth on a saw blade.
Understanding Edge Measurement
Edge measurement involves detecting transitions in pixel intensity that correspond to physical edges in objects. In industrial applications, this technique is crucial for:
- Quality control: Verifying part dimensions and features
- Counting operations: Detecting repetitive features like teeth, holes, or ridges
- Defect detection: Finding missing or damaged edges
- Alignment: Using edges as reference points for positioning
The Challenge: Counting Saw Teeth
Our objective is to create an application that automatically counts the number of teeth on a circular saw blade from a single image.

Example saw blade image - our goal is to automatically count the teeth around the perimeter
Input Requirements
- Single image of a saw blade
- Clear visibility of the mounting hole and teeth
- Adequate lighting to distinguish teeth from background
Expected Output
- Accurate count of blade teeth
- Robust performance across different blade types
Key Observations
- Teeth are distributed evenly around the mounting hole
- The central mounting point provides a reference for circular scanning
- Teeth create dark-to-light transitions that can be detected as stripes
Solution Approach
Step 1: Locate the Central Reference Point
The mounting hole serves as our coordinate system origin. We use circle detection to find this reference:
// Detect the central mounting hole
DetectSingleCircle(inputImage, expectedRadius, detectedCircle);
Point2D centerPoint = detectedCircle.Center;
Key Parameters:
- Expected Radius: Measure manually or estimate based on blade specifications
- ROI Optimization: Restrict search to the central region for better performance
- Detection Confidence: Ensure reliable circle detection before proceeding
Step 2: Define the Scanning Path
Create a circular path around the center at the appropriate radius to intersect all teeth:
// Create circular scanning path
Circle scanCircle = {
center: centerPoint,
radius: teethRadius // Distance from center to teeth tips
};
CreateCirclePath(scanCircle, pointCount, scanPath);
Critical Considerations:
- Point Count: Must be sufficient to detect each tooth individually
- Radius Selection: Position path to cross all teeth consistently
- Path Density: Balance between detection accuracy and processing speed
Step 3: Scan for Edge Transitions
Use stripe scanning along the circular path to detect teeth edges:
// Scan for multiple stripes (teeth) along the path
ScanMultipleStripes(
inputImage,
scanPath,
stripeParameters,
detectedStripes
);
int toothCount = detectedStripes.Count;
Stripe Detection Parameters:
- Polarity: Set to “Dark” since teeth appear darker than background
- Width Tolerance: Account for varying tooth sizes
- Contrast Threshold: Ensure sufficient edge strength for reliable detection
Implementation Details
Image Preprocessing
Before edge detection, ensure optimal image quality:
// Enhance contrast if needed
if (imageContrast < minimumThreshold) {
EnhanceContrast(inputImage, enhancedImage);
} else {
enhancedImage = inputImage;
}
Robust Circle Detection
Improve mounting hole detection reliability:
// Set detection parameters
CircleDetectionParams params = {
radiusRange: {minRadius, maxRadius},
edgeThreshold: adaptiveThreshold,
centerTolerance: searchTolerance
};
// Detect with validation
if (DetectSingleCircle(image, params, circle)) {
if (ValidateCircleQuality(circle)) {
// Proceed with scanning
} else {
// Handle detection failure
}
}
Adaptive Scanning
Optimize scanning parameters based on detected circle:
// Calculate optimal scanning radius
double scanRadius = circle.Radius * TEETH_RADIUS_RATIO;
// Adjust point count based on expected tooth count
int estimatedTeeth = EstimateToothCount(scanRadius);
int pointCount = estimatedTeeth * POINTS_PER_TOOTH;
Practical Implementation Example
To see this edge measurement technique in action, here’s a demonstration using industrial vision software to solve the blade counting challenge:
This video demonstrates the practical application of the edge measurement principles we’ve discussed, showing how circular scanning and stripe detection can be implemented in a real vision system.
Advanced Techniques
Multi-Scale Detection
For blades with varying tooth sizes:
// Scan at multiple radii
vector<int> toothCounts;
for (double radius = minRadius; radius <= maxRadius; radius += step) {
CreateCirclePath(center, radius, pointCount, path);
int count = ScanMultipleStripes(image, path, params).Count;
toothCounts.push_back(count);
}
// Select most consistent result
int finalCount = FindConsistentCount(toothCounts);
Validation and Quality Control
Implement checks to ensure measurement reliability:
bool ValidateToothCount(int count, Circle blade) {
// Check reasonable count range
if (count < MIN_TEETH || count > MAX_TEETH) return false;
// Verify even distribution
double expectedSpacing = (2 * PI * scanRadius) / count;
return ValidateSpacing(detectedStripes, expectedSpacing);
}
Error Handling
Robust applications handle edge cases:
MeasurementResult CountBladeTooth(Image input) {
try {
// Main processing pipeline
Circle hole = DetectMountingHole(input);
Path scanPath = CreateScanningPath(hole);
StripeArray teeth = ScanForTeeth(input, scanPath);
if (ValidateResults(teeth)) {
return {success: true, count: teeth.Count};
} else {
return {success: false, error: "Invalid detection"};
}
} catch (const VisionException& e) {
return {success: false, error: e.message};
}
}
Performance Optimization
Region of Interest (ROI)
Limit processing to relevant image areas:
// Restrict circle detection to central region
Rectangle centerROI = {
x: imageWidth/4,
y: imageHeight/4,
width: imageWidth/2,
height: imageHeight/2
};
SetROI(centerROI);
DetectSingleCircle(image, params, circle);
ResetROI();
Parallel Processing
For real-time applications:
// Process multiple scan radii in parallel
#pragma omp parallel for
for (int i = 0; i < radiusCount; i++) {
results[i] = ScanAtRadius(image, radii[i]);
}
Applications and Extensions
Quality Control
- Tooth uniformity: Measure individual tooth dimensions
- Damage detection: Identify broken or worn teeth
- Spacing verification: Check even distribution
Different Blade Types
- Circular saws: Standard tooth counting
- Band saws: Linear stripe detection
- Specialty blades: Adaptive parameter selection
Integration with Manufacturing
- Automated sorting: Route blades based on tooth count
- Process monitoring: Track blade quality over time
- Batch verification: Ensure specification compliance
Best Practices
Lighting Considerations
- Uniform illumination: Prevent shadows that could be mistaken for teeth
- Contrast optimization: Ensure clear tooth-to-background separation
- Reflection management: Avoid specular reflections on metal surfaces
Parameter Tuning
- Start with manual measurements: Establish baseline parameters
- Use test datasets: Validate across different blade types
- Implement adaptive algorithms: Adjust parameters based on image characteristics
System Integration
- Calibration procedures: Regular system validation
- Error reporting: Clear feedback on measurement failures
- Data logging: Track measurements for quality analysis
Troubleshooting Common Issues
Problem: Inconsistent tooth counting Solution: Verify lighting consistency and adjust contrast thresholds
Problem: Missing mounting hole detection Solution: Check expected radius range and edge detection parameters
Problem: False tooth detections Solution: Increase stripe contrast threshold and validate tooth spacing
Problem: Varying counts across similar blades Solution: Implement multi-scale scanning and result validation
Conclusion
Edge measurement through stripe scanning provides a robust solution for counting saw blade teeth. This technique demonstrates key principles applicable to many industrial vision challenges:
- Reference point establishment: Using geometric features for coordinate systems
- Systematic scanning: Following defined paths for comprehensive analysis
- Edge detection optimization: Tuning parameters for specific applications
- Result validation: Implementing quality checks for reliable measurements
The methods shown here can be adapted for counting other repetitive features like gear teeth, holes in perforated materials, or ridges in textured surfaces.
Next Steps
Ready to implement edge measurement in your applications? Try adapting these techniques for:
- Gear tooth counting and analysis
- PCB via hole detection
- Textile thread counting
- Surface texture analysis
Master more industrial vision techniques with our upcoming tutorials on geometric matching and measurement calibration.