manuka
Posts: 1
Joined: Wed Feb 19, 2014 9:56 pm

Re: RPi Cam Web Interface

Wed Feb 19, 2014 10:08 pm

Beautiful project and well composed!
I think I found a typo in preview.php

Code: Select all

line 35: onclick='if(confirm(\"Delete al?\"))
should be

Code: Select all

onclick='if(confirm(\"Delete all?\"))
Not a single major problem so far.. Thank you so much for this!

robm99
Posts: 6
Joined: Sat Feb 22, 2014 1:20 am

Re: RPi Cam Web Interface

Sat Feb 22, 2014 1:24 am

Is it possible to trigger a photo every X seconds through this, to create a full frame timelapse video?

leyonwaiter
Posts: 2
Joined: Sat Feb 22, 2014 8:08 am

Re: RPi Cam Web Interface

Sat Feb 22, 2014 3:34 pm

why i type the last sentence:./RPi_Cam_Browser_Control_Installer.sh install
RPI:No option selected

?


I'm so sorry! It's my fault....I forgot the 'Install',am I blind....

silvanmelchior
Posts: 76
Joined: Mon Nov 25, 2013 5:56 pm

Re: RPi Cam Web Interface

Sun Feb 23, 2014 1:50 pm

@manuka: Thanks, I fixed the typo.

@robm99: You can add the javascript-command

Code: Select all

setInterval("send_cmd('im');", 1000)
to the web-Interface for example to take a picture every second. RaspiMJPEG itself hasn't implemented timelapse at the moment.

karateo
Posts: 2
Joined: Mon Feb 24, 2014 12:56 pm

Re: RPi Cam Web Interface

Mon Feb 24, 2014 1:04 pm

Just posting to say thank you!
Great work.

The only thing I needed to change is,
basic authentication of the web page using .htaccess

HeikoG
Posts: 12
Joined: Wed Oct 16, 2013 11:53 am

Re: RPi Cam Web Interface

Mon Feb 24, 2014 7:40 pm

Please fix this in preview.php too:

"preview.php" line 37 of 52 --71%-- col 112

echo "<input type='button' value='Delete JPEGs' onclick='window.location=\"preview.php?deljpg=" . 'Y' . "\";'> ";

Thx.

robm99
Posts: 6
Joined: Sat Feb 22, 2014 1:20 am

Re: RPi Cam Web Interface

Mon Feb 24, 2014 9:40 pm

silvanmelchior wrote:@robm99: You can add the javascript-command

Code: Select all

setInterval("send_cmd('im');", 1000)
to the web-Interface for example to take a picture every second. RaspiMJPEG itself hasn't implemented timelapse at the moment.
Thanks for that. Perhaps a silly question, but how would you then stop the system taking a picture every second? I'd ideally like to add a "start timelapse" button which sends that command, and then a "stop timelapse" button which would stop the process and revert to normal use. Alternatively, I would probably be able to work with something which would just start the timelapse process and run it for say 5 minutes before stopping automatically and requiring a manual restart to continue with timelapse.


On a different note, in the intro post, you say "To configure motion detection, edit /etc/motion/motion.conf". Can you give any more detail about what needs to be edited in this file?

Many thanks for all of your work on this.

poing
Posts: 1131
Joined: Thu Mar 08, 2012 3:32 pm

Re: RPi Cam Web Interface

Mon Feb 24, 2014 11:37 pm

robm99 wrote:
silvanmelchior wrote:@robm99: You can add the javascript-command

Code: Select all

setInterval("send_cmd('im');", 1000)
to the web-Interface for example to take a picture every second. RaspiMJPEG itself hasn't implemented timelapse at the moment.
Thanks for that. Perhaps a silly question, but how would you then stop the system taking a picture every second? I'd ideally like to add a "start timelapse" button which sends that command, and then a "stop timelapse" button which would stop the process and revert to normal use.
Not really tested, as I have no camera running at the moment, but this should work. Just paste the code somewhere in the page, but not inside another tag:

Code: Select all

<script>
var lapsrunning=0;
function setlaps(){
	if(lapsrunning==0){
		document.getElementById('startstopLaps').innerHTML='Stop Timelapse';
		var e=document.getElementById("lapsInterval");
		lapsrunning=e.options[e.selectedIndex].value;
		lapsrunning=parseInt(lapsrunning)*1000;
		runlaps();
	}else{
		document.getElementById('startstopLaps').innerHTML='Start Timelapse';
		lapsrunning=0;
	}
}
function runlaps(){
	if(lapsrunning>0){
		send_cmd('im');
		setTimeout("runlaps()",lapsrunning);
	}
}
</script>

