function setPixel(x, y, pix) if x >= 0 and y >= 0 and x < w and y < h then pixels[y*w+x+1] = pix end end -- 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 -- iterate over heatmap _, _, map = string.find(result, ": (.*)") for y = 0, h-1 do b = math.floor((string.byte(map, y+1)-string.byte("A"))*255/25+0.5) for x = 0, 3 do setPixel(x, y, b*0x010101) setPixel(w-1-x, y, b*0x010101) end end
Began life as a copy of #367
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: | #450 |
Snippet name: | Heat Map Visualizer (Vertical) |
Eternal ID of this version: | #450/1 |
Text MD5: | 8c45ab7730d92560fc3317a0f2ae8402 |
Author: | stefan |
Category: | ir result visualizers |
Type: | Lua code - Visualizer |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-02-12 23:43:33 |
Source code size: | 533 bytes / 27 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 721 / 177 |
Referenced in: | [show references] |