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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jul 26, 2015 4:22 pm

I only just started playing around with the Regions ON and Vectors ON to show how the computer sees the scene- very interesting! In my case, it looks like cars always have COUNT > 250 (and span at least two regions), bicycles COUNT < 200, people COUNT ~ 100 (more if walking a dog). In other words, it looks like it might be useful to sort a collection of thumbnails by the COUNT (and maybe MAGNITUDE) in case you were looking for a car/truck at one end, or a person or small animal at the other end. As far as I know, this information is currently not stored?
Last edited by jbeale on Sun Jul 26, 2015 4:31 pm, edited 1 time in total.

YvesG
Posts: 46
Joined: Wed Oct 03, 2012 6:54 pm

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jul 26, 2015 4:30 pm

jbeale wrote:I only just started playing around with the Regions ON and Vectors ON to show how the computer sees the scene- very interesting! In my case, it looks like cars always have COUNT > 250, bicycles COUNT < 200, people COUNT ~ 100. In other words, it looks like it might be useful to sort a collection of thumbnails by the COUNT (and maybe MAGNITUDE) in case you were looking for a car/truck at one end, or a person or small animal at the other end. As far as I know, this information is currently not stored?
Very interesting, i just checked with a car moving in front of the camera (this is as rare as a squirrel from this window :-)) i get a count of about 50~60 (i think my camera is far from the car than yours), sorting by COUNT could help you to find what you are looking for but order things by time is also helpful.

Another cool thing that can be done now is using gphoto2 to take some pictures from your camera when a motion has been detected :-)

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jul 26, 2015 4:37 pm

WIth the camera looking over the driveway, the road is pretty close. Also in 1920x1080 16:9 mode you get more pixels per object than in full-frame 4:3 format. Here a car exceeds a total count of 400, spanning two detection regions.
Image

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jul 26, 2015 9:55 pm

jbeale wrote:I only just started playing around with the Regions ON and Vectors ON to show how the computer sees the scene- very interesting! In my case, it looks like cars always have COUNT > 250 (and span at least two regions), bicycles COUNT < 200, people COUNT ~ 100 (more if walking a dog). In other words, it looks like it might be useful to sort a collection of thumbnails by the COUNT (and maybe MAGNITUDE) in case you were looking for a car/truck at one end, or a person or small animal at the other end. As far as I know, this information is currently not stored?
It's known at the time of the preview save, but it's not saved. There could be a variable
to embed the magnitude/count in the filename and the web page would have to handle that.
But this is almost like sorting on file size. It's not a perfect correlation, but if you range from
a car detect to an animal detect, count box is larger for the car and the corresponding
thumbnail size will likely be bigger.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jul 26, 2015 10:00 pm

There's an update available, to update:

Code: Select all

cd ~/pikrellcam
git pull origin
Just a note about git. If you modify about anything in src or www,
git is going to complain because by modifying you have created your
own git branch. If you know git then you know what to do, but if
you don't there's a simple shortcut to get back in sync.
If you ever run git and get an error like:

Code: Select all

$ git pull origin
Updating e78deba..a6929d1
error: Your local changes to the following files would be overwritten by merge:
    www/index.php
    www/media.php
Please, commit your changes or stash them before you can merge.
Just delete www/index.php and www/media.php and run again: git pull origin
But if you have modified something you really want to keep, then you
will need to know git and know about git {pull|fetch|merge} to start.
You can modify any file in the scripts directory and git won't complain.

I've made Jbeal's thumbnail page script part of the distribution
and there's a link to it on the web page. The thumbnail creation
and saving is now automatic and is no longer in new install
preview-save scripts. But it is still there for all of you that have
already installed and if you have enabled the "convert" line in your
preview-save you no longer need that. Either comment it out or copy the
new scripts-dist/preview-save into the scripts directory and edit again
if you want the email or preview jpeg save to somewhere. Also,
to use your current thumbnails, you need to move them to the thumbs
directory. First, run the new pikrellcam to create the thumbs directory,
and then whatever your media_dir is (default is ~/pikrellcam/media):

Code: Select all

