-- load image to recognize loadSnippet("#100")() minWidth=10 minHeight=5 bgcolor=0 function isSet(pixel) return pixel ~= nil and pixel ~= bgcolor end function on(x, y) return x >= 0 and y >= 0 and x < width and y < height and isSet(pixels[y*width+x]) end function check(x, y, pivot) if pivot == 2 then return true end local is = on(x, y) == true local should = pivot == 1 --print("check", x, y, is, should) return is == should end function detectNode(x, y, a, b, c, d, e, f, g, h, i) --print("xy", x, y, "abcdef", a, b, c, d, e, f) return check(x-1, y-1, a) and check(x, y-1, b) and check(x+1, y-1, c) and check(x-1, y, d) and check(x, y, e) and check(x+1, y, f) and check(x-1, y+1, g) and check(x, y+1, h) and check(x+1, y+1, i) end function detect(x1, y1) if not detectNode(x1, y1, 0, 0, 0, 0, 1, 1, 0, 1, 0) then return end --print("Corner found! ", x1, y1) local x=x1+1 while on(x, y1) and not on(x, y1-1) and not on(x, y1+1) and x < width do x=x+1 end if x