我需要一个python+opencv程序,具体要求是本机自己摄像头拍一张照(如命名kk.jpeg)后,利用socket把kk传给服务器(另一台电脑),服务器对图片进行处理后生成一张图片如命名gg,jpeg,然后服务器再把图片gg回传给本机。
因为对图片处理我可以自己写,所以我想请你们帮忙设计一个程序:把一张本机摄像头截取的图片(kk.jpg)用socket传给另一个电脑后电脑自动将指定目录的一张图片(gg.jpg)回传给本机.
截图程序:
import cv2
import numpy as np
import pickle
import matplotlib.pyplot as plt
import socket
import os
import sys
import struct
cap = cv2.VideoCapture(0)
index = 0
while True:
ret, frame = cap.read()
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
# Display the resulting frame
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('p'):
cv2.imwrite("kk.jpg", frame)
index = index + 1
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。