cd media_dir/stills
mv *.th.jpg ../thumbs
If on the web page you delete a video in media_dir/videos, the
corresponding thumbnail in media_dir/thumbs will be deleted but
there's not yet any deleting capability on the thumbs page itself.
After jbeale has a chance to do everything he wants with that page,
we can see if there's anything else people want. YvesG has already
suggested some kind of date listing or filtering.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jul 26, 2015 10:55 pm

The motion-area thumbnail almost always works as expected, but sometimes it covers more area than it should. Here is an example, where the thumbnail has a vertical aspect whereas the car is more horizontal. I suppose it is because there is a small disconnected area of motion. Watching the video in this case, you can see that there is a tiny sparkle from the foreground parked car's rear window reflecting a glint coming from the moving car, and generating a small area of motion in the lower part of the frame. So this is a (small area of) legitimate motion, but I wonder if there is some way to ignore a small area when calculating the bounding box, if there is a disconnected large area?

Full preview area:
Image
Generated motion-area thumbnail:
Image

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jul 26, 2015 11:05 pm

jbeale wrote:So this is a (small area of) legitimate motion, but I wonder if there is some way to ignore a small area when calculating the bounding box, if there is a disconnected large area?
It sure could be done since the counts and positions of each of the contributing vectors are known.
I'll take a look at it.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Sun Jul 26, 2015 11:55 pm

jbeale wrote:
billw wrote: Maybe if I just wait a little longer you might have it all done before I could even start on it.
Here is a very simple, no-frills thumbnail index page. You can click on any image to play the associated video.

Create "thumbs.php" with the code below, and put it in the directory /home/pi/pikrellcam/www/ so you can see it in your browser at <my.pi.ip.addr>/thumbs.php

This assumes you have enabled the "motion area only" thumbnails as described here, and still filenames have the form *.th.jpg
This also assumes that videos are in media/videos/ and thumbnail images are in media/stills/ relative to the PHP file, so you'll have it edit it at the bottom where it says showGallery("media/videos/","media/stills/"); if your file structure is something else.

Code: Select all

<?php
// display JPEG images in directory in name order, with clickable links
function showGallery( $pathToVideo, $pathToThumbs )
{
  $cols = 4;  // how many columns on the HTML page

  $output = "<html>";
  $output .= "<head><title>Thumbnails</title></head>";
  $output .= "<body>";
  $output .= "<center><h3><a href=index.php>PiKrellCam</a></h3></center>";
  $output .= "<table cellspacing=\"0\" cellpadding=\"2\" width=\"500\">";
  $output .= "<tr>";

  $dir = opendir( $pathToThumbs );  // open the directory
  $a=array();  // hold filenames in array so we can sort them in order
  while (false !== ($fname = readdir($dir)))  // loop through directory
  {
    if (substr($fname, -4) == '.jpg') // select only *.jpg filenames
    { $a[]=$fname; } // add this filename to the array
  }
  closedir( $dir ); // close the directory, all done reading
  $counter = 0;     // count how many images total so far
  sort($a);         // sorts the array of filenames in-place
  foreach($a as $fname){
      $vname = rtrim($fname, ".th.jpg") . ".mp4"; // filename X.th.jpg becomes X.mp4
      $output .= "<td valign=\"middle\" align=\"center\"><a href=\"{$pathToVideo}{$vname}\">";
      $output .= "<img src=\"{$pathToThumbs}{$fname}\" border=\"0\" />";
      $output .= "</a></td>";
      $counter += 1;
      if ( $counter % $cols  == 0 ) { $output .= "</tr><tr>"; }
  }
  $output .= "</tr> </table> </body> </html>"; // end of HTML file
  echo $output;  // send out the completed HTML web page
}
showGallery("media/videos/","media/stills/");  // video and thumbnail directories
?>
Also I changed index.php to add a button next to VIDEO and STILL, to link to the new "thumbs.php" page:

Code: Select all

        <div id="container" class="top-margin">
      Files:
      <a href="media.php?dir=<?php echo VIDEO_DIR; ?>"
        class="btn-control"
      >Videos</a>
      <a href="media.php?dir=<?php echo STILL_DIR; ?>"
        class="btn-control"
      >Stills</a>
      <a href="thumbs.php"
        class="btn-control"
        style="margin-right:20px;"
      >Thumbs</a>
      Enable:
@jbeale:

Thanks for all the hard work you and have done as well as billw. I think if I can get the motion-area thumbs to work for me, this could very well be my goto for surveillance on my RPis.

