Update camera_test.py
This commit is contained in:
		
							parent
							
								
									5702af8c36
								
							
						
					
					
						commit
						099fffbb6f
					
				
					 1 changed files with 6 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -3,14 +3,15 @@ import cv2
 | 
			
		|||
import base64
 | 
			
		||||
import requests
 | 
			
		||||
 | 
			
		||||
# #Capture Image
 | 
			
		||||
# cam = cv2.VideoCapture(0)
 | 
			
		||||
# ret, img = cam.read()
 | 
			
		||||
#Capture Image
 | 
			
		||||
cam = cv2.VideoCapture(1)
 | 
			
		||||
ret, img = cam.read()
 | 
			
		||||
 | 
			
		||||
# #Save Image
 | 
			
		||||
# 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
 | 
			
		||||
ret, jpg_buffer = cv2.imencode('.jpg',img)
 | 
			
		||||
| 
						 | 
				
			
			@ -18,7 +19,7 @@ b64_img = base64.b64encode(jpg_buffer)
 | 
			
		|||
 | 
			
		||||
#Send Image to Server
 | 
			
		||||
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)
 | 
			
		||||
 | 
			
		||||
#Decode Image
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue