Package io.github.jspinak.brobot.action.basic.find.motion
package io.github.jspinak.brobot.action.basic.find.motion
Motion detection and dynamic element tracking.
This package provides sophisticated motion detection capabilities for identifying and tracking moving elements in the GUI. It can distinguish between static and dynamic pixels, track moving objects, and identify regions of motion activity.
Core Capabilities
- Motion Detection - Identify pixels and regions that change over time
- Dynamic Tracking - Follow moving elements across frames
- Static vs Dynamic Classification - Distinguish fixed UI elements from animated ones
- Motion Visualization - Visual representation of detected motion for debugging
Key Classes
FindMotion
- Main motion detection action that coordinates the motion analysis processFindDynamicPixelMatches
- Identifies pixels that change between frames (moving elements)FindFixedPixelMatches
- Identifies pixels that remain constant (static UI elements)FindRegionsOfMotion
- Groups motion pixels into coherent regions representing moving objects-
invalid reference
io.github.jspinak.brobot.action.basic.find.motion.IllustrateMotion
Motion Detection Process
- Capture multiple frames over a time period
- Compare pixels across frames to identify changes
- Classify pixels as static or dynamic based on change patterns
- Group dynamic pixels into motion regions
- Track motion regions across frames
- Return motion matches with trajectory information
Use Cases
- Tracking animated UI elements (loading spinners, progress bars)
- Detecting pop-ups or notifications that slide into view
- Following game characters or moving objects
- Identifying areas of screen activity
- Waiting for animations to complete
- Distinguishing between static background and moving foreground
Example Usage
// Detect motion in a specific region
FindMotion findMotion = new FindMotion(...);
ActionConfig options = new ActionConfig.Builder()
.setAction(ActionType.FIND)
.setFind(Find.MOTION)
.setMaxWait(5.0) // Observe for 5 seconds
.build();
ObjectCollection searchRegion = new ObjectCollection.Builder()
.withRegions(Region.SCREEN) // Or specific region
.build();
ActionResult result = findMotion.perform(new ActionResult(), searchRegion);
// Visualize detected motion
IllustrateMotion illustrate = new IllustrateMotion(...);
ActionResult visualization = illustrate.perform(result, searchRegion);
// Access motion regions
for (Match motionMatch : result.getMatches()) {
System.out.println("Motion detected at: " + motionMatch.getRegion());
}
Performance Considerations
- Motion detection requires capturing multiple frames
- Larger regions require more processing time
- Adjust frame rate and duration based on expected motion speed
- Use region constraints to focus on specific areas
- See Also:
-
ClassesClassDescriptionFinds matches based on dynamic (changing) pixels across multiple patterns.Finds matches based on fixed (unchanging) pixels across multiple patterns.Detects and tracks motion across multiple scene captures.Identifies regions containing motion across multiple scene captures.Configuration for motion-based Find actions.Builder for constructing
MotionFindOptions
with a fluent API.Creates visual representations of detected motion for debugging and analysis.