Well, I'm still not doing something correctly. I believe I've been following the correct steps:

1. I took the "thumb.php" file you made and put it in the home/pi/pikrellcam/www folder. That page comes up (nothing on it yet).

2. I added the "thumbs" button code you added to index.php. Not essential for the issues I'm having`, but it does work.

3. In the scripts (and scripts-dist) folder, I uncommented:
on_motion_preview_save $C/preview-save $F $m $P $G $i $J $K $Y
cp $PREVIEW_JPEG $PREVIEW_JPEG_DIR
echo "cp $PREVIEW_JPEG $PREVIEW_JPEG_DIR" >> $LOG_FILE
BASE=`basename $PREVIEW_JPEG`
THUMB_JPEG=${BASE%.jpg}.th.jpg

I think that's it. When I did #3 above, I got both stills and thumbs, but of the entire image screen, not the motion-area thumbs. So clearly I'm missing something.

Thanks!

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 12:16 am

3. In the scripts (and scripts-dist) folder, I uncommented:
on_motion_preview_save $C/preview-save $F $m $P $G $i $J $K $Y
cp $PREVIEW_JPEG $PREVIEW_JPEG_DIR
echo "cp $PREVIEW_JPEG $PREVIEW_JPEG_DIR" >> $LOG_FILE
BASE=`basename $PREVIEW_JPEG`
THUMB_JPEG=${BASE%.jpg}.th.jpg

I think that's it. When I did #3 above, I got both stills and thumbs, but of the entire image screen, not the motion-area thumbs. So clearly I'm missing something.
The "cp" line you uncommented is for the entire screen jpeg. You would have had to
uncomment the "convert" line lower down. But that is all unnecessary now. Do a
git pull origin and you will get jbeale's thumb page as well as automatic saving of the thumb.
But if you have edited anything in scripts-dist you will get an error with the git command.
So, you will need to do this:

Code: Select all

cd ~/pikrellcam
rm scripts-dist/preview-save
git pull origin
cp scripts-dist/preview-save scripts
Then start over editing scripts/preview-save if you want. The thumb option is no longer
in it since that is automatic now.
EDIT: you will also have to delete ~/pikrellcam/www/thumbs.php and
~/pikrellcam/www/index.php before the git pull will work.
Everybody else that edited those files will also need to delete them before doing git pull.
Read my post above about getting errors with git pull origin.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 12:39 am

@boomlikethat: Have a look at your log file: cat /tmp/pikrellcam.log
Below is an example from mine. Note the line that says "convert...." which is what actually creates the smaller thumbnail, using the imagmagick program 'convert'. If you don't have it, that could be the reason. (I've actually created a new directory 'media/thumbs' but that's only local to me for now.)

The 'convert' command is called from /home/pi/pikrellcam/scripts/preview-save so check what you have in that file.

Code: Select all

Video record: /home/pi/pikrellcam/media/videos/motion_2015-07-26_17.35.45_125.mp4.h264 ...
event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg
event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg
event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg
Video motion record stopped.
execl:[(MP4Box -quiet -fps 24 -add /home/pi/pikrellcam/media/videos/motion_2015-07-26_17.35.45_125.mp4.h264 /home/pi/pikrellcam/media/videos/motion_2015-07-26_17.35.45_125.mp4 2> /dev/null ; rm /home/pi/pikrellcam/media/videos/motion_2015-07-26_17.35.45_125.mp4.h264)]
execl:[/home/pi/pikrellcam/scripts/preview-save  /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg /home/pi/pikrellcam/media /home/pi/pikrellcam/www/FIFO /tmp/pikrellcam.log 124 125 307 83]
cp /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg /home/pi/pikrellcam/media/stills
convert /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg -crop 124x125+245+21 -resize 200x200 /home/pi/pikrellcam/media/thumbs/motion_2015-07-26_17.35.45_125.th.jpg
event_preview_dispose(); removing /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg

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

motion-area thumbnails better square?

Mon Jul 27, 2015 4:54 am

I am realizing that it is difficult to make a nice-looking page of thumbnails when they have different sizes and aspect ratios. So my current thinking is to force them all to be square, making both Width and Height equal the larger of the (Width, Height) values found from the actual area of motion, as done in the pikrellcam/scripts/preview-save file below. Also I'm using a separate directory for the thumbnails, vs. the full-size stills.

