Go Back   Maryland Shooters > The Arsenal > Optics

Notices


Reply
 
Thread Tools Display Modes
Old September 12th, 2017, 09:37 AM #1
W2D's Avatar
W2D W2D is offline
Senior Member
 
Join Date: Dec 2015
Location: Pasadena MD
Posts: 1,382
W2D W2D is offline
Senior Member
W2D's Avatar
 
Join Date: Dec 2015
Location: Pasadena MD
Posts: 1,382
Raspberry Pi Remote Camera

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
__________________
"A gun is a tool, Marian; no better or no worse than any other tool:--an axe, a shovel or anything. A gun is as good or as bad as the man using it. Remember that." - Alan Ladd as Shane - Shane, 1953.
W2D is offline   Reply With Quote
Old September 12th, 2017, 09:51 AM #2
whistlersmother whistlersmother is offline
Peace through strength
 
Join Date: Jan 2013
Location: Fulton, MD
Posts: 3,557
whistlersmother whistlersmother is offline
Peace through strength
 
Join Date: Jan 2013
Location: Fulton, MD
Posts: 3,557
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
whistlersmother is offline   Reply With Quote
Old September 12th, 2017, 02:49 PM #3
ToolAA's Avatar
ToolAA ToolAA is offline
Senior Member
 
Join Date: Jun 2016
Location: Ellicott City
Posts: 1,925
ToolAA ToolAA is offline
Senior Member
ToolAA's Avatar
 
Join Date: Jun 2016
Location: Ellicott City
Posts: 1,925
Quote:
Originally Posted by W2D View Post
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.
__________________
Honorable people with a good work ethic and strong character have shaped our communities and nation more so than presidents and congressmen. The crisis of character we see in our political leaders is a symptom of our nation's sickness not the cause for the disease.
ToolAA is offline   Reply With Quote
Old September 12th, 2017, 07:07 PM #4
gamer_jim's Avatar
gamer_jim gamer_jim is online now
Beer Czar
 
Join Date: Feb 2008
Location: Carroll County
Posts: 8,595
Images: 5
gamer_jim gamer_jim is online now
Beer Czar
gamer_jim's Avatar
 
Join Date: Feb 2008
Location: Carroll County
Posts: 8,595
Images: 5
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.
__________________
"...they celebrated the occasion by eating and drinking, firing guns, and all manner of riotous hilarity."
Buccaneers and Pirates of Our Coasts by Frank Richard Stockton
gamer_jim is online now   Reply With Quote
Old September 12th, 2017, 07:53 PM #5
ToolAA's Avatar
ToolAA ToolAA is offline
Senior Member
 
Join Date: Jun 2016
Location: Ellicott City
Posts: 1,925
ToolAA ToolAA is offline
Senior Member
ToolAA's Avatar
 
Join Date: Jun 2016
Location: Ellicott City
Posts: 1,925
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.
__________________
Honorable people with a good work ethic and strong character have shaped our communities and nation more so than presidents and congressmen. The crisis of character we see in our political leaders is a symptom of our nation's sickness not the cause for the disease.
ToolAA is offline   Reply With Quote
Old September 13th, 2017, 12:20 AM #6
W2D's Avatar
W2D W2D is offline
Senior Member
 
Join Date: Dec 2015
Location: Pasadena MD
Posts: 1,382
W2D W2D is offline
Senior Member
W2D's Avatar
 
Join Date: Dec 2015
Location: Pasadena MD
Posts: 1,382
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
__________________
"A gun is a tool, Marian; no better or no worse than any other tool:--an axe, a shovel or anything. A gun is as good or as bad as the man using it. Remember that." - Alan Ladd as Shane - Shane, 1953.
W2D is offline   Reply With Quote
Old September 13th, 2017, 12:49 AM #7
W2D's Avatar
W2D W2D is offline
Senior Member
 
Join Date: Dec 2015
Location: Pasadena MD
Posts: 1,382
W2D W2D is offline
Senior Member
W2D's Avatar
 
Join Date: Dec 2015
Location: Pasadena MD
Posts: 1,382
Quote:
Originally Posted by ToolAA View Post
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
__________________
"A gun is a tool, Marian; no better or no worse than any other tool:--an axe, a shovel or anything. A gun is as good or as bad as the man using it. Remember that." - Alan Ladd as Shane - Shane, 1953.
W2D is offline   Reply With Quote
Old September 13th, 2017, 01:05 AM #8
W2D's Avatar
W2D W2D is offline
Senior Member
 
Join Date: Dec 2015
Location: Pasadena MD
Posts: 1,382
W2D W2D is offline
Senior Member
W2D's Avatar
 
Join Date: Dec 2015
Location: Pasadena MD
Posts: 1,382
Quote:
Originally Posted by gamer_jim View Post



* 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
__________________
"A gun is a tool, Marian; no better or no worse than any other tool:--an axe, a shovel or anything. A gun is as good or as bad as the man using it. Remember that." - Alan Ladd as Shane - Shane, 1953.
W2D is offline   Reply With Quote
Old September 13th, 2017, 01:23 AM #9
MikeTF's Avatar
MikeTF MikeTF is offline
Senior Member
 
Join Date: Jan 2009
Location: MD 40yrs - Smith Mountain Lake, VA since '13
Posts: 11,758
MikeTF MikeTF is offline
Senior Member
MikeTF's Avatar
 
Join Date: Jan 2009
Location: MD 40yrs - Smith Mountain Lake, VA since '13
Posts: 11,758
Quote:
Originally Posted by W2D View Post
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.
MikeTF is offline   Reply With Quote
Old September 13th, 2017, 06:42 AM #10
W2D's Avatar
W2D W2D is offline
Senior Member
 
Join Date: Dec 2015
Location: Pasadena MD
Posts: 1,382
W2D W2D is offline
Senior Member
W2D's Avatar
 
Join Date: Dec 2015
Location: Pasadena MD
Posts: 1,382
Quote:
Originally Posted by MikeTF View Post
This sounds unique and potentially marketable.


Give away the plans and code for the Pi and sell the IPhone app?


Sent from my bunker using Tapatalk Pro

__________________
"A gun is a tool, Marian; no better or no worse than any other tool:--an axe, a shovel or anything. A gun is as good or as bad as the man using it. Remember that." - Alan Ladd as Shane - Shane, 1953.
W2D is offline   Reply With Quote
Reply

  Home Page > Forum List > The Arsenal > Optics


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 06:53 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
2017, Congregate Media, LP Privacy Policy Terms of Service