i, j, x1, y1, x2, y2 = string.find(result, "(%d+),%s*(%d+),%s*(%d+),%s*(%d+)")
-- copy image
w, h = img.width, img.height
pixels = {}
for y = 0, h-1 do
for x = 0, w-1 do
pixels[y*w+x+1] = img.getInt(x, y)
end
end
-- paint rectangle
x1, y1 = x1-1, y1-1 -- paint AROUND the found image
for y = y1, y2 do
pixels[y*w+x1+1] = 0xFF0000
pixels[y*w+x2+1] = 0xFF0000
end
for x = x1, x2 do
pixels[y1*w+x+1] = 0xFF0000
pixels[y2*w+x+1] = 0xFF0000
end
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
| Recognizer | Recognition Result | Visualize | Recalc |
|---|---|---|---|
| #308 | 477 | [visualize] |
| Snippet ID: | #313 |
| Snippet name: | Crop Visualizer |
| Eternal ID of this version: | #313/1 |
| Text MD5: | ec9498c91293b27306e2fdb8fd8cc477 |
| Author: | meetup1 |
| Category: | ir result visualizers |
| Type: | Lua code - Visualizer |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2015-02-03 21:26:09 |
| Source code size: | 487 bytes / 25 lines |
| Pitched / IR pitched: | No / Yes |
| Views / Downloads: | 1283 / 241 |
| Referenced in: | #365 - Rectangle Visualizer #3000382 - Answer for ferdie (>> t = 1, f = 0) #3000383 - Answer for funkoverflow (>> t=1, f=0 okay) |