From 465112841c32a44987cbd22e6568adbc34e46682 Mon Sep 17 00:00:00 2001 From: Vesa Halenius <vesa.m.halenius@utu.fi> Date: Tue, 20 Feb 2018 23:04:41 +0200 Subject: [PATCH] Update sbs_client.py --- client/sbs_client.py | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/client/sbs_client.py b/client/sbs_client.py index 1232522..58c3ed9 100644 --- a/client/sbs_client.py +++ b/client/sbs_client.py @@ -10,9 +10,6 @@ import requests from requests_toolbelt.multipart.encoder import MultipartEncoder import os -# Haarcascade for face detection -face_cascade = cv2.CascadeClassifier(".\haarcascade\haarcascade_frontalface_default.xml") - # Image file name and location image = ".\images\image.jpg" @@ -21,15 +18,15 @@ image = ".\images\image.jpg" def sendImage(): # Send local image file to tensorflow-client multipart_data = MultipartEncoder( - fields={ - # a file upload field - "image": ("image.jpg", open(image, "rb"), "image/jpg"), - "stop_code": "Test" - } - ) + fields={ + # a file upload field + "image": ("image.jpg", open(image, "rb"), "image/jpg"), + "stop_code": "Test" + } + ) - response = requests.post("http://tensorflow.stop.capstone.utu.fi/api/v1/classifyImage/&stop_code=test", data=multipart_data, - headers={"Content-Type": multipart_data.content_type}) + response = requests.post("http://tensorflow.stop.capstone.utu.fi/api/v1/classifyImage/", data=multipart_data, + headers={"Content-Type": multipart_data.content_type}) # Removing image for security purposes def removeImage(): @@ -41,13 +38,9 @@ def takePicture(): ret, frame = cap.read() - # Trying to detect faces - gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) - faces = face_cascade.detectMultiScale(gray, 1.3, 5) - cv2.imwrite(image,frame) cap.release() takePicture() sendImage() -removeImage() +removeImage() \ No newline at end of file -- GitLab