Conf:
Raspberry Pi 4 - Raspbian GNU/Linux 10 (buster) 32 bit os, ARM
pylibdmtx (0.1.9)
libdmtx0b (0.7.5-3)
from PIL import Image
from pylibdmtx.pylibdmtx import decode, Decoded, DmtxSymbolSize
import time
img_path = "auxiliaries/peripherals/camera/test.jpg"
img = Image.open(img_path)
for t in [50, 500, 5000, 3000, None]:
started = time.time()
res = decode(img, shape=DmtxSymbolSize.DmtxSymbol8x18, timeout=t)
print(f"timeout: {t/1000 if t else None}, elapsed: {round(time.time() - started, 3)}, result: {res}")
I conclude that for such a small pic it takes less than 0.5 sec to process, but timeout is always waited (one core of cpu is maxed out until the end of the timeout).
I cannot achieve high throughput and guaranteed operation. Any ideas of what might be wrong?
Conf: Raspberry Pi 4 - Raspbian GNU/Linux 10 (buster) 32 bit os, ARM pylibdmtx (0.1.9) libdmtx0b (0.7.5-3)
Output on Raspberry: timeout: 0.05, elapsed: 0.053, result: [] timeout: 0.5, elapsed: 0.502, result: [Decoded(data=b'033757', rect=Rect(left=156, top=65, width=-55, height=131))] timeout: 5.0, elapsed: 5.003, result: [Decoded(data=b'033757', rect=Rect(left=156, top=65, width=-55, height=131))] timeout: 3.0, elapsed: 3.001, result: [Decoded(data=b'033757', rect=Rect(left=156, top=65, width=-55, height=131))] timeout: None, elapsed: 15.503, result: [Decoded(data=b'033757', rect=Rect(left=156, top=65, width=-55, height=131))]
Also tried it on Mac Output on OSX: timeout: 0.05, elapsed: 0.051, result: [] timeout: 0.5, elapsed: 0.501, result: [Decoded(data=b'033757', rect=Rect(left=156, top=65, width=-55, height=131))] timeout: 5.0, elapsed: 5.001, result: [Decoded(data=b'033757', rect=Rect(left=156, top=65, width=-55, height=131))] timeout: 3.0, elapsed: 3.001, result: [Decoded(data=b'033757', rect=Rect(left=156, top=65, width=-55, height=131))] timeout: None, elapsed: 4.807, result: [Decoded(data=b'033757', rect=Rect(left=156, top=65, width=-55, height=131))]
I conclude that for such a small pic it takes less than 0.5 sec to process, but timeout is always waited (one core of cpu is maxed out until the end of the timeout). I cannot achieve high throughput and guaranteed operation. Any ideas of what might be wrong?
)