测试发现1280*720的图像传输,一张平均需要8ms,两张需要15ms,
内容越多,时间越长。
# !/usr/bin/env python
# -*- coding: utf-8 -*-
import multiprocessing
import random
import time
import os
import cv2
class producer(multiprocessing.Process):
def __init__(self, queue):
multiprocessing.Process.__init__(self)
self.queue = queue
def run(self):
path = r"E:\Team-CV\train_data\augment_yy0712\train\JPEGImages/"
files = os.listdir(path)
images = []
for j, file in enumerate(files):
img = cv2.imread(path + file)
if img is None:
continue
if j > 100:
break
images.append(img)
for i in range(60):
for j in range(len(images) - 1):
self.queue.put((images[j], j))
time.sleep(0.05)
print("The size of queue is %s