Gaming Problem with Kinect taking screenshot

Delta517

Its okay...Im a ninja ;)
OP
Member
Joined
Nov 25, 2008
Messages
1,329
Trophies
0
Age
29
Website
Visit site
XP
1,180
Country
Norway
So what I'm trying to do is this, but I cant even get the Kinect to take a screenshot!
mad.gif

I have installed the drivers for Kinect, Python 2.6 and PIL for it. When I try to start the getSnapshot scrip this is what I get back:

CODETraceback (most recent call last):
ÂÂFile "C:\Users\Atle\Desktop\Minecraft Kinect Hack\getSnapshot.py", line 40, in
ÂÂÂÂkinect = ctypes.cdll.CLNUIDevice
ÂÂFile "C:\Python26\lib\ctypes\__init__.py", line 423, in __getattr__
ÂÂÂÂdll = self._dlltype(name)
ÂÂFile "C:\Python26\lib\ctypes\__init__.py", line 353, in __init__
ÂÂÂÂself._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found

Anybody have a clue?
unsure.gif


Here's the getSnapshot script btw:

CODE# Requires at least Python 2.5, PIL
#ÂÂÂÂa Kinect, and CL NUI drivers from http://codelaboratories.com/get/nui
# By Nathan Viniconis

# You can use this code freely without any obligation to the original or myself

import ctypes
import time
import Image
import math
import sys
import os

#######################
# Editable globals
#######################

# base file names to be used to store the depth and color info.
colorImageName = "OutputColor" # .png
depthImageName = "OutputDepth" # .tiff

# number of images to take
numImages = 20

# seconds to wait between the images
imageWait = 2ÂÂÂÂ# less than 2 causes wierd results

###########################
## Global inits
###########################

curImageIndex = 0
maxDigits = 5 # 00000 to 99999 should be plenty

# Kinect frame buffers
clrBuffer = ctypes.create_string_buffer(640*480*3)
dpthBuffer = ctypes.create_string_buffer(640*480*2)

# Init the Kinect
kinect = ctypes.cdll.CLNUIDevice
serial = kinect.GetNUIDeviceSerial(0)
camera = kinect.CreateNUICamera(serial)
if (str(camera) == "0"):
ÂÂÂÂprint "could not connect to kinect"
ÂÂÂÂsys.exit(0)

ÂÂÂÂ

# starts the cameras so that frames can be extracted
def startKinect():
ÂÂÂÂkinect.StartNUICamera(camera)

# stops the camera, call before closing or it can freeze
def endKinect():
ÂÂÂÂkinect.StopNUICamera(camera)
ÂÂÂÂkinect.DestroyNUICamera(camera)

# Create the filenames to use
def getFilenamesFromIndex():
ÂÂÂÂglobal curImageIndex
ÂÂÂÂprefix = ""
ÂÂÂÂif (len(str(curImageIndex)) < maxDigits):
ÂÂÂÂÂÂÂÂnumZeros = maxDigits - len(str(curImageIndex))
ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂwhile (numZeros > 0):
ÂÂÂÂÂÂÂÂÂÂÂÂprefix = "0" + prefix
ÂÂÂÂÂÂÂÂÂÂÂÂnumZeros -= 1
ÂÂÂÂÂÂÂÂÂÂÂÂ
ÂÂÂÂclrImage = prefix + str(curImageIndex) + colorImageName + ".png"
ÂÂÂÂdpthImage = prefix + str(curImageIndex) + depthImageName + ".tiff"
ÂÂÂÂ
ÂÂÂÂreturn clrImage, dpthImage

# find the index to use so each image independently so that they are not overwritten
def getFilenamesToUse():
ÂÂÂÂglobal curImageIndex
ÂÂÂÂclrFileUsed = True
ÂÂÂÂdepthFileUsed = True
ÂÂÂÂwhile clrFileUsed or depthFileUsed:
ÂÂÂÂÂÂÂÂ# see if either the depth or color index has already been used
ÂÂÂÂÂÂÂÂfileNames = getFilenamesFromIndex()
ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂ# check the two files
ÂÂÂÂÂÂÂÂclrFileUsed = os.path.exists(fileNames[0])
ÂÂÂÂÂÂÂÂdepthFileUsed = os.path.exists(fileNames[1])
ÂÂÂÂÂÂÂÂ
ÂÂÂÂÂÂÂÂ# if either exist, try the next index
ÂÂÂÂÂÂÂÂif (clrFileUsed or depthFileUsed):
ÂÂÂÂÂÂÂÂÂÂÂÂcurImageIndex += 1