Code: Select all

#!/bin/bash

# This is a motion event on_motion_preview_save script.
# Uncomment lines to enable emailing the preview jpeg, copying the preview
# jpeg, taking a still, or generating a thumb of the preview jpeg.
#
# uncomment any echo lines to the LOG_FILE if you want logging.
#
# Argument substitution done by PiKrellCam before running this script:
#   $C - scripts directory so this script is found.
#   $F - the preview jpeg filename full path (from MJPEG_DIR)
#   $m - the media directory full path
#   $P - the command FIFO
#   $G - log file configured in ~/.pikrellcam/pikrellcam.conf.
#   $i	 width of the motion detected area in the preview jpeg
#   $J	 height of the motion detected area in the preview jpeg
#   $K	 x coordinate of the motion detected area center in the preview jpeg
#   $Y	 y coordinate of the motion detected area center in the preview jpeg
# 
# In ~/.pikrellcam.conf, for this script as is, make on_motion_preview_save:
#
# on_motion_preview_save  $C/preview-save  $F $m $P $G $i $J $K $Y

PREVIEW_JPEG=$1
MEDIA_DIR=$2
FIFO=$3
LOG_FILE=$4

# uncomment and edit MY_EMAIL to your email address to email the preview jpeg.
#
[email protected]
#mpack -s [email protected]$HOSTNAME $PREVIEW_JPEG $MY_EMAIL
#echo "mpack -s [email protected]$HOSTNAME $PREVIEW_JPEG $MY_EMAIL" >> $LOG_FILE



# uncomment to copy the low resolution preview jpeg to the stills directory.
# Edit PREVIEW_JPEG_DIR to copy it anywhere you want.
#
PREVIEW_JPEG_DIR=$MEDIA_DIR/stills
cp $PREVIEW_JPEG $PREVIEW_JPEG_DIR
echo "cp $PREVIEW_JPEG $PREVIEW_JPEG_DIR" >> $LOG_FILE



# uncomment if you want to take a still.  This is probably only useful if
# preview_save_mode is "first" because if the mode is "best" the still will
# be taken after the action has ended.  So use the on_motion_begin command
# to take a still if preview_save_mode is "best".  The on_motion_begin
# command can be a script like this or the internal command "@still"
# Note that taking a full resolution still can put a glitch into the motion
# video being recorded because the camera has to switch modes.
#
#echo "still" > $FIFO
#echo "preview save script: still" >> $LOG_FILE



# Uncomment the "convert" line to generate a thumb of the motion detected area
# inside of the preview jpeg.
# The default here is to save the thumb into the media_dir/stills directory
# so a name is created with a ".th" inserted into the PREVIEW_JPEG name in case
# saving the full jpeg has also been enabled to save to the same directory.
#
W=$5
H=$6
X=$7
Y=$8

if [ "$W" -gt "$H" ]; then
  SZ=$W
else
  SZ=$H
fi

XT=`expr $SZ / 2`
XO=`expr $X - $XT`
YT=`expr $SZ / 2`
YO=`expr $Y - $YT`
if [ "$XO" -lt 0 ]; then
  XO=0
fi
if [ "YO" -lt 0 ]; then
  YO=0
fi

THUMB_JPEG_DIR=$MEDIA_DIR/thumbs

# Change a motion-xxx.jpg into motion-xxx.th.jpg.  PREVIEW_JPEG is a full path.
# This is not necessary if THUMB_JPEG_DIR is different from PREVIEW_JPEG_DIR
# or the PREVIEW_JPEG is not copied.
BASE=`basename $PREVIEW_JPEG`
THUMB_JPEG=${BASE%.jpg}.th.jpg

convert $PREVIEW_JPEG -crop ${SZ}x$SZ+$XO+$YO -resize 150x150\! $THUMB_JPEG_DIR/$THUMB_JPEG
echo "convert $PREVIEW_JPEG -crop ${SZ}x$SZ+$XO+$YO -resize 150x150\! $THUMB_JPEG_DIR/$THUMB_JPEG" >> $LOG_FILE
I'm thinking of rudely ripping off the preview page from RPi Web Cam; a partial (modified) port is shown below. The PHP files are somewhat lengthy and I don't understand all of the code. Seems to include a fonts directory for a single character (that boldface "<" at the top left), and a css directory with a bunch more stuff.
Image