<button type='button' id='startstopLaps' onClick='setlaps()';>Start TimeLapse</button>
 with
<select id='lapsInterval'>
	<option value='1'>1</option>
	<option value='3'>3</option>
	<option value='5'>5</option>
	<option value='10'>10</option>
	<option value='30'>30</option>
	<option value='60'>60</option>
</select>
 second interval<br>
Last edited by poing on Tue Feb 25, 2014 12:40 pm, edited 1 time in total.

Pangu
Posts: 78
Joined: Tue Dec 18, 2012 5:30 pm

Re: RPi Cam Web Interface

Mon Feb 24, 2014 11:49 pm

Hello. Can anyone explain to me what the difference between this tool and "motion-mmal" from "dozencrow" or even the use of "uv4l" is ? What is the advantage/disadvantage? Which is the best way to get motion run on the RPi with maximum possible FPS and quality? thanks to all

rjain15
Posts: 6
Joined: Fri Nov 30, 2012 1:33 am

Re: RPi Cam Web Interface

Tue Feb 25, 2014 5:03 pm

Is it possible to create some kind of beep or warning sound if the object is moving towards you or if you are moving towards an obstacle.

The idea is to use the motion capture to warn someone if they are hitting an object or if the object is going to hit them.
The variables could be distance, speed of motion, size

Thanks,
Rajesh

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

Re: RPi Cam Web Interface

Tue Feb 25, 2014 6:13 pm

Pangu wrote:Hello. Can anyone explain to me what the difference between this tool and "motion-mmal" from "dozencrow" or even the use of "uv4l" is ? What is the advantage/disadvantage? Which is the best way to get motion run on the RPi with maximum possible FPS and quality? thanks to all
The RPi Cam Web Interface uses a program called raspimjpeg which generates a stream of relatively low resolution JPEG images. Such a stream is called motion-JPEG or MJPEG. If you turn on motion detection from the web interface, these MJPEG frames are sent to the "motion" application which does motion detection (but note, unless you change the source code to 'motion' and recompile it youself, it is rate-limited to actually do the motion detection algorithm at only 3 fps even if you send it 30 frames each second.) Once motion is detected, a signal goes back to the "raspimjpeg" program using a named-pipe mechanism and this turns on full-HD video recording at 30 fps, and recording proceeds until such time as the motion event is over. As a result you get normal rate video, even though the actual motion-detect algorithm is only running at 3 fps.

By contrast, the dozencrows "motion-mmal" and motion/UV4L by themselves can generate still frames or video, but they reconstruct that video from the still frames they are given, and that is limited by the small bandwidth and computation power of the Pi's ARMv6 CPU to something much less than full HD / 30 fps. I've found 3 fps at 1024x576 to be about as much as I can get from them.

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

Re: RPi Cam Web Interface

Tue Feb 25, 2014 6:23 pm

rjain15 wrote:Is it possible to create some kind of beep or warning sound if the object is moving towards you or if you are moving towards an obstacle.
The idea is to use the motion capture to warn someone if they are hitting an object or if the object is going to hit them.
The variables could be distance, speed of motion, size
Did you mean to post this in a different thread? How does the computer know from a JPEG image how close or far away an object is? It would first need to detect objects, and also would need to know their true size. The "motion" program is actually mis-named, it does NOT detect motion! It detects local changes in image brightness. That could be from something moving, or just from a change in lighting- the sun coming out from behind the clouds and casting shadows, for example.

The OpenCV program can detect objects, and comparing frames you could tell if it is moving towards you or away from you, but not the true distance. You can program it to know actual size of some specific objects it can recognize, and calculate distance for a few special cases but that is a very difficult problem in general. (Even people can have trouble with this, especially if you use only one eye like the RPi would generally have). It can be done at least in theory if you have two cameras, with image detection on both of them, matching up images and using the stereo depth information. This is quite a project though.

Normally to get distance information for a robot, etc. you use an ultrasonic sensor, something like this:
http://www.bytecreation.com/blog/2013/1 ... or-hc-sr04
http://www.youtube.com/watch?v=xACy8l3LsXI

You can also measure distance optically if you project a light (laser pointer?) from some distance offset to the side of your camera, and measure the position of the spot, you can then calculate distance using triangulation, something like this:
https://sites.google.com/site/todddanko ... ser_ranger

talkeasy
Posts: 38
Joined: Sun Nov 04, 2012 10:57 pm

Re: RPi Cam Web Interface

Wed Feb 26, 2014 1:30 pm

oke wrote:Dear jussi24,

You can change the picture size in following places and see what happens:
1. (sudo nano) RPI_Cam_Browser_Control_Installer.sh
2. (sudo nano) /etc/rc.local
3. (sudo nano) /var/www/index.html
- limit width and height for browser like: <img id="mjpeg_dest" width="960" height="540">

If You add this link (by hand), You can use IP Cam Viewer Pro (by Robert Chou) on tablet or phone
- ln -s /run/shm/mjpeg/cam.jpg /var/www/cam.jpg
- You can see the bigger picture by browser with no refresh too

IP Cam Viewer Pro settings are as follows:
- Generic URL, URL: http://my.raspberry.pi:80/cam.jpg
- Max size here is 1920 x 1080
- Tested with Nexus 4, Nexus 7 and Jolla

I have 4 cameras in use now and 3 of them with ethernet cable connection
keep on working. One camera has Wi-Fi connction and that connection
freezes at least once a week. I suggest a timer for daily power reset.
This is normal behavior with allmost all surveillance cameras.
Mozilla browser is used by me to record the max. resolution image.

If You get vc.ril.camera error message, check and push back the yellow connector on camera.

Set of different lenses is available from Verkkokauppa.com for 30€ (Item 10207).


Regards,

Oke
Can you please explain where

Code: Select all

- ln -s /run/shm/mjpeg/cam.jpg /var/www/cam.jpg
is placed?

Thanks.

Edit: just learnt a new Linux command ln! Got it working now, thanks.
Last edited by talkeasy on Wed Feb 26, 2014 3:50 pm, edited 1 time in total.

rjain15
Posts: 6
Joined: Fri Nov 30, 2012 1:33 am

Re: RPi Cam Web Interface

Wed Feb 26, 2014 2:34 pm

Did you mean to post this in a different thread? How does the computer know from a JPEG image how close or far away an object is? It would first need to detect objects, and also would need to know their true size. The "motion" program is actually mis-named, it does NOT detect motion! It detects local changes in image brightness. That could be from something moving, or just from a change in lighting- the sun coming out from behind the clouds and casting shadows, for example.

The OpenCV program can detect objects, and comparing frames you could tell if it is moving towards you or away from you, but not the true distance. You can program it to know actual size of some specific objects it can recognize, and calculate distance for a few special cases but that is a very difficult problem in general. (Even people can have trouble with this, especially if you use only one eye like the RPi would generally have). It can be done at least in theory if you have two cameras, with image detection on both of them, matching up images and using the stereo depth information. This is quite a project though.

Normally to get distance information for a robot, etc. you use an ultrasonic sensor, something like this:
http://www.bytecreation.com/blog/2013/1 ... or-hc-sr04
http://www.youtube.com/watch?v=xACy8l3LsXI

You can also measure distance optically if you project a light (laser pointer?) from some distance offset to the side of your camera, and measure the position of the spot, you can then calculate distance using triangulation, something like this:
https://sites.google.com/site/todddanko ... ser_ranger
Thanks... In my science project I was interested in using RPi Cam to detect obstacles and beep. The second part of the science project was to recognize objects. The RPi and camera are going to be mounted on a moving robot or a person.

This may be a wrong thread and I can move it to a different thread ...

Seems this might be a bigger task as you suggest and maybe not possible to do everything.

So here are my options, based on what you described.

1. Use Video for object recognition using frame by frame comparison....
2. Use Still Images for motion detection (Or I could do this using Video)
3. Use Ultra sonic sensor for distance of the object

All this has to be done in real time to provide the feedback to the robot or the person to react.

Is this all possible.?

Thanks
Rajesh

Pangu
Posts: 78
Joined: Tue Dec 18, 2012 5:30 pm

Re: RPi Cam Web Interface

Wed Feb 26, 2014 4:22 pm