ÂÂÂÂreturn getFilenamesFromIndex()

# actually take the snapshots
def takeSnapshot(fileNames):

ÂÂÂÂ# Get the Kinect data
ÂÂÂÂkinect.GetNUICameraColorFrameRGB24(camera, clrBuffer)
ÂÂÂÂkinect.GetNUICameraDepthFrameRAW(camera, dpthBuffer)

ÂÂÂÂ# Output with PIL
ÂÂÂÂclrImage = Image.fromstring('RGB', [640, 480], clrBuffer, 'raw', 'BGR', 0, 1)
ÂÂÂÂclrImage.save(fileNames[0])

ÂÂÂÂdpthImage = Image.fromstring('I;16', [640, 480], dpthBuffer)
ÂÂÂÂdpthImage.save(fileNames[1])

def main():

ÂÂÂÂ# turn on the kinect
ÂÂÂÂstartKinect()

ÂÂÂÂ# take the images
ÂÂÂÂimagesTaken = 0
ÂÂÂÂwhile (imagesTaken < numImages):
ÂÂÂÂÂÂÂÂtime.sleep(imageWait)
ÂÂÂÂÂÂÂÂfileNames = getFilenamesToUse()
ÂÂÂÂÂÂÂÂtakeSnapshot(fileNames)
ÂÂÂÂÂÂÂÂprint "Saving: " + fileNames[0] + " and " + fileNames[1]
ÂÂÂÂÂÂÂÂimagesTaken += 1
ÂÂÂÂ
ÂÂÂÂ# turn off the kinect
ÂÂÂÂendKinect()

if __name__ == "__main__":
ÂÂÂÂmain()
 

Delta517

Its okay...Im a ninja ;)
OP
Member
Joined
Nov 25, 2008
Messages
1,329
Trophies
0
Age
29
Website
Visit site
XP
1,180
Country
Norway
I found the file in "C:\Program Files (x86)\Code Laboratories\CL NUI Platform\SDK\Bin", but when I try to run the script now, I get this:

QUOTE said:
Traceback (most recent call last):
File "C:\Users\Atle\Desktop\Minecraft Kinect Hack\getSnapshot.py", line 40, in
kinect = ctypes.cdll.CLNUIDevice
File "C:\Python26\lib\ctypes\__init__.py", line 423, in __getattr__
dll = self._dlltype(name)
File "C:\Python26\lib\ctypes\__init__.py", line 353, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 193] %1 is not a valid Win32 application

???
 

Delta517

Its okay...Im a ninja ;)
OP
Member
Joined
Nov 25, 2008
Messages
1,329
Trophies
0
Age
29
Website
Visit site
XP
1,180
Country
Norway
So I tried again, but now I'm getting this crap
mad.gif

QUOTE said:
Traceback (most recent call last):
File "C:\Users\Atle\Desktop\Minecraft Kinect Hack\getSnapshot.py", line 191, in
main()
File "C:\Users\Atle\Desktop\Minecraft Kinect Hack\getSnapshot.py", line 153, in main
initKinect()
File "C:\Users\Atle\Desktop\Minecraft Kinect Hack\getSnapshot.py", line 53, in initKinect
serial = kinect.GetNUIDeviceSerial(0)
File "C:\Python26\lib\ctypes\__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "C:\Python26\lib\ctypes\__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'GetNUIDeviceSerial' not found

Please help me? Is there no one here that has ever tried to take a picture with it before?
unsure.gif
 

Revrick

New Member
Newbie
Joined
Jan 12, 2011
Messages
2
Trophies
0
XP
1
Country
United States
From the error message it looks like it is finding the .dll, but isn't able to find a function that is in their specs detailed at http://codelaboratories.com/forums/viewthread/442/

Is there any chance you installed an older version of their library? I don't believe that function existed in their November release.

For whatever reason the hacked kinect .dlls aren't working properly on your machine. To optimize your chances, completely remove what you have currently.. Download and install the 1210 verion of the NUI drivers.. move the CLNUIDevice.dll into the current script directory and/or the system32 directory, and give it another go.