Jasimo
Posts: 51
Joined: Mon Apr 27, 2015 11:50 am

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 8:31 am

Hi,
need help again ;-)
I just setup the regions for my cam and i try to save this, but after a stop/start my setting for the regions are gone. Could someone pls explain the load/save functionality.
I want my regions to load at startup.
rgs
Jan

kevw
Posts: 22
Joined: Wed Aug 27, 2014 1:49 pm

Re: motion-area thumbnails better square?

Mon Jul 27, 2015 8:54 am

jbeale wrote:
I'm thinking of rudely ripping off the preview page from RPi Web Cam; a partial (modified) port is shown below. The PHP files are somewhat lengthy and I don't understand all of the code. Seems to include a fonts directory for a single character (that boldface "<" at the top left), and a css directory with a bunch more stuff.
Image
That would be really good - they both have excellent features...would that be classed as a fork by taking the file management pieces/scheduler/tbc from RPi Web Cam and integrating with pikrelcam? :) I imagine it'd be awkward to merge the projects and focus as a collective.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 12:55 pm

jbeale wrote:@boomlikethat: Have a look at your log file: cat /tmp/pikrellcam.log
Below is an example from mine. Note the line that says "convert...." which is what actually creates the smaller thumbnail, using the imagmagick program 'convert'. If you don't have it, that could be the reason. (I've actually created a new directory 'media/thumbs' but that's only local to me for now.)

The 'convert' command is called from /home/pi/pikrellcam/scripts/preview-save so check what you have in that file.

Code: Select all

Video record: /home/pi/pikrellcam/media/videos/motion_2015-07-26_17.35.45_125.mp4.h264 ...
event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg
event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg
event preview save: copy /run/pikrellcam/mjpeg.jpg -> /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg
Video motion record stopped.
execl:[(MP4Box -quiet -fps 24 -add /home/pi/pikrellcam/media/videos/motion_2015-07-26_17.35.45_125.mp4.h264 /home/pi/pikrellcam/media/videos/motion_2015-07-26_17.35.45_125.mp4 2> /dev/null ; rm /home/pi/pikrellcam/media/videos/motion_2015-07-26_17.35.45_125.mp4.h264)]
execl:[/home/pi/pikrellcam/scripts/preview-save  /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg /home/pi/pikrellcam/media /home/pi/pikrellcam/www/FIFO /tmp/pikrellcam.log 124 125 307 83]
cp /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg /home/pi/pikrellcam/media/stills
convert /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg -crop 124x125+245+21 -resize 200x200 /home/pi/pikrellcam/media/thumbs/motion_2015-07-26_17.35.45_125.th.jpg
event_preview_dispose(); removing /run/pikrellcam/motion_2015-07-26_17.35.45_125.jpg
@billw: thanks for updating it. To be sure, I deleted all I had and re-installed PiKrellCam.

@jbeale: Ok, now that I've reinstalled, I'm seeing this in my log (this is a partial):

pikrellcam/media/videos/motion_2015-07-27_08.42.55_5.mp4 2> /dev/null ; rm /home/pi/pikrellcam/media/videos/motion_2015-07-27_08.42.55_5.mp4.h264)]
execl:[/home/pi/pikrellcam/scripts-dist/_thumb /run/pikrellcam/motion_2015-07-27_08.42.55_5.jpg /home/pi/pikrellcam/media /home/pi/pikrellcam/www/FIFO /tmp/pikrellcam.log 60 60 488 177]
convert /run/pikrellcam/motion_2015-07-27_08.42.55_5.jpg -crop 60x60+458+147 -resize 200x200 /home/pi/pikrellcam/media/thumbs/motion_2015-07-27_08.42.55_5.th.jpg
event_preview_dispose(); removing /run/pikrellcam/motion_2015-07-27_08.42.55_5.jpg

So, I'm seeing convert going, but still no motion-area thumbs.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 1:55 pm

/home/pi/pikrellcam/media/thumbs/motion_2015-07-27_08.42.55_5.th.jpg
Only in the past few days did I modify my installation to have a "media/thumbs" directory and for the index page to look at it; previously and by default the original index page looked only at media/stills, is that the case with your setup?

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 2:38 pm