Pangu wrote:Hello. Can anyone explain to me what the difference between this tool and "motion-mmal" from "dozencrow" or even the use of "uv4l" is ? What is the advantage/disadvantage? Which is the best way to get motion run on the RPi with maximum possible FPS and quality? thanks to all
jbeale wrote:The RPi Cam Web Interface uses a program called raspimjpeg which generates a stream of relatively low resolution JPEG images. Such a stream is called motion-JPEG or MJPEG. If you turn on motion detection from the web interface, these MJPEG frames are sent to the "motion" application which does motion detection (but note, unless you change the source code to 'motion' and recompile it youself, it is rate-limited to actually do the motion detection algorithm at only 3 fps even if you send it 30 frames each second.) Once motion is detected, a signal goes back to the "raspimjpeg" program using a named-pipe mechanism and this turns on full-HD video recording at 30 fps, and recording proceeds until such time as the motion event is over. As a result you get normal rate video, even though the actual motion-detect algorithm is only running at 3 fps.
Hello jbeale and thanks for your reply. Well, I understand now, that there are two different ways FPS occurs in this manner. So if I understood correct: the default raspbian package "motion" is hardcoded to support maximum 3fps for detection? In my understanding the 3fps for motion detection mechanism should be enough, please correct me if I'm wrong.
jbeale wrote:By contrast, the dozencrows "motion-mmal" and motion/UV4L by themselves can generate still frames or video, but they reconstruct that video from the still frames they are given, and that is limited by the small bandwidth and computation power of the Pi's ARMv6 CPU to something much less than full HD / 30 fps. I've found 3 fps at 1024x576 to be about as much as I can get from them.
So, when one is using "motion-mmal" (what exactly is different on this version from dozencrow? did he rewrote the package "motion" with some enhancement/improvements??) or the combination "default raspbian motion package + uv4l + uv4l-raspicam" it won't be possible to get a Full-HD videostream at 30fps ? At the other side: is it possible to have 1920x1080 @30fps video when I use the "RPi Cam Web Interface" from this topic here?

Perompak
Posts: 3
Joined: Wed Feb 26, 2014 5:36 pm

Re: RPi Cam Web Interface

Wed Feb 26, 2014 5:56 pm

Hi SilvanMelchior & Gruezi
being pretty novice to RPI & Debian, I have stuck 100% to your instructions - and received the following response:

pi@raspberrypi ~ $ mmal: mmal_vc_component_enable: failed to enable component: ENOSPC
Error: Could not enable camera

And the red LED of the camera is on. When I call the IP from my windows-WS, I get the RPI Cam Control settings, but when clicking "Download Videos and Images" I get a new page with "Files No videos/images saved".
To be sure that the cam works, I had tried it out with raspivid & raspistill.
How can I find out about my screw-up?

hairynoggin
Posts: 14
Joined: Wed Feb 05, 2014 7:31 pm

Re: RPi Cam Web Interface

Thu Feb 27, 2014 9:31 am

oke wrote:Dear jussi24,

You can change the picture size in following places and see what happens:
1. (sudo nano) RPI_Cam_Browser_Control_Installer.sh
2. (sudo nano) /etc/rc.local
3. (sudo nano) /var/www/index.html
- limit width and height for browser like: <img id="mjpeg_dest" width="960" height="540">

If You add this link (by hand), You can use IP Cam Viewer Pro (by Robert Chou) on tablet or phone
- ln -s /run/shm/mjpeg/cam.jpg /var/www/cam.jpg
- You can see the bigger picture by browser with no refresh too

IP Cam Viewer Pro settings are as follows:
- Generic URL, URL: http://my.raspberry.pi:80/cam.jpg
- Max size here is 1920 x 1080
- Tested with Nexus 4, Nexus 7 and Jolla

I have 4 cameras in use now and 3 of them with ethernet cable connection
keep on working. One camera has Wi-Fi connction and that connection
freezes at least once a week. I suggest a timer for daily power reset.
This is normal behavior with allmost all surveillance cameras.
Mozilla browser is used by me to record the max. resolution image.

If You get vc.ril.camera error message, check and push back the yellow connector on camera.

Set of different lenses is available from Verkkokauppa.com for 30€ (Item 10207).


Regards,

Oke
Hi Guys,

tried this but doesn't seem to alter the video output size. I will try to explain.

the current video is set at 512px × 288px (from recorded video information)... how, using this threads cam project can I alter the video image recorded to say 1024 x 576 giving me a wider field of view, but maintain the 512x288 on the rpi cam control.

