ruby - How to find screen coordinates of a smaller image within a screenshot -


how coordinates of image exists within screenshot?

i have screen shot looks this. (partial)

progresss bar

and find out coordinates of progress indicator

progress indicator

and play button

play button

my script written in ruby , running osx 10.7

is there exists can this?

if brute force search needed whats best language in?

if know target size use brute force attack ...

  • this pretty basic shape/pattern
  • so if size known quite easy , not slow ...

1.find possible locations

  • create control points check possible location of button
  • they should describe image discard invalid loactions
  • something this:

control points

  • red dots control points
  • the less tne number of points faster be
  • but less precise ...
  • now go through entire screen , compute

    maxdiff = max(|scrpnt(i)-ctrlpnt(i)|) avgdiff = sum(|scrpnt(i)-ctrlpnt(i)|) / n 
  • n - number of control points (in picture n = 11)

  • i = 0,1,2...n-1
  • if both maxdiff , avgdiff < treshold possible location on button

2.test possible location

  • now check points of possible location arrea
  • if both maxdiff , avgdiff < treshold button location
  • if image big enough can speed testing not pixels @ first
  • but step ... example:
    • first test step = 8px
    • if pass step = 1px

[notes]

  • i not code platform can not consider language pixel access do
  • i saw few similar questions here on se in past
  • so if search bit find solutions (try pattern recognition)

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -