Raspberry Pi Remote Camera

The #1 community for Gun Owners of the Northeast

Member Benefits:

  • No ad networks!
  • Discuss all aspects of firearm ownership
  • Discuss anti-gun legislation
  • Buy, sell, and trade in the classified section
  • Chat with Local gun shops, ranges, trainers & other businesses
  • Discover free outdoor shooting areas
  • View up to date on firearm-related events
  • Share photos & video with other members
  • ...and so much more!
  • W2D

    Ultimate Member
    Dec 2, 2015
    2,074
    Escaped MD for FL
    I bought a Raspberry Pi ($35) and have an older USB web camera. The Pi has wifi and Bluetooth for connectivity. I'm looking into developing a remote camera that transmits to my phone. Octave is a free Matlab like program that could process the image. My bright idea is to process the image to do scoring of the hits, and provide the POI on a graphic instead of, or in addition to, the video image.
    Sort of like automatic scoring at the bowling alley.
    Any ideas, or links to similar projects?


    Sent from my bunker using Tapatalk Pro
     

    whistlersmother

    Peace through strength
    Jan 29, 2013
    8,948
    Fulton, MD
    I run raspberry Pi with webcam over WiFi for Zoneminder, but I let Zoneminder hunt down blobs and report on alert status, etc.

    I use mjpeg streamer to present web interface to webcam, then set up a monitor in Zoneminder.

    You can also get the dedicated cameras for Pi with the ribbon cables that attach to the Pi's "motherboard". I also run this configuration under mjpeg streamer, but the version that has raspi-camera support.

    Sounds like you've got the connectivity already running, though.

    Been too long on the algorithm front. Zoneminder figures out blobs and sizes and that sort of thing if you don't mind trapsing through their source code.

    Given the depth of the community, someone will be along with a specific algorithm and implementation details...

    Sent from my SM-G955U using Tapatalk
     

    ToolAA

    Ultimate Member
    MDS Supporter
    Jun 17, 2016
    10,499
    God's Country
    I bought a Raspberry Pi ($35) and have an older USB web camera. The Pi has wifi and Bluetooth for connectivity. I'm looking into developing a remote camera that transmits to my phone. Octave is a free Matlab like program that could process the image. My bright idea is to process the image to do scoring of the hits, and provide the POI on a graphic instead of, or in addition to, the video image.
    Sort of like automatic scoring at the bowling alley.
    Any ideas, or links to similar projects?


    Sent from my bunker using Tapatalk Pro



    If you have the ability to handle the software side I'll would like to collaborate. I can help out fabricating any hardware, brackets, small cnc or 3d printed parts, building the case.
     

    gamer_jim

    Podcaster
    Feb 12, 2008
    13,233
    Hanover, PA
    I've tried a few things with my Pi for streaming video. I gave up a couple years ago.

    Basically here is what I've learned:

    * There's two ways to do a streaming video on the Pi.

    First is to let the Pi take a series of JPEG images, store them locally and then depend on the file system to transport them to the network which then sends them to any clients listening. This is the most expensive way to streaming. It costs my Pi B+ about 60% of it's CPU for one client. The advantage of this method is most web browsers can read streaming jpegs like this so it is virtually plug and play.

    The other way is to have the pi dump the raw image directly to the network stream from a Pi camera module--The Pi does none of the encoding. This requires the client to decode H256 on the fly. Most newer browsers, or have plugins for them, can do this. Running this on my Pi B+ only consumes about 15% CPU. I've only ever had one client this way but I believe this would scale well as the burden is on the network, not the Pi's limited CPU.

    * I haven't had much luck when it comes to frame-by-frame comparison for motion detection. I tried zoneminder but unless you have a lot of control over the lighting too many false flags were being reported for me. I had one pointed at my front yard and anytime the trees would move from wind or cloud shadow triggers the alarm. I ended up getting 5+ hours of non-sense video.

    * I recommend spending the extra $35 and getting the camera module specifically built for the Pi. I think the OP said they have a USB web cam. From my (limited) understanding is that with a USB web cam on the Pi you are forced into doing the jpeg method of streaming, which is expensive on the Pi's CPU and limited to whatever quality the USB camera is capable of. The Pi has a special video bus for the Pi camera module which allows the Pi to receive the raw data from the camera. This allows you to direct that data from the camera to the network without involving the Pi's CPU.

    * adafruit.com is a great website to learn and buy Pi stuff. I'm sure if you send them an e-mail asking them for advice they will point you in the right direction.

    * My ultimate goal is to have a bunch of Pi zero's with camera modules and also infra-red detectors wired to the Pi around my house. This will then let the IR detector act as the motion sensor and then a script turns on the Pi's camera to stream and send alerts to a full-blown linux PC.


    I can send you the links and notes I have from my Pi experiments if you want. Just send me a PM.
     

    ToolAA

    Ultimate Member
    MDS Supporter
    Jun 17, 2016
    10,499
    God's Country
    Im no Pi programmer but would it be possible to work with still images instead of streaming. For a target cam even a frame rate if 1 frame per second would be able to track shots.
     

    W2D

    Ultimate Member
    Dec 2, 2015
    2,074
    Escaped MD for FL
    My idea was to get away from streaming actual video so as to not require bandwidth. Probably just still images.
    I have the Pi 3 which is (apparently) a huge improvement over the B.
    I have been able to capture images from the USB camera into an array using Octave, but haven't done any image processing just yet. Still working on the proof-of-concept stage. The advantage of using Octave is I have total control of the image processing- and total ability to do it wrong too. I do see the need for some optical magnification on the camera to get the target reasonably in frame. Have yet to work that out. Probably need to see a 2ft square at -30 feet distance. I would prefer a cheep USB camera over the Pi cam module for mounting away from the Pi/battery/misc hardware, but either could work.
    ToolAA, it's a little early to think about hardware and packaging, but I'll let you know.
    What I really need is some guidance on writing an IPhone app and determining an appropriate data transfer protocol.


    Sent from my bunker using Tapatalk Pro
     

    W2D

    Ultimate Member
    Dec 2, 2015
    2,074
    Escaped MD for FL
    Im no Pi programmer but would it be possible to work with still images instead of streaming. For a target cam even a frame rate if 1 frame per second would be able to track shots.


    That's the idea. Periodic screen shots to detect the bullet impact, calculate the relation to the rings, count the rings to determine the actual score of the hit, and send to the iPhone the X,Y coords, score and a screen shot. Maybe the iPhone could listen for the sound of the report to determine a complete miss. I do see an issue if the hole in the target overlaps too much to be detected.
    (Like the Davy Crocket movie where they thought he missed but they dug two balls out of the same hole. Love that scene)

    Just don't know how well the 'blob detector' would work in real life.
    I don't want to send images to the phone at any frame rate - I want the only the results of the shot detection processing and maybe one image sent to the phone. Data costs money.
    Next up is to see what kind of range I can get with an ad hoc network with the Pi and my phone, or if it needs wireless routers. Hope not.

    This is still just a pie in the sky idea yet.



    Sent from my bunker using Tapatalk Pro
     

    W2D

    Ultimate Member
    Dec 2, 2015
    2,074
    Escaped MD for FL
    * My ultimate goal is to have a bunch of Pi zero's with camera modules and also infra-red detectors wired to the Pi around my house. This will then let the IR detector act as the motion sensor and then a script turns on the Pi's camera to stream and send alerts to a full-blown linux PC.


    I'm doing that now with the DVR sending me an email when a camera detects motion. Every morning my inbox is full of pictures of brightly IR illuminated bugs.

    (Mounting IR illuminators away from non IR illuminated cameras is supposed to help with that. )

    Filtering the wheat from the chaff is the great use of the Pi's power.



    Sent from my bunker using Tapatalk Pro
     

    MikeTF

    Ultimate Member
    I bought a Raspberry Pi ($35) and have an older USB web camera. The Pi has wifi and Bluetooth for connectivity. I'm looking into developing a remote camera that transmits to my phone. Octave is a free Matlab like program that could process the image. My bright idea is to process the image to do scoring of the hits, and provide the POI on a graphic instead of, or in addition to, the video image.
    Sort of like automatic scoring at the bowling alley.
    Any ideas, or links to similar projects?


    Sent from my bunker using Tapatalk Pro
    This sounds unique and potentially marketable.
     

    W2D

    Ultimate Member
    Dec 2, 2015
    2,074
    Escaped MD for FL
    Finally got the Matlab-like code installed on the Pi. I tested some simple images, but the image processing library is “less than satisfactory “. Trying to use Hough Transform to detect circles.
    I covered one bullet hole in the first image, the second image shows the hole, and the third image is a simple subtraction.
    2875ba0173a2f85f583c2613ba9aca3c.jpg




    Sent from my bunker using Tapatalk Pro
     

    gamer_jim

    Podcaster
    Feb 12, 2008
    13,233
    Hanover, PA
    Finally got the Matlab-like code installed on the Pi. I tested some simple images, but the image processing library is “less than satisfactory “. Trying to use Hough Transform to detect circles.
    I covered one bullet hole in the first image, the second image shows the hole, and the third image is a simple subtraction.
    congrats on the progress.

    Could you use the Pi as just an image capture and then something else more powerful as the analyzer?
     

    W2D

    Ultimate Member
    Dec 2, 2015
    2,074
    Escaped MD for FL
    congrats on the progress.



    Could you use the Pi as just an image capture and then something else more powerful as the analyzer?



    The Pi is plenty powerful - the images and development environment in the post above was running on the Pi. I just need to fix the code. Matlab is waaay too expensive, and Octave should (?) do it.


    Sent from my bunker using Tapatalk Pro
     

    vgplayer

    Ultimate Member
    Jan 17, 2013
    1,069
    King George, VA

    HogCommander

    Active Member
    Aug 10, 2013
    411
    Texas Hill Country
    If you haven't seen it already, check out the TargetScan app. It scores targets like you envision (lots of targets to choose from and you tell it what caliber you're shooting). If that can be fed by the camera on your RPi, I'll be building one too!

    My brother just programmed my RPI to serve as a turning target controller for Bullseye practice (used Node Red to program it). I use my phone to connect via wifi. We put an external wifi antenna on the Pi and was abLe to connect to it at 105 yards.
     

    Qbeam

    Ultimate Member
    Apr 16, 2008
    6,074
    Georgia
    What kind of range can you get on wifi/bluetooth. I would think bluetooth is ~100ft range, with wifi being a little further?

    Q
     

    gamer_jim

    Podcaster
    Feb 12, 2008
    13,233
    Hanover, PA
    What kind of range can you get on wifi/bluetooth. I would think bluetooth is ~100ft range, with wifi being a little further?

    Q

    It depends.

    They make wifi extenders that go miles if you have line of sight.

    I've gotten about 50 feet with my bluetooth headset away from my phone before it started breaking up.

    I do not know if there is such a thing as a bluetooth range extender but wifi is pretty easy to make yourself. You need a wifi USB dongle which allows you to plug in an external antenna.

    I got this one:

    https://www.amazon.com/gp/product/B002SZEOLG

    and with a couple dollars in parts and a big soup can made an antenna that picks up signals from hundreds of feet away.
     

    W2D

    Ultimate Member
    Dec 2, 2015
    2,074
    Escaped MD for FL
    If you haven't seen it already, check out the TargetScan app. It scores targets like you envision (lots of targets to choose from and you tell it what caliber you're shooting). If that can be fed by the camera on your RPi, I'll be building one too!

    My brother just programmed my RPI to serve as a turning target controller for Bullseye practice (used Node Red to program it). I use my phone to connect via wifi. We put an external wifi antenna on the Pi and was abLe to connect to it at 105 yards.



    Could you send me the phone code and RPi code? Did you use an iPhone? I’d PM you my email address.

    Great links everyone. I’m still trying to get Linux Octave to determine the circles on the target for the scoring rings (and then assign the score for each ring). The circle detection would then find each bullet hole.
    The Hough transform is a bit of a brute force method, I haven’t found a better method to find the rings.
    Looking for a spike in contrast combined with the Hough transform or other method would speed up the bullet hole detection.
    The good thing about the Hough transform is that it detects partial circles when they overlap.


    At first I thought the Hough search crashed, but it was working- but it took 15 minutes to complete!


    Sent from my bunker using Tapatalk Pro
     

    W2D

    Ultimate Member
    Dec 2, 2015
    2,074
    Escaped MD for FL
    It depends.



    They make wifi extenders that go miles if you have line of sight.



    I've gotten about 50 feet with my bluetooth headset away from my phone before it started breaking up.



    I do not know if there is such a thing as a bluetooth range extender but wifi is pretty easy to make yourself. You need a wifi USB dongle which allows you to plug in an external antenna.



    I got this one:



    https://www.amazon.com/gp/product/B002SZEOLG



    and with a couple dollars in parts and a big soup can made an antenna that picks up signals from hundreds of feet away.



    That’s a good idea. I looked up some reviews on that device and it’s iffy if it will work with Linux. You used it with the RPi?



    Sent from my bunker using Tapatalk Pro
     

    Users who are viewing this thread

    Latest posts

    Forum statistics

    Threads
    274,918
    Messages
    7,258,666
    Members
    33,348
    Latest member
    Eric_Hehl

    Latest threads

    Top Bottom