1

I have a script where I am obtaining the data matrix from scanning a 2D barcode, with my Python script. But I am unsure how to incorporate the panda library or xlsxwriter to save the output in the terminal into an Excel spreadsheet. Here is my code:

import cv2 
import time
from pylibdmtx.pylibdmtx import decode

cap = cv2.VideoCapture(1)
cap.set(3,640)
cap.set(4,480)

while True:
    ret,img = cap.read()

    
    cv2.waitKey(1)
    t0 = time.time()
    code = decode(img, timeout=100, max_count=1, corrections=3)
    if(code):
        print((time.time() - t0)*1000)
        print(code)
        print(code[0].data.decode('utf-8'))
        print(code[0].rect)    
        #x,y,w,h = code[0].rect
        #cv2.rectangle(img,(x,y),(x+w,480-y-h),(255,0,255),2)
        
    cv2.imshow('Result',img)    
        
    if cv2.waitKey(1) == 27:
        break
rehanr19
  • 11
  • 1
  • The answer to your question is available [here](https://stackoverflow.com/questions/58428146/how-to-write-decoded-data-matrix-to-dataframe). – Esraa Abdelmaksoud Apr 07 '22 at 00:30

0 Answers0