Ich habe vor kurzem eine Kinect-Kamera auf einem Raspberry Pi 3 mit Libfreenect und Pygame nach this guy's work arbeiten und ich bin um 13fps bekommen, aber ich frage mich, ob es einen besseren/schneller Weg mehr fps oder ist es nur eine Hardware-Beschränkung ? HierMit Kinect mit Python auf einem Raspberry Pi 3, gibt es einen besseren/schnelleren Weg für mehr fps?
ist der Code jetzt:
from freenect import sync_get_depth as get_depth
import pygame
import numpy
import sys
def make_gamma():
num_pix = 2048 # there's 2048 different possible depth values
npf = float(num_pix)
_gamma = numpy.empty((num_pix, 3), dtype=numpy.uint16)
for i in xrange(num_pix):
if i < 950:
a = numpy.array([255, 0, 0], dtype=numpy.uint8)
else:
a = numpy.array([0, 0, 0], dtype=numpy.uint8)
_gamma[i] = a
return _gamma
fpsClock = pygame.time.Clock()
FPS = 30 # kinect only outputs 30 fps
disp_size = (640, 480)
pygame.init()
screen = pygame.display.set_mode(disp_size)
pygame.display.set_caption('Kinect depth display')
font = pygame.font.Font('/usr/share/fonts/truetype/freefont/FreeSerif.ttf', 32)
gamma = make_gamma()
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
fps_text = "FPS: {0:.2f}".format(fpsClock.get_fps())
# draw the pixels
depth = numpy.rot90(get_depth()[0])
pixels = gamma[depth]
temp_surface = pygame.Surface(disp_size)
pygame.surfarray.blit_array(temp_surface, pixels)
pygame.transform.scale(temp_surface, disp_size, screen)
screen.blit(font.render(fps_text, 1, (255, 255, 255)), (30, 30))
pygame.display.flip()
fpsClock.tick(FPS)
Haben Sie einen Benchmark erstellt? Wo ist der Flaschenhals? – Divakar