您现在的位置是:主页 > news > 做网站多少钱啊/关键词优化工具

做网站多少钱啊/关键词优化工具

admin2025/5/24 16:26:01news

简介做网站多少钱啊,关键词优化工具,中牟高端网站建设,大连百度推广开户使用socket 传递摄像头图像到pc。确定安装好opencv和python后,确定自己作为服务器端设备ip:首先是服务器端:import socketimport cv2import numpyaddress (local ip,8002)s socket.socket(socket.AF_INET, socket.SOCK_STREAM)s.bind(addre…

做网站多少钱啊,关键词优化工具,中牟高端网站建设,大连百度推广开户使用socket 传递摄像头图像到pc。确定安装好opencv和python后,确定自己作为服务器端设备ip:首先是服务器端:import socketimport cv2import numpyaddress (local ip,8002)s socket.socket(socket.AF_INET, socket.SOCK_STREAM)s.bind(addre…

使用socket 传递摄像头图像到pc。

确定安装好opencv和python后,确定自己作为服务器端设备ip:

首先是服务器端:

import socket

import cv2

import numpy

address = ('local ip',8002)

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

s.bind(address)

s.listen(True)

def recvall(sock, count): buf = b'' while count: newbuf = sock.recv(count) if not newbuf: return None buf += newbuf count -= len(newbuf) return bufconn, addr = s.accept()while 1: length = recvall(conn,16) stringData = recvall(conn, int(length)) data = numpy.fromstring(stringData, dtype='uint8') decimg=cv2.imdecode(data,1) cv2.imshow('SERVER',decimg) cv2.waitKey(10) s.close()cv2.destroyAllWindows()

然后是客户端:

import socket

import cv2

import numpy

capture = cv2.VideoCapture(0)

ret, frame = capture.read()address = ('local ip',8002)sock = socket.socket()sock.connect(address)encode_param=[int(cv2.IMWRITE_JPEG_QUALITY),90]while ret: result, imgencode = cv2.imencode('.jpg', frame, encode_param) data = numpy.array(imgencode) stringData = data.tostring() sock.send( str(len(stringData)).ljust(16)); sock.send( stringData ); ret, frame = capture.read() #decimg=cv2.imdecode(data,1) #cv2.imshow('CLIENT',decimg) cv2.waitKey(10)sock.close()cv2.destroyAllWindows()

出现下面这个问题,

Traceback (most recent call last):

File "client.py", line 12, in sock.connect((TCP_IP, TCP_PORT))

File "C:\Python27\lib\socket.py", line 228, in meth

return getattr(self._sock,name)(*args)

socket.error: [Errno 10061]

要确认 local ip是服务器端的ip,

ip在window的cmd中可以ipconfig查看;在linux中可以ifconfig查看。