How To Scan QR Codes With A Raspberry Pi + OpenCV + Python

Поділитися
Вставка
  • Опубліковано 27 лис 2024

КОМЕНТАРІ • 59

  • @simonvillada
    @simonvillada 2 роки тому +1

    Amazing! I think its the best video tutuorial I have ever seen!

  • @DarrylAdams
    @DarrylAdams 3 роки тому +2

    I have not been to our makers space for a while (Covid was only part of the reason *sad*) but the boom gate we had was triggered by a pi accessing a remote control button. This could be even better as it could log details of each member. Interesting if you could use one pi to scan then broadcast to another so that the remote can be protected so people don't push the remote button...

  • @Fraunzi
    @Fraunzi 3 роки тому +4

    Can you please make a face tracking pan tilt raspi camera tutorial? Love these videos!

    • @Core-Electronics
      @Core-Electronics  3 роки тому +1

      Absolutely, next weeks episode will cover that very topic. 👍

    • @Fraunzi
      @Fraunzi 3 роки тому +1

      You guys are AWESOME!

  • @brawlstrso1732
    @brawlstrso1732 3 роки тому +2

    Hey, would I be able to connect the cables to the GPIO pins and light up the LEDs without using a breadboard? I only have cables and resistors

    • @Core-Electronics
      @Core-Electronics  3 роки тому

      If you have a steady hand you can always solder this set up together, eliminating the need for the breadboard.

  • @asangalo
    @asangalo 2 роки тому +1

    Really great video! Congrats! Can you tell me what best cost-benefit relation camera to read a qr-code of 6 x 6 inches from 5 meters of distance?

    • @Core-Electronics
      @Core-Electronics  2 роки тому

      To manage that 5 Meters of distance I would want to use a lens I could zoom in with. Something like the Telephoto Camera Lens in combination with the HQ Camera Module. Linked both here - core-electronics.com.au/catalog/product/view/sku/CE06936 & core-electronics.com.au/catalog/product/view/sku/CE06935

  • @Marc-qf8bs
    @Marc-qf8bs 3 роки тому +1

    Thanks for the great video. Everything worked so far. I would also like to read in a data matrix code with your program. Unfortunately it doesn't work, can you help me?

    • @Core-Electronics
      @Core-Electronics  3 роки тому

      Nice mate! Glad the system is working for you. Because data matrices are encoded differently from QR codes the library we are using here won't understand them. However the | libdmtx | is purpose built to decode data matrices and is exactly what you should use.
      To incorporate this new library into Open-CV code have a look at this example - stackoverflow.com/questions/59989893/datamatrix-with-raspberry

  • @PusherAtUrDoor
    @PusherAtUrDoor 2 роки тому +1

    Hey! great video! just what I needed! all works as showed, however my camera is having a 5 -10 second delay. im using raspberry pi 3B+ (1gb) and rasp pi cam V1.3. What could be the issue, what do you think? Not enough ram?

    • @Dan070
      @Dan070 2 роки тому +1

      Hey. I'm doing the same thing. You've already said the answer in short. OpenCV is HEAVY for a rpi. Pi 4 you can have more fps... but pretty much im getting 1 or 0.5 fps when using a camera + opencv on 3b.

    • @Core-Electronics
      @Core-Electronics  2 роки тому

      The only issue with this type of computer vision is the computational power required to do it. Definitely using the slightly slower Raspberry Pi 3B+ is the issue here.

  • @thejopal7111
    @thejopal7111 2 роки тому +1

    Great video! Is there a way to stop getting multiple readings of the same QR code stored in the csv? The text file currently does not store the data even though it is displayed in Thonny. Is there a way to fix this?

    • @Core-Electronics
      @Core-Electronics  2 роки тому

      So there are three codes in the download section. The CSV code will store and save the data to the text file. Just open the text file once you have stopped the code.
      To stop multiple readings of the same QR Code you will need to alter the code slightly by adding an If statement. That way when it see the same QR code it will ignore it.

  • @excellent_self_2294
    @excellent_self_2294 2 роки тому +2

    Thanks for the video. I had a bit of an issue using the buster legacy image from pi imager (released 2022). The installation work but when using it in python (same way as your code), it doesn't work, it returns error : vidioc_qbuf invalid argument. Some sources said to increase gpu mem to 128 or even 144 but that didn't work.
    I reinstalled your image (from link) this time when doing sudo modprobe bcm2835-v4l2: it doesn't work (error : fatal, not found).
    can you please guide me to solve this issue, I have been struggling for weeks with the csi camera, given that my code was tested on ubuntu server and didn't work because of csi camera issue.
    Thanks :)

    • @Core-Electronics
      @Core-Electronics  2 роки тому

      Totally interesting errors. Come make a comment at the bottom of the full write up article with some screenshots of your errors. I'll best be able to help you get your system up and running that way 😊

  • @sidraines
    @sidraines 2 роки тому +1

    Love the video. Can the same set up work for normal barcodes?

    • @Core-Electronics
      @Core-Electronics  2 роки тому

      Absolutely and the code will be simpler. Have a look at what the OpenCV team has created - opencv.org/recognizing-one-dimensional-barcode-using-opencv/

  • @kingkringe5090
    @kingkringe5090 8 місяців тому

    i tryed this reciently w the new bookworm os but it seems the camera code is all broken/dependencys failed to install ;c, gonna try with the old OS

  • @terantejhastine
    @terantejhastine 2 роки тому +1

    Is it possible to read the QR code that contains Pdf file url link from our database and print it immediately (just make sure the printer is connected to the raspberry pi)

    • @Core-Electronics
      @Core-Electronics  2 роки тому +1

      You should definitely be able to do that. I've been searching around for Python Libraries to make interfacing to a normal printer really easy but yet to find a perfect one for a Raspberry Pi system. CUPS may be what you need (along with some script writing) - www.cups.org/doc/overview.html

    • @terantejhastine
      @terantejhastine 2 роки тому +1

      @@Core-Electronics Thanks, cause I've been watching a lot of videos about CUPS now. I will use a raspberry pi camera module 2 to scan the qr code using OpenCV . My only concern is what will be content of that qr code. I'm thinking if i can put a task/instructions on the qr code (that orders to print the file associated on it once scanned)

    • @Core-Electronics
      @Core-Electronics  2 роки тому +1

      QR Codes can Definitely Link to Websites which can then have the desired subject to be printed. Then all the orders/instructions to do the printing can be running on a Python script operating in the background.

    • @terantejhastine
      @terantejhastine 2 роки тому +1

      @@Core-Electronics Thanks I'll comeback here once I made progress.

    • @Core-Electronics
      @Core-Electronics  2 роки тому

      Hit up our Forum if you need any extra help! Much easier for us to help you there 😊 You'll be able to send through pictures - forum.core-electronics.com.au/

  • @franciscruz5759
    @franciscruz5759 Рік тому

    hello, can i do this without any problem in raspberry pi lower versions like 3-1?

  • @hackerr2656
    @hackerr2656 3 роки тому +1

    amazing, thanl you! 👍👍

  • @karique01
    @karique01 2 роки тому

    is it possible to modify your source code so that it only recognizes qrs and barcodes in pairs (which will be very close together)?

  • @waledkhaled5439
    @waledkhaled5439 3 роки тому +1

    very nice video .. can i do this on a streaming live video ?

    • @Core-Electronics
      @Core-Electronics  3 роки тому

      Any video feed that you can get into the Raspberry Pi can have this computer vision system evaluate it 😊 you may just have to tinker with the code. Then that information can be sent out of the Raspberry Pi in all different ways.

  • @rogeriohartungtoppa3109
    @rogeriohartungtoppa3109 Рік тому

    Do you know how to read micro qrcode using python? If is possible, could you make a video to explain the steps to create a script? Thanks from Brazil!

  • @shreyadhume8906
    @shreyadhume8906 2 роки тому +2

    Hello,
    I am getting this error :
    Overload resolution failed: > - Can't parse 'pt1'. Sequence item with index 0 has a wrong type

    • @Core-Electronics
      @Core-Electronics  2 роки тому

      Sounds to me like it can't locate the camera. What kind of camera are you using with this system? Also what version of Raspberry Pi OS are you using? I highly recommend using the older 'Buster' Raspberry Pi OS for this application. Come pop me a comment at the bottom of the full article page if you keep running into issues.

    • @shreyadhume8906
      @shreyadhume8906 2 роки тому +1

      @@Core-Electronics I'm using buster. And NoIR camera.

    • @Core-Electronics
      @Core-Electronics  2 роки тому

      Cheers mate, type and enter the following into a new terminal window.
      raspistill -t 0
      If that doesn't open up a camera feed straight away (which you can close with CTRL-C) then double check that the camera is enabled in the Raspberry Pi Configuration Menu and that all the ribbon cables are connected securely and are right way around. If that doesn't fix it come jump onto our Core Electronics Forum as we can help you better there.

    • @coreelectronicssupportteam6775
      @coreelectronicssupportteam6775 2 роки тому +1

      ​@@Core-Electronics Went through and checked it, I have it working over here. The problem could be to do with the v4l driver. That happens when you type and enter the below into your terminal.
      sudo modprobe bcm2835-v4l2

    • @shreyadhume8906
      @shreyadhume8906 2 роки тому

      @@Core-Electronics camera is working, when I run the code it pops up the preview window but I'm getting that error. Also, don't know how to start new topic on core electronics forum.

  • @electronicsnoobject3545
    @electronicsnoobject3545 3 роки тому +1

    I'm newbie and have problem installing library like this:
    "Package libqtgui4 is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsolete, or is only available from another source".
    Can you help me? please

    • @Core-Electronics
      @Core-Electronics  3 роки тому +1

      I absolutely can. Your problem is arising because currently there is compatability issues between Open-CV and the new 'Bullseye' OS. Flash and utilise the previous 'Buster' OS and you won't have this issue. core-electronics.com.au/tutorials/flash-buster-os-pi.html

    • @electronicsnoobject3545
      @electronicsnoobject3545 2 роки тому

      @@Core-Electronics thankyou so much bro. it works🙏

    • @HaloHaunter360
      @HaloHaunter360 2 роки тому

      @@Core-Electronics if one does this, should they avoid using the get apt update and upgrade? will they just update it back to bullseye?

  • @aquarium-i2s
    @aquarium-i2s Рік тому +1

    You are the best

  • @kysevader
    @kysevader 2 роки тому

    If I didn't want a Camera , but rather to screenshare a QR code , what would I do? Get rid of the webcam but still gain the data off of, the QR code

  • @ssj5omar
    @ssj5omar 2 роки тому +1

    I am getting Unable to locate package python3-opencv~ when trying to apply the install python3-opencv command. I am using raspberry pi zero W. Searched everywhere to fix this and nothing. Anyone have an idea?

    • @ssj5omar
      @ssj5omar 2 роки тому +1

      Going to trying using Buster OS. Hopefully this fixes it.

    • @ssj5omar
      @ssj5omar 2 роки тому

      pip3 install opencv-contrib-python==4.1.0.25
      sudo modprobe bcm2835-v4l2. Now these two aren't working but i got this far at least. For the pip install im getting a "THESE PACKAGES DO NOT MATCH THE HASHES FROM REQ...." error. I have tried deleting the cache directory and specifying no cache directory to no avail.
      And for the sudo modprob command im getting a "modprobe: FATAL: module bcm2835-v412 not found in directory /lib/modules/5.10.17. Im guessing that one depends on the previous command?

    • @Core-Electronics
      @Core-Electronics  2 роки тому

      100% that will sort you, I rebuilt this yesterday to confirm continued full operation and all was well

    • @ssj5omar
      @ssj5omar 2 роки тому

      @@Core-Electronics Thanks alot for the reply I appreciate it! Did you see my most recent message? Im getting a "THESE PACKAGES DO NOT MATCH HASES FROM.." error when trying to use pip3 install opencv-contrib-python==4.10.25. This is after using Buster OS. Any ideas or tips?

  • @abdurrazzak1612
    @abdurrazzak1612 Рік тому +1

    u are awesome.

  • @NadavFedida
    @NadavFedida 2 роки тому

    Really nice tutorial, just noticed i'm getting an error with "libqtgui4: saying not available. currently have Rpi4b os-version 11(bullseye). Any suggestions how to overcome this?

    • @NadavFedida
      @NadavFedida 2 роки тому +1

      "E: Unable to locate package libqt4-test
      E: package 'libqtgui4' has no installation candidate"

    • @Core-Electronics
      @Core-Electronics  2 роки тому +1

      Hey mate, perhaps the library has been updated. Try running this command | sudo apt-get install libqt5gui5 libqt5webkit5 libqt5test5 | and tell me how you go