Skip to content

Commit b428e2f

Browse files
committed
Update
1 parent fff45c7 commit b428e2f

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

test.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,12 +87,23 @@ def callback(results):
8787
image = cv2.imread(file_path)
8888
reader.addAsyncListener(callback)
8989

90-
for i in range(5):
90+
for i in range(2):
9191
print('decodeMatAsync: {}'.format(i))
9292
reader.decodeMatAsync(image)
9393

9494
sleep(1)
9595

9696
reader.clearAsyncListener()
9797

98+
# asyncio test
99+
import asyncio
98100

101+
async def async_decode_mat():
102+
loop = asyncio.get_event_loop()
103+
results = await loop.run_in_executor(None, reader.decodeMat, image)
104+
print('Asyncio results:')
105+
for result in results:
106+
print(result.text)
107+
print(result.format)
108+
109+
asyncio.run(async_decode_mat())

0 commit comments

Comments
 (0)