Re: Getting a hook from shell mode to do motion detection?
Alan Corey <[email protected]>
| Newsgroups | gmane.comp.multimedia.gphoto.user |
|---|---|
| Message-ID | <CAOh3dDafF74Hd6F7oELdKdm3LVbjkoLRr6vP1+3eoC+JN642BQ@mail.gmail.com> |
fwiw Gphoto capabilities on the S70 are like: Gphoto on a Canon PowerShot S70 /main/actions/focuslock /main/actions/opcode /main/settings/datetime /main/settings/output /main/settings/ownername /main/settings/capturetarget /main/settings/capture /main/status/serialnumber /main/status/manufacturer /main/status/cameramodel /main/status/deviceversion /main/status/vendorextension /main/status/model /main/status/firmwareversion /main/status/orientation /main/imgsettings/imagequality /main/imgsettings/imageformat /main/imgsettings/imagesize /main/imgsettings/iso /main/imgsettings/whitebalance /main/imgsettings/photoeffect /main/capturesettings/zoom /main/capturesettings/assistlight /main/capturesettings/autorotation /main/capturesettings/selftimer /main/capturesettings/exposurecompensation /main/capturesettings/flashcompensation /main/capturesettings/flashmode /main/capturesettings/shootingmode /main/capturesettings/aperture /main/capturesettings/avopen /main/capturesettings/avmax /main/capturesettings/focusingpoint /main/capturesettings/shutterspeed /main/capturesettings/meteringmode /main/capturesettings/afdistance Exploring the numbered d*** config options (Canon S70) (tab delimited) d001 BeepModewriteable menu 2 options d002 Battery type readonly menu 6 options d003 Battery Mode readonly menu 4 options d005 Camera Mode readonly TEXT CURRENT 32(?) d006 Image Quality writeable menu 3 options d007 Full View File Format writeable menu 2 options d008 Image Size writeable menu 5 options d009 Self Time readonly text current is 100 d00a Flash Mode writeable menu 5 options d00b Beep writeable menu 2 options d00c Shooting Mode writeable menu 4 options d00e Drive Mode readonly text current 0 d00f Zoom readonly text current 0 d010 Metering Mode writeable menu 3 options d011 AF Distance writeable menu 2 options d012 Focusing Point writeable menu 2 options d013 White Balance writeable menu 8 options d015 AF Mode readonly text current 0 d017 Contrast writeable menu 1 option d018 Color Gain writeable menu 1 option d019 Sharpness writeable menu 1 option d01c ISO Speed writeable menu 5 options d01d Aperture writeable menu 1 option current 40 d01e Shutter Speed writeable menu 1 option current 112 d01f Exposure Compensation writeable menu 13 options current 24 d020 Flash Compensation writeable menu 13 options current 24 d023 Av Open readonly text current 32 d024 Av Max readonly text current 56 d025 Focal Length readonly text current 186 d026 Focal Length Tele readonly text current 662 d027 Focal Length Wide readonly text current 186 d028 Focal Length Denominator readonly text current 32 d029 Capture Transfer Mode writeable menu 15 options current 13 d02a Zoom writeable menu 15 options current 0 d02c Size Quality Mode readonly menu 1 choice current null d02d Supported Thumb Size readonly text current null d02e Size of Output Data from Camera readonly text current 20480 d02f Size of Input Data to Camera readonly text current 5120 d030 Remote API Version readonly text current 256 d031 Firmware Version readonly text current 16777216 d032 Camera Model readonly text current "Current: Canon PowerShot S70" d033 Camera Owner writeable text current null d034 UNIX Time writeable text (reads camera's clock) d036 Camera Output writeable menu 3 options current 2 d037 Disp Av readonly text current 0 d038 Av Open Apex readonly text current 32 d039 Digital Zoom Magnification readonly text current 3072 d03a Ml Spot Position readonly text current 0 d03b Disp Av Max readonly text current 0 d03c Av Max Apex readonly text current 56 d03d EZoom Start Position readonly text current 9 d03e Focal Length Tele readonly text current 662 d03f EZoom Size of Tele readonly text current 752 d040 Photo Effect writeable menu 6 options d041 Assist Light writeable menu 2 options d042 Flash Quantity Count writeable menu 1 option d043 Rotation Angle readonly text current 0 d044 Rotation Scene writeable menu 2 options d045 Event Emulate Mode writeable menu 7 options d046 DPOF Version readonly text current 257 d047 Type of Slideshow readonly text current 2 d048 Average Filesizes readonly text current null d049 Model ID readonly text current 20447232 d04b PTP Property 0xd04b readonly text current 0 On 1/1/18, Marcus Meissner <[email protected]> wrote: > Hi, > > Order of -l components is important and you need to add -lgphoto2_port, e.g. > like: > > > gcc -Wall -o pb sample-photobooth.c -L/usr/local/bin/gphoto2-2.5.15/lib > -lgphoto2 -lgphoto2_port > > Ciao, Marcus > > On Sun, Dec 31, 2017 at 07:39:01PM -0500, Alan Corey wrote: >> Well, I haven't had a lot of luck getting things from the >> libgphoto2/examples dir running so I gave up. Just recently I tried >> copying sample-photobooth.c (and samples.h) into an empty dir and >> compiling with a makefile that looks like >> >> ------------- >> pb: sample-photobooth.c >> gcc -Wall -o pb -lgphoto2 sample-photobooth.c \ >> -L/usr/local/bin/gphoto2-2.5.15/lib >> >> # lib path is because I didn't want it to conflict with debs gphoto >> # it's where libgphoto2.so.6.0.0 is >> -------------- >> >> And I get errors like: >> upstairs# make >> gcc -Wall -o pb -lgphoto2 sample-photobooth.c \ >> -L/usr/local/bin/gphoto2-2.5.15/lib >> /usr/bin/ld: /tmp/ccBGh1Jj.o: undefined reference to symbol >> 'gp_log_add_func@@LIBGPHOTO2_5_0' >> //usr/local/bin/gphoto2-2.5.15/lib/libgphoto2_port.so.12: error adding >> symbols: DSO missing from command line >> collect2: error: ld returned 1 exit status >> Makefile:2: recipe for target 'pb' failed >> make: *** [pb] Error 1 >> >> I did an ldconfig on the path where the library is. I was also >> getting the "DSO missing from command line" error trying to build >> preview.c. I've never seen it on anything I wrote, trying to google >> it wasn't very productive. >> >> On 12/31/17, Marcus Meissner <[email protected]> wrote: >> > Hi, >> > >> > If you want to do this all with one camera you might be better of >> > writing >> > a program using libgphoto2, either in C or Python. >> > >> > FWIW, I did something similar to Tomas btw. >> > >> > Setup: >> > >> > - Cheap Webcam >> > - Canon EOS 1000D with AC adapter. >> > - Laptop >> > >> > Then I ran the "motion" tool using the webcam. >> > >> > The "motion" tool has hooks where it can callout to shell scripts. >> > I wrote a simple shell script that ran gphoto2 >> > --capture-image-and-download >> > >> > and hooked it to the motion detection hook. >> > >> > It needed some checking that it does not run it twice (because >> > if there is motion it would trigger faster than capturing) >> > and it runs the disk full quite quickly with DSLR sized images. >> > >> > Ciao, Marcus >> > >> > >> > On Sat, Dec 30, 2017 at 02:06:13PM -0500, Alan Corey wrote: >> >> I've been thinking about this. I plan to write in C, and between >> >> system() and popen() and pipe() and etc there's probably a way to do >> >> it. From a console you type shell and give commands, then you can >> >> type more commands. But I'm not sure how a program would do that: as >> >> a file descriptor or a pipe (or a socket) (dbus?)? Gphoto as a >> >> process stays running, you just need a programmatic way to communicate >> >> with it. The looping and branching wouldn't happen in Gphoto's shell, >> >> that would be more like a low level server or driver. I could of >> >> course modify my copy of the source but I'd rather not do that. I was >> >> about to experiment a bit until I found my oldschool loadjpeg function >> >> evidently doesn't work under Linux, I need to make a Turbo Jpeg >> >> equivalent. Or maybe I still need some dev file or header. Wacky, it >> >> doesn't know jpeg_CreateDecompress or what a size_t is? I wrote it >> >> under OpenBSD a couple years ago, it's been reasonably portable until >> >> now. Loading a straight uncompressed RGB binary would be optimum but >> >> I need to decompress jpegs. Don't know yet if I can send to stdout. >> >> >> >> I ran across motion last night but didn't bother to install it. I >> >> think it's strictly V4L so it's low quality just because the cameras >> >> are. I've got a 640x480 USB webcam that does V4L but I'd rather not >> >> use it. My motion detection scheme comes partly from a D-Link IP cam, >> >> that also only does 640x480. I'll probably be running this on a >> >> Raspberry Pi, and I've got a few of those cameras, but I'd rather not >> >> use them. >> >> >> >> The standard Gphoto --capture-preview or the shell equivalent gets me >> >> a 320x240 jpeg which, if I decompress and compare in C, not something >> >> awful like Python, should be fast enough. I'd rather not use 2 >> >> cameras. I'm from the Nikon camp, new to Canons for this project. >> >> For $20 used I got a 7 MP camera that not only works with Gphoto but >> >> also shoots RAW, most low-end Nikons won't do either. I'm not >> >> sticking my D5200 DSLR in a birdfeeder. >> >> >> >> Shell mode is good for this because there's only 1 start-up time, the >> >> delay between pictures can be much lower than if you call Gphoto in a >> >> loop to start from scratch each time. 1 frame per second might be >> >> adequate but I'm aiming at 10. CPU time on a Pi 3 comes cheap since >> >> it runs on a watt or two. So I don't need to compare 320x240 images >> >> but if I can do it efficiently I can live with it. >> >> >> >> On 12/30/17, Tomas Alonso <[email protected]> wrote: >> >> > El Viernes, 29 de diciembre de 2017 17:39:08 Alan Corey escribió: >> >> >> I want to set up a wildlife camera, so I've read a few articles >> >> >> about >> >> >> it. I've been practicing with an old Canon PowerShot S70 and it >> >> >> seems >> >> >> suitable. What I'd like to try to do is use the preview images for >> >> >> motion detection. I need to mask out some areas to avoid false >> >> >> activations from clouds passing over, that sort of stuff, and >> >> >> probably >> >> >> some averaging to account for the sun rising and setting. >> >> >> >> >> >> For speed it seems advisable to work in Gphoto2's shell mode but >> >> >> I'm >> >> >> trying to figure out a way to provide input from an external >> >> >> program. >> >> >> I want to do capture-preview in a loop: get a preview, run my >> >> >> compare >> >> >> program, get another preview. If the compare sees something go >> >> >> into >> >> >> another loop grabbing big images for some amount of time, then back >> >> >> to >> >> >> previews. >> >> >> >> >> >> I did help in shell mode but I don't see anything listed that looks >> >> >> like it would work, like being able to detect the presence of some >> >> >> file I could use a a semaphore. There aren't any branch (or loop) >> >> >> instructions either. >> >> >> >> >> >> Alan >> >> > >> >> > Hello Alan, >> >> > >> >> > For other needs related to security I'm also interested in doing >> >> > something >> >> > equivalent. I thought my first try would be >> >> > >> >> > http://www.chriswpage.com/2009/05/setup-an-advanced-webcam-security-system-with-ubuntu-8-04-and-motion/ >> >> > >> >> > using the motion program under Linux. It allows to launch scripts >> >> > when >> >> > motion >> >> > is detected, but you need a webcam for motion detection and a camera >> >> > for >> >> > good >> >> > quality shots. That's (and the fact I own a Canon 40D) why I'm not >> >> > sure >> >> > at >> >> > all >> >> > about the webcam approach. >> >> > >> >> > I have high programming skills and experience with gphoto so to >> >> > implement >> >> > this >> >> > myself will not be a problem. If you can't find a solution for your >> >> > case >> >> > just >> >> > send me the exact gphoto commands you use for your camera to enter >> >> > shell >> >> > mode, >> >> > take a preview, and take also a big image in auto mode or whatever >> >> > you >> >> > use >> >> > (including the file names generated in your computer after executing >> >> > those >> >> > commands). >> >> > >> >> > Can't promise to do it for a given date but likely it will take few >> >> > weeks. >> >> > >> >> > Regards, >> >> > Tomas. >> >> > >> >> > >> >> > ------------------------------------------------------------------------------ >> >> > Check out the vibrant tech community on one of the world's most >> >> > engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> >> > _______________________________________________ >> >> > Gphoto-user mailing list >> >> > [email protected] >> >> > https://lists.sourceforge.net/lists/listinfo/gphoto-user >> >> > >> >> >> >> >> >> -- >> >> ------------- >> >> No, I won't call it "climate change", do you have a "reality problem"? >> >> - >> >> AB1JX >> >> Impeach Impeach Impeach Impeach Impeach Impeach Impeach Impeach >> >> >> >> ------------------------------------------------------------------------------ >> >> Check out the vibrant tech community on one of the world's most >> >> engaging tech sites, Slashdot.org! http://sdm.link/slashdot >> >> _______________________________________________ >> >> Gphoto-user mailing list >> >> [email protected] >> >> https://lists.sourceforge.net/lists/listinfo/gphoto-user >> > >> >> >> -- >> ------------- >> No, I won't call it "climate change", do you have a "reality problem"? - >> AB1JX >> Impeach Impeach Impeach Impeach Impeach Impeach Impeach Impeach > -- ------------- No, I won't call it "climate change", do you have a "reality problem"? - AB1JX Impeach Impeach Impeach Impeach Impeach Impeach Impeach Impeach ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Gphoto-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/gphoto-user