Exemple #1
0
 def setImage1(self):
     try:
         # HOST = '192.168.43.217'
         PORT = 6666
         c = s.connect_tcp(HOST,PORT)
         print("client connected on socket ", c)
         s.send_text("hotel1", c)
         data1 = s.rcv_data(c)
         myfile1 = open("recievedPic.jpg", 'wb')
         myfile1.write(data1)
         pixmap = QPixmap("recievedPic.jpg")
         self.ui.label_8.setPixmap(pixmap)
     except:
         self.errorMessage1()
Exemple #2
0
    def setVideo2(self):
        try:
            # HOST = '192.168.43.217'

            PORT = 6666
            c = s.connect_tcp(HOST,PORT)
                #print("client connected on socket ", c)
            s.send_text("hotel2video", c)
            data1 = s.rcv_data(c)
            myfile1 = open("recievedVideo.mp4", 'wb')
            myfile1.write(data1)
            #print(url)
            
            print("I'm here")
            self.ui.tabWidget.setTabEnabled(2, True)
            self.ui.tabWidget.setCurrentIndex(2)
            #self.errorMessage()
        except:
            self.errorMessage1()
Exemple #3
0
    def Book(self):
        # HOST = '192.168.43.217'
        PORT = 6666
        data = []
        data.append(self.ui.lineEdit_3.text())
        data.append(self.ui.lineEdit_2.text())
        data.append(self.ui.lineEdit_4.text())
        data.append(self.ui.lineEdit_5.text())
        data.append("save")

        for x in data:
            c = s.connect_tcp(HOST,PORT)
                #print("client connected on socket ", c)
            s.send_text(x, c)

        self.bookedMessage()
        self.ui.tabWidget.setCurrentIndex(0)
        self.ui.tabWidget.setTabEnabled(1, False)
        self.ui.tabWidget.setTabEnabled(2, False)
        self.ui.tabWidget.setTabEnabled(3, False)
Exemple #4
0
import easySocket as s
HOST = '127.0.0.1'
PORT = 6666

c = s.connect_tcp(HOST,PORT)
print("client connected on socket ", c)
s.send_text("hotel2", c)
data = s.rcv_data(c)
myfile = open("hotel2r.jpg", 'wb')
myfile.write(data)
async def saving(pil_im, class_names, scores, boxes, images_dir,
                 predictions_dir, nodetection_images_dir):
    # save the detection results
    start_time = time.monotonic()
    if len(class_names) > 0:
        # save the image file
        t = datetime.datetime.now().strftime("%Y%m%d_%H%M%S_%f")
        image_name = t + ".jpg"
        image_path = os.path.join(images_dir, image_name)
        pil_im.save(image_path)
        # send image file to server
        easySocket.send_text('image', s)
        easySocket.send_text(image_name, s)
        easySocket.send_file(image_path, s)

        # save the prediction
        csv_name = t + ".csv"
        csv_path = os.path.join(predictions_dir, csv_name)
        f = open(csv_path, 'w')
        with f:
            fnames = [
                'timestamp', 'width', 'height', 'image_name', 'image_path',
                'class_names', 'scores', 'boxes'
            ]
            writer = csv.DictWriter(f, fieldnames=fnames)
            writer.writeheader()
            (width, height) = pil_im.size
            writer.writerow({
                'timestamp': t,
                'width': width,
                'height': height,
                'image_name': image_name,
                'image_path': image_path,
                'class_names': str(class_names),
                'scores': str(scores),
                'boxes': str(boxes)
            })
        # send csv file to server
        easySocket.send_text('csv', s)
        easySocket.send_text(csv_name, s)
        easySocket.send_file(csv_path, s)
    # no detection, save the image only
    else:
        t = datetime.datetime.now()
        image_name = t.strftime("%Y%m%d_%H%M%S_%f") + ".jpg"
        image_path = os.path.join(nodetection_images_dir, image_name)
        pil_im.save(image_path)
        # send image file to server
        easySocket.send_text('image', s)
        easySocket.send_text(image_name, s)
        easySocket.send_file(image_path, s)

    end_time = time.monotonic()
    print('Saving time: {:.2f} ms'.format((end_time - start_time) * 1000))
Exemple #6
0
import easySocket as s
HOST = '127.0.0.1'
PORT = 6666
c, address = s.host_tcp(HOST, PORT)
print("connected to ", address)
data = s.rcv_data(c)
if data:
    if (data.decode() == "hotel1"):
        file = "hotel1.jpg"
    elif (data.decode() == "hotel2"):
        file = "hotel2.jpg"
    print(data)
    s.send_file(file, c)
else:
    s.send_text("error, plz resend",c)
Exemple #7
0
while 1:
    HOST = '192.168.43.218'
    PORT = 6666
    print('hey there')
    c, address = s.host_tcp(HOST, PORT)
    print("connected to ", address)
    data = s.rcv_data(c)
    if data:
        if (data.decode() == "hotel1"):
            file1 = "hotel1.jpg"
            s.send_file(file1, c)
        elif (data.decode() == "hotel2"):
            file1 = "hotel2.jpg"
            s.send_file(file1, c)
        elif (data.decode() == "hotel1video"):
            file1 = "leysbeu.mp4"
            s.send_file(file1, c)
        elif (data.decode() == "hotel2video"):
            file1 = "dalen.mp4"
            s.send_file(file1, c)
        elif (data.decode() == "save"):
            array.append("Other Client")
            with open('UserData.txt', 'w') as filehandle:
                for listitem in array:
                    filehandle.write('%s\n' % listitem)
        else:
            array.append(data.decode())
            print(data)
    else:
        s.send_text("error, plz resend", address)