1 | get("#380") -- hashImage |
2 | |
3 | w, h = img.width, img.height |
4 | |
5 | function cacheImage() |
6 | cached = {} |
7 | for i = 1, 100 do |
8 | local x, y = math.random(0, w-1), math.random(0, h-1) |
9 | cached[i] = {x, y, img.getInt(x, y)} |
10 | end |
11 | end |
12 | |
13 | function hasMovement() |
14 | for i = 1, #cached do |
15 | local x, y, pix = unpack(cached[i]) |
16 | if img.getInt(x, y) ~= pix then |
17 | return true |
18 | end |
19 | end |
20 | return false |
21 | end |
22 | |
23 | return function() |
24 | if cached == nil then |
25 | cacheImage() |
26 | return nil -- "Initializing..." |
27 | end |
28 | if hasMovement() then |
29 | cacheImage() |
30 | return "Movement" |
31 | else |
32 | cacheImage() -- optional, but a little safer |
33 | return "Probably no movement" |
34 | end |
35 | end |
Began life as a copy of #467
Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Image | Result | Result calculated |
---|---|---|
#1004090 | java.lang.OutOfMemoryError: Java heap space | 2016-08-07 13:34:12 [raw result] [visualize] |
#1000336 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 17:48:38 [raw result] [visualize] |
#1000330 | java.lang.OutOfMemoryError: Java heap space | 2016-08-01 17:36:25 [raw result] [visualize] |
#1000327 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 16:53:45 [raw result] [visualize] |
#1000326 | java.lang.OutOfMemoryError: Java heap space | 2016-08-01 16:53:12 [raw result] [visualize] |
#1000320 | java.lang.OutOfMemoryError: Java heap space | 2016-08-01 15:25:56 [raw result] [visualize] |
#1000314 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 14:43:28 [raw result] [visualize] |
#1000310 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 14:21:21 [raw result] [visualize] |
#1000309 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 14:20:52 [raw result] [visualize] |
#1000301 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 14:20:50 [raw result] [visualize] |
#1000241 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 09:35:20 [raw result] [visualize] |
#500 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 08:34:29 [raw result] [visualize] |
#488 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 07:29:04 [raw result] [visualize] |
#1000196 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 05:29:54 [raw result] [visualize] |
#1000212 | java.lang.OutOfMemoryError: Java heap space | 2016-08-01 05:29:53 [raw result] [visualize] |
#1000218 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 05:29:52 [raw result] [visualize] |
#1000216 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 05:29:52 [raw result] [visualize] |
#1000003 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:56:10 [raw result] [visualize] |
#309 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:56:10 [raw result] [visualize] |
#182 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:50:13 [raw result] [visualize] |
#178 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:15:58 [raw result] [visualize] |
#85 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:15:58 [raw result] [visualize] |
#145 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:15:57 [raw result] [visualize] |
#141 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:15:57 [raw result] [visualize] |
#115 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:15:57 [raw result] [visualize] |
#84 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:15:57 [raw result] [visualize] |
#100 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:15:55 [raw result] [visualize] |
#48 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:15:55 [raw result] [visualize] |
#87 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:15:55 [raw result] [visualize] |
#93 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:15:55 [raw result] [visualize] |
#1000219 | java.lang.OutOfMemoryError: Java heap space | 2016-07-31 18:51:40 [raw result] [visualize] |
#1003745 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-07-31 18:51:23 [raw result] [visualize] |
#489 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-07-31 18:51:22 [raw result] [visualize] |
Snippet ID: | #468 |
Snippet name: | Movement detector (monte carlo) |
Eternal ID of this version: | #468/1 |
Text MD5: | 9aa7e83b4244252776b13d94c69718c7 |
Author: | stefan |
Category: | |
Type: | Lua code - Image recognition |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-02-17 20:55:46 |
Source code size: | 695 bytes / 35 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 1485 / 148 |
Referenced in: | [show references] |