Click here to Skip to main content
15,881,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Iam using open cv and opencv to read multiple barcode scan I need to check if theres some barcode equal to each other by uaing live video by webcam i need to say of theres barcode equal to other display truee on screen theres more than one barcode at the same image i need ro find ienter image description heref there 2 text equal eacg other or not as attached pic Iam using this code


IMG-20230120-184829 hosted at ImgBB — ImgBB[^]
Iam Using This Code

import cv2
import numpy as np
from pyzbar.pyzbar import decode
 
#img = cv2.imread('1.png')
cap = cv2.VideoCapture(0)
cap.set(3,640)
cap.set(4,480)
 
while True:
 
    success, img = cap.read()
    for barcode in decode(img):
        myData = barcode.data.decode('utf-8')
        print(myData)
        pts = np.array([barcode.polygon],np.int32)
        pts = pts.reshape((-1,1,2))
        cv2.polylines(img,[pts],True,(255,0,255),5)
        pts2 = barcode.rect
        cv2.putText(img,myData,(pts2[0],pts2[1]),cv2.FONT_HERSHEY_SIMPLEX, 0.9,(255,0,255),2)
 
    cv2.imshow('Result',img)
    cv2.waitKey(1)


What I have tried:

Just Iam Try To Display Reading Barcode Only
Posted
Updated 22-Jan-23 3:27am
v2
Comments
0x01AA 22-Jan-23 6:36am    
I have some problems reading and understanding you first paragraph. Maybe you should rewrite that...
Apart from that: How is about decode the barcodes and compare the results?
omar weeka 22-Jan-23 9:27am    
As attached image
If theres apart of text inside barcode equal to other barcode that readed by webcam using python and opencv display true on screen
0x01AA 22-Jan-23 9:41am    
Sorry, again hard to understand. Try to use google translate (or similar) to translate the question written in your native language into English ;)

Furthermore: '... text inside barcode equal to other barcode ...' has a very wide range. What means equals here? One word, two words ...?


omar weeka 22-Jan-23 9:43am    
Can you find attached image to understand
I mean if theres text inside barcode equal to other text inaide other barcode diaplay or type true
0x01AA 22-Jan-23 10:23am    
What is the problem?
Barcode 1 -> Text1
Barcode 2 -> Text2

bool isSame= Text1 == Text2;

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900