Closed emiln closed 9 years ago
The Robot class has a nice method for getting a portion of the screen, which should work well for getting test data. Having a buffered image, you can do something along the lines of:
(let [dummy (int-array 3)]
(for [x (range (.getWidth img))
y (range (.getHeight img))]
(-> img (.getData) (.getPixel x y dummy))))
to get all the pixels, which are really int arrays with three elements: red, green, and blue.
It would be great to be able to express flows like: If this region of the screen is similar to this old version of it, perform some command. One measure for similarity could be simple color histograms. Here's my thought on a first version:
Similarity is calculated by:
Note that this means you can save a "fingerprint" of an image by saving its bucket values.