Raspberry Pi LESSON 45: Using the Raspberry Pi Camera in Bullseye with OpenCV

Поделиться
HTML-код
  • Опубликовано: 14 окт 2024
  • Announcing the Most Awesome Raspberry Pi Lessons of All Times! This time we RUMBLE!
    In this class series, we will be using the most excellent Sunfounder Ultimate Raspberry Pi kit, available here: (Affiliate Link)
    amzn.to/3tSk9Mo
    or for our UK friends, amzn.to/3I5d401
    In this lesson I will show you how to use the Raspberry Pi camera on the Bullseye operating system, in either 32 bit or 64 bit mode. I will show you how to operate the camera using OpenCV.
    If you want to grab those cool little straight jumper wires I am using to keep my breadboard builds neat and clean you can snag a box of them here:
    amzn.to/36NyfHq
    If you guys are interested in the oscilloscope I am using, you can pick one up here (affiliate link):
    amzn.to/3v13Mhl
    You guys get your hardware ordered so you can follow along at home!
    You will also need a Raspberry Pi. I suggest the Raspberry Pi 4. If you do not already have one, this is the most suitable gear I could find:
    amzn.to/3pBMfKm
    The Raspberry Pi's are sort of pricy right now, so you can look on ebay or elsewhere to see if there are any deals. You will need a SD card. If you do not already have one, this is a good one:
    amzn.to/3KcXTn2
    I like using a wireless keyboard and mouse to have fewer wires. You can certainly use your USB keyboard and mouse, but if you want a nice wireless one, this one works on the pi. We demonstrate this by using a button switch to control a LED.
    amzn.to/36Rv9Sk
    You guys can help me out over at Patreon, and that will help me keep my gear updated, and help me keep this quality content coming:
    / paulmcwhorter
    [Disclosure of Material Connection: I am a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to amazon.com. ]
    #bullseye
    #opencv
    #raspberrypi

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

  • @AronAyub
    @AronAyub Год назад +14

    Hi Proff, you taught me a lot back then when I was a fresher in my early career journey, 7 years ago. Now I'm an Electrical/Electronic Engineer working as an IoT/AI Solutions dev and a tutor. Lot of thanks and I salute you !

    • @paulmcwhorter
      @paulmcwhorter  Год назад +5

      Well done! Congratulations on your success.

    • @AronAyub
      @AronAyub Год назад +3

      @@paulmcwhorter forever grateful !

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

    Thanks Paul. What I love about these courses is that it ties together classes I took in the past.

  • @drzwithcrow6075
    @drzwithcrow6075 Месяц назад

    So perpetually envious of the environment that you inhabit. Sometimes I think I watch your vids for the background as much as anything.
    Nah, just joshing, the content is great! as always. Stimulation for the imagination!

    • @paulmcwhorter
      @paulmcwhorter  Месяц назад

      We really are blessed to live in such a beautiful place. My wife are very deliberate to not become blind to the beautiful spot on the river. We have lunch every day outside on the balcony to enjoy the beautiful view of the river.

  • @markbooco1719
    @markbooco1719 Год назад +5

    Excellent lesson. Python would not work until I had to updated my bullseye firmware to get libcamera library by using: sudo rpi-update.
    Also, updated /boot/config.txt file with the following changes:
    #start_x=1
    camera_auto_detect=1
    gpu_mem=256
    Found libcamera-hello command was a good way to confirm camera is wired up correctly.

    • @pranav08112
      @pranav08112 4 месяца назад

      I am still getting " no camera available" when I am testing with libcamera-hello ..any suggestions..?

  • @qzorn4440
    @qzorn4440 2 месяца назад +1

    Thanks! I love the Raspberry Pi Camera videos with OpenCV. Thank you Paul. Also, I just found a SunFounder Video Robot Car Kit for Raspberry Pi 5 /4/3B+/3B.
    Python/Blockly (Scratch), Video Courses, Rechargeable Battery (Raspberry Pi NOT Included) Amazon $89.99 This might be one way to learn the RPi5???

    • @paulmcwhorter
      @paulmcwhorter  2 месяца назад

      Thanks! Really appreciate the support.

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

    OMG,you are my lifesaver,I tried so much ways including pi camera2 face detection program on their official repo but idk it is not working for me,but you are rockingg,Thankyou Somuuchh.If didn't saw this video my last opt was to restart all from 32bit os which will drain my entire work on 64bit.Once Thank you Paul

  • @RicardoMaciasYepez6913
    @RicardoMaciasYepez6913 9 месяцев назад +1

    A lot of thanks you made my University carrer a lot easier, masive thanks proff!!!

  • @eei2036
    @eei2036 11 месяцев назад

    Its perfect and the best pick. I tried 10 -15 videos , this gave me the desired output
    ☺☺☺☺☺

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

    Thanks a lot sir,.
    I was trying to connect the camera since last two day, But You code is so simple. I don't know why, But I was not getting any blog regarding the same.
    Thanks again

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

    Hi Paul,
    Thanks for the series. Ive learned a ton. One small note to others watching the new 5 pi cables from this kit dont fit a raspberry pi 5 slot as it is to small.

    • @paulmcwhorter
      @paulmcwhorter  8 месяцев назад +1

      These lessons are better suited for earlier version of the Pi. The 5 is really trying to become more of a desktop type machine, and less of an embedded platform. Maybe pickup a used, earlier version of the pi for the class.

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

      Thanks for the response! I have enjoyed the class a lot and learned a ton.
      Would a raspberry 3 work for this class or only a 4?
      Thanks!

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

    Hi Paul. This is awesome!
    It is hard to keep up during the summer, but I'm trying to catch up. Thanks again.

  • @RobertWood-mg4ro
    @RobertWood-mg4ro Год назад +1

    I have followed you loosely on many of your posts. Arduino, Fusion 360, etc. You're an excellent teacher. I find all of your content intriguing and I normally browse your posts as my hobby needs dictate. Thank you for all you do. Unfortunately, I popped into this lesson w/o fully understanding the 64-bit operating repercussions. As a heads up for any of your followers. If they do not install the 64-bit version, i.e. go with default settings on the PI page even though it is a 'fresh install'; they will not be successful in installing the CV-2. At some level I thought the 64-bit vs 32 would just be a performance Hicky...but no...the files structures, etc. are a bit different. Anyway, you earned a Patrion visit from me. Just for the pure tenacity of putting that all together for us. If only I would have popped into lesson 44 1st * smile * . Please keep up the good fight. Rob

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

    It is great to see the Pi camera come to life! Having done the FPS calculation in the AI course, it was a pretty quick addition to the Pi lesson. I am seeing around 18 FPS. It looks good, but is not the 30 FPS that Paul expected. Thanks for the great lesson Paul!

  • @Michael197155
    @Michael197155 7 месяцев назад

    Thanks Paul. I like this video training course. It's useful.

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

    That was a lot of fun, thanks for your effort and great video production.

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

      Things get fun now we can use the camera.

  • @andrewnorburn
    @andrewnorburn 11 месяцев назад

    excellent Video - got the camera working in minutes

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

    Thanks for this interesting new way of using the Pi camera. 😀

  • @cadmanof50s
    @cadmanof50s 7 месяцев назад

    Hello Paul. Firstly thank you for putting on these great tutorials. I am having a problem with lesson 45, Getting some errors when installing opencv. Is there somewhere I can go to get assistance? Thank you in advance. Vic

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

    This is exciting stuff. Looking forward to seeing where you take us from here.

  • @BerndBraun-qp9dt
    @BerndBraun-qp9dt Год назад +2

    Hello Paul. I enjoy your tutorial in this series very much here in Solingen in Germany. Thanks al lot for that. As I'm using Visual Studio Code on my PC, I was very pleased to see that in bullseye this is shown as a Recommended Software. So I installed it and it works very fine with all that very helpfull stuff in programming. It makes coding much easier than in Geany or Thony, which of course I tried as well. Perhaps it's usefull for your community to know that and try that tool. Best regards Bernd

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

      Thanks Bernd und grüße aus Wuppertal!

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

      Grüße aus Mettmann… 😃

  • @stefan_balint_youtube
    @stefan_balint_youtube 11 месяцев назад

    thank you for this valuable lesson

  • @MichaelCarbaugh-q3n
    @MichaelCarbaugh-q3n Год назад +1

    Paul just completed 1 thru 44 no issues went great. THANKS Now lesson 45 I installed cv2 as shown in lesson 45
    Says sucessfully installed . If type python it says not found. If I type python3 details are show. When I type import cv2 i get the same error as the other student import error can not open shared drives .
    Please advised im lost. 1 to 44 went great

    • @MichaelCarbaugh-q3n
      @MichaelCarbaugh-q3n Год назад

      Found the issue. Had not installed 64 bit yet. Folded like a cheap WM lawn chair

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

    Great lesson today! Will be working on updating my bullseye and doing homework and getting pico w loaded with micropython. I am up for live stream tomorrow night!!

  • @EnergySeeker
    @EnergySeeker 9 месяцев назад

    nice ideo i love it , can we put this video in format mjpeg and how ? and one more question can we stream that video and how , thanks

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

    I now have three CSI cameras. I tested each of them and the results are listed below. I did notice some lag, but I was using VNC viewer. I dont have a spare screen to verify if that is the cause of the lag. I set the start time prior to the capture statement and the end time after the show statement. I then increment the frame count and add the calculated frame time to the total time. After quit, I divide the frame count by the total time to get the FPS.
    Arducam Camera OV5647
    5MP 1080P day/night
    FPS Res
    31.04 1920X1080
    44.44 1280X720
    24.01 480x360
    Sunfounder Camera
    FPS Res
    30.238 1920X1080
    48.939 1280X720
    19.371 480x360
    Raspberry Pi Camera V2
    FPS Res
    35.809 1920X1080
    65.226 1280X720
    40.724 480x360

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

    Think I got the home work. I also tried different resolutions. When I went to 640x360 seems to slow my fps but not as much as 1920x1080. Thanks for this lesson.

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

    Hi Paul, Another high value session. I will be trying to add camera to my current Pico W project and expect this knowledge will be transferrable to Pico. Best regards, Ed

    • @Gerald-iz7mv
      @Gerald-iz7mv Год назад

      I think you cant use pico with raspberry pi camera modules…

  • @lontongtepungroti2777
    @lontongtepungroti2777 11 месяцев назад

    thank you very much Mr. Paul you're awesome :)

  • @paulzhu8436
    @paulzhu8436 10 месяцев назад

    Paul, you are awesome!

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

    Hi Paul, first of all thank you for your time and very useful tutorials. Could you put somewhere source code of program you created on tutorials?

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

      No, my objective is to teach people to code, and do not want to tempt people to just copy and paste my code.

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

      @@paulmcwhorter Once again thank you for your time.

  • @MichaelCarbaugh-q3n
    @MichaelCarbaugh-q3n Год назад +2

    Lesson 45 new 64bit Pi added downloads as instructed . Python echoed 3.9.2 cv2 echoed 4.6.0 vcgencmd getcamera returns zeros
    Run program I get :
    Traceback (most recent call last):
    File "", line 3, in
    File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 254, in __init__
    raise RuntimeError("Camera __init__ sequence did not complete.")
    RuntimeError: Camera __init__ sequence did not complete.
    I even copy paste you program Same thing. Paul love you videos and you are a great teacher.
    Also configuration on the new 64 bit Bullseye does not show option to select camera , Should it ?
    Just need someone outthere to point me in the right direction .

  • @Gerald-iz7mv
    @Gerald-iz7mv Год назад

    Hi nice video. Do you have a like to the pir sensor you mention?

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

    you're just amazing ! Thank you very much ❤️

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

    on the fps script, I had to remove the line picam2.preview_configuration.controls.FrameRate=30 to obtain the video with FPS. I am using the USB camera from your previous AI series on the pi400 and obtain FPS of about 20.

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

    I cannot seem to catch up. I am on 14. Can start here or is there stuff I really need to know before I start this lesson

    • @paulmcwhorter
      @paulmcwhorter  Год назад +2

      This is sort of a late place to start. I would try to do the earlier lessons.

  • @MyWTFName
    @MyWTFName Месяц назад

    I was confused why the output was lagging on my machine, I recorded it to an AVI file and playback quality was excellent. I assume the lagging I saw while running the code real time was from the VNC viewer WiFi connection.

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

    Hi Paul, the recommended Raspberry Pi kit is not available currently on Amazon. Any other kit you might recommend for compatibility with your tutorials.

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

    Ok i got it working 😁👍i don't know what it was i couldn't find it . But it works ❤

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

    Hey Paul, I have completed your Arduino series and am now looking to get into this series. I just have one question, can I complete this series with the pi 4 model b or does it have to be the pi 4 model a. Thanks.

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

    Hello Paul, Thank you very much for the video. I have a doubt regarding the camera module. So, I am trying to use ROS on Raspberry pi to build a RC Car due to which I had to install Ubuntu on my Raspberry pi. However, the camera that I have (Freenove 8MP) does get detected by Raspberry pi but does not capture any frames. Can you please assist what I should do in this case?

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

    Hi,
    Many thanks for one more excellent tutorial.
    I have followed the instructions using the Raspberry Pi HQ camera.
    It all works smoothly, however, it looks like the Red and the Blue channels are interchanged.
    Blue things look Red, Red things look Blue, and Green things look Green (as well as white).
    Looks like an RGB BGR issue.
    Do you have any idea what's wrong?
    Thanks.
    Nahum Budin.

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

      To prove the interchanging, the following fixes the display: frame[:, :, [2,0] = frame[:, :, [0,2]]. Nahum.

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

    i do not have a pi camera, I am using a USB webcam instead, what shoud i change in my code to get the same results.

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

    Can i use this in a virtual enviornment?

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

    So far so good, but what if you use OpenCV to open the camera and grab a frame. Did you find a solution, why it's not possible to use cv2.VideoCapture(-1, cv2.CAP_V4L2)

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

    Hi sir, I'm doing a project, for now, can you help me? How can I enable two web cameras at the same time?

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

    I fired up a new my newly delivered RPi 4B today. I tried to install opencv as I did last on my older 4B running Bullseye and it didn't work. A newer version of opencv is available. I installed opencv without specifying the version number and I didn't get any errors installing it. pip install opencv-python

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

      The possible issue will come in that we will be on different versions of opencv, and will my future demos work on your version. I would really try and see if you can get my version installed, that would be safest.

  • @arihantsinghi9110
    @arihantsinghi9110 11 месяцев назад

    Hey, i am working in a virtual environment. I successfully installed cv2 library in it, but I am unable to install Picamera2 library. Can you help. Thanks

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

    A shift to Python from Debian Linux enabling expanding market for Pi Camera for the several knock-off SBC on the market today. RaspberryPiOrg, et al, showing lack of loyalty by not including the breadth of required code to operate PiCam with Bullseye before its release.🤬
    Backward compatibility is a fable.
    looking anxiously for saving video to file??

  • @davidhenry2927
    @davidhenry2927 9 дней назад

    After starting with a fresh install of Bullseye 64 and installing opencv-python, import cv2 complains about a host of missing dependencies. A few minutes with google shows this to be a common problem but I never found the correct solution. Any help greatly appreciated.

    • @davidhenry2927
      @davidhenry2927 8 дней назад

      Well that was interesting. Upon making a fresh SD with Bullseye I noticed that there are 2 desktop images, one with security updates and desktop environment and another with recommended applications. On my previous attempt I'd used the first option, now I tried the second option. Bingo!! Everything works just fine. I suppose it stands to reason that importing applications also drags in a lot more python libraries.

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

    it's working but the footage I am getting looks zoomed. any solutions?

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

    Greetings from Nigeria, did you use Python programming language for the pi camera

  • @RIPlly
    @RIPlly 2 месяца назад

    I wonder, will this also work with raspi 5 and camera v3?

    • @paulmcwhorter
      @paulmcwhorter  2 месяца назад +1

      The lessons will work with a pi 4. Lots of things changed on the pi 5

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

    Hi Paul, I wonder if you have a Discord server to get in touch with followers of the channel. They work great to share and ask for help on common topics of interest.

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

      No, just too much to try and moderate and monitor a discord server. Maybe at some point.

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

    Does picamera2 have the possibility to access two different cameras in one script? Would be nice to know!

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

      I think it is possible but would run slow with two cameras

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

      @@paulmcwhorter Thanks for the Response. What would you recommend for using 2 cameras?

  • @BrianBeam-nl4lw
    @BrianBeam-nl4lw Год назад +1

    Hello all. All went well with no errors until i type "import cv2" i get " ImportError: libcblas.so.3: cannot open shared object file: no such file or directory" any suggestions

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

    Hello I tried this but I can’t get a good frame rate even if I lowered my resolution. I get around 20fps when I reduce the resolution to 360x360. Please help me fix this guys. Thanks in advance.

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

    Homework posted ruclips.net/video/c6Jr0tHpXKc/видео.html
    I also show my design of a holder for the Pi Cam and included the Fusion 360 file in the description. I also added a little show and tell of what I have been up to over the holidays.

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

    Another great learning exercise, Paul! Here is the link to my homework: ruclips.net/video/iEcdQCwPulo/видео.html
    I cannot figure out why I am only measuring about 15 fps. I took out the print statement that I was using for troubleshooting, but surprisingly, that doesn't do anything to the fps.

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

    Here is link to my homework for this lesson, ruclips.net/video/5r9Raz-hIlM/видео.html. There was a considerable amount of head scratching to get it done. Thanks Paul for doing these videos.

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

      James, nice work, but I think you are not getting an accurate number. There are lots of lines of code not between your two measurements of time. You need as much of the loop code as possible between these two lines of code, as each line takes some time to execute, and hence code not between your two time measureuments are not being accounted for. Nice work, think on it a little more.

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

    Here is an update to my homework for lesson 45, ruclips.net/video/FMmEJTisfFA/видео.html

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

    Homework ruclips.net/user/shortsH0ovfTPWvVM?si=eC-46tTcvTullI43
    FPS is based on lighting

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

    if you ever need an idea on lessons, im trying to learn something called ROS to run on a raspberry pi

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

      I have tried ROS several times and found it very frustrating.