Update camera_test.py

This commit is contained in:
Siwat Sirichai 2023-09-23 02:30:19 +07:00
parent 5702af8c36
commit 099fffbb6f
1 changed files with 6 additions and 5 deletions

View File

@ -3,14 +3,15 @@ import cv2
import base64 import base64
import requests import requests
# #Capture Image #Capture Image
# cam = cv2.VideoCapture(0) cam = cv2.VideoCapture(1)
# ret, img = cam.read() ret, img = cam.read()
# #Save Image # #Save Image
# cv2.imwrite("cam_test_img_pre.jpg",img) # cv2.imwrite("cam_test_img_pre.jpg",img)
img = cv2.imread("cam_test_img_pre.jpg") # #Load Image
# img = cv2.imread("cam_test_img_pre.jpg")
#Encode Image #Encode Image
ret, jpg_buffer = cv2.imencode('.jpg',img) ret, jpg_buffer = cv2.imencode('.jpg',img)
@ -18,7 +19,7 @@ b64_img = base64.b64encode(jpg_buffer)
#Send Image to Server #Send Image to Server
data = {"image":b64_img.decode("utf-8")} data = {"image":b64_img.decode("utf-8")}
req = requests.post("http://localhost:5000/process_image",json=data) req = requests.post("https://racist.siwatsystem.com/process_image",json=data)
print(req.content) print(req.content)
#Decode Image #Decode Image