Skip to content

Add image recognition tools #7

@NakaokaRei

Description

@NakaokaRei

Description

Add tools for finding images on screen using computer vision.

SwiftAutoGUI API Reference

  • locateOnScreen(imagePath: String, confidence?: Float) - Find image on screen
  • locateCenterOnScreen(imagePath: String) - Find image center
  • locateAllOnScreen(imagePath: String) - Find all image matches

Proposed Implementation

locateOnScreen

  • Input:
    • imagePath (string) - Path to reference image
    • confidence (number, optional) - Match confidence 0.0-1.0
  • Output: {x, y, width, height} or null if not found

locateCenterOnScreen

  • Input:
    • imagePath (string) - Path to reference image
    • confidence (number, optional) - Match confidence
  • Output: {x, y} center coordinates or null

locateAllOnScreen

  • Input:
    • imagePath (string) - Path to reference image
    • confidence (number, optional) - Match confidence
  • Output: Array of {x, y, width, height} for all matches

Use Cases

  • Automated UI testing
  • Waiting for UI elements
  • Game automation
  • Visual verification

Technical Considerations

  • OpenCV dependency (already in SwiftAutoGUI)
  • Performance impact of image matching
  • Handling retina displays and scaling
  • Image format support
  • Error handling for missing images

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions