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

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ต.ค. 2024

ความคิดเห็น • 63

  • @simonvillada
    @simonvillada 2 ปีที่แล้ว +1

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

  • @syaduinotech3681
    @syaduinotech3681 2 ปีที่แล้ว +3

    Superb, simple and clearly explain videos. Will try it for sure.. start with the pi zero.. hopefully its working. Anyway, hope author can also create content, how to record this qr code into the google sheet. Will be very useful for making attendance for my students. Tq sir

    • @jyvben1520
      @jyvben1520 2 ปีที่แล้ว +1

      pi zero is probably not powerful enough, that is why the video used a pi 4b (4 cores at 1500 mhz)

    • @Core-Electronics
      @Core-Electronics  2 ปีที่แล้ว

      Glad you liked it, you could import the CSV file from the second example directly into Google sheets.

    • @lachyborne4684
      @lachyborne4684 2 ปีที่แล้ว +2

      @@jyvben1520 Manged to get this and also facial recognition with a tensor flow model working on a pi zero w. It runs, but a bit slowly, really depends on what your use case is for anyone else attempting it!

  • @Fraunzi
    @Fraunzi 2 ปีที่แล้ว +4

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

    • @Core-Electronics
      @Core-Electronics  2 ปีที่แล้ว +1

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

    • @Fraunzi
      @Fraunzi 2 ปีที่แล้ว +1

      You guys are AWESOME!

  • @DarrylAdams
    @DarrylAdams 2 ปีที่แล้ว +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...

    • @Core-Electronics
      @Core-Electronics  2 ปีที่แล้ว

      That would be awesome! I'd love to see that 🙂

  • @aquarium-i2s
    @aquarium-i2s ปีที่แล้ว +1

    You are the best

  • @hackerr2656
    @hackerr2656 2 ปีที่แล้ว +1

    amazing, thanl you! 👍👍

  • @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 2 ปีที่แล้ว +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  2 ปีที่แล้ว

      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

  • @brawlstrso1732
    @brawlstrso1732 2 ปีที่แล้ว +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  2 ปีที่แล้ว

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

  • @kingkringe5090
    @kingkringe5090 6 หลายเดือนก่อน

    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

  • @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/

  • @abdurrazzak1612
    @abdurrazzak1612 ปีที่แล้ว +1

    u are awesome.

  • @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.

  • @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!

  • @waledkhaled5439
    @waledkhaled5439 2 ปีที่แล้ว +1

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

    • @Core-Electronics
      @Core-Electronics  2 ปีที่แล้ว

      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.

  • @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 😊

  • @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)?

  • @franciscruz5759
    @franciscruz5759 ปีที่แล้ว

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

  • @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

  • @electronicsnoobject3545
    @electronicsnoobject3545 2 ปีที่แล้ว +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  2 ปีที่แล้ว +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?

  • @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.

  • @terantejhastine
    @terantejhastine ปีที่แล้ว +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  ปีที่แล้ว +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 ปีที่แล้ว +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  ปีที่แล้ว +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 ปีที่แล้ว +1

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

    • @Core-Electronics
      @Core-Electronics  ปีที่แล้ว

      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/

  • @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?

  • @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