We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent fff45c7 commit b428e2fCopy full SHA for b428e2f
1 file changed
test.py
@@ -87,12 +87,23 @@ def callback(results):
87
image = cv2.imread(file_path)
88
reader.addAsyncListener(callback)
89
90
-for i in range(5):
+for i in range(2):
91
print('decodeMatAsync: {}'.format(i))
92
reader.decodeMatAsync(image)
93
94
sleep(1)
95
96
reader.clearAsyncListener()
97
98
+# asyncio test
99
+import asyncio
100
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