Help about Augmented reality library in Panda

I hope you help me guys because I feel lost

I decided to learn panda3d because of augmented reality

but the problem there is no any tutorial

so I tried with myself to get started

but I found many problems stops in my way


1- How to use multi markers in the same scene

2- How to get animation to the augmented reality

I only know how to get model nothing more

3- is that able to mix between augmented reality and panda to make a traditationl card game

I hope you help me

one more thing here is the code I use for now

from pandac.PandaModules import *
from direct.directbase.DirectStart import *
from import Actor
loadPrcFileData("", "auto-flip 1")
def update(task):
    if cursor.ready():
        cursor.fetchIntoTexture(0, videoTexture, 0)
    return task.cont

option = WebcamVideo.getOption(0)
cursor =
videoTexture = Texture('movie')
videoTextureScale = Vec2(option.getSizeX()/float(videoTexture.getXSize()), option.getSizeY()/float(videoTexture.getYSize()))   

cardMaker = CardMaker('cardMaker')
cardMaker.setUvRange(Point2(videoTextureScale[0],0), Point2(0,videoTextureScale[1]))
card = render.attachNewNode(cardMaker.generate())
card.setBin("fixed", -1)

model = loader.loadModel("panda")
model.setBin("fixed", 1)
model.setScale(0.112,0.112, 0.112)
model.setPos(+8, -42, 0)

model2 = loader.loadModel("teapot")
model2.setBin("fixed", 1)
model2.setScale(0.112, 0.112, 0.112)
model2.setPos(-8, 42, 0)

toolkit = ARToolKit.make(, Filename("camera_para.dat"), .5)
toolkit.attachPattern(Filename("patt.hiro"), model)
toolkit.attachPattern(Filename("patt.kanji"), model2)

taskMgr.add(update, "update")

Thank you in advance guys

I’m not sure what you mean by your first question. Doesn’t the code already use multiple markers?

first of all yup the code is well about something

when I put the first card in front of the other

one disappear and the other appear

please help me fix it thank you

If one card obscures the other, the one that’s partially obscured won’t be recognised of course, because it’s not completely visible to the camera. Is that what you meant? If so, then there’s nothing you can do about. ARToolKit can’t know where the card is if the pattern isn’t completely visible.

Bro both of cards are completely visible I dont know whats wrong

maybe me code is not right can you give me code of yours to be able to use more than one pattern To test

I’ll be very gratful

but here is a thing when I put two of the cards in the opposite of each other
one of them keeps appearing and disappearing
maybe this has something to do with my camera position
please take a look at my code I know how excellent you’re with augmented reality
thank you in advance

Oh, you mean when the cards are almost perpendicular to the screen? That’s normal, and it’s hard to do anything about that. The best thing you can do is to smooth out movement, and when the card is no longer recognised, let it keep the previous frame’s position for a few frames (or, even better: estimate the card’s current position and orientation based on previous movement).

It doesnt work or maybe I dont get it right

I dont know why there is samples of augmented reality availabe for windows to test it and see is that coding problem or what
because I watch on youtube everything is ok specially with
coder game called ninja 2 patterns are working perfectly but the problem with me I hope anyone to create augmented reality sample for windows to teach me or create tutorial for us beginners
thank you I’m very disappointed

in other words: you are disappointed that no one solved your problem, that no one was able to see so far.

the code is the same across plattforms. the code doesnt look terribly wrong. altho the way you open the camera is a bit odd.

can you provide any screenshots that show where it works, and when the code fails?


thank you for your help

I always watch in youtube augemented reality very fast

but with me

I put the card more than 5 times to show up

here is one pic

might very well be a problem with your input image. tried to change your light setup? the contrast of the card aint very good. in big parts it is more gray than black. maybe paint it over with a black marker?
artoolkit is not very robust and requires pretty good input images. you may be able to get a bit better results by adjusting the threshold for the detection.

you meant this has nothing to do with code thank you
another queries :

this is my first time learing panda

Should I learn panda normally or learn python first

secondly how to put panda default animate in my code
(augmented reality)

I can’t answer the second question - I know nothing about AR - but I can answer the first: Learn Python first. If you don’t, most (if not all) the code you write will be modified versions of Panda example code and code you found around the web, both of which aren’t the best examples of Python coding practice. So I recommend learning Python first, ahead of Panda; you’ll understand what each line of code in your program does better, and your code will be more readable as a result.