Inverted LKOptical Tracking in the Tracking service (Bleeding Edge 1688)

But wait there's more ! Chuck has inverted cameras and found it problematic to Flip correctly, since the Tracking service removes and inserts its own filters depending on the type of tracking its doing (LKOptical point, Face Tracking, Object tracking).

So the Tracking service is easy to use since it bundles all the necessary filter setup, routing, and data extraction into simple single methods like (startLKTracking() , faceDetect(), searchForeground()) - but that prevents adding additional filters like Flip :(

But now !  Now you can add additional filters to the Tracking service and they will be added auto-magically to all the different types of tracking !

example Python code

tracking = Runtime.createAndStart("tracking","Tracking")
flip = OpenCVFilterFlip();
flip.flipCode = 0  #flip vertically 
tracking.addFilter(flip)

# now all tracking will be inverted

 

Well, everyone is walking on the ceiling or I've got the Flip filter working.
Build 1685.

How to add in Python.

opencv=Runtime.createAndStart("opencv","OpenCV")
flip = OpenCVFilterFlip() 
flip.flipCode = 0 # around the x axis
opencv.addFilter(flip)

flipCode – Specifies how to flip the array: 0 means flipping around the x-axis, positive (e.g., 1) means flipping around y-axis, and negative (e.g., -1) means flipping around both axes.

for example -2 flips it around the x axis (upside down), but also flips it so you can read text correctly (upside down) :)

chuckfletcher

11 years 2 months ago

I'll test this tonight - when I get home from work

GroG

11 years 2 months ago

In reply to by chuckfletcher

That would be great Chuck !

I don't know if you already have a custom Python script - but given
#file : InMoov.head.py

since its one of the simplest which does tracking on the InMoov service page

you want to add something like this.


# a head script for InMoov
inMoov = Runtime.createAndStart("inMoov", "InMoov")
 
# variables to adjust
leftSerialPort = "COM7"
cameraIndex = 1

# add the following here
flip = OpenCVFilterFlip();
flip.flipCode = 0  #flip vertically 

inMoov.tracking.addFilter(flip)

...

 

dwilli9013

10 years 8 months ago

 

Rob was super shocked to hear his vision could be corrected so easily. He salutes you and the Nation.