Skip to main content

Live video streaming over network with OpenCV and (ZMQ or TCP)

Project description

Imagiz

Fast and none blocking live video streaming over network with OpenCV and (ZMQ or TCP).

Install

pip3 install imagiz

ZMQ Client

import imagiz
import cv2


client=imagiz.Client("cc1",server_ip="localhost")
vid=cv2.VideoCapture(0)
encode_param = [int(cv2.IMWRITE_JPEG_QUALITY), 90]

while True:
    r,frame=vid.read()
    if r:
        r, image = cv2.imencode('.jpg', frame, encode_param)
        client.send(image)
    else:
        break

ZMQ Server

import imagiz
import cv2

server=imagiz.Server()
while True:
    message=server.recive()
    frame=cv2.imdecode(message.image,1)
    cv2.imshow("",frame)
    cv2.waitKey(1)

TCP Client

import imagiz
import cv2

vid=cv2.VideoCapture(0)
client=imagiz.TCP_Client(server_port=9990,client_name="cc1")
encode_param = [int(cv2.IMWRITE_JPEG_QUALITY), 90]


while True:
    r,frame=vid.read()
    if r:
        r,image=cv2.imencode('.jpg',frame, encode_param)
        response=client.send(image)
        print(response)

TCP Server

import imagiz
import cv2

server=imagiz.TCP_Server(9990)
server.start()
while True:
    message=server.receive()
    frame=cv2.imdecode(mmessage.image,1)
    cv2.imshow("",frame)
    cv2.waitKey(1)

Client Options

Name Description
client_name Name of client
server_ip Ip of server default value is localhost
server_port Port of server default value is 5555
request_timeout how many milliseconds wait to resend image again
request_retries how many time retries to send an image before client exit
generate_image_id image_id is unique and ordered id that you can use for save data on disk or db also it is show time of image sended by client
time_between_retries On TCP client show time between retries

Server Options

Name Description
Port Port of server
listener Number of listening threads.default value is 10

Message Class

Name Description
image Byte of image
client_name Name of client
image_id If disable generate_image_id it will be 0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imagiz-0.4.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imagiz-0.4-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file imagiz-0.4.tar.gz.

File metadata

  • Download URL: imagiz-0.4.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.9

File hashes

Hashes for imagiz-0.4.tar.gz
Algorithm Hash digest
SHA256 68aed7e11acd2eef5187074ca8075930c8c225e552adf5df6415dae952010366
MD5 af8d520fa7fc71ee82ec60501779376c
BLAKE2b-256 78428dbab70b976e94ffd7a8acd0f05f4e16dea82b1417657216bb240f488fdb

See more details on using hashes here.

File details

Details for the file imagiz-0.4-py3-none-any.whl.

File metadata

  • Download URL: imagiz-0.4-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/42.0.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.9

File hashes

Hashes for imagiz-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 839a7310be9024ecb8c4a3d598bd9b11266fa350dbc00470bd699703a107f2f8
MD5 8095b3976fbd744396cc335695dfce21
BLAKE2b-256 87e1927df93335bd76d845fa991cac885fd68f289c9d234dd9de183376e02b3e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page