'The Canvas is not showing depth video

The code is:

def ir_frame_to_jpg(self, IRFrame): 
         IRFrame = IRFrame.reshape((const.ir_image_size))
         IRFrame = np.uint8(IRFrame)

         jpgIRFrame = np.zeros((const.ir_image_size[0],const.ir_image_size[1],3), np.uint8)
         jpgIRFrame[:,:,0]  =  IRFrame
         jpgIRFrame[:,:,1]  =  IRFrame
         jpgIRFrame[:,:,2]  =  IRFrame
         return jpgIRFrame
   def button1_clicked(self):
       kinect = PyKinectRuntime.PyKinectRuntime(PyKinectV2.FrameSourceTypes_Color |
                                              PyKinectV2.FrameSourceTypes_Infrared |
                                              PyKinectV2.FrameSourceTypes_Depth)
       redAlert = np.zeros((const.ir_image_size[0],const.ir_image_size[1],3),np.uint8)
       redAlert[:,:,2] = 255
       run = True
       
       c = Canvas(self.root, width = 512, height = 424)
       c.place(x=0, y=0)
              ph = ImageTk.PhotoImage(image=Image.fromarray(self.ir_frame_to_jpg(kinect.get_last_depth_frame())))
       c.create_image(0, 0, image = ph, anchor = NW)

No errors, but canvas is not displaying me video When I call

cv2.imshow('video', self.ir_frame_to_jpg(kinect.get_last_depth_frame()))

It shows me the video on a different window...but when I try to display it on gui canvas it doesn't show me video.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source