0

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.

  • related: https://forum.opencv.org/t/canvas-is-not-displaying-video/8594/2 – Christoph Rackwitz Apr 30 '22 at 14:30
  • welcome. please take the [tour] and review [ask] and [mre]. your question should contain code that can be executed as is. – Christoph Rackwitz Apr 30 '22 at 14:32
  • Does this answer your question? [Why does Tkinter image not show up if created in a function?](https://stackoverflow.com/questions/16424091/why-does-tkinter-image-not-show-up-if-created-in-a-function) – jasonharper Apr 30 '22 at 14:36
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community May 01 '22 at 04:22
  • @jasonharper yes, i tried it but still not showing video in the canvas – Hamna Malik May 02 '22 at 07:21

0 Answers0