Brobot Pattern Capture Tool Guide
Overviewโ
The Brobot Pattern Capture Tool is a standalone application that provides SikuliX IDE-like functionality for capturing screen patterns. Based on extensive testing, Windows Snipping Tool produces the cleanest patterns that achieve the best match rates during runtime automation.
Key Featuresโ
- ๐ธ Multiple Capture Providers: SikuliX, Robot, and FFmpeg (JavaCV)
- ๐ฏ 100% Compatibility: Identical results to Windows Snipping Tool with FFmpeg
- ๐ผ๏ธ Image Gallery: View and manage captured patterns
- โก Hotkeys: F1 for instant capture, F2 for delayed capture
- ๐ Auto-organization: Saves patterns with timestamps
- ๐ง Provider Switching: Change capture methods on the fly
Installationโ
Prerequisitesโ
- Java 21 or higher
- Brobot library built and installed
Building the Toolโ
# From the brobot directory
cd pattern-capture-tool
./build.sh
# Or manually
./gradlew :pattern-capture-tool:bootJar
Running the Toolโ
Windowsโ
cd pattern-capture-tool
java -jar build\libs\pattern-capture-tool-1.0.0.jar
Linux/Macโ
cd pattern-capture-tool
./run.sh
Usage Guideโ
Basic Capture Workflowโ
-
Launch the tool
java -jar pattern-capture-tool-1.0.0.jar
-
For best results, use Windows Snipping Tool (Win+Shift+S)
- Produces cleanest patterns with 95-100% match rates
- Better than using the tool's FFmpeg capture for patterns
- The tool is useful for testing and organizing patterns
-
Capture a pattern
- Click "Capture" or press F1
- Screen darkens with overlay
- Click and drag to select region
- Press ESC to cancel
-
Pattern is auto-saved
- Saved to
./patterns/
folder - Named with timestamp
- Visible in image gallery
- Saved to
Capture Providers Comparisonโ
Based on extensive testing:
Capture Method | Best Use | Runtime Match Rate |
---|---|---|
Windows Snipping Tool | Pattern creation (recommended) | 95-100% |
Tool FFmpeg | Testing/validation | 70-80% |
Tool SikuliX | Legacy compatibility | 70-77% |
Tool Robot | Quick testing | 70-77% |
Hotkeysโ
- F1 - Instant capture
- F2 - Delayed capture (500ms default)
- ESC - Cancel capture selection
Settingsโ
Access via the "Settings" button:
# Default configuration
pattern.capture.default-folder=./patterns
pattern.capture.capture-delay=500
pattern.capture.save-screenshots=false
pattern.capture.show-dimensions=true
Advanced Featuresโ
Gallery Managementโ
The image gallery provides:
- Thumbnail view of all captured patterns
- Click to copy path to clipboard
- Double-click to open in default viewer
- Right-click menu:
- Copy path
- Copy filename
- Open in viewer
- Show in folder
- Delete
Batch Capture Modeโ
For capturing multiple patterns quickly:
- Set up your application in the desired state
- Use F2 for delayed capture
- Position windows/dialogs
- Capture multiple regions in sequence
Resolution Handlingโ
The tool automatically handles DPI scaling:
- Physical capture (1920x1080): Scaled to fit logical display
- Logical capture (1536x864): Displayed 1:1
- Selection coordinates: Automatically converted to correct resolution
Configuration for Brobotโ
Optimal Settingsโ
After capturing patterns with the tool, configure Brobot:
# application.properties
brobot.capture.provider=JAVACV_FFMPEG # Match the tool's FFmpeg
brobot.dpi.resize-factor=auto
brobot.action.similarity=0.70
Pattern Organizationโ
Recommended folder structure:
project/
โโโ images/
โ โโโ login/
โ โ โโโ username-field.png
โ โ โโโ password-field.png
โ โ โโโ submit-button.png
โ โโโ dashboard/
โ โ โโโ menu-icon.png
โ โ โโโ search-bar.png
โ โโโ common/
โ โโโ logo.png
โโโ patterns/ # Tool's default save location
Troubleshootingโ
Issue: "JavaCV FFmpeg not available"โ
Solution: Ensure Brobot library is properly built:
./gradlew :library:build
Issue: Captured image appears zoomedโ
Solution: This is fixed in the latest version. The tool now:
- Detects physical vs logical resolution
- Scales display appropriately
- Captures at original resolution
Issue: Can't capture full screenโ
Solution: The tool now correctly includes all pixels (fixed off-by-one error)
Issue: Different colors than expectedโ
Normal behavior - slight color variations don't affect pattern matching:
- FFmpeg: 24-bit color
- Windows: 32-bit color
- Difference is negligible for matching
Best Practicesโ
For Optimal Pattern Matchingโ
- Use Windows Snipping Tool (Win+Shift+S) for pattern creation
- macOS: Use Cmd+Shift+4
- Linux: Use GNOME Screenshot or Spectacle
- Capture small, unique elements (< 200x200 pixels)
- Avoid capturing text (use OCR instead)
- Include some background for context
- Test patterns with this tool after capture
Pattern Quality Guidelinesโ
โ Good Patterns:
- Buttons with unique icons
- Distinctive UI elements
- Fixed-size components
- High contrast areas
โ Poor Patterns:
- Large areas of solid color
- Text that might change
- Animated elements
- Semi-transparent overlays
Performance Metricsโ
Based on testing with various providers:
Metric | FFmpeg | SikuliX | Robot |
---|---|---|---|
Capture Speed | ~0.5s | ~0.3s | ~0.3s |
File Size (1920x1080) | 255 KB | 324 KB* | 324 KB* |
Compression Ratio | 23.7x | 12.0x | 12.0x |
Match Accuracy | 100% | 97% | 97% |
*At logical resolution (1536x864)
Integration with CI/CDโ
Automated Pattern Captureโ
// Headless pattern validation
@Test
public void validatePatterns() {
File patternDir = new File("patterns");
for (File pattern : patternDir.listFiles()) {
StateImage img = new StateImage.Builder()
.withPath(pattern.getPath())
.build();
// Validate pattern loads correctly
assertNotNull(img);
assertTrue(pattern.length() > 0);
}
}
Docker Supportโ
FROM openjdk:21
COPY pattern-capture-tool-1.0.0.jar /app/
COPY patterns/ /app/patterns/
WORKDIR /app
# Note: Requires display for capture
Extending the Toolโ
The tool is built with Spring Boot and can be extended:
Adding Custom Providersโ
@Component
public class CustomProvider implements CaptureProvider {
@Override
public String getName() {
return "CUSTOM";
}
@Override
public BufferedImage captureScreen() {
// Your capture implementation
}
}
Adding Export Formatsโ
// In ImageGalleryPanel
public void exportToSikuliXBundle() {
// Export patterns in SikuliX format
}
Research Backgroundโ
This tool was developed after extensive testing comparing:
- 3 Brobot capture methods (SikuliX, Robot, FFmpeg)
- 5 external tools (Windows, SikuliX IDE, Pattern Capture Tool variants)
- 28 pairwise comparisons
- 1000+ test patterns
Key finding: While FFmpeg captures match Windows Snipping Tool when comparing full screenshots, Windows Snipping Tool patterns achieve significantly better match rates (95-100% vs 70-80%) when used as patterns during runtime automation. This is because clean, artifact-free patterns from native OS tools match better against runtime screenshots.
Supportโ
For issues or questions:
- Check the capture comparison study
- Review quick start guide
- File issues on GitHub
Version Historyโ
v1.0.0 (Current)โ
- Initial release
- Three capture providers
- Image gallery
- Hotkey support
- DPI scaling fixes
- Off-by-one capture fix
Planned Featuresโ
- State detection from screen
- Batch capture mode
- Pattern optimization
- OCR integration
- Cloud storage support
Licenseโ
Part of the Brobot project - see main project license.