Esempio n. 1
0
def main():
    '''
    Create our window and comm driver
    '''
    global root
    global comm
    global ProductionCount
    
    # create a comm driver
    comm = PLC()
    comm.IPAddress = ipAddress

    # create a tkinter window
    root = Tk()
    root.config(background='black')
    root.title = 'Production Count'
    root.geometry('800x600')
    
    # bind the "q" key to quit
    root.bind('q', lambda event:root.destroy())
    
    # create a labe to display our variable
    ProductionCount = Label(root, text='n', fg='white', bg='black', font='Helvetica 350 bold')
    ProductionCount.place(anchor=CENTER, relx=0.5, rely=0.5)
    
    # call our updater and show our window
    root.after(1000, UpdateValue)
    root.mainloop()
    comm.Close()
Esempio n. 2
0
capture = cv2.VideoCapture(0)
#capture.set(cv2.CAP_PROP_FRAME_WIDTH,416)
#capture.set(cv2.CAP_PROP_FRAME_HEIGHT, 416)

while True:
    stime = time.time()
    ret, frame = capture.read()
    if ret:  #quit()
        results = tfnet.return_predict(frame)
        for color, result in zip(colors, results):
            tl = (result['topleft']['x'], result['topleft']['y'])
            br = (result['bottomright']['x'], result['bottomright']['y'])
            label = result['label']
            confidence = result['confidence']
            text = '{}: {:.0f}%'.format(label, confidence * 100)
            textCon = '{:.0f}'.format(confidence * 100)
            frame = cv2.rectangle(frame, tl, br, color, 5)
            frame = cv2.putText(frame, text, tl, cv2.FONT_HERSHEY_COMPLEX, 1,
                                (0, 0, 0), 2)
        cv2.imshow('frame', frame)
        # Make a String tag(Nano_YOLO_label) and a String tag(Nano_YOLO_confidence) in your CLX 5000 processor
        ex: test.Write("Nano_YOLO_label", label)
        ex: test.Write("Nano_YOLO_confidence", textCon)
        print('FPS {:.1f}'.format(1 / (time.time() - stime)))
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break
    #Un coment line below for PLC support
test.Close()
capture.release()
cv2.destroyAllWindows()
Esempio n. 3
0
'''
the following import is only necessary because eip is not in this directory
'''
import sys
sys.path.append('..')
'''
The simplest example of reading a tag from a PLC

NOTE: You only need to call .Close() after you are done exchanging
data with the PLC.  If you were going to read in a loop or read
more tags, you wouldn't want to call .Close() every time.
'''
from eip import PLC

comm = PLC()
comm.IPAddress = '192.168.1.9'
value = comm.Read('CurrentScreen')
print(value)
comm.Close()