here i am using baumer machine vision camera and tkinter framework for making gui application. i captured image from camera and convert using PIL Library but lable throws error for numpy array. this application work for webcam so i cant understand diffrence of camera image data.
import neoapi
from neoapi.neoapi import NeoException
import numpy as np
import cv2
from tkinter import *
import sys
from PIL import Image, ImageTk
try:
camera = neoapi.Cam()
camera.Connect()
dim = (640,480)
camera.f.ExposureTime = 4000
camera.f.Width = 640
camera.f.Height = 480
except(neoapi.NeoException, Exception)as exc:
print(exc)
root = Tk()
def main():
while True:
img =camera.GetImage().GetNPArray()
img2 = Tk.PhotoImage(Image.fromarray(img))
L1['Image'] = img2
L1 = Label(root,borderwidth=1,text= ' var')
L1.pack()
B1 = Button(root,text='connnect',command= main).pack()
root.mainloop()