Problem with artoolkit

Hi,
I am creating a program with panda and artoolkit for windows, i have this code:

 
class AR:
    def __init__( self ):
        option = WebcamVideo.getOption(5)
        self.cursor = option.open()
        self.videoTexture = Texture('movie')
        self.cursor.setupTexture( self.videoTexture )
        videoTextureScale = Vec2(option.getSizeX()/float(self.videoTexture.getXSize()), option.getSizeY()/float(self.videoTexture.getYSize()))

        cm = CardMaker("background-card")
        cm.setFrame(1, -1, 1, -1)
        cm.setUvRange(Point2(1,0), Point2(0,videoTextureScale[1]))

        card = render2d.attachNewNode(cm.generate())
        card.setTexture(self.videoTexture)
        base.cam.node().getDisplayRegion(0).setSort(20)
        self.ar = ARToolKit.make( base.cam, "./camera_para.dat", 1 )

This works fine, but i have some problems, if i use:
setUvRange(Point2(1,0), Point2(0,videoTextureScale[1]))
i have a image with a black stripe on right:

but if i use:
setUvRange.(Point2(videoTextureScale[0],0), Point2(0,videoTextureScale[1]))
the graphics are with wrong cordinate:

so, how can i have the right image sizes ans right cordinates?

Thanks

André

You’ve likely seen this already, but the problem with the black line is explained here: panda3d.org/manual/index.php/C … xture_Size

so you might try adding the lines:

from pandac.PandaModules import loadPrcFileData
loadPrcFileData("", "textures-power-2 none")

to the top of your code and then running it with setUvRange(Point2(1,0), Point2(0,videoTextureScale[1])) .

I have the black stripe too. It’s just because my webcam doesn’t deliver an image as wide as my panda window.

I usually just resize my panda window to match the webcam size.

Hi guys,

Thanks for the answers but i still have the black stripe.

pro-rsoft: I know i will have a stripe if i have widescreen image with a 4:3 camera , but this image is 800x600.

mcstrother: I tried “textures-power-2 none” and all options available on tha page that you said, but i still have the black stripe or the wrong coordinates.

So i was thinking, i need to apply a correction factor, in X coordinates, but how can i remove the automatic model and draw myself a model?

Thanks

André