You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Did you read all of that code? Try to understand what each line does. You learn way more then if sb just tells you.
Hint:
Check what resolution the kinect uses for the rgb image.
I checked the resolution of kinect , and change the 'frame = np.reshape(frame, (2880, 2880))' to '(1920, 1080)', but there has a Exception: 'ValueError: cannot reshape array of size 8294400 into shape (1920,1080)'
yeah, I read the sourcecode just now, and successed show it by pygame.
Nevertheless when I wanna to preccess it with OpenCV, there are sth trouble:
Error:
Traceback (most recent call last):
File "E:/PycharmProjects/PyKinect2/venv/real.py", line 97, in
game.run();
File "E:/PycharmProjects/PyKinect2/venv/real.py", line 72, in run
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.error: OpenCV(3.4.4) c:\projects\opencv-python\opencv\modules\imgproc\src\color.hpp:255: error: (-2:Unspecified error) in function '__cdecl cv::CvtHelper<struct cv::Set<3,4,-1>,struct cv::Set<1,-1,-1>,struct cv::Set<0,2,5>,2>::CvtHelper(const class cv::_InputArray &,const class cv::_OutputArray &,int)'
Invalid number of channels in input image:
'VScn::contains(scn)'
where
'scn' is 1
I have fixed it for a long time.....
anyway, thanks a lot for your help
the code:
from pykinect2 import PyKinectV2
from pykinect2.PyKinectV2 import *
from pykinect2 import PyKinectRuntime
import numpy as np
import cv2
kinect = PyKinectRuntime.PyKinectRuntime(PyKinectV2.FrameSourceTypes_Color)
while True:
# --- Getting frames and drawing
if kinect.has_new_color_frame():
frame = kinect.get_last_color_frame()
frame = frame.astype(np.uint8)
frame = np.reshape(frame, (2880, 2880))
img = cv2.cvtColor(frame, cv2.COLOR_GRAY2BGR)
output = cv2.bilateralFilter(img, 9, 150, 75)
cv2.imshow('KINECT Video Stream', output)
frame = None
the result:
I dont know how to fix it, anybody can help me, plz...
The text was updated successfully, but these errors were encountered: