-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ability to assess similarity of images. #11
Comments
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. |
emiln
pushed a commit
that referenced
this issue
Sep 1, 2015
It is now possible to compute a simple color histogram of a given BufferedImage. The histogram uses 8 buckets for each color, and each bucket contains a normalized number between 0 and 255. The 8 buckets sum up to 255. Why 255? It will make it really easy to create reader tags with hexadecimal literals later on, which can be entered in the EDN files without too much verbosity. I envision a reader tag like `#cljck.color.Histogram[0x0011223344556677 0x8899aabbccddeeff 0x0123456789abcdef]` which is a fairly compact notation for a histogram.
emiln
added a commit
that referenced
this issue
Sep 1, 2015
There is now a function to compare two histograms and return their difference between 0 (very similar) and 1 (very different).
Merged
emiln
pushed a commit
that referenced
this issue
Sep 2, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The text was updated successfully, but these errors were encountered: