get("#451") -- getIcons (grid size=3) get("#388") -- rect functions fw, fh = 7, 15 -- font size function findLeftBorder() for x = 0, w-1 do local nwhite = 0 for y = 0, fh*2-1 do if img.getInt(x, y) == 0xFFFFFF then nwhite = nwhite+1 end end if nwhite >= fh-1 then -- one row might not be white leftBorder = x return end print("x", x, "nwhite", nwhite) end error("left border not found") end w, h = img.width, img.height function findGrid() findLeftBorder() getIcons() r = icons["00f8a328"] or icons["00919df2"] or icons["002afe9a"] -- the latter is in black if r == nil then error "package statement not found" end r = stringtorect(r) --return r.x..", "..r.y sx, sy = r.x, r.y-2 sx, sy = (sx-leftBorder) % fw + leftBorder, sy%fh end
Began life as a copy of #447
test run test run with input download show line numbers
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #452 |
Snippet name: | Java grid locator (include) |
Eternal ID of this version: | #452/1 |
Text MD5: | f7b9ded8aba83cbb0fef3c38daf2507d |
Author: | stefan |
Category: | image recognition |
Type: | Lua code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-02-13 00:50:55 |
Source code size: | 863 bytes / 38 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 1036 / 213 |
Referenced in: | [show references] |