Hopefully you can actually get past the driver install issues and actually get to the script. I have it working on multiple win7 machines and havn't had any of these issues, i wonder what else could be causing them.

-Nate

Delta517 said:
So I tried again, but now I'm getting this crap
mad.gif

QUOTE said:
Traceback (most recent call last):
File "C:\Users\Atle\Desktop\Minecraft Kinect Hack\getSnapshot.py", line 191, in
main()
File "C:\Users\Atle\Desktop\Minecraft Kinect Hack\getSnapshot.py", line 153, in main
initKinect()
File "C:\Users\Atle\Desktop\Minecraft Kinect Hack\getSnapshot.py", line 53, in initKinect
serial = kinect.GetNUIDeviceSerial(0)
File "C:\Python26\lib\ctypes\__init__.py", line 366, in __getattr__
func = self.__getitem__(name)
File "C:\Python26\lib\ctypes\__init__.py", line 371, in __getitem__
func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'GetNUIDeviceSerial' not found

Please help me? Is there no one here that has ever tried to take a picture with it before?
unsure.gif
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • BigOnYa @ BigOnYa:
    Not even once, but 100's of times
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    My girlfriend at the time, she had me stay up with her all night because some how the crazy bitch had spent like 12 hours snorting 2 8 balls, didn't use any water (gotta clean your nose) so she had so much crusted in her nose I was sure she was gonna blow up her heart. I mean this was the stuff right off the boat so absolutely pure. ugghh so annoying
  • Psionic Roshambo @ Psionic Roshambo:
    Also doing like 320 dollars worth of coke in half a day lol damn it
  • Psionic Roshambo @ Psionic Roshambo:
    hmmm 360 even lol
  • Psionic Roshambo @ Psionic Roshambo:
    Well I was getting a discount so 320 is probably right
  • BigOnYa @ BigOnYa:
    That is cheap, I used to pay $100 for a tine.
  • Psionic Roshambo @ Psionic Roshambo:
    Tine? One gram?
  • BigOnYa @ BigOnYa:
    Sixteenth
  • Psionic Roshambo @ Psionic Roshambo:
    Also it was literally out of a kilo when I got it off the boat so absolutely pure
  • Psionic Roshambo @ Psionic Roshambo:
    Holy shiz that's a lot
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    I was getting 3.5 Grams for 320 could have stepped on it and doubled my money easy lol
    +1
  • BigOnYa @ BigOnYa:
    I'd be afraid to it nowdays, my heart would explode prob. I just stick beers n buds nowdays.
  • Psionic Roshambo @ Psionic Roshambo:
    I would get to drive from tarpon springs to like Miami a thousand bucks lol do that twice a week and back in 92 that was good money
  • Xdqwerty @ Xdqwerty:
    @BigOnYa,
    @Psionic Roshambo what are you guys talking about?
  • Psionic Roshambo @ Psionic Roshambo:
    Blew it on women and muscle cars lol
    +1
  • BigOnYa @ BigOnYa:
    @Xdqwerty Hamster food, its pricey nowadays to keep PCs running.
    +2
  • Psionic Roshambo @ Psionic Roshambo:
    I don't do anything except cigarettes and gotta stop eventually lol
    +1
  • BigOnYa @ BigOnYa:
    I'd do shrooms again if could find, and I was outside camping/fishing, and had a cooler full of beer.
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    I wouldn't mind some LSD, laughing until my face hurt sounds fun lol
    +1
  • BigOnYa @ BigOnYa:
    You ever try soaper powder/qauludes? I did once and like a dumbass drank beer on top of taking, I woke up laying in my backyard in the pouring rain, it knocked me out. I have not seen it around in many many years.
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    No never tried a lot of things but never that lol
  • Psionic Roshambo @ Psionic Roshambo:
    I did pass out one time on a floor after taking a bunch of Ambien lol thought it would help me sleep and did it lol
  • Psionic Roshambo @ Psionic Roshambo:
    Girlfriend was working at a pharmacy and stole like 500 of them, was and still is the biggest pill bottle I have ever seen lol
    Psionic Roshambo @ Psionic Roshambo: Girlfriend was working at a pharmacy and stole like 500 of them, was and still is the biggest...