I’m having issues capturing from a DataPath Vision E2s capture card.
I’m running Windows 7 x64, with Panda 1.7.2. Previewing the videos in the preview software that comes with the card looks fine. Creating a test graph and routing the capture into a renderer in GraphEdit also works fine.
Here’s the code that I’m using:
import sys
from pandac.PandaModules import *
from direct.directbase import DirectStart
# manually select the video mode
option = WebcamVideo.getOption(0)
cursor = option.open()
videoTexture = Texture('movie')
cursor.setupTexture(videoTexture)
# calculate the same as openCVTexture has as function
videoTextureScale = Vec2(option.getSizeX()/float(videoTexture.getXSize()), option.getSizeY()/float(videoTexture.getYSize()))
# under windows the webcam must be updated manually
def updateVideo(task):
if cursor.ready():
cursor.fetchIntoTexture(0, videoTexture, 0)
return task.cont
taskMgr.add(updateVideo, 'updateVideo')
# generate a card to show the texture on
cardMaker = CardMaker('cardMaker')
# define the card size
#cardMaker.setFrame(-videoTextureScale[1]/2.,videoTextureScale[1]/2.,-videoTextureScale[0]/2.,videoTextureScale[0]/2.)
cardMaker.setFrame(-videoTextureScale[1],videoTextureScale[1],-videoTextureScale[0],videoTextureScale[0])
# set the uv coordinates of the card, y-scale must be reversed
cardMaker.setUvRange(Point2(videoTextureScale[0],0), Point2(0,videoTextureScale[1]))
# create a card and attach to render
card = render.attachNewNode(cardMaker.generate())
card.setTexture(videoTexture)
card.setTwoSided(True)
# rotate it
#card.hprInterval(10,Point3(360,0,0)).loop()
base.disableMouse()
base.camera.setPos(0,-3,0)
run()
And here is the result I’m getting:
I’ve had other issues with other capture cards that I never was really able to solve, but I’ve never even seen the “Could not select desired video resolution” error before.
Hmm, that error message is generated within code in Panda, and it indicates that IAMStreamConfig::SetFormat() returned something other than S_OK.
To research it further, you’ll probably need to be comfortable with C++, and add a few additional output statements around the relevant calls, in webcamVideoDS.cxx. Are you able to do this?
I tried excluding OpenCV, but I think I need it for what I’m testing (do I?), and although it did compile, it resulted in an error when running the test script:
Seems like it might be referencing some stuff incorrectly though, as the path to my test build is actually
E:\Panda3D-1.7.2\AWBUILDS\caminfo2\bin
so I’m not sure why it’s looking in the original Panda3D build… my panda.pth file specifies the aforementioned path.
I’m obviously doing something wrong, but am not sure where to go next.
Any thoughts?
Well, first, I’d suggest uninstalling any previous versions of Panda to guarantee that you don’t get it conflated with the version you’re trying to run. (If you’re careful setting up your environment, you can keep multiple Pandas installed in parallel, but you do have to be careful, and it appears that you’re getting some bleed-through so something’s not quite right in your environment.)
And the next thing is, you’ll have to fix that compilation error before you can run your dev build. Which compiler are you using? One easy (and hacky) thing to do is to put “typedef long ssize_t;” in the beginning of openCVTexture.h.