GithubHelp home page GithubHelp logo

echocv's Introduction

Echo IPC library OpenCV support

Echo is a simple and efficient interprocess communication (IPC) library for Linux written in C++11. This library is an extension that enables OpenCV matrix serialization as Echo messages.

Contributors

  • Luka Čehovin (developer, maintainer)

echocv's People

Contributors

lukacu avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

echocv's Issues

Racing condition v readMat

Izvajanje callback funkcije v novi niti, na kanalu, kjer prebira numpy matriko s funkcijo readMat, povzroči zamrznitev aplikacije.
Potencialna rešitev je premik tega izvajanja v glavno nit, kar pa ima druge nezaželjene implikacije. Podobnih problemov nisem zaznal v funkcijah readString, readInt...

Primer kode prejemnika

import threading
import numpy
import time

from echolib import pyecho
import echocv
import cv2

def callbackThread(message):
    print("Callback before matread...")

    reader = pyecho.MessageReader(message)
    img = echocv.readMat(reader)

    print("Callback after read...")
    print(img.shape)

def callback(message):
    threading.Thread(target=callbackThread, args=[message]).start()

    #reader = pyecho.MessageReader(message)
    #img = echocv.readMat(reader)
    #print(img.shape)

def main():
    loop = pyecho.IOLoop()
    client = pyecho.Client()
    loop.add_handler(client)

    p0 = pyecho.Subscriber(client, "test", "numpy.ndarray", callback)
    try:
        while loop.wait(10):
            time.sleep(0.001)
    except KeyboardInterrupt:
        pass

if __name__ == '__main__':
    main()

Primer kode pošiljatelja

from echolib import pyecho
import echocv
import cv2
import time
import sys

class Demo():

    def __init__(self):
        self.loop = pyecho.IOLoop()
        self.client = pyecho.Client()
        self.loop.add_handler(self.client)

        self.dockerCommandOut = pyecho.Publisher(self.client, "test", "numpy.ndarray")
        self.loop.wait(10)

        self.count = 0

def main():

    demo = Demo()
    camera = cv2.VideoCapture(0)

    try:
        while demo.loop.wait(10):

            ret, frame = camera.read()

            writer = pyecho.MessageWriter()
            echocv.writeMat(writer, frame)
            demo.dockerCommandOut.send(writer)
            demo.count += 1

            time.sleep(1.0)
    except KeyboardInterrupt:
        pass

if __name__=='__main__':
    main()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.