Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

17
LINES

< > BotCompany Repo | #325 - Standard crop include

Lua code

crop = otherresults["#324"]
if crop == nil then error("need output of #324, please recalc") end

local _, _, x1, y1, x2, y2 = string.find(crop, "(%d+),%s*(%d+),%s*(%d+),%s*(%d+)")
if x1 == nil then error("output of #324 malformed") end
print("x1", x1, "y1", y1, "x2", x2, "y2", y2)

-- crop the image

local orig = img
img = {
  width = x2-x1,
  height = y2-y1,
  getInt = function(x, y)
    return orig.getInt(x+x1, y+y1)
  end
}

test run  test run with input  download  show line numbers   

Travelled to 8 computer(s): aoiabmzegqzx, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, tslmcundralx, tvejysmllsmz

Comments [hide]

ID Author/Program Comment Date
393 #1000610 Edit suggestion:
!636
!629

main {
static Object androidContext;
static String programID;

public static void main(String[] args) throws Exception {
crop = otherresults["#324"]
if crop == nil then error("need output of #324, please recalc") end

local _, _, x1, y1, x2, y2 = string.find(crop, "(%d+),%s*(%d+),%s*(%d+),%s*(%d+)")
if x1 == nil then error("output of #324 malformed") end
print("x1", x1, "y1", y1, "x2", x2, "y2", y2)

-- crop the image

local orig = img
img = {
width = x2-x1,
height = y2-y1,
getInt = function(x, y)
return orig.getInt(x+x1, y+y1)
end
}
}}
2015-08-18 10:17:43  delete 
391 #1000604 (pitcher) 2015-08-18 00:07:22

add comment

Image recognition results

Recognizer Recognition Result Visualize Recalc
#308 javax.imageio.IIOException: Can't get input stream from URL! [visualize]

Snippet ID: #325
Snippet name: Standard crop include
Eternal ID of this version: #325/1
Text MD5: 40cef2243264037ad2956092fa6077c6
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-01-23 01:23:00
Source code size: 446 bytes / 17 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 715 / 86
Referenced in: [show references]

Formerly at http://tinybrain.de/325 & http://325.tinybrain.de