Tashman
Posts: 16
Joined: Tue Mar 08, 2016 11:23 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Mar 08, 2016 12:05 pm

Update
Just stopped and started PiKrellCam and now disk sizes correctly reported!

Thanks
Tashman

billw
Posts: 404
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Mar 08, 2016 3:42 pm

Tashman wrote:Hi

Running PiKrellCam for a few months now - excellent! Massive thanks to Bill and other contributors.

Just added a USB stick to the pi2 running PiKrellCam and have noticed a couple of annoyances -

1 Videos archived previously onto the sdcard are not showing in the archive calendar now. I can imagine why as the usb stick is now being used for media storage. How can I merge/copy the older sdcard files onto the usb stick please?
The files just need to be copied from the old archive to the new, but use -a to preserve mod times:

Code: Select all

cp -a oldpath/archive newpath/archive
Then if no problem, delete the oldpath/archive.

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Mar 08, 2016 4:45 pm

BerryPicker wrote: I just love those thumbnails, located at just the right moment in time, and zoomed in to just the right region of interest.
Just FYI- the thumbnails often show the region of interest, but don't rely on them 100% because there are cases when they don't work as you would like:
1) fast moving object- may miss it completely
2) more than one moving object during a single record event- the most interesting one may be not shown

Tashman
Posts: 16
Joined: Tue Mar 08, 2016 11:23 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Mar 08, 2016 4:54 pm

billw wrote:
Tashman wrote:Hi

Running PiKrellCam for a few months now - excellent! Massive thanks to Bill and other contributors.

Just added a USB stick to the pi2 running PiKrellCam and have noticed a couple of annoyances -

1 Videos archived previously onto the sdcard are not showing in the archive calendar now. I can imagine why as the usb stick is now being used for media storage. How can I merge/copy the older sdcard files onto the usb stick please?
The files just need to be copied from the old archive to the new, but use -a to preserve mod times:

Code: Select all

cp -a oldpath/archive newpath/archive
Then if no problem, delete the oldpath/archive.
Mmm but the usb stick path to media directory appears, to me (noob:-)) to be the same as the sdcard path to the "old" media directory?

Anyhow I switched back to PiKrellCam using the sdcard, copied the archive directory to a temporary directory, switched back to usb stick and moved the directories under the usb stick archive directory.
All seems OK.

Out of interest how would I (if I knew more) have done this more properly?

Many thanks
Tashman

billw
Posts: 404
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Mar 08, 2016 7:51 pm

Tashman wrote: Mmm but the usb stick path to media directory appears, to me (noob:-)) to be the same as the sdcard path to the "old" media directory?

Anyhow I switched back to PiKrellCam using the sdcard, copied the archive directory to a temporary directory, switched back to usb stick and moved the directories under the usb stick archive directory.
All seems OK.

Out of interest how would I (if I knew more) have done this more properly?
Uh, maybe I'm more the noob than you are
Starting from the initial defaults, the media directory paths and links in the
pikrellcam/www directory are:

Code: Select all

/home/pi/pikrellcam/media/
/home/pi/pikrellcam/media/archive

/home/pi/pikrellcam/media/www/media   -> /home/pi/pikrellcam/media/
/home/pi/pikrellcam/media/www/archive -> /home/pi/pikrellcam/media/archive
So for example, if you edit the startup script to mount a disk without changing the media
or archive directory in pikrellcam.conf, then the USB disk is mounted on top of
/home/pi/pikrellcam/media/ and your existing media files are now not accessible and you
do have to indirectly get them copied over just as you did.

But, if you edit pikrellcam.conf and say, change the media directory to /mnt/media
and still have mounting enabled in the startup script (you will need to initially
"sudo mkdir /mnt/media" manually to set this up), then you will get the USB disk mounted
on /mnt/media and pikrellcam will use media directory paths and links:

Code: Select all

/mnt/media/
/mnt/media/archive

