get("#348") -- rgb functions get("#346") -- getcrop get("#337") -- map(list, f) w, h = img.width, img.height brightnessThreshold = 0.9 function isEmpty(y) for x=0, w-1 do if bright(rgb(img.getInt(x, y))) <= brightnessThreshold then return false end end return true end lastEmpty = true segments = {} for y=0, h-1 do empty = isEmpty(y) if empty and not lastEmpty then table.insert(segments, {start, y}) elseif not empty and lastEmpty then start = y end lastEmpty = empty end if not lastEmpty then table.insert(segments, {start, h}) end if #segments <= 1 then -- don't bother with only 1 segment return end result = {} for _, seg in ipairs(segments) do local sy1, sy2 = unpack(seg) local cropped = { width = img.width, height = sy2-sy1, getInt = function(x, y) return img.getInt(x, y+sy1) end } local x1, y1, x2, y2 = getcrop(cropped) table.insert(result, x1..", "..(y1+sy1)..", "..x2..", "..(y2+sy1)) end return "Parts: "..table.concat(result, "|")
Began life as a copy of #345
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:11 [raw result] [visualize] |
#1004070 | LuaError: #472:3 vm error: java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientCon... | 2016-08-05 15:10:16 [raw result] [visualize] |
#1004060 | Parts: 0, 0, 1366, 26|0, 29, 1366, 162|146, 196, 1351, 406|146, 458, 1351, 480|154, 515, 1351, 534|1... | 2016-08-05 13:35:17 Lua instructions: 16806k [raw result] [visualize] |
#1004061 | LuaError: #472:3 vm error: java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientCon... | 2016-08-05 13:31:15 [raw result] [visualize] |
#1004009 | Parts: 8, 4, 748, 44|0, 54, 763, 55|128, 79, 622, 91|0, 111, 763, 114|129, 132, 402, 144|129, 170, 2... | 2016-08-03 17:19:14 Lua instructions: 5998k [raw result] [visualize] |
#1000519 | Parts: 0, 0, 1366, 1|0, 4, 1366, 88|1351, 95, 1362, 99|14, 103, 1364, 266|14, 275, 1351, 301|14, 311... | 2016-08-01 18:39:59 Lua instructions: 9811k (1239 ms) [raw result] [visualize] |
#1000421 | Parts: 0, 3, 1280, 345|461, 767, 820, 787 | 2016-08-01 18:12:51 Lua instructions: 29364k (3140 ms) [raw result] [visualize] |
#1000418 | Parts: 0, 3, 320, 87|0, 89, 320, 102|0, 104, 168, 117|0, 120, 209, 133|1, 135, 248, 148|0, 150, 169,... | 2016-08-01 18:06:06 Lua instructions: 1861k (240 ms) [raw result] [visualize] |
#1000336 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 17:48:38 [raw result] [visualize] |
#1000331 | Parts: 243, 0, 340, 1|44, 19, 314, 281 | 2016-08-01 17:38:16 Lua instructions: 1680k (190 ms) [raw result] [visualize] |
#1000330 | java.lang.OutOfMemoryError: Java heap space | 2016-08-01 17:36:52 [raw result] [visualize] |
#1000328 | Parts: 0, 2, 300, 3|0, 6, 300, 232 | 2016-08-01 16:54:31 Lua instructions: 121k (19 ms) [raw result] [visualize] |
#1000326 | java.lang.OutOfMemoryError: Java heap space | 2016-08-01 16:53:28 [raw result] [visualize] |
#1000320 | java.lang.OutOfMemoryError: Java heap space | 2016-08-01 15:26:09 [raw result] [visualize] |
#1000316 | Parts: 0, 8, 494, 25|0, 26, 493, 43|0, 44, 472, 61|0, 67, 440, 593 | 2016-08-01 15:00:28 Lua instructions: 1198k (144 ms) [raw result] [visualize] |
#1000314 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 14:55:21 [raw result] [visualize] |
#1000311 | java.lang.OutOfMemoryError: Java heap space | 2016-08-01 14:21:16 [raw result] [visualize] |
#1000309 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 14:20:53 [raw result] [visualize] |
#1000301 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 14:20:50 [raw result] [visualize] |
#1000283 | Parts: 32, 4, 373, 10|0, 12, 400, 114|0, 122, 336, 135 | 2016-08-01 13:50:30 Lua instructions: 722k (176 ms) [raw result] [visualize] |
#1000247 | Parts: 0, 8, 300, 25|8, 36, 288, 55|0, 62, 296, 225|8, 227, 272, 238 | 2016-08-01 11:20:39 Lua instructions: 779k (93 ms) [raw result] [visualize] |
#1000238 | Parts: 0, 0, 1366, 1|0, 3, 1366, 56|0, 60, 1366, 92|0, 97, 1366, 768 | 2016-08-01 09:25:08 Lua instructions: 7052k (865 ms) [raw result] [visualize] |
#1000235 | Parts: 0, 0, 1366, 1|0, 3, 1366, 26|9, 32, 164, 47|0, 50, 1366, 51|0, 52, 1366, 768 | 2016-08-01 09:03:11 Lua instructions: 1402k (155 ms) [raw result] [visualize] |
#1000233 | Parts: 0, 0, 1366, 1|0, 3, 1366, 26|9, 32, 164, 47|0, 50, 1366, 51|0, 52, 1366, 768 | 2016-08-01 08:53:36 Lua instructions: 1431k (168 ms) [raw result] [visualize] |
#500 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 08:34:29 [raw result] [visualize] |
#499 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 08:34:28 [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:47 [raw result] [visualize] |
#1000212 | java.lang.OutOfMemoryError: Java heap space | 2016-08-01 05:23:05 [raw result] [visualize] |
#1000218 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 05:10:51 [raw result] [visualize] |
#1000216 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 05:10:51 [raw result] [visualize] |
#1000034 | Parts: 0, 0, 1920, 1|0, 3, 1920, 23|834, 587, 1086, 612|1, 1176, 1919, 1198 | 2016-08-01 03:47:33 Lua instructions: 97238k (10647 ms) [raw result] [visualize] |
#1000187 | Parts: 0, 0, 1366, 1|0, 3, 1366, 26|12, 32, 242, 47|0, 51, 1366, 724|1126, 727, 1364, 744|0, 746, 13... | 2016-08-01 03:22:01 Lua instructions: 7615k (814 ms) [raw result] [visualize] |
#1000180 | Parts: 0, 18, 186, 31|0, 33, 170, 46|0, 48, 135, 59|0, 78, 200, 91|0, 93, 261, 106|0, 108, 79, 119|0... | 2016-08-01 02:53:15 Lua instructions: 1055k (258 ms) [raw result] [visualize] |
#1000176 | Parts: 0, 0, 1366, 1|0, 3, 1366, 26|12, 32, 242, 47|0, 51, 1366, 724|1126, 727, 1364, 744|0, 746, 13... | 2016-08-01 02:08:10 Lua instructions: 7615k (940 ms) [raw result] [visualize] |
#1000047 | Parts: 0, 0, 1366, 745|0, 746, 1366, 768 | 2016-08-01 01:56:28 Lua instructions: 198k (120 ms) [raw result] [visualize] |
#1000055 | Parts: 0, 0, 83, 12|20, 25, 53, 73|17, 102, 62, 152|19, 183, 57, 231|20, 262, 29, 310|15, 342, 43, 3... | 2016-08-01 01:56:13 Lua instructions: 1081k (126 ms) [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] |
#1000054 | Parts: 7, 9, 22, 23|21, 36, 64, 84|25, 115, 62, 163|23, 192, 65, 242|26, 273, 65, 321|26, 353, 61, 4... | 2016-08-01 01:56:09 Lua instructions: 1534k (181 ms) [raw result] [visualize] |
#1000042 | Parts: 0, 0, 1366, 1|0, 3, 1366, 23|0, 25, 1366, 54|0, 58, 1366, 90|0, 95, 1366, 766 | 2016-08-01 01:56:06 Lua instructions: 5928k (803 ms) [raw result] [visualize] |
#1000172 | Parts: 84, 0, 294, 79|0, 81, 294, 127 | 2016-08-01 01:55:47 Lua instructions: 1142k (140 ms) [raw result] [visualize] |
#113 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:55:16 [raw result] [visualize] |
#178 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:50:30 [raw result] [visualize] |
#1000051 | Parts: 34, 14, 124, 89|29, 100, 129, 114|47, 120, 111, 128 | 2016-08-01 01:50:23 Lua instructions: 614k (181 ms) [raw result] [visualize] |
#1000107 | Parts: 9, 0, 73, 3|3, 8, 73, 40|0, 41, 73, 63 | 2016-08-01 01:50:16 Lua instructions: 65k (76 ms) [raw result] [visualize] |
#1000153 | Parts: 0, 0, 762, 1|24, 2, 695, 15|0, 16, 762, 17|0, 18, 762, 19|0, 20, 762, 21|0, 22, 762, 23|0, 24... | 2016-08-01 01:50:14 Lua instructions: 2954k (305 ms) [raw result] [visualize] |
#182 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:50:13 [raw result] [visualize] |
#1000079 | Parts: 15, 19, 642, 63|18, 80, 314, 116 | 2016-08-01 01:50:11 Lua instructions: 2331k (343 ms) [raw result] [visualize] |
#1000149 | Parts: 0, 0, 24, 17|0, 19, 803, 106 | 2016-08-01 01:50:09 Lua instructions: 315k (130 ms) [raw result] [visualize] |
#1000155 | Parts: 24, 0, 688, 15|0, 16, 762, 17|0, 18, 762, 19|0, 20, 762, 21|0, 22, 762, 23|0, 24, 762, 25|0, ... | 2016-08-01 01:50:05 Lua instructions: 3328k (430 ms) [raw result] [visualize] |
#1000019 | Parts: 9, 10, 498, 33|47, 52, 51, 54|47, 55, 64, 66|47, 70, 465, 84|47, 88, 247, 102 | 2016-08-01 01:49:45 Lua instructions: 1407k (160 ms) [raw result] [visualize] |
#1000151 | Parts: 0, 0, 762, 1|24, 2, 695, 15|0, 16, 762, 17|0, 18, 762, 19|0, 20, 762, 21|0, 22, 762, 23|0, 24... | 2016-08-01 01:49:41 Lua instructions: 3818k (498 ms) [raw result] [visualize] |
#1000170 | Parts: 8, 9, 962, 107|12, 108, 945, 127|136, 150, 826, 194|172, 199, 791, 243|0, 266, 944, 599|0, 60... | 2016-08-01 01:36:25 Lua instructions: 8474k (1031 ms) [raw result] [visualize] |
#1000100 | Parts: 13, 11, 260, 21|13, 28, 92, 38|17, 46, 207, 88|13, 104, 180, 118 | 2016-08-01 01:36:12 Lua instructions: 998k (157 ms) [raw result] [visualize] |
#115 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:36:11 [raw result] [visualize] |
#1000130 | Parts: 0, 0, 1366, 1|0, 4, 1366, 26|6, 30, 601, 43|0, 45, 1366, 46|10, 49, 1361, 72|0, 73, 1366, 768 | 2016-08-01 01:36:11 Lua instructions: 2079k (237 ms) [raw result] [visualize] |
#92 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:36:11 [raw result] [visualize] |
#1000124 | Parts: 0, 0, 283, 56|0, 60, 283, 92|0, 96, 283, 97|8, 107, 283, 124|8, 148, 283, 173|8, 197, 74, 215... | 2016-08-01 01:36:10 Lua instructions: 2821k (409 ms) [raw result] [visualize] |
#1000104 | Parts: 0, 0, 182, 9|0, 13, 285, 23|193, 35, 293, 58|0, 61, 294, 83 | 2016-08-01 01:36:09 Lua instructions: 597k (171 ms) [raw result] [visualize] |
#1000013 | Parts: 0, 0, 1920, 1|0, 4, 1920, 23|6, 28, 670, 41|0, 43, 1920, 44|10, 47, 1915, 70|0, 71, 1920, 120... | 2016-08-01 01:36:08 Lua instructions: 3177k (485 ms) [raw result] [visualize] |
#100 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:36:08 [raw result] [visualize] |
#48 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:36:08 [raw result] [visualize] |
#1000017 | Parts: 0, 0, 1920, 1|0, 3, 1920, 23|7, 30, 368, 45|0, 49, 1920, 74|0, 81, 1920, 105|0, 113, 1920, 12... | 2016-08-01 01:36:07 Lua instructions: 3166k (380 ms) [raw result] [visualize] |
#1000169 | Parts: 0, 0, 1366, 1|0, 4, 1366, 26|6, 30, 601, 43 | 2016-08-01 01:36:07 Lua instructions: 806k (188 ms) [raw result] [visualize] |
#141 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:36:07 [raw result] [visualize] |
#1000095 | Parts: 0, 0, 402, 1|0, 3, 402, 26|0, 27, 402, 372 | 2016-08-01 01:36:07 Lua instructions: 128k (19 ms) [raw result] [visualize] |
#1000025 | Parts: 0, 2, 1906, 26|0, 34, 1906, 1097 | 2016-08-01 01:36:05 Lua instructions: 36844k (4462 ms) [raw result] [visualize] |
#84 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:36:05 [raw result] [visualize] |
#1000035 | Parts: 0, 0, 1920, 1|0, 3, 1920, 23|834, 587, 1086, 612|0, 790, 190, 806|0, 813, 190, 900|0, 904, 19... | 2016-08-01 01:36:00 Lua instructions: 80620k (9193 ms) [raw result] [visualize] |
#1000166 | Parts: 0, 0, 307, 27|22, 31, 307, 41|3, 46, 279, 78|0, 79, 307, 83 | 2016-08-01 01:36:00 Lua instructions: 327k (123 ms) [raw result] [visualize] |
#1000161 | Parts: 0, 0, 81, 1|0, 7, 81, 24|0, 28, 81, 56|0, 60, 81, 92|0, 97, 81, 746|0, 748, 81, 767 | 2016-08-01 01:35:48 Lua instructions: 1683k (301 ms) [raw result] [visualize] |
#1000160 | Parts: 0, 0, 81, 1|0, 7, 81, 56|0, 60, 81, 92|0, 97, 81, 746|0, 748, 81, 767 | 2016-08-01 01:35:48 Lua instructions: 1437k (167 ms) [raw result] [visualize] |
#1000152 | Parts: 0, 0, 26, 19|0, 21, 811, 170 | 2016-08-01 01:35:48 Lua instructions: 375k (154 ms) [raw result] [visualize] |
#1000012 | Parts: 0, 0, 1366, 1|0, 4, 1366, 23|6, 28, 670, 41|0, 43, 1366, 44|10, 47, 1361, 70|0, 71, 1366, 768 | 2016-08-01 01:35:47 Lua instructions: 2125k (345 ms) [raw result] [visualize] |
#93 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:35:47 [raw result] [visualize] |
#1000158 | Parts: 0, 0, 53, 1|0, 4, 53, 26|7, 30, 53, 40|6, 41, 47, 42|0, 45, 53, 46|10, 54, 53, 60 | 2016-08-01 01:35:47 Lua instructions: 68k (12 ms) [raw result] [visualize] |
#1000167 | Parts: 0, 0, 307, 27|22, 31, 307, 41|3, 46, 279, 78|0, 79, 307, 83 | 2016-08-01 01:35:47 Lua instructions: 327k (43 ms) [raw result] [visualize] |
#1000150 | Parts: 0, 0, 26, 19|0, 21, 811, 170 | 2016-08-01 01:35:47 Lua instructions: 375k (85 ms) [raw result] [visualize] |
#1000148 | Parts: 0, 0, 243, 1|22, 2, 151, 15|0, 16, 243, 17|0, 18, 243, 19|0, 20, 243, 21|0, 22, 243, 23|0, 24... | 2016-08-01 01:35:47 Lua instructions: 3484k (350 ms) [raw result] [visualize] |
#1000154 | Parts: 0, 0, 38, 16|0, 18, 817, 173 | 2016-08-01 01:35:47 Lua instructions: 367k (145 ms) [raw result] [visualize] |
#85 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:35:47 [raw result] [visualize] |
#1000162 | Parts: 0, 0, 1366, 1|0, 3, 1366, 56|0, 60, 1366, 92|0, 97, 1366, 768 | 2016-08-01 01:35:46 Lua instructions: 12008k (1443 ms) [raw result] [visualize] |
#1000044 | Parts: 0, 0, 1366, 1|0, 4, 1366, 56|0, 60, 1366, 92|0, 97, 1366, 768 | 2016-08-01 01:35:45 Lua instructions: 14566k (1659 ms) [raw result] [visualize] |
#1000131 | Parts: 0, 0, 1366, 1|0, 4, 1366, 26|6, 30, 601, 43|0, 45, 1366, 46|10, 49, 1361, 72|0, 73, 1366, 768 | 2016-08-01 01:35:43 Lua instructions: 2083k (350 ms) [raw result] [visualize] |
#1000156 | Parts: 0, 9, 85, 10|0, 14, 85, 46|0, 51, 85, 700|0, 702, 85, 720 | 2016-08-01 01:35:43 Lua instructions: 212k (119 ms) [raw result] [visualize] |
#87 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-08-01 01:35:43 [raw result] [visualize] |
#1000222 | LuaError: #472:3 vm error: java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientCon... | 2016-07-31 18:52:19 [raw result] [visualize] |
#1000219 | java.lang.OutOfMemoryError: Java heap space | 2016-07-31 18:51:35 [raw result] [visualize] |
#1003745 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-07-31 18:51:22 [raw result] [visualize] |
#489 | java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: No operat... | 2016-07-31 18:51:22 [raw result] [visualize] |
#1000141 | LuaError: #472:3 vm error: java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientCon... | 2016-07-31 18:45:28 [raw result] [visualize] |
#1003958 | LuaError: #472:3 vm error: java.io.IOException: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientCon... | 2016-07-31 18:34:25 [raw result] [visualize] |
#1000310 | javax.imageio.IIOException: Can't get input stream from URL! | 2015-07-15 12:00:05 [raw result] [visualize] |
#1000294 | Parts: 0, 0, 176, 5|0, 13, 176, 14|2, 24, 176, 41 | 2015-07-01 21:31:01 Lua instructions: 298k (125 ms) [raw result] [visualize] |
#1000241 | java.lang.IllegalArgumentException: image == null! | 2015-05-17 21:26:56 [raw result] [visualize] |
Snippet ID: | #472 |
Snippet name: | Vertical split with crop |
Eternal ID of this version: | #472/1 |
Text MD5: | af62f59d3cb99b968972ffd133a03c0a |
Author: | stefan |
Category: | |
Type: | Lua code - Image recognition |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-02-18 20:55:23 |
Source code size: | 1084 bytes / 53 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 1830 / 160 |
Referenced in: | [show references] |