Scan QR codes and barcodes with Python

Поделиться
HTML-код
  • Опубликовано: 11 дек 2024

Комментарии • 79

  • @sravanjosh1218
    @sravanjosh1218 3 года назад +9

    Hey Kostadin, Thanks a lot for the video. It was really helpful. I'm that introvert who would watch videos and go silent without commenting in it. This video demands appreciation. Thanks again for the video.

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад +1

      Hey Sravan, thanks a lot for your comment, it is much appreciated :)

    • @Frank-xx6rs
      @Frank-xx6rs 2 года назад +1

      I just felt the need to add +1!

  • @Sinclair393
    @Sinclair393 2 года назад +1

    Thank you for posting this video, python just became less intimidating to me. Thanks again.

    • @Pythonenthusiast
      @Pythonenthusiast  Год назад +1

      I wish you lots of success in your journey, you can do it! :)

  • @vaibhavsrivastva1253
    @vaibhavsrivastva1253 5 месяцев назад

    *HELPFUL TIPS* (will update) :-
    1. myVidCap = cv2.VideoCapture(0, cv2.CAP_DSHOW) # CAP_DSHOW api opens camera MUCH faster than CAP_MSMF, at least on Windows.
    2. flippedHorizontal = cv2.flip(frame, 1) # Flipping the output about the Y-axis.
    cv2.imshow("Testing-Code-Scan", flippedHorizontal) # Change "frame" to the operation carried out on it.

  • @etigorkhe41
    @etigorkhe41 2 года назад

    Did this and loved it. Thankyou soo much!

  • @IsaacMoore-un9hc
    @IsaacMoore-un9hc 2 года назад

    To scan UPC-A barcodes would I still use utf-8 or would it be a different format of decoding? I scanned a pack of gum and it registered as EAN13 even though it is UPC-A, however when I tried to scan a drink can, it would not register. How can I fix this?

  • @kgoulas21
    @kgoulas21 8 месяцев назад

    Hi,
    This is great! May I ask if this would work with a Data Matrix?

  • @te_b4_69_parmesh_walunj3
    @te_b4_69_parmesh_walunj3 3 года назад +1

    Hello Kostadin, how to connect the USB barcode scanner device to the code you have shown in the video? Thanking you in advance for your help!

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад

      Hey there. I don't think there's one answer that would be correct for all barcode scanners. But, you can take a look at the link below:
      www.instructables.com/USB-Barcode-Scanner-Raspberry-Pi/
      Basically, you need to have the option to add the code to your barcode scanner. However, you can think outside of the box. A scanner doesn't have to look like a regular scanner, it can be your phone.

  • @Oussama-qp2hh
    @Oussama-qp2hh 3 года назад

    Thank you so much bro.
    I have a conflict, how add the code reader instead the camera?
    I hope to answer me

  • @vivektiwari4511
    @vivektiwari4511 2 года назад

    Can we get the details(price) and store(price) in SQLite(database)

  • @mustaqim6642
    @mustaqim6642 3 года назад +7

    Hello Kostadin. Your tutorial is very helpful. Can i know, how can i put the data that was printed into a variable. Then, i can just use the variable to play around with the data such as insert into a database. Thank you in advance for your help!

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад +5

      Hi Mustaqim, thanks for your question. If you want to create a variable (let's name that variable x), you can use x = code.data.decode('utf-8'). Then you can work with the variable. Hope this helps!

  • @joacimjohnsson
    @joacimjohnsson 3 года назад

    Hi, is the pyzbar only handling type EAN13 and QRCODE? I have once lable which is not seems to be working ... just wonder how many types pyzbar could handle...

  • @cocopalafox3918
    @cocopalafox3918 3 года назад +2

    Great video, thanks for posting it. How do you stop the camera and get out of the while loop after reading ONE barcode? Thanks

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад +2

      In the code, I am using time.sleep(5), which waits for 5 seconds after finding a code. If you want to completely get out of the loop, here's how you would do it:
      1. Take a look at the while look, it starts with while camera == True. So, while camera == True, it will keep running.
      2. In the first if-statement, instead of having time.sleep(5), you can add a line camera == False (or replace the time.sleep one with this.
      What this would do is, once a barcode is found, it would set camera to be False and therefore get out of the while loop.
      I hope this helps!

    • @cocopalafox3918
      @cocopalafox3918 3 года назад +1

      @@Pythonenthusiast Thank you so much for the quick reply.

    • @kyawzinhtet1704
      @kyawzinhtet1704 3 года назад +2

      Add a line camera == False? I think camera = False.

    • @sravanjosh1218
      @sravanjosh1218 3 года назад

      @@kyawzinhtet1704 I guess its camera == False.

    • @alexportugal3986
      @alexportugal3986 3 года назад

      @@sravanjosh1218 definetly camera = false. You want to set the variable to false so only one =. With 2 you would use to check if camera is false --> camera == false

  • @KartihkCg80
    @KartihkCg80 3 года назад +1

    if it possible using raspberry pi zero w and camera to build a barcode scanner using tis code?
    plz replay sir, if this works i like to build a portable scanning devices!

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад +1

      It is absolutely possible :)

    • @KartihkCg80
      @KartihkCg80 3 года назад

      @@Pythonenthusiast one more question sir, "pyzbar" is that a package?

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад +1

      @@KartihkCg80 Yes, it is a package/library that can be installed as any other.

    • @KartihkCg80
      @KartihkCg80 3 года назад

      @@Pythonenthusiast thank you so much sir 🖤

  • @raghuram1291
    @raghuram1291 3 года назад

    Do this code work for barcode scanning machine than webcam..?

  • @ahmedbahaaulddin1606
    @ahmedbahaaulddin1606 3 года назад

    could this code be used within flask
    ??

  • @KudoMarkos
    @KudoMarkos 3 года назад

    Hello @ Kostadin Ristovski , i would like to know if i use cv2 in a BeeWare python app, built it in Android. It would use the cam of the phone??? Or are more things necesary??

  • @mohanprasath4666
    @mohanprasath4666 Год назад

    Hello, wonderful demo !!! Can you help me resolving the below issue pls ?
    When I use import statement as "from pyzbar.pyzbar import decode" and run the code (without any other executable lines), am getting the error "ImportError: Unable to find zbar shared library".
    P.S - I did brew the ZBAR and then installed the PYZBAR as mentioned in one of the forums but still no luck...
    Thanks in advance !

  • @mangotofu1360
    @mangotofu1360 2 года назад

    Thank you this helped!

  • @vijayreddykondapally3836
    @vijayreddykondapally3836 2 года назад

    how can i stop the scaaning once system able to recognize the QR .. please suggest

    • @Pythonenthusiast
      @Pythonenthusiast  2 года назад

      Try to create a loop that breaks when a QR is found.

  • @jorgeluizdossantos2376
    @jorgeluizdossantos2376 2 года назад

    Thanks a lot for this video. It's very helpful.

  • @frroossst4267
    @frroossst4267 2 года назад

    Great tutorial!

  • @group3cpe95
    @group3cpe95 2 года назад

    Hello Kostadin, Thank You very much for this video, do you perhaps know how to close the video capture? When i close the ui of the camera it just kept on coming back, do you know what to do with this?

    • @Pythonenthusiast
      @Pythonenthusiast  2 года назад +1

      There are many ways to do that, probably the easiest one is to break when a QR code is found.

    • @group3cpe95
      @group3cpe95 2 года назад

      @@Pythonenthusiast Thank You

  • @tinylittleanj2
    @tinylittleanj2 2 года назад

    This is fantastic.
    Thank you

  • @UTechHacks
    @UTechHacks 4 года назад +2

    Awesome content buddy.

  • @Mystery_Glitch
    @Mystery_Glitch 3 года назад

    I think it should be change to if the same code not get scan in a minute , it can rescan , it should be better if you make a bought list in supermarket

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад

      In the supermarkets I have noticed two types of scanners:
      1. Fixed ones that are built in the table, where they scan constantly, until there is a product. Then, there is a stop for a second or two before they start scanning again. This is to ensure that the same product is not scanned multiple times at once.
      2. Portable ones, where the scanning starts by pressing (and sometimes holding) a button. Once a product is scanned, the same one/two seconds stop is applicable for the same reason.

  • @rickyricardo75
    @rickyricardo75 4 года назад

    Great tutorial !!
    Question: Do you know if there's a way to run some code from the Atom editor into IDLE-Shell without having to open the folder where my py file is located then right-click on it and select "open with > IDLE..." it's quite tedious when testing. Thanks!

    • @Pythonenthusiast
      @Pythonenthusiast  4 года назад +1

      Hi Ricky, if you have a .txt file, by double-clicking it, it would open in a word-processing program, such as notepad. The reason for that is, well, you can't do anything else with the file.
      However, if you have a .py file, it can be edited, but also run. So, by double-clicking it, you access its main function, to run the code written inside. If you want to edit it, you have to right-click and open via IDLE for example.

  • @rohitkhandal6442
    @rohitkhandal6442 2 года назад

    Hello kostadin,
    Importing pyzbar showing me an error
    Could not find module 'libiconv.dll' (or one of its dependencies). Try using the full path with constructor syntax.
    please help!!

    • @Olivernipples
      @Olivernipples Год назад

      hey did you find the solution?

    • @neonyt6739
      @neonyt6739 5 месяцев назад

      @@Olivernipples did you find?

  • @chadwick9718
    @chadwick9718 2 года назад

    Hello this is one of the best cv tutorial i ever watched. can i add script on this code where once i click the button this python code will run?

  • @chrizzchan6800
    @chrizzchan6800 6 месяцев назад

    part 2??? and 3??

  • @puzobaklan
    @puzobaklan 4 года назад +1

    Hello Kostadin!
    Firstly, thank you for good tutorial!
    I have a question about how can I use jpeg-file with QR Code that I got, for example, by taking photo of some item in supermarket

    • @Pythonenthusiast
      @Pythonenthusiast  4 года назад +2

      Hi there. The tutorial starts with decoding an image and extracting the information from a QR-code. If you have a jpeg file, then it would be the same. You need to "read" the image with cv2, then decode it and you can extract the data. Hope this helps!

    • @puzobaklan
      @puzobaklan 4 года назад

      @@Pythonenthusiast but, I saw in the documentation, that there are two ways to read an image file in to the pyzbar: with PIL and with Open CV.
      What is your favorite way, and why?

    • @Pythonenthusiast
      @Pythonenthusiast  4 года назад +2

      @@puzobaklan Well, both PIL and Open CV allow you to read an image. PIL (short for pillow) is more usable for image manipulation/processing. So for example if you want to resize an image or cut it. Open CV is a computer vision library, which is suitable for complex vision-related tasks or live videos.
      Hope this helps!

    • @puzobaklan
      @puzobaklan 4 года назад +1

      @@Pythonenthusiast many thanks!

  • @SadButTrue206
    @SadButTrue206 3 года назад

    hello kostadin. I really enjoy your tutorial, can i know that can I use it for the mobile app which is implemented by Kivy, such as using camera from smartphone, then read it then the returned data can be used for sth else. by the way, is there any solution to tracking the scanned time of the QR code, thanks!

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад

      Hi there, thanks for the question. All of what you have mentioned is possible. I am not that familiar yet with mobile app development, but Kivy library was recommended to me, so maybe you can combine this tutorial with the Kivy library and create an app as you describe. As for the scanned time, you can take a look at datetime, there's a function datetime.now() that would return the current time. Hope this helps!

  • @tojoeinstein5558
    @tojoeinstein5558 Год назад

    how to make it with tkinter?

  • @killbillk4286
    @killbillk4286 3 года назад

    how do i put the webcam inside a tkinter window

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад

      Maybe the link below would help you out.
      stackoverflow.com/questions/16366857/show-webcam-sequence-tkinter

  • @patrickstar1394
    @patrickstar1394 3 года назад

    can you paste the code because I'm getting errors when copied your code

    • @mjroma9298
      @mjroma9298 3 года назад

      What error do you get? Is it fix now?

  • @moneyodsg
    @moneyodsg 3 года назад

    how does one install cv2

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад +1

      Check the link below:
      pypi.org/project/opencv-python/

    • @moneyodsg
      @moneyodsg 3 года назад

      @@Pythonenthusiast thanks, found it

  • @crajeextreme8469
    @crajeextreme8469 3 месяца назад

    this is some good shit

  • @M0ntanaT
    @M0ntanaT 2 года назад

    👍👌🙏🙏🙏

  • @mickscience3830
    @mickscience3830 2 года назад

    Man codes in light mode i dont trust him

  • @tanmeowsoon5252
    @tanmeowsoon5252 3 года назад

    Hi Sir can i want learn from you how can it learn step by step can text us ,
    Thanks you,

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад

      Hi Tan, sorry I cannot fully understand your message.

    • @tanmeowsoon5252
      @tanmeowsoon5252 3 года назад

      @@Pythonenthusiast Hi Sir i want to learn from you is good that i can get more detail form you i am from Singapore after watch your video is a great thing ,
      Many Thanks,
      Tan MS

    • @Pythonenthusiast
      @Pythonenthusiast  3 года назад

      My email is stated on my RUclips profile, so you can reach out to me with any questions that you might have.

    • @tanmeowsoon5252
      @tanmeowsoon5252 3 года назад

      @@Pythonenthusiast Hi Sir i did see your address can pass to me ,
      Many Thanks,
      Tan Meow Soon

    • @tanmeowsoon5252
      @tanmeowsoon5252 3 года назад

      @@Pythonenthusiast Hi Kostadin i want to learn the way you do the python program for the barcode,
      by using the Pc cameras how can i go to your Tutorial step by step ?
      can guide me ,
      Many Thanks,
      Tan Meow Soon

  • @voil6161
    @voil6161 Год назад

    I hate tutorials like this. Whats the point of making a barcode scanner with Python if youre gonna import all of the code anyway. Theres no good tutorials out there. Everybody just imports everything and calls it a day.