/home/pi/pikrellcam/media/www/media   -> /mnt/media/
/home/pi/pikrellcam/media/www/archive -> /mnt/media/archive
and the original media directory will now still be accessible. So it's for this case
my original answer applies and after /mnt/media is mounted you can directly

Code: Select all

cp -a /home/pi/pikrellcam/media/* /mnt/media
Sorry for the first incomplete answer.

Tashman
Posts: 16
Joined: Tue Mar 08, 2016 11:23 am

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Mar 08, 2016 8:00 pm

billw wrote:
Tashman wrote: ...
Out of interest how would I (if I knew more) have done this more properly?
Uh, maybe I'm more the noob than you are
Starting from the initial defaults, the media directory paths and links in the
pikrellcam/www directory are:

Code: Select all

/home/pi/pikrellcam/media/
/home/pi/pikrellcam/media/archive

/home/pi/pikrellcam/media/www/media   -> /home/pi/pikrellcam/media/
/home/pi/pikrellcam/media/www/archive -> /home/pi/pikrellcam/media/archive
So for example, if you edit the startup script to mount a disk without changing the media
or archive directory in pikrellcam.conf, then the USB disk is mounted on top of
/home/pi/pikrellcam/media/ and your existing media files are now not accessible and you
do have to indirectly get them copied over just as you did.

But, if you edit pikrellcam.conf and say, change the media directory to /mnt/media
and still have mounting enabled in the startup script (you will need to initially
"sudo mkdir /mnt/media" manually to set this up), then you will get the USB disk mounted
on /mnt/media and pikrellcam will use media directory paths and links:

Code: Select all

/mnt/media/
/mnt/media/archive

/home/pi/pikrellcam/media/www/media   -> /mnt/media/
/home/pi/pikrellcam/media/www/archive -> /mnt/media/archive
and the original media directory will now still be accessible. So it's for this case
my original answer applies and after /mnt/media is mounted you can directly

Code: Select all

cp -a /home/pi/pikrellcam/media/* /mnt/media
Sorry for the first incomplete answer.
No apology necessary, thanks very much for taking the time to go through it for me, and any other noobs :-)

dmurphydrtc
Posts: 30
Joined: Tue Jan 29, 2013 5:30 am

Re: PiKrellCam on RPi 3 ?

Tue Mar 08, 2016 8:13 pm

jbeale wrote:My Rpi 3 is still on backorder, so I'm throwing the question out there: can anyone confirm if the RPi 3 allows PiKrellCam to run at 30 fps, instead of being limited to 24 fps? There are some applications where it would be nice if the frame rate synchronized with another camera I have, which runs at 29.97 fps.
My pi3 just arrived.. Happy to check out fps issue. Can I just increase fps from 24 to say 30 in the pikrellcam.conf file?

Happy to help

boomlikethat
Posts: 85
Joined: Sun Aug 03, 2014 10:32 pm

Re: PiKrellCam on RPi 3 ?

Wed Mar 09, 2016 1:23 am

dmurphydrtc wrote:
jbeale wrote:My Rpi 3 is still on backorder, so I'm throwing the question out there: can anyone confirm if the RPi 3 allows PiKrellCam to run at 30 fps, instead of being limited to 24 fps? There are some applications where it would be nice if the frame rate synchronized with another camera I have, which runs at 29.97 fps.
My pi3 just arrived.. Happy to check out fps issue. Can I just increase fps from 24 to say 30 in the pikrellcam.conf file?

Happy to help
@jbeale,

I got my Pi 3 today, and a new Pi Cam. I set the Video FPS and Video MP4box to 30 fps, and maxed the video_bitrate. Then I manually recorded a 10 second video.

I took the video and opened it in Quicktime on my Mac, and the Video Inspector reports 30 fps.

Thought you should know ;)

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Mar 10, 2016 8:47 pm

Thanks for testing it! My Pi3 came today and this test was the first thing I did. Sure enough, 30 fps works OK. Very nice!

I am also reminded just how good PiKrellCam motion detection is. Stock out of the box without adjusting it reliably detects distant birds like this, while generally ignoring small movements of the telephone cable in the foreground, even though the cable covers a lot more pixels. The bird image is so small I would have assumed it was a coincidence and detecting the cable motion anyway, except that the thumbnail image neatly frames just the bird. (note: this is using a 3rd party RPi-compatible camera board with a 16mm CS-mount lens.)

Image

Image

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Mar 11, 2016 3:16 am

I suspected, if I pointed the camera anywhere out the window and waited, that eventually a squirrel would pass through the frame. Turns out I was right.
https://www.youtube.com/watch?v=RYquT_f-TvQ

User avatar
rpdom
Posts: 15610
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Mar 11, 2016 6:43 am

jbeale wrote:I suspected, if I pointed the camera anywhere out the window and waited, that eventually a squirrel would pass through the frame. Turns out I was right.
That reminds me of the time I was sure the kids next door were getting in to my garden when I was out. I set up a USB camera connected to an old PC, pointed it out of a window and ran Motion on it for a few days.

It detected cats and birds and a lot of something I couldn't work out at first... eventually I spotted a tiny house spider on the window in front of the camera. It showed up a huge dark blob on the recorded pictures :)

boomlikethat
Posts: 85
Joined: Sun Aug 03, 2014 10:32 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Mar 11, 2016 1:33 pm

jbeale wrote:Thanks for testing it! My Pi3 came today and this test was the first thing I did. Sure enough, 30 fps works OK. Very nice!

I am also reminded just how good PiKrellCam motion detection is. Stock out of the box without adjusting it reliably detects distant birds like this, while generally ignoring small movements of the telephone cable in the foreground, even though the cable covers a lot more pixels. The bird image is so small I would have assumed it was a coincidence and detecting the cable motion anyway, except that the thumbnail image neatly frames just the bird. (note: this is using a 3rd party RPi-compatible camera board with a 16mm CS-mount lens.)

Image

Image
@jbeale:

May I ask what camera you are using? Thanks.

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Fri Mar 11, 2016 2:54 pm

boomlikethat wrote:May I ask what camera you are using? Thanks.
I combined this CS-mount pi-compatible camera board:
http://www.ebay.com/itm/OV5647-Camera-B ... 1212355128
with this CS-mount 16mm lens: http://www.ebay.com/itm/231530999443

You can also get a M12 mount board from the same Ebay vendor that sells the CS-mount type, and you can find cheaper equivalent M12 lenses for example at http://m12lenses.com/ although even their so-called "megapixel" lenses may not do full justice to the 5 Mpixel sensor.

jit
Posts: 33
Joined: Fri Apr 18, 2014 2:52 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Mar 14, 2016 1:19 pm

When a motion event is completed, is there a way to know which motion regions (the motion region numbers) that the motion occurred in?

billw
Posts: 404
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Mar 14, 2016 2:35 pm

jit wrote:When a motion event is completed, is there a way to know which motion regions (the motion region numbers) that the motion occurred in?
Not the region numbers but something about that is in my todo. There are a few things in the todo I
probably won't get to until I finish up the pikrellcam presets and servo control I'm currently doing.

What you can do now:
1) Use the $K $Y variables to get te (x,y) coordinates of the motion event that is saved as the preview
thumbnail. But that is one event.

2) Turn on motion_stats in pikrellcam.conf and get a .csv file of time and coordinates for vectors for all
of the motion events for a video. Search this thread for motion_stats.

jit
Posts: 33
Joined: Fri Apr 18, 2014 2:52 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Mar 16, 2016 8:28 pm

billw wrote:
jit wrote:When a motion event is completed, is there a way to know which motion regions (the motion region numbers) that the motion occurred in?
Not the region numbers but something about that is in my todo. There are a few things in the todo I
probably won't get to until I finish up the pikrellcam presets and servo control I'm currently doing.

What you can do now:
1) Use the $K $Y variables to get te (x,y) coordinates of the motion event that is saved as the preview
thumbnail. But that is one event.

2) Turn on motion_stats in pikrellcam.conf and get a .csv file of time and coordinates for vectors for all
of the motion events for a video. Search this thread for motion_stats.
Thanks for the info. I'm glad that something like that is in the pipeline. I was thinking that it would be great to be able to classify regions into groups and then get details on which groups contained motion.

My use case around this is having a core group of regions that cover my property, for which motion events are always stored. Then a secondary group that could cover the road in front of the house, for which motion events would be stored, but separately from the core group. It would also be great to be able to filter the UI on groups, so that you only see the events that your interested in so that the clutter of events from the road outside is hidden unless its required.

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Wed Mar 16, 2016 8:57 pm

jit wrote:It would also be great to be able to filter the UI on groups, so that you only see the events that your interested in so that the clutter of events from the road outside is hidden unless its required.
Just remember that a given motion event may contain more than one moving object, and/or motion present in more than one area group. I'm interested in this idea as well and have plans to write something (eventually), but it may not happen in any reasonable timeframe.

jit
Posts: 33
Joined: Fri Apr 18, 2014 2:52 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Thu Mar 17, 2016 10:44 am

jbeale wrote:
jit wrote:It would also be great to be able to filter the UI on groups, so that you only see the events that your interested in so that the clutter of events from the road outside is hidden unless its required.
Just remember that a given motion event may contain more than one moving object, and/or motion present in more than one area group. I'm interested in this idea as well and have plans to write something (eventually), but it may not happen in any reasonable timeframe.
Very true. I think the best approach would be to provide a comma separated list of groups in which motion occurred. Thereby allowing the post event script to perform appropriate handling.

Koepisch
Posts: 12
Joined: Fri Mar 18, 2016 10:41 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Mar 21, 2016 4:20 pm

Hi there,

first i want to say that i really appreciate the work. Really impressive.

I've tried PiKrellCam a couple of days with different setups. My current problem is to detect slow, but still directional, movements. If a person is moving slowly thru the view, the vectors doesn't catch this up. I tried to slow down the frame rate, to help the algo to get more differences between each frame. But it doesn't work.

So i first want to know if the "Block Pixels" in "Vectors On" mode are filtered in any kind or yet the result of any algo filtering of PiKrellCam. I think they are not filtered.

Furthermore can anybody give hints to optimize the settings for slow movement detection? I'm afraid, that the camera doesn't notice such slow movements.

Thanks and Regards,
Koepisch

User avatar
jbeale
Posts: 3522
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Mar 21, 2016 6:43 pm

There is a setting for the magnitude of the motion vector that trips the motion detect, I think the minimum setting is "2" (?) which is pretty sensitive. If you want to go even slower, you might consider using an aftermarket camera with a more telephoto lens, that magnifies the image and the apparent rate of motion by the same factor. Of course you lose field of view as the tradeoff. But the RPi and the camera are relatively cheap so you could have a wide camera and also a narrow view camera for catching even slow movements.

Koepisch
Posts: 12
Joined: Fri Mar 18, 2016 10:41 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Mar 21, 2016 8:20 pm

Thanks, but did you know, if the "Block Pixels" which are showing the detected motion are the raw data from the H264 stream? I have to build some test scenarios and i have to be sure that i see the raw motion data and not any filtered ones.

I don't have hot spots in my view, so i can't use any second magified view in parallel (surveillance project).

Regards,
Koepisch

billw
Posts: 404
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Mar 21, 2016 10:04 pm

Koepisch wrote:Thanks, but did you know, if the "Block Pixels" which are showing the detected motion are the raw data from the H264 stream? I have to build some test scenarios and i have to be sure that i see the raw motion data and not any filtered ones.

I don't have hot spots in my view, so i can't use any second magified view in parallel (surveillance project).
All vectors (block pixels) you see have a magnitude >= to your configured value so there is filtering
by magnitude. Beyond that there is only filtering by grayscale color and you do see them all.
The filtering is as described on the "Example Motion Detects" image in the help page: all isolated
"sparkles" are black (sometimes hard to see) and the rest are white for passing vectors or medium
gray for direction rejected vectors.

They are all directly from the raw data h264 stream. The h264 video data frames and the motion
vector data frames are interleaved. Pikrellcam superimposes a C vector structure on top of the
raw data and directly processes it. However, the motion vectors are processed at the
video_fps rate divided by the mjpeg_divider so you don't see every frame. To see every frame
the mjpeg_divider would need to be 1, but then you are likely to hit Pi GPU and CPU processing limits
depending on your video_fps.
Edit: and how fast the web page refreshes the image puts a limit on reducing the mjpeg_divider.
It probably won't do much better than 6 fps.

Koepisch
Posts: 12
Joined: Fri Mar 18, 2016 10:41 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Mar 21, 2016 11:43 pm

OK i think i've got it. In my test scenario an person walk thru the view. The persons scheme has low contrast, but a human can detect it easily. The person has an recognizable pattern, so i thought that it must be detected. But in the area of the person movements there was not an single vector detected (tried with different setups). When the person moves faster the detection gets it.

I think i can run some more test's with the frame rate settings. I don't know if it was asked before, but is it possible to feed the algo with a H264 from file? I need some more time to get familiar with the sources and the code structure. Perhaps we can save the motion vector stream only and use it as a replay feed for the detection algo.

Thanks,
Koepisch

billw
Posts: 404
Joined: Tue Sep 18, 2012 8:23 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Tue Mar 22, 2016 12:57 am

Koepisch wrote:OK i think i've got it. In my test scenario an person walk thru the view. The persons scheme has low contrast, but a human can detect it easily. The person has an recognizable pattern, so i thought that it must be detected. But in the area of the person movements there was not an single vector detected (tried with different setups). When the person moves faster the detection gets it.
You can set the magnitude limit down to 3 and count to 2 and that's pretty low. If your scene doesn't
have otherwise noise (if you haven't already tried it) the last thing to do for max sensitivity is set the
confirm_gap to zero.
I think i can run some more test's with the frame rate settings. I don't know if it was asked before, but is it possible to feed the algo with a H264 from file? I need some more time to get familiar with the sources and the code structure. Perhaps we can save the motion vector stream only and use it as a replay feed for the detection algo.
H264 from a file will not have motion vector data so that won't work. The vector data interleaved in
the stream from the pi camera is a bonus we get from the mmal layer and is not normally in h264
streams. I'm not sure saving the vector stream by itself would be useful. In pikrellcam I have a I420
video stream (a camera component) on which I overlay draw the vector data before sending it to
a jpeg encoder.

If you save just vectors, you have no video reference to see. If you save the I420 video stream
you do not have the raw vector data. I'm not sure where you want to go with this, but if you save
data for some kind of replay, you might need to save both streams separately and process them
as you want.

BerryPicker
Posts: 177
Joined: Tue Oct 16, 2012 3:03 pm
Location: The East of England

Re: PiKrellCam: motion vector detect + OSD web interface

Sat Mar 26, 2016 2:05 pm

What is the best way to assign multiple tasks to take place for a single point in time or a single motion event. The several individual custom tasks will be bash scripts put in the scripts folder. The tasks will be called from within at-commands.conf for time events, and from within pikrellcam .conf for motion events.

Can the time or event be repeated for each task?
e.g.
daily sunset "do-this"
daily sunset "do-that"
e.g.
on_motion_begin $C/do-this
on_motion_begin $C/do-that

Or can several tasks be listed against a single time, or motion event
e.g.
daily sunset "do-this" "do-that"
e.g.
on_motion_begin $C/do-this $C/do-that

Return to “Camera board”