jbeale wrote:
/home/pi/pikrellcam/media/thumbs/motion_2015-07-27_08.42.55_5.th.jpg
Only in the past few days did I modify my installation to have a "media/thumbs" directory and for the index page to look at it; previously and by default the original index page looked only at media/stills, is that the case with your setup?
My current setup has:
Thumbs pointing to http://ip.address/thumbnails.php
Stills pointing to http://ip.address/media.php?dir=media/stills

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

Re: motion-area thumbnails better square?

Mon Jul 27, 2015 2:55 pm

kevw wrote:
jbeale wrote:
I'm thinking of rudely ripping off the preview page from RPi Web Cam; a partial (modified) port is shown below. The PHP files are somewhat lengthy and I don't understand all of the code. Seems to include a fonts directory for a single character (that boldface "<" at the top left), and a css directory with a bunch more stuff.
Image
That would be really good - they both have excellent features...would that be classed as a fork by taking the file management pieces/scheduler/tbc from RPi Web Cam and integrating with pikrelcam? :) I imagine it'd be awkward to merge the projects and focus as a collective.
There is a copyright notice in the RPI Cam Web www directory which allows reuse. So if you
want to use their preview.php, you should put the Silvan Melchior Copyright notice in the
php file or any file of theirs you use. That is not a fork and all remaining parts of the two
projects would remain separate. But I don't want to start the precedent of using a lot of their code.
If you do that, you can certainly post the file or files on this forum, but I would consider this for now
a means for people to get that functionality to use on their own and I will not immediately add
it to the pikrellcam git repository. I will have to review the situation:

If there were ever to be any kind of merging of the projects, I would prefer it to happen through
a discussion and not through the step of suddenly using sections of their code. Their web
page development certainly has features we lack, but the core pikrellcam program has features
raspimjpeg lacks, and there are some incompatibilies. Maybe the right approach would be to post
on their forum that you are looking at using the preview.php from their web interface in pikrellcam
and want them to be aware of it. Give them an opportunity to voice an opinion and have input.
If anything positive long term is to develop, we can't have them resent our using the hard work
they have put into their web page development. So that is why I won't immediately add this
to the pikrellcam git repository.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 3:27 pm

In truth I'm not completely happy with the RPi Cam preview page, I prefer to do things a little differently. However I don't really know PHP, I'm in the process of learning what I need. The existing RPi Cam preview is more complex than I'm comfortable with right now and I would certainly not suggest importing it wholesale into PiKrellCam at this point.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 4:23 pm

Jasimo wrote:Hi,
need help again ;-)
I just setup the regions for my cam and i try to save this, but after a stop/start my setting for the regions are gone. Could someone pls explain the load/save functionality.
I want my regions to load at startup.
rgs
Jan
@Jasimo,

Here's what I did. After I created all the regions, I typed a name (I made it easy, I made it "1") in the box to the left for "Save", and then clicked "Save".

If I needed to start/stop, or reboot the Pi, I typed in "1" in the box next to the "Load" button, then clicked "Load". That works.

Now, if you look in the ~/.pikrellcam folder, you'll see the "motion-regions.conf" (the default regions filename) and any others (in my case, "motion-regions-1.conf"). I'm guessing you could rename the file you made to the default name.

Then it would load your settings by default, but it may get overwritten on any updates.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 4:34 pm

boomlikethat wrote:
Jasimo wrote:Hi,
need help again ;-)
I just setup the regions for my cam and i try to save this, but after a stop/start my setting for the regions are gone. Could someone pls explain the load/save functionality.
I want my regions to load at startup.
rgs
Jan
@Jasimo,

Here's what I did. After I created all the regions, I typed a name (I made it easy, I made it "1") in the box to the left for "Save", and then clicked "Save".

If I needed to start/stop, or reboot the Pi, I typed in "1" in the box next to the "Load" button, then clicked "Load". That works.

Now, if you look in the ~/.pikrellcam folder, you'll see the "motion-regions.conf" (the default regions filename) and any others (in my case, "motion-regions-1.conf"). I'm guessing you could rename the file you made to the default name.

