I want to know if my tracking target is in the image, so I used
sim.checkVisionSensor in my code. But, its output keeps 0 even when the
tracking target is in the picture
my code in the child script of kinect is as follows:
function sysCall_init()
depthCam=sim.getObject('./depth')
depthView=sim.floatingViewAdd(0.9,0.9,0.2,0.2,0)
sim.adjustView(depthView,depthCam,64)
colorCam=sim.getObject('./rgb')
colorView=sim.floatingViewAdd(0.69,0.9,0.2,0.2,0)
sim.adjustView(colorView,colorCam,64)
c=sim.createCollection(1)
local o1=sim.getObject('/PioneerP3DX')
sim.addItemToCollection(c,sim.handle_single,o1,0)
end
function sysCall_cleanup()
end
function sysCall_sensing()
result,p1,p2=sim.checkVisionSensor(colorCam,c)
print(result)
end
function sysCall_vision(inData)
simVision.sensorImgToWorkImg(inData.handle)
simVision.workImgToSensorImg(inData.handle)
end
How to correctly use sim.checkVisionSensor?
Re: How to correctly use sim.checkVisionSensor?
Hello,
you can't simply call sim.checkVisionSensor and expect that your object(s) will be magically detected. You need to write an image processing function that can detect your object(s).
Have a look at the demo scene scenes/vision/objectTracking.ttt and the script attached to Vision_sensor to get an idea how this can be done
Cheers
you can't simply call sim.checkVisionSensor and expect that your object(s) will be magically detected. You need to write an image processing function that can detect your object(s).
Have a look at the demo scene scenes/vision/objectTracking.ttt and the script attached to Vision_sensor to get an idea how this can be done
Cheers