Image Find Debugging System
Comprehensive debugging system for troubleshooting image pattern matching issues in Brobot applications.
Overview
The Image Find Debugging System provides detailed insights into why patterns may not be found during automation. It uses Spring AOP to intercept find operations and provides:
- Colorful console output with match details (Windows support via Jansi)
- Visual annotations on screenshots showing search regions and matches
- Comparison grids showing pattern vs found regions
- Session-based file organization for easy debugging
- Performance metrics and similarity scores
- HTML/JSON reports for analysis
Features
1. Colorful Console Output
- Real-time feedback with ANSI colors
- Success/failure indicators with visual symbols (✅ ❌)
- Similarity scores and timing information
- Pattern dimensions and match counts
2. Visual Debugging
- Annotated screenshots showing search regions
- Match highlights with similarity scores
- Comparison grids showing pattern vs matched regions
- Failed region indicators
3. Detailed Reports
- HTML reports with interactive timeline
- JSON reports for programmatic analysis
- Session statistics and summaries
- Performance metrics
4. File Saving
- Screenshots of each find operation
- Pattern images for reference
- Visual comparison grids
- All outputs organized by session
Quick Start
Enable Debugging
Add to your run command:
# Windows/Linux live automation with debugging
./gradlew bootRun --args='--spring.profiles.active=debug'
Debug Output Location
Debug files are saved to:
debug/image-finding/
├── session-20250913-102030/
│ ├── 001-LoginButton/
│ │ ├── screenshot.png
│ │ ├── pattern.png
│ │ ├── annotated.png
│ │ └── comparison-grid.png
│ ├── 002-SubmitButton/
│ │ └── ... similar files ...
│ └── session-summary.json
Configuration
Profile-Based Configuration
Brobot uses Spring profiles for clean configuration:
Profile | Purpose | Properties File |
---|---|---|
(none) | Live automation | application.properties |
debug | Live with debugging | application-debug.properties |
mock | Testing without GUI | application-mock.properties |
mock,debug | Mock with debugging | Both profiles combined |
Key Properties
# Master switch
brobot.debug.image.enabled=true
# Debug level (OFF, BASIC, DETAILED, VISUAL, FULL)
brobot.debug.image.level=DETAILED
# File saving
brobot.debug.image.save-screenshots=true
brobot.debug.image.save-patterns=true
brobot.debug.image.save-comparisons=true
brobot.debug.image.output-dir=debug/image-finding
# Visual features
brobot.debug.image.visual.enabled=true
brobot.debug.image.visual.show-search-regions=true
brobot.debug.image.visual.show-match-scores=true
brobot.debug.image.visual.highlight-best-match=true
brobot.debug.image.visual.create-comparison-grid=true
# Console output (Windows support via Jansi)
brobot.debug.image.console.use-colors=true
brobot.debug.image.console.show-box=true
brobot.debug.image.console.show-timestamp=true
Debug Levels
OFF
No debugging output
BASIC
- Success/failure status
- Basic timing information
DETAILED
Everything from BASIC plus:
- Similarity scores
- Search parameters
- Match locations
- Failure reasons
VISUAL
Everything from DETAILED plus:
- Visual annotations
- Screenshot saving
- Comparison grids
FULL
Everything from VISUAL plus:
- Memory usage
- Performance metrics
- Complete operation traces
Console Output
Colorful Output on Windows
The debug system uses the Jansi library to enable ANSI colors on Windows terminals:
✅ IMAGE FIND DEBUGGER: Session initialized
→ FIND START: LoginButton
╔══════════════════════════════════════════════════════════════╗
║ FIND OPERATION DEBUG ║
╠══════════════════════════════════════════════════════════════╣