Commit History

undefined - Follow Up Deployment
68b1e39
verified

qhjk commited on

import cv2 from pyzbar.pyzbar import decode import webbrowser # Optional: Base URL if barcode contains only a product ID BASE_URL = "https://www.example.com/product/" def open_url(data): if data.startswith("http://") or data.startswith("https://"): webbrowser.open(data) else: # Assume it's a product ID; redirect to your platform webbrowser.open(BASE_URL + data) def main(): cap = cv2.VideoCapture(0) print("Scanning... Press 'q' to quit.") scanned = set() while True: ret, frame = cap.read() if not ret: break for barcode in decode(frame): barcode_data = barcode.data.decode('utf-8') if barcode_data not in scanned: print(f"Scanned: {barcode_data}") scanned.add(barcode_data) open_url(barcode_data) pts = barcode.polygon if len(pts) > 4: pts = pts[:4] for i in range(len(pts)): cv2.line(frame, pts[i], pts[(i+1) % 4], (0,255,0), 2) cv2.putText(frame, barcode_data, (pts[0].x, pts[0].y - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (255, 0, 0), 2) cv2.imshow("Barcode Scanner", frame) if cv2.waitKey(1) == ord('q'): break cap.release() cv2.destroyAllWindows() if __name__ == "__main__": main() create a dedicated website - Initial Deployment
08fab6f
verified

qhjk commited on

initial commit
c7df888
verified

qhjk commited on