I have this piece of code and expected that my "input" function would get called

I do not know whether this is thought to trigger with every frame captured?

Anyway, in my case "input" does not get called. What is wrong with my code (tried it with 2241 and 2275)?

def input(data):
  print "in input"
opencv = Runtime.create("opencv","OpenCV")
topcodes = Runtime.createAndStart("topcodes","TopCodes")
opencv.startService()
opencv.addFilter("PyramidDown1", "PyramidDown")
opencv.addFilter("Transpose", "Transpose")

opencv.addListener("publishOpenCVData", python.name, "input");
opencv.setCameraIndex(0)
opencv.capture()

my errror, my program looks indeed like this:

def input(data) :
 simage = opencv.getDisplay()
 codes = topcodes.scan(simage.getImage())
 limit = codes.size()
 print "topcodes, ", limit
 for x in range(limit) :
    code = codes.get(x)
    print 'code number' , x ,'=', code.getCode()
now in my case - also the code is visible in the image - I get 0 codes found. That made me think the "input"  never got called.

 

juerg

6 years 8 months ago

done some more testing (mrl 2278).

Interesting that I need to move into the picture or change the cam position for the topcode to be detected. It also won't give me the code at startup with a static image.

At least I was not able to see this defined in the topcode service code.

after a while (and several positive recognitions) the script ran into a null pointer exception. Where and how would my script have to test for this (sent a noworky, juerg, 07/11/2017)?