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
  • No one is chatting at the moment.
    BigOnYa @ BigOnYa: https://torrentfreak.com/one-nintendo-dmca-notice-just-wiped-out-8535-yuzu-emulator-forks-240502/