I am working on Yolo3-4-PY to implement it with tkinter.
I\'ve looked up everywhere but not able to resolve the issue.
When I run the program the canvas is d
In the line imgtk = ImageTk.PhotoImage(image=cv2image)
, you are passing a numpy array (cv2image) as input to ImageTk.PhotoImage. But the source code of PIL.ImageTk mentions that it requires a PIL image.
This is what source code of PIL.ImageTk mentions for init() of PhotoImage.
class PhotoImage(object):
.....
:param image: Either a PIL image, or a mode string. If a mode string is
used, a size must also be given.
So basically, you will have to convert the numpy array to a PIL Image and then pass it to ImageTk.PhotoImage().
So, can you replace the line imgtk = ImageTk.PhotoImage(image=cv2image)
with imgtk = ImageTk.PhotoImage(image=PIL.Image.fromarray(cv2image))
?
This would convert the numpy array to a PIL Image and it would be passed into the method.
I extracted the code for converting a numpy array to PIL Image from this source.