Then it would load your settings by default, but it may get overwritten on any updates.
Yes, you can type in "default" as the name and that should work. Or you can give it any custom
name you want. It can be "1" as suggested or any name that means something if you have
multiple Pi setups. Names like backyard, window, etc. Then for each pi, put in
~/.pikrellcam/at-commands.conf a startup motion regions load depending on Pi:

Code: Select all

daily start "@motion load_regions window"
Eventually I'm going to add a way to list on the OSD the custom regions you have saved,
but for not just look in ~/.pikrellcam to see regions you have saved, names
like: motion-regions-window.conf

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 4:35 pm

boomlikethat wrote:
jbeale wrote:
/home/pi/pikrellcam/media/thumbs/motion_2015-07-27_08.42.55_5.th.jpg
Only in the past few days did I modify my installation to have a "media/thumbs" directory and for the index page to look at it; previously and by default the original index page looked only at media/stills, is that the case with your setup?
My current setup has:
Thumbs pointing to http://ip.address/thumbnails.php
Stills pointing to http://ip.address/media.php?dir=media/stills

@jbeale: update

I copied your preview-save code, and I indeed get full-camera stills (with vectors and all that), which is a good start. Now it's just the motion-area only thumbs I cannot get.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 4:50 pm

billw wrote:
boomlikethat wrote:
Jasimo wrote:Hi,
need help again ;-)
I just setup the regions for my cam and i try to save this, but after a stop/start my setting for the regions are gone. Could someone pls explain the load/save functionality.
I want my regions to load at startup.
rgs
Jan
@Jasimo,

Here's what I did. After I created all the regions, I typed a name (I made it easy, I made it "1") in the box to the left for "Save", and then clicked "Save".

If I needed to start/stop, or reboot the Pi, I typed in "1" in the box next to the "Load" button, then clicked "Load". That works.

Now, if you look in the ~/.pikrellcam folder, you'll see the "motion-regions.conf" (the default regions filename) and any others (in my case, "motion-regions-1.conf"). I'm guessing you could rename the file you made to the default name.

Then it would load your settings by default, but it may get overwritten on any updates.
Yes, you can type in "default" as the name and that should work. Or you can give it any custom
name you want. It can be "1" as suggested or any name that means something if you have
multiple Pi setups. Names like backyard, window, etc. Then for each pi, put in
~/.pikrellcam/at-commands.conf a startup motion regions load depending on Pi:

Code: Select all

daily start "@motion load_regions window"
Eventually I'm going to add a way to list on the OSD the custom regions you have saved,
but for not just look in ~/.pikrellcam to see regions you have saved, names
like: motion-regions-window.conf
Well, THAT's easier. Thanks billw!

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 4:59 pm

jbeale wrote:In truth I'm not completely happy with the RPi Cam preview page, I prefer to do things a little differently. However I don't really know PHP, I'm in the process of learning what I need. The existing RPi Cam preview is more complex than I'm comfortable with right now and I would certainly not suggest importing it wholesale into PiKrellCam at this point.
OK, look it over. We don't have to rush and I agree the PRi Cam code is more complex than
we need because for starters, it is compensating for functionality that raspimjpeg does not have.
The most prominent example is event scheduling. We don't need (and I don't want) a web
page scheduler. And we can add more functionality to pikrellcam if we need to if it would make
some operation from the web page easier to implement.

For the PHP, we can iron that out as we go. When you like, post what you have done and I'll help.

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

Re: PiKrellCam: motion vector detect + OSD web interface

Mon Jul 27, 2015 5:08 pm

boomlikethat wrote:
I copied your preview-save code, and I indeed get full-camera stills (with vectors and all that), which is a good start. Now it's just the motion-area only thumbs I cannot get.
From the webpage stop pikrellcam. Then in a terminal window run:

Code: Select all

pikrellcam -v
You may be able to see some additional error messages from the script that are not showing up
in the log.
And be sure you are really running the latest pikrellcam. I really need to get some version
numbers in that program! Umm, for now I guess look at the pikrellcam binary executable size.
The latest binary size from git should be: 122460.
EDIT: I mean run pikrellcam -v from a terminal on the Pi, either a window, console terminal,
or ssh terminal.
Last edited by billw on Mon Jul 27, 2015 5:31 pm, edited 1 time in total.

Return to “Camera board”