Assertion Error on OpenCVTexture()

opencv textures are quite a bit of a pain.

in most cases you are better off using webcamvideo

from my own code-snips base.

from panda3d.core import loadPrcFileData 
loadPrcFileData("", "textures-power-2 none")
from pandac.PandaModules import *
from panda3d.vision import WebcamVideo
from panda3d.core import MovieTexture
#loadPrcFileData("", "auto-flip 1") #usualy the drawn texture lags a bit behind the calculted positions. this is a try to reduce the lag.
from direct.task import Task
from time import sleep
import sys
for x,option in enumerate(WebcamVideo.getOptions()):
  print >>sys.stderr, option ,x

print "choose webcam and resolution by index"
option = WebcamVideo.getOption(int(raw_input()))
from direct.showbase.ShowBase import ShowBase
ShowBase()
print "req:", option
tex = MovieTexture(option)
tex.setKeepRamImage(True)
cm = CardMaker("card")
cm.setUvRange(Point2(0, 0), Point2(1, 1))
cm.setFrame(-1, 1, -1, 1)
card = render2d.attachNewNode(cm.generate())
card.setTexture(tex)


#set the rendering order manually to render the card-with the webcam-image behind the scene.
base.cam.node().getDisplayRegion(0).setSort(20)

#load a model to visualize the tracking
axis = loader.loadModel("yup-axis")
axis.reparentTo(render)
axis.setScale(.2)

#initialize artoolkit, base.cam is our camera ,
#the camera_para.dat is the configuration file for your camera. this one comes with the artoolkit installation.
#last paremeter is the size of the pattern in panda-units.
ar = ARToolKit.make(base.cam, "./camera_para.dat", 1)

#attach the model to a pattern so it updates the model's position relative to the camera each time we call analyze()
ar.attachPattern("./patt.hiro", axis)

#updating the models positions each frame.
def updatePatterns(task):
  ar.analyze(tex)
  return Task.cont
  
  
taskMgr.doMethodLater(1,updatePatterns, "update-patterns", priority = 100)

run()