Exemple #1
0
import cv2
import numpy as np
from easy_memmap import MultiImagesMemmap

v0 = cv2.VideoCapture(0)
v1 = cv2.VideoCapture(4)

labels = ["C", "B", "F"]
m = MultiImagesMemmap(mode="w", name="mycamera3", labels=labels)
print(m.get_labels())

while True:
    _, image0 = v0.read()
    _, image1 = v1.read()
    data = np.concatenate([image0, image1], axis=2)
    m.write(data)
    cv2.imshow("Writer0", image0)
    cv2.imshow("Writer1", image1)
    cv2.waitKey(1)
import cv2
from easy_memmap import EasyMemmap, MultiImagesMemmap
import time

m = MultiImagesMemmap(mode="r")
print("Available streams: {}".format(EasyMemmap.get_memmap_files()))

m.wait_until_available("mycamera3")

print("Labels: {}".format(m.get_labels()))

while True:
    image0 = m.read("C")
    image1 = m.read("B")
    cv2.imshow("Reader0", image0)
    cv2.imshow("Reader1", image1)
    cv2.waitKey(1)