Also Is there a way to (or does it do it already) to compile the video then have it uploaded to a remote server? Or am I missing the target here. Are the images buffered before then mp4 is placed for viewing? (in which case pre-compile wouldn't be necessary)

thanks in advance from a raspnoob

mr_wberrypi
Posts: 10
Joined: Fri Nov 16, 2012 3:44 pm

Re: RPi Cam Web Interface

Fri Feb 28, 2014 8:53 am

Hi, got the Rpi Cam interface working nicely. Its running over a longer period already without any problem. One thing I still did not figured out, is how to record the files onto my Mounted NAS, instead of saving them on the SD card.
So would be nice having the PI record video 24/7 and save the recorded files on my Nas?

Thanks. W.

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

Re: RPi Cam Web Interface

Fri Feb 28, 2014 5:32 pm

Pangu wrote:So, when one is using "motion-mmal" (what exactly is different on this version from dozencrow? did he rewrote the package "motion" with some enhancement/improvements??) or the combination "default raspbian motion package + uv4l + uv4l-raspicam" it won't be possible to get a Full-HD videostream at 30fps ? At the other side: is it possible to have 1920x1080 @30fps video when I use the "RPi Cam Web Interface" from this topic here?
motion-mmal from dozencrows was written to enable motion detection using the R-Pi mmal camera interface directly, before the v4l2 interface was available. Nowadays, you can also use stock "motion" with the new v4l2 interface. But as I explained, neither one allows 1920x1080 @ 30fps because the R-Pi CPU is too slow to encode HD video by itself. You would have to use the GPU to get full HD, and motion doesn't do that.

The "RPi Cam Web Interface" setup allows you to record 1920x1080 @ 30fps straight from the GPU, after it is triggered by the (slow) motion-detection algorithm running on the CPU.

By the way, if you just want to record HD video 24x7 to an external NAS, without bothering with any motion detection, there is no need for this program. Just use raspivid with the "-o" option specifying the path to your storage. Of course you would first need to mount the NAS. If your drive is on a windows box, here is one approach to do that: http://www.stuffaboutcode.com/2012/05/r ... share.html

memilanuk
Posts: 53
Joined: Fri Aug 09, 2013 2:20 pm

Re: RPi Cam Web Interface

Sat Mar 01, 2014 5:39 am

Hello there,

I recently reloaded Raspbian on an sd card for my RPi + pi cam and loaded the program as described in the first post of this thread. Everything seems to work fine; I can access the web page from my laptop, my Kindle Fire, or my Samsung S4 phone. Sweet! :mrgreen:

The problem I'm having at this point is that the whole thing seems to run... really... slooooooooooooow...... like a very visible lag in displaying changes of the image. Displaying images via the web interface is similarly very slow, given an RPi w/ wifi dongle about 20 feet from the access point and the viewing laptop a similar distance. Displaying videos recorded via motion detection? Forget it - takes 5 minutes or more to download a ~30 meg video file.

Is there something I should be checking, or is the RPi really this slow?

Thanks,

Monte

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

Re: RPi Cam Web Interface

Sat Mar 01, 2014 3:29 pm

memilanuk wrote: ...very slow, given an RPi w/ wifi dongle ...
I have seen the program perform perfectly smoothly, it is not the RPi by itself. I think it is your wifi dongle. When I used a small cheap 8188CUS type wifi it would be very slow. When I used a Atheros AR9271 it worked better, see this post:
http://www.raspberrypi.org/forum/viewto ... 25#p493031
and when I use wired ethernet it works best of all. Unless you are running some other resource-heavy program on your Pi, I can almost guarantee you the wifi is the problem.

aunitt
Posts: 11
Joined: Tue Sep 18, 2012 8:43 pm

Re: RPi Cam Web Interface

Sun Mar 02, 2014 1:07 pm

Apologies for the possibly stupid question, but I can't get the rotation on the web page to work, whatever rotation value I set doesn't seem to make a difference.

Any pointers as to what I could be doing wrong?

hairynoggin
Posts: 14
Joined: Wed Feb 05, 2014 7:31 pm

Re: RPi Cam Web Interface

Sun Mar 02, 2014 2:57 pm

aunitt wrote:Apologies for the possibly stupid question, but I can't get the rotation on the web page to work, whatever rotation value I set doesn't seem to make a difference.

Any pointers as to what I could be doing wrong?
Try a different web browser...firefox works... mobile browsers on tablets and phones don't seem to, well stock, chrome and firefox on android (for me)

aunitt
Posts: 11
Joined: Tue Sep 18, 2012 8:43 pm

Re: RPi Cam Web Interface

Sun Mar 02, 2014 4:51 pm

Cool, Firefox did the trick, I was using Chrome and Safari.

0lly
Posts: 77
Joined: Sun Mar 02, 2014 5:07 pm

Re: RPi Cam Web Interface

Sun Mar 02, 2014 5:19 pm

mr_wberrypi wrote:how to record the files onto my Mounted NAS, instead of saving them on the SD card.
So would be nice having the PI record video 24/7 and save the recorded files on my Nas?
Serch for Mount --bind
One can also mount an already visible directory tree elsewhere:
mount --bind olddir newdir

Code: Select all

# mount --bind /mnt/xyz /var/www/media

Return to “Camera board”