Example #1
0
	def recvdata(self):
		while self.recv_status:
			try:
				data=self.socket.recv(4096)
				self.dataq.put(data)
			except Exception as e:
				socket.emit('message','error')
	def send_result_to_application(self,emotion_class):
		"""
		Send emotion predict to web app.
		Input: Class of emotion between 1 to 5 according to Russel's Circumplex Model.
		Output: Send emotion prediction to web app.
		"""
		#socket =  SocketIO('localhost', socket_port, LoggingNamespace) //НЕ РАБОТАЕТ БЕЗ БИБЛИ, ЗАПУСТИТЕ НА МАШИНЕ, У КОГО ВСЕ ХОРОШО
		socket.emit('realtime emotion',emotion_class)
    def send_result_to_application(self, emotion_class):
        """
		Send emotion predict to web app.
		Input: Class of emotion between 1 to 5 according to Russel's Circumplex Model.
		Output: Send emotion prediction to web app.
		"""
        socket = SocketIO('localhost', socket_port, LoggingNamespace)
        socket.emit('realtime emotion', emotion_class)
	def send_result_to_application(self,emotion_class):
		"""
		Send emotion predict to web app.
		Input: Class of emotion between 1 to 5 according to Russel's Circumplex Model.
		Output: Send emotion prediction to web app.
		"""
		socket =  SocketIO('localhost', socket_port, LoggingNamespace)
		socket.emit('realtime emotion',emotion_class)
Example #5
0
def latlog(vehicle):
    while True:
        eventlet.sleep(.5)
        loc = vehicle.location.global_frame
        if loc:
            socketio.emit('location', {
                "altitude": loc.alt,
                "longitude": loc.lon,
                "latitude": loc.lat,
            })
        else:
            socket.emit('location', None)
Example #6
0
def latlog(vehicle):
    while True:
        eventlet.sleep(.5)
        loc = vehicle.location.global_frame
        if loc:
            socketio.emit('location', {
                "altitude": loc.alt,
                "longitude": loc.lon,
                "latitude": loc.lat,
                })
        else:
            socket.emit('location', None)
def pyr(vehicle):
    while True:
        time.sleep(.5)
        atti = vehicle.attitude
        if atti:
            socketio.emit('pyr_status', {
                "Pitch": atti.pitch,
                "Yaw": atti.yaw,
                "Roll": atti.roll,
            })
        else:
            socket.emit('pyr_status', None)
Example #8
0
        if top == 'Surprise':
            cntSurprise += 1
        if top == 'Neutral':
            cntNeutral += 1

        #Append engagement level
        Engage.append(probs_mean)

        text = top + ' + ' + label
        cv2.putText(frame, text, (x, y-50), cv2.FONT_HERSHEY_SIMPLEX, 2, (255, 255, 255), 4, cv2.LINE_AA)

        msg = ';'.join([emotion,str(emotion_acc),distraction,str(distraction_acc),pause]) 

    print(msg)
    if isSocket==1:
        socket.emit('emoNode', msg)

    if isSocket==0:
        cv2.imshow('Video', frame)

    if cv2.waitKey(1) & 0xFF == ord('q'):
        break


#Engagement Level Graph
time = np.arange(cntTime + 1)
engm = np.asarray(Engage)
trace1 = go.Scatter(
        x = time,
        y = engm
        )
Example #9
0
 def broadcast(cls, event, message = None):
   print "broadcasting: %s, %s" % (event, message)
   for socket in cls.sockets:
     socket.emit(event, convert_to_jsonable(message))
Example #10
0
import socket
import time
from socketIO_client import SocketIO, LoggingNamespace

socket =  SocketIO('localhost', 8080, LoggingNamespace)
print('Connection started')

i = 0
while True:
    time.sleep(2)
    socket.emit('keyApp',i)
    socket.emit('keyApp2',i**2)
    print(i)
    i += 1
Example #11
0
 def broadcast(cls, event, message=None):
     print "broadcasting: %s, %s" % (event, message)
     for socket in cls.sockets:
         socket.emit(event, convert_to_jsonable(message))
                    cntNeutral += 1


                text = top + ' + ' + label
                cv2.putText(frame, text, (x, y-50), cv2.FONT_HERSHEY_SIMPLEX, 2, (255, 255, 255), 4, cv2.LINE_AA)

                msg = ';'.join([emotion,str(emotion_acc),distraction,str(distraction_acc),pause,str(cntTime)])
                disp = ' '.join([emotion,str(emotion_acc),distraction,str(distraction_acc),'Frame#',str(cntTime)])

            if debug:
                print(disp)
            #if(inx=='m'):
             #   cv2.imwrite('../public_static/frames/fig'+str(cntTime%10)+'.png', frame)

            if isSocket==1:
                socket.emit('emoNode', msg)

            if isSocket==0:
                cv2.imshow('Video', frame)
                key = cv2.waitKey(1) & 0xFF
                if key == ord('q'):
                    break

            if inx=='m':
                img = cv2.resize(frame, (685,390))
                cv2.imshow('Mood', img)
                key = cv2.waitKey(1) & 0xFF
                if key == ord('q'):
                    break

            if kbhit():