<?xml version="1.0" encoding="ISO-8859-1"?>

<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
	<channel>
		<title><![CDATA[OPENCV & COMPUTER VISION FORUM - IT/EN - OpenCV, Computer Vision and HighTech Security]]></title>
		<link>http://www.bernardotti.it/portal</link>
		<description>Il portale biometrico.  Computer vision con OpenCV. Tutte le argomentazioni legate alla programmazione avanzata in particolar modo indirizzata alle metodologie di riconoscimento biometrico, Riconoscimento facciale,  impronta digitale e tutto quello che riguarda la videosorveglianza intelligente. Opencv forum.</description>
		<language>it</language>
		<lastBuildDate>Mon, 06 Sep 2010 04:27:11 GMT</lastBuildDate>
		<generator>vBulletin</generator>
		<ttl>60</ttl>
		<image>
			<url>http://www.bernardotti.it/portal/images/misc/rss.jpg</url>
			<title><![CDATA[OPENCV & COMPUTER VISION FORUM - IT/EN - OpenCV, Computer Vision and HighTech Security]]></title>
			<link>http://www.bernardotti.it/portal</link>
		</image>
		<item>
			<title>Proiezione di un oggetto 3D su marker</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416773&amp;goto=newpost</link>
			<pubDate>Sun, 05 Sep 2010 15:13:29 GMT</pubDate>
			<description>Sal...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>Salve a tutti,<br />
ho scritto un programma per il rilevamento di marker di forma quadrata/rettangolare. Adesso dovrei visualizzare un oggetto 3d su questi marker di cui riesco a rilevare i 4 angoli.<br />
Dato che ho già un programma che, tramite cvFindChessboardCorners e cvFindExtrinsics, mi visualizza un cubo sulla scacchiera della calibrazione di opencv, avevo pensato che bastasse passare i punti del marker come image points a cvFindExtrinsics e utilizzare lo stesso sistema per calcolare gli object points usato per la scacchiera:<br />
for ( int j = 0; j &lt; board_size.height; j++ )<br />
	{<br />
		for ( int k = 0; k &lt; board_size.width; k++ )<br />
		{<br />
			*obj_pt++ = cvPoint3D32f(j*square_size, k*square_size, 0);<br />
		}<br />
	}<br />
<br />
(dove board_size è il numero di quadrati della scacchiera)<br />
<br />
Dato che in questo caso non ho 1 scacchiera ma un singolo marker, ho pensato di fare così:<br />
<br />
for ( int j = 0; j &lt; 2; j++ ) {<br />
		for ( int k = 0; k &lt; 2; k++ ) {<br />
			*obj_pt++ = cvPoint3D32f(j, k, 1);<br />
		}<br />
	}<br />
<br />
Ma, come era prevedibile, il cubo non viene visualizzato nella posizione del marker, oppure non viene visualizzato affatto.<br />
<br />
Dopo alcune ricerche, anche su questo forum, ho letto che  bisognerebbe usare un algoritmo RANSAC per trovare le giuste coppie object-image points.<br />
E' così, oppure esiste una soluzione più semplice?<br />
<br />
Grazie in anticipo.</div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=7">OpenCV</category>
			<dc:creator>gio</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416773</guid>
		</item>
		<item>
			<title>Gspy</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416772&amp;goto=newpost</link>
			<pubDate>Sun, 05 Sep 2010 13:37:16 GMT</pubDate>
			<description>Ima...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div><a href="http://gspy.sourceforge.net/gspy.jpg" target="_blank"><img src="http://gspy.sourceforge.net/gspy_sm.jpg" border="0" alt="" /></a> <br />
<a href="http://gspy.sourceforge.net/gspy.jpg" target="_blank">Check out a full screen view</a>  <a href="http://gspy.sourceforge.net/video.mpg" target="_blank"><img src="http://gspy.sourceforge.net/video.png" border="0" alt="" /></a> <br />
<a href="http://gspy.sourceforge.net/video.mpg" target="_blank">Sample MPEG file (9,363,987bytes!!!)</a>    <b> <b>Introduction:</b></b><br />
<br />
 <b>Gspy retrieves images from a video4linux device and processes these into a daily mpeg movie on the disk drive. Each image is recorded with a time stamp to insure accurate real world correlation. Special motion detection algorithms are used to reduce the size of the daily movies by eliminating pictures with similar content as well as the normal compression obtained via the mpeg process. The result is a time lapse video per day with nonlinear time compression using only the images of interest. This program will only run on Linux machines which support a video4linux-device in 640x480 capture size. This software has been tested with the 2.4.0-test1 kernel, 2.4.0-test4 and the 2.2.16 kernel with the usb backport patch. You should have the Berkeley MPEG Tools installed if you wish to generate the MPEG files. Gspy can be used without the MPEG tools, as it will fill a directory with jpg images that can be processed or viewed at a later time. Versions from 0.1.6 include a user defined command that is executed on each alarm. This command string can include a token(s) &quot;%f%&quot; that will get  replaced with the alarm picture filename. Typical uses would be to copy the alarm picture to a remote site using ftp or scp, email the picture to  someone, play a sound annoucement... &quot;Step away from the keyboard!&quot;, turn on lights using a parallel port or X10 interface, or ???. Have FUN</b>   <b> <b>Known Supported Devices:</b></b><br />
<ul><li> <b>Creative Labs Video Blaster WebCam 3 USB, Model CT6840</b></li>
<li> <b>BT848 Grabber ( WinTV PCI Radio )</b></li>
<li> <b>Hauppage PCI board - BT848</b></li>
<li> <b>Philips USB WebCam - PCVC680K Vesta Pro one</b><br />
Working with gspy 0.1.5 and Redhat 7.2 with kernel (2.4.9-13). Use pwc and pwcx modules.</li>
<li> <b>Phillips PWC690</b><br />
 Thanks to Hervé BOTERMAN, the PWC690 is now supported in version 0.1.5  Use &quot;modprobe pwc size=vga fps=5&quot; and &quot;insmod -f pwcx-i386&quot; to connect the webcam   to the usb port and set it by default to 640x480 and 5 frame per second.   The pwcx module must be loaded to enable image compression of the webcam.</li>
<li><b>Matrox marvel g200 card and an Hitachi Hi8</b><br />
Cherubini reports: I would like to let you know that gspy works for me, using linux debian woody, kernel 2.4.6 with matrox marvel g200 card and an hitachi Hi8 videocamera...</li>
<li> <b>D-Link DSB-C300 </b><br />
   Daniel reports that all that was needed was to build the kernel with    v4l, ov511 and usb-uhci modules, then modprobe usb-uhci, modprobe ov511<br />
   Phil reports:     Thanks for gspy.     I just opened my DSB-C300 camera and tried to install it on my win2k     machine. Crash crash the darn thing wont even boot with the camera installed.     Well back to linux. RH 7.1 Sony PCG F430 <br />
   all I had to do was:<br />
   mv /dev/video /dev/videodir <br />
   ln -s /dev/video0 /dev/video <br />
   /sbin/modprobe usb-uhci <br />
   /sbin/modprobe ov511 <br />
   gspy <br />
   and it all worked.... <br />
   cool thanks</li>
<li> <b>AVerMedia InterCam-Elite (OV511-based)</b><br />
    Huib reports: <br />
I tried your program and it works great. Gspy will be used to catch a bike thief(-ves) who stole 6 bikes from several roommates. Anyway, it's a great program and it works without any extra afford on a redhat 7.1 system with a (OV511-based) &quot;AVerMedia InterCam-Elite&quot;: The v4l driver is loaded automatic when the USB camera is plugged in the port. The webcam supports 640x480 so the program works without modifications.</li>
<li> <b>avaks AvCam USB-600 (OV511-based)</b><br />
    Alain reports: <br />
Thanks for your very nice program and installation instructions! I'm using Redhat 7.1 (2.4.2-2). If you'd like to check out my <a href="http://www.avaks.fi/COMPUTERPART/AvCam/usb600.htm" target="_blank">camera's specs.</a> The only thing I had to do was link /dev/video-&gt;video0.</li>
<li> <b>Maxell Maxcam USb(OV511)</b></li>
<li> <b>Dexxa Webcam (USB 352*288)</b><br />
see changes under &quot;User Feedback&quot; below for a patch.</li>
<li> <b>Logitech QuickCam (352x288). </b><br />
Blaine reports being able to compile the code and obtain a working system with the logitech camera.</li>
<li><b>Creative Webcam5 on Debian with with gnome2.</b></li>
<li><b>Kensignton &quot;svga webcam&quot; using the se401 module on a linux 2.4.19  kernel. </b><br />
alejandro reports gspsy 0.1.6 works brilliantly with his kensignton camera.</li>
<li><b> Intel CS330 Create and Share Camera</b><br />
Ben reports the Intel driver <a href="http://spca50x.sourceforge.net/" target="_blank">  http://spca50x.sourceforge.net </a> is still under development and there are  some issues with the brightness of the picture, but it still works.</li>
<li><b>Philips ToUcam Pro (PCVC740K) with Red Hat 8.0/kernel 2.4.18-14</b> <br />
(compiled using instructions for the Red Hat 8.0 fixes)</li>
<li> <b>Please drop me a line if you have success with your camera.</b></li>
</ul><b> <b>Changelog:</b></b><br />
<br />
 Version 0.1 - June 2 2000<br />
- birth via the wonderful glade interface<br />
- starting with kernel 2.4.0-test1-ac5 with ov511 patch cm3 by claudio<br />
- webcam is the Creative Labs video Web Blaster III - USB<br />
<br />
Version 0.1.1 - June 29	2000<br />
-added image intensity normalization to counteract cameras AGC jumps.<br />
-made first image init the reference image<br />
-added mug shot pixmap to help about box<br />
-added picture stats to status bar<br />
<br />
Version 0.1.2 - July 18	2000<br />
- added code to call mpeg encoder from file menu<br />
- added code so that mpeg is generated in a child process (using nice)<br />
- altered image intensity normalization... still getting alarms on jumps<br />
  of camera AGC under certain conditions.... needs more work<br />
- updated defaults for alarms<br />
<br />
Version 0.1.3<br />
- removed calls to sync. The USB driver seems to have stabilized enough<br />
  not to crash the kernel.<br />
<br />
Version 0.1.4   Feb 24 2002<br />
- support added for Philips cameras, requires user to uncomment the<br />
  #define PWC 1 statement in callbacks.c before compiling. ccvt.S and<br />
  ccvt.h added to project to support data conversions.<br />
  Thanks to Herve BOTERMAN<br />
- default device changed to /dev/video0 as Redhat 7.2 uses /dev/video<br />
  as a directory<br />
<br />
Version 0.1.5   Feb 25 2002<br />
- updated main.c and callbacks.c to support automatic polling of camera<br />
  data types available. This helped to support the Philips cameras which<br />
  do not have RGB24 format data available. Source cahnges (#define PWC)<br />
  are no longer required. Thanks to Herve BOTERMAN.<br />
  <br />
Version 0.1.6   Aug 12 2002<br />
- changed contact email address on about page<br />
- changed version in  configure.in<br />
- next 2 options were suggested by a user ( Thanks Tim )<br />
- added setup param for turning active alarm area box on display on/off<br />
- added setup for a user command to be executed on alarms<br />
  (this can be anything from rsyncing a directory to a remote box, to<br />
   emailing a file)<br />
- commented out some debug printing to the console  <br />
<br />
Version 0.1.7   Nov 20 2002 (recommended for Redhat 6,7,8,9)<br />
- added a console version that runs without X or gnome installed<br />
  ( see the console directory and main.c for building information )<br />
  The console version uses configuration that is imbedded in the source code.<br />
  <br />
Version 0.1.8   Jan 15 2005 (recommended for gnome2, 2.6 kernels)<br />
- rebuilt/reconfigured project to build using a modern distribution. This<br />
  builds on my current development system:<br />
  Ubuntu warty<br />
  2.6.8.1-4-386 kernel, <br />
  glade 0.6.4  (sorry, havent had much luck porting to glade-2 yet)<br />
  automake (GNU automake) 1.4-p6<br />
  autoconf (GNU Autoconf) 2.59<br />
  gcc (GCC) 3.3.4 (Debian 1:3.3.4-9ubuntu5)<br />
  <br />
 <b> <b>To Build This Project:</b></b><br />
<br />
 <b>Download <br />
<a href="http://gspy.sourceforge.net/gspy-0.1.2-src.tar.gz" target="_blank">gspy-0.1.2-src.tar.gz(145920 bytes)</a> or<br />
<a href="http://gspy.sourceforge.net/gspy-0.1.3-src.tar.gz" target="_blank">gspy-0.1.3-src.tar.gz(192891 bytes)</a> or<br />
<a href="http://gspy.sourceforge.net/gspy-0.1.4-src.tar.gz" target="_blank">gspy-0.1.4-src.tar.gz(534302 bytes)</a> or<br />
<a href="http://gspy.sourceforge.net/gspy-0.1.5-src.tar.gz" target="_blank">gspy-0.1.5-src.tar.gz(200008 bytes)</a> or<br />
<a href="http://gspy.sourceforge.net/gspy-0.1.6-src.tar.gz" target="_blank">gspy-0.1.6-src.tar.gz(205802 bytes)</a> or<br />
<a href="http://gspy.sourceforge.net/gspy-0.1.7-src.tar.gz" target="_blank">gspy-0.1.7-src.tar.gz(222107 bytes)</a> or<br />
<a href="http://gspy.sourceforge.net/gspy-0.1.8-src.tar.gz" target="_blank">gspy-0.1.8-src.tar.gz(208662 bytes)</a>.<br />
</b>  <br />
<b>To build the application from the glade project in the gspy directory, enter:</b> <blockquote><b>./autogen.sh</b> <br />
<b>make</b> <br />
<b>su</b> <br />
<b>rootpassword</b> <br />
<b>make install</b></blockquote><b>To run the application, enter gspy at the shell prompt. Gspy should open the video device and then popup the runtime display window similar to that shown above. If the open fails on the video device, gspy will exit with an error message. You may need to check and see that the usb stack is loaded if you are using a usb web camera device. To get your usb camera running, you may find the Linux USB guide useful (see reference section below). Gspy is quite cpu intensive due the the image processing load. I run it on a 500mhz PIII and it puts a 25% load blip on every 2 seconds. It should run on most pentium class computers. Gspy creates subdirectories under a user specified location for each date it runs. All jpegs captured for the day are placed in the subdirectory. Use the menu option file/Makempeg to select one of the daily directories and start the mpeg generation process (done in the background at a nice priority). You must have the Berkeley mpeg tools installed (mpeg_encode binary) for this command to work.</b> <br />
<b> <b>ToDo:</b></b><br />
<ul><li> <b>help generating the internationalization translations would be appreciated.</b></li>
<li> <b>add support for multiple USB cameras, maybe 4 as a first pass</b></li>
<li> <b>automate the mpeg file generation once per day (currently a manual process)</b></li>
<li> <b>improve compensation for camera AGC jumps... causes a lot of false alarms under certain lighting conditions</b></li>
<li> <b>implement video for linux 2 device interface</b></li>
<li> <b>reverse engineer compression modes and update ov511 driver to get faster framerates</b></li>
<li> <b>support for smaller video image sizes</b></li>
<li> <b>support alternate video fomats such as avi, motion jpeg or divx for the &quot;action movie&quot;</b></li>
<li> <b>write the user documentation</b></li>
</ul>  <br />
  <b> <b>Not Working?:</b></b><br />
<ol style="list-style-type: decimal"><li> <b><a href="http://gspy.sourceforge.net/gettext.html" target="_blank">Builds fail on RH 7.3 and 8.0 (gettext version 0.11.xx)</a></b></li>
<li> <b><a href="http://gspy.sourceforge.net/usb.html" target="_blank">Example tests and logs for checking usb setup</a></b></li>
<li> <b>USB device questions:<a href="mailto:linux-usb-users@lists.sourceforge.net"> linux-usb-users@lists.sourceforge.net</a></b></li>
<li> <b><a href="http://gspy.sourceforge.net/FAQ.html" target="_blank">Frequently Asked Questions relating to gspy</a></b></li>
</ol>  <br />
  <b> <b>User Feedback:</b></b><br />
<ol style="list-style-type: decimal"><li> <b><a href="http://gspy.sourceforge.net/gspystory.html" target="_blank">Car thief stars on gspy</a></b></li>
<li> <b><a href="http://gspy.sourceforge.net/sizechange.html" target="_blank">Changing Gspy for Non 640x480 Cameras</a></b></li>
</ol>  <b> <b>References</b></b><br />
<ol style="list-style-type: decimal"><li> <b>Homepage -- <a href="http://gspy.sourceforge.net/" target="_blank">gspy.sourceforge.net</a></b></li>
<li> <b>CVS server -- cvs.gspy.sourceforge.net</b></li>
<li> <b><a href="http://www.linux-usb.org/USB-guide/book1.html" target="_blank">Linux USB Guide</a></b></li>
<li> <b><a href="http://bmrc.berkeley.edu/research/mpeg/mpeg_encode.html" target="_blank">Berkeley MPEG Tools</a></b></li>
<li> <b><a href="http://alpha.dyndns.org/ov511/" target="_blank">Linux OV511 Driver</a></b></li>
<li> <b><a href="http://www.ovt.com/pdfs/OV511plus.pdf" target="_blank">Omnivision OV511 Advanced camera USB bridge, data sheet</a></b></li>
<li> <b><a href="http://gspy.sourceforge.net/gspy-lj.pdf" target="_blank">October 2002 Linux Journal Article about gspy(163k).</a></b></li>
</ol><img src="http://gspy.sourceforge.net/spectbar.png" border="0" alt="" />  <b> <b>Who We Are and Where to Find Us</b></b><br />
<br />
      <b>The Face</b>    <b>The Vital Statistics</b>     <img src="http://gspy.sourceforge.net/lpg3.jpg" border="0" alt="" />  <b>Lawrence P. Glaister P.Eng. VE7IT </b>    <b>1462 Madrona Drive</b>    <b>Nanoose Bay B.C.</b>    <b>Canada V9P 9C9</b>     <a href="mailto:ve7it@shaw.ca"><img src="http://gspy.sourceforge.net/email.jpg" border="0" alt="" /></a></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=173">Videosorveglianze - Videosurveillance</category>
			<dc:creator>Flavio58</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416772</guid>
		</item>
		<item>
			<title>Elvis</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416771&amp;goto=newpost</link>
			<pubDate>Sun, 05 Sep 2010 12:28:49 GMT</pubDate>
			<description>*eL...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div><div align="center"><b>eLViS: Linux Video Surveillance</b><br />
</div> <div align="center"><img src="http://www.silicontao.com/software/lvs/doc/bar.gif" border="0" alt="" /><br />
</div> <font color="#000000">Linux Video Surveillance AKA eLViS provides a user interface for watching motion frames captured by the <a href="http://motion.sourceforge.net/" target="_blank">motion</a> program as JPEG files. eLViS lets you view up to four motion threads and has a simple configuration panel to setup the motion.conf file and eLViS configurations.<br />
<br />
eLViS is intended to be used as a low cost security monitoring system. For that reason we have chosen Linux for the high reliability and flexible licensing of software.<br />
<br />
We recommend that you use eLViS on a standalone Linux system that is dedicated to this task.<br />
</font><br />
                                                        <a href="http://www.osguild.com/" target="_blank"><img src="http://www.osguild.com/themes/Skyway/images/logo.gif" border="0" alt="" /></a>             <b>Open Support Guild</b><br />
Bringing Open concepts to IT support             The <a href="http://www.osguild.com/" target="_blank">Open Support Guild</a> views Open Support as a community based service which adopts fundamental Open Source practices as the foundation for the deployment of a professional IT software support program. <br />
                                                        <br />
 <br />
                <b><u>Version:</u></b><br />
Stable <a href="http://www.silicontao.com/software/lvs/arc/lvs-0.2.13.tgz" target="_blank">0.2.13</a> <br />
      <br />
Unstable <a href="http://www.silicontao.com/software/lvs/arc/lvs-CVS.tgz" target="_blank">0.3.x</a><br />
      <br />
      <a href="http://www.silicontao.com/software/lvs/patches/" target="_blank">Patches</a><br />
      <br />
      <a href="http://www.silicontao.com/software/lvs/doc/Changes.txt" target="_blank">Change log</a><br />
      <br />
      <b><u>Feature list:</u></b><ul><li>VCR like controls, rewind, stop, play, fast forward</li>
<li>Multiple camera view from 1 to 4 cameras ( more are planned)</li>
<li>Configuration panel to setup eLViS and the motion program</li>
<li>Automatic image scaling</li>
<li>Daemon script starts motion</li>
<li>Yes it does support color video. I only have B&amp;W cameras right now</li>
</ul><b><u>How to use:</u></b><br />
This is changing as people email me with bug reports and feature requests.<br />
At the time this was written the <a href="http://www.silicontao.com/software/lvs/doc/information.html#OSG_Installer" target="_blank">OSG Installer</a> found below works great and on Mandrake 10 eLViS is installed and running in just a few minutes.<ol style="list-style-type: decimal"><li>Install a video capture card</li>
<li>Install Linux ( Mandrake 10 works painlessly )</li>
<li>Connect a camera to your capture card</li>
<li>Run the <a href="http://www.silicontao.com/software/lvs/doc/information.html#OSG_Installer" target="_blank">OSG Installer</a> for lvs</li>
<li>Run &quot;/usr/local/bin/lvs.elf&quot;</li>
<li>Go to the config tab and set your path and any other settings you need</li>
<li>Start the motion daemon by running &quot;/etc/init.d/motiond start&quot;</li>
</ol><b><u>Known Issues:<br />
      </u></b>I cannot test more then one camera at this time. Multiple cameras may not work.<br />
      <br />
The motiond script does not always start the daemon. Recommend that you add a line to your /etc/crontab file to start the daemon every five minutes like so<br />
      */5 * * * * root /usr/local/bin/motiond.bsh The script keeps track of the motion PID and will only start it if it is not already running.<br />
      <br />
      <b><u>Do-to:</u></b><br />
Add CD-R burning of selected range of images<br />
Extend the number of cameras to a dynamic array<br />
Automatic loading of new frames<br />
      <br />
      <b><u>License &amp; Copyright:</u></b><br />
Unless otherwise stated all files are copyright of there respective authors and licensed under the GNU General Public License.<br />
eLViS is licensed under the <a href="http://www.gnu.org/" target="_blank">GNU GPL</a> and Copyright© Silicon Tao Technology Systems Inc. 2004<br />
    <br />
      <div align="left"><b><u>Support</u></b><ul><li>Custom features &amp; fee support</li>
</ul>      <b><u>Downloads:</u></b><ul><li><a href="http://www.silicontao.com/software/lvs/doc/information.html#OSG_Installer" target="_blank">OSG Installer</a></li>
<li><a href="http://www.silicontao.com/software/lvs/arc/lvs-0.2.13.tgz" target="_blank">Latest stable version 0.2.13</a></li>
<li><a href="http://www.silicontao.com/software/lvs/arc/lvs-CVS.tgz" target="_blank">Download CVS source tree</a></li>
</ul>Downloads that do not use the OSG Installer will also need the <a href="http://unc.dl.sourceforge.net/sourceforge/motion/motion-3.0.7-1.tar.gz" target="_blank">motion source</a>.<br />
      <br />
      <b><u>Contact:</u></b><br />
      Roy Souther &lt;roy@SiliconTao.com&gt; </div>       <br />
      <br />
             Click for larger image<br />
Video view<br />
      <a href="http://www.silicontao.com/software/lvs/pix/eLVis_screenshot-v0.2.0_001.jpeg" target="_blank"> <img src="http://www.silicontao.com/software/lvs/pix/eLVis_screenshot-v0.2.0_001_thm.jpeg" border="0" alt="" /></a><br />
      <br />
      <a href="http://www.silicontao.com/software/lvs/pix/eLVis_screenshot-v0.2.0_002.jpeg" target="_blank">Config panel</a><br />
      <br />
      <a href="http://www.silicontao.com/software/lvs/pix/eLVis_screenshot-v0.2.0_003.jpeg" target="_blank">Controls On</a> / <a href="http://www.silicontao.com/software/lvs/pix/eLVis_screenshot-v0.2.0_004.jpeg" target="_blank">Controls Off</a><br />
      <br />
      <br />
      <br />
Older versions<br />
      <br />
eLViS 0.1.x<br />
      <a href="http://www.silicontao.com/software/lvs/pix/eLVis_screenshot.jpeg" target="_blank"><img src="http://www.silicontao.com/software/lvs/pix/eLVis_screenshot_thm.jpeg" border="0" alt="" /></a><br />
      <br />
      <a href="http://www.silicontao.com/software/lvs/pix/eLViS_screenshot2.jpeg" target="_blank">Running eLViS and XawTV at the same time</a><br />
                <div align="center"><img src="http://www.silicontao.com/software/lvs/doc/bar.gif" border="0" alt="" /><br />
</div> <br />
<b>OSG Installer<br />
</b>The latest stable version of eLViS can be installed using the <a href="http://osgi.osguild.com/" target="_blank">OSG Installer</a> in one simple command.<br />
<br />
The OSG Installer is an easy to use software installer from the <a href="http://www.osguild.com/" target="_blank">Open Support Guild</a> that can automatically download and compile programs and their dependencies.<br />
<br />
To use this OSG Installer to install eLViS simply open a terminal and <b>su</b> to root then copy and paste this command into you terminal program.<br />
wget <a href="http://osgi.OsGuild.com/osgi.sh" target="_blank">http://osgi.OsGuild.com/osgi.sh</a> -O - | sh -s lvs <br />
For more information about the OSG Installer please visit <a href="http://osgi.osguild.com/" target="_blank">http://osgi.OsGuild.com</a>.<br />
<br />
<b>Requirements</b><br />
To run the OSG Installer and install eLViS you will need the following software installed. Different versions of Linux will have slightly different names for these.<ul><li>wget</li>
<li>cvs</li>
<li>gcc-c++</li>
<li>qt3-devel</li>
</ul></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=173">Videosorveglianze - Videosurveillance</category>
			<dc:creator>Flavio58</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416771</guid>
		</item>
		<item>
			<title>Displaying a webcam’s video in a Flex VideoDisplay control</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416770&amp;goto=newpost</link>
			<pubDate>Sun, 05 Sep 2010 12:09:57 GMT</pubDate>
			<description>The...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>The following example shows you how you can display a user’s webcam feed in a VideoDisplay control using the static Camera.getCamera() method and VideoDisplay class’s attachCamera() method.<br />
 Full code after the jump.<br />
 <br />
 This example won’t be very interesting unless you actually have a webcam installed.<br />
  <font color="#000000">&lt;?xml version=<font color="#FF0000">&quot;1.0&quot;</font> encoding=<font color="#FF0000">&quot;utf-8&quot;</font>?<font color="#7400FF">&gt;</font></font><br />
<font color="#000000"><font color="#808080"><i>&lt;!-- <a href="http://blog.flexexamples.com/2008/01/22/displaying-a-webcams-video-in-a-flex-videodisplay-control/" target="_blank">Displaying a webcams video in a Flex VideoDisplay control | Flex Examples</a> --&gt;</i></font></font><br />
<font color="#000000"><font color="#7400FF">&lt;mx:Application</font> name=<font color="#FF0000">&quot;VideoDisplay_attachCamera_test&quot;</font></font><br />
<font color="#000000">        xmlns:mx=<font color="#FF0000">&quot;http://www.adobe.com/2006/mxml&quot;</font></font><br />
<font color="#000000">        layout=<font color="#FF0000">&quot;vertical&quot;</font></font><br />
<font color="#000000">        verticalAlign=<font color="#FF0000">&quot;middle&quot;</font></font><br />
<font color="#000000">        backgroundColor=<font color="#FF0000">&quot;white&quot;</font><font color="#7400FF">&gt;</font></font><br />
 <br />
    <font color="#339933">&lt;mx:Script&gt;</font><br />
<font color="#339933">        &lt;![CDATA[</font><br />
<font color="#339933">            import mx.controls.Alert;</font><br />
 <br />
<font color="#339933">            private function videoDisplay_creationComplete():void {</font><br />
<font color="#339933">                var camera:Camera = Camera.getCamera();</font><br />
<font color="#339933">                if (camera) {</font><br />
<font color="#339933">                    videoDisplay.attachCamera(camera);</font><br />
<font color="#339933">                } else {</font><br />
<font color="#339933">                    Alert.show(&quot;You don't seem to have a camera.&quot;);</font><br />
<font color="#339933">                }</font><br />
<font color="#339933">            }</font><br />
<font color="#339933">        ]]&gt;</font><br />
<font color="#339933">    &lt;/mx:Script&gt;</font><br />
 <br />
    <font color="#000000"><font color="#7400FF">&lt;mx:VideoDisplay</font> id=<font color="#FF0000">&quot;videoDisplay&quot;</font></font><br />
<font color="#000000">            creationComplete=<font color="#FF0000">&quot;videoDisplay_creationComplete();&quot;</font></font><br />
<font color="#000000">            width=<font color="#FF0000">&quot;160&quot;</font></font><br />
<font color="#000000">            height=<font color="#FF0000">&quot;120&quot;</font> <font color="#7400FF">/&gt;</font></font><br />
 <br />
    <font color="#000000"><font color="#7400FF">&lt;mx:Button</font> id=<font color="#FF0000">&quot;button&quot;</font></font><br />
<font color="#000000">            label=<font color="#FF0000">&quot;Reload Camera&quot;</font></font><br />
<font color="#000000">            click=<font color="#FF0000">&quot;videoDisplay_creationComplete();&quot;</font> <font color="#7400FF">/&gt;</font></font><br />
 <br />
<font color="#000000"><font color="#7400FF">&lt;/mx:Application</font><font color="#7400FF">&gt;</font></font><br />
<br />
  <a href="http://blog.flexexamples.com/wp-content/uploads/VideoDisplay_attachCamera_test/bin/srcview/index.html" target="_blank">View source</a> is enabled in the following example.<br />
 <br />
 <img src="http://blog.flexexamples.com/wp-content/plugins/wp-spamfree/img/wpsf-img.php" border="0" alt="" /> 					Tagged as: 						<a href="http://blog.flexexamples.com/tag/attachcamera/" target="_blank">attachCamera()</a>,  						<a href="http://blog.flexexamples.com/tag/getcamera/" target="_blank">getCamera()</a></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=173">Videosorveglianze - Videosurveillance</category>
			<dc:creator>Flavio58</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416770</guid>
		</item>
		<item>
			<title>Streaming</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416769&amp;goto=newpost</link>
			<pubDate>Sun, 05 Sep 2010 12:04:04 GMT</pubDate>
			<description>*1....</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div><b>1. Introduction</b><br />
<br />
 One of the most asked questions by OpenCV users is, &quot;How can I stream videos over the network so I can process it on different computer?&quot; OpenCV does not provide such a function by nature (or so I thought), so we have to write custom code to accomplish this task.<br />
 If you have experiences with network programming before, this should be quite easy. Just like when you send text files over the network, the same apply for this one. only this time we need to convert the received data into OpenCV's IplImage format.<br />
 In this tutorial, I will explain to you the system I built to stream OpenCV videos over TCP/IP network. Keep in mind that there are many ways to achieve this. Not to mention the freely available video streaming library such as <a href="http://www.ffmpeg.org/" target="_blank">ffmpeg</a> and <a href="http://www.videolan.org/" target="_blank">VLC</a>. This is not about &quot;this one is better&quot;, it is just about sharing the knowledge.<br />
  <b>2. Design of the System</b><br />
<br />
 The system follows the client-server model. The computer that has the video input acts as the server. It waits for a client to connect and stream the videos once the connection has established. The diagram is shown below.<br />
 <a href="http://nashruddin.com/library/image.php?t=fig&amp;f=120.jpg" target="_blank">http://nashruddin.com/library/image.php?t=fig&amp;f=120.jpg</a><br />
Fig 1. Streaming OpenCV videos over the network.<br />
 The diagram above shows several clients connect to the server and receive the streaming video simultaneously. However, to keep things simple, I made it that the server only accepts one client at a time.<br />
 If we look deeper into the server side, it should consists from two parts. One who read the video input in a loop, and one who waits for the client and send the video frames. It is impossible to have both parts as a single block of code, since they have to run <i>simultaneously at the same time</i>. To overcome this, we have to write a <a href="http://en.wikipedia.org/wiki/Multi-threaded" target="_blank">multi-threaded</a> program.<br />
 The same also apply for the client side.<br />
 But another problem occurs, Windows and Unix-like systems have different way for handling with threads. While it is possible to write a code that compile and runs on both systems (using C preprocessor), it doesn't necessarily to. Let's just use Unix and throw Windows away.<br />
 In addition, I use <a href="http://en.wikipedia.org/wiki/Berkeley_socket" target="_blank">Berkeley Sockets</a> that is widely available on Unix-like systems for the networking code.<br />
 In summary, to make this as simplest as possible we keep these things in mind:<ul><li>The Operating System is Unix-like. Therefore we're using <a href="http://en.wikipedia.org/wiki/POSIX_Threads" target="_blank">POSIX Threads</a> and <a href="http://en.wikipedia.org/wiki/Berkeley_socket" target="_blank">Berkeley Sockets</a>. (If you use Windows, install <a href="http://cygwin.com/" target="_blank">Cygwin</a> first).</li>
<li>Only one client connected at a time.</li>
<li>The client <i>knows</i> the width and the height of the expected frame.</li>
<li>The client receives grayscaled (single channel) frames.</li>
</ul><b>3. Implementation of the Server-side</b><br />
<br />
 The server side is the computer that has the video input to be streamed. And like I mentioned before, it consists of two parts. One who read the video input in a loop, and the other waits for the client to connect and send the video frames.<br />
 <a href="http://nashruddin.com/library/image.php?t=fig&amp;f=121.gif" target="_blank">http://nashruddin.com/library/image.php?t=fig&amp;f=121.gif</a><br />
Fig 2. Stream server diagram.<br />
 In the diagram above, we see two threads running on the server side: Frame Grabber and Stream Server. The input is taken from a webcam, but you can use other resources too, like an avi file.<br />
 Frame Grabber grabs a frame from the webcam and stores it to a global variable img. Stream Server waits for a client to connect. Once the connection has established, it sends img to the client repeatedly whenever a newer version of img is available.<br />
 The full listing of the server side is in <a href="http://nashruddin.com/code/stream_server.c" target="_blank">stream_server.c</a>. Next we'll see the detail of both threads.<br />
  <b>3.a. Frame Grabber</b><br />
<br />
 This is the main thread of the server-side. Its just like the usual <a href="http://nashruddin.com/display-video-from-webcam-with-opencv.html" target="_blank">code to display video from webcam</a>. Below is the code snippet from <a href="http://nashruddin.com/code/stream_server.c" target="_blank">stream_server.c</a>.<br />
 <b>Listing 1:</b> Frame Grabber<br />
<font face="monospace">...<br />
 <br />
 <!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">/* run the stream server */<br />
&nbsp;if (pthread_create(&amp;thread_s, NULL, streamServer, NULL)) {<br />
&nbsp; &nbsp;  quit(&quot;pthread_create failed.&quot;, 1);<br />
&nbsp;}<br />
&nbsp;<br />
&nbsp;while(key != 'q') <br />
&nbsp;{<br />
&nbsp; &nbsp;  /* get a frame */<br />
&nbsp; &nbsp;  img0 = cvQueryFrame(capture);<br />
&nbsp;<br />
&nbsp; &nbsp;  /* convert to grayscale, thread safe */<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  pthread_mutex_lock(&amp;mutex);<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  cvCvtColor(img0, img1, CV_BGR2GRAY);<br />
&nbsp; &nbsp;  is_data_ready = 1;<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  pthread_mutex_unlock(&amp;mutex);<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  cvShowImage(&quot;stream_server&quot;, img0);<br />
&nbsp; &nbsp;  key = cvWaitKey(30);<br />
&nbsp;}<br />
&nbsp;<br />
&nbsp;/* stop the stream server */<br />
&nbsp;if (pthread_cancel(thread_s)) {<br />
&nbsp; &nbsp;  quit(&quot;pthread_cancel failed.&quot;, 1);<br />
&nbsp;}<br />
&nbsp;<br />
&nbsp;...</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></font><br />
 The code above should somehow look familiar with you. It grabs a frame in a loop, save it to a global variable img1, and wait until the user press the 'q' button.<br />
 But there are also some additional lines you should have notices. When the program starts, it creates a new thread for the streaming server by the line:<br />
 pthread_create(&amp;thread_s, NULL, streamServer, NULL);<br />
 After that, the function streamServer runs simultaneously at the same time with the main code. When the program finish (the user pressed the 'q' button) the main code terminates the streamServer thread:<br />
 pthread_cancel(thread_s);<br />
 Also note that the global variable img1 is used by both threads. Frame Grabber writes it, while Stream Server reads it. It is important to avoid both threads access img1 at the same time, since it will give unwanted result. So we add a <a href="http://en.wikipedia.org/wiki/Mutex" target="_blank">lock</a> mechanism when writing img1.<br />
  pthread_mutex_lock(&amp;mutex);<br />
 cvCvtColor(img0, img1, CV_BGR2GRAY);<br />
 is_data_ready = 1;<br />
 pthread_mutex_unlock(&amp;mutex); <br />
 Just that simple. Now we move to the Stream Server code.<br />
  <b>3.b. Stream Server</b><br />
<br />
 This thread waits for a client to connect to server on a predefined port. Once the connection has established, it sends the global variable img1 repeatedly whenever a newer version is available.<br />
 The code snippet of the main loop is shown below.<br />
 <b>Listing 2:</b> Stream Server<br />
<font face="monospace">...<br />
 <br />
 <!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">int imgsize = img1-&gt;imageSize;<br />
&nbsp;<br />
&nbsp;while(1) <br />
&nbsp;{<br />
&nbsp; &nbsp;  /* send the grayscaled frame, thread safe */<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  pthread_mutex_lock(&amp;mutex);<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  if (is_data_ready) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  bytes = send(clientsock, img1-&gt;imageData, imgsize, 0);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  is_data_ready = 0;<br />
&nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  pthread_mutex_unlock(&amp;mutex);<br />
&nbsp;<br />
&nbsp; &nbsp;  /* if something went wrong, restart the connection */<br />
&nbsp; &nbsp;  if (bytes != imgsize) <br />
&nbsp; &nbsp;  {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  fprintf(stderr, &quot;Connection closed.\n&quot;);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  close(clientsock);<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if ((clientsock = accept(serversock, NULL, NULL)) == -1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  quit(&quot;accept() failed&quot;, 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  pthread_testcancel();<br />
&nbsp; &nbsp;  usleep(1000);<br />
&nbsp;}<br />
&nbsp;<br />
&nbsp;...</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></font><br />
 In the main loop above, the raw data of img1 is sent over the network if a newer version is available.<br />
 <!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">if (is_data_ready) {<br />
&nbsp; &nbsp;  bytes = send(clientsock, img1-&gt;imageData, imgsize, 0);<br />
&nbsp; &nbsp;  is_data_ready = 0;</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --> } <br />
 Note that we make it thread safe by enclosing the lines above with pthread_mutex_lock().<br />
 The return value of send() is the number of bytes actually sent, or -1 on error. We need to check the return value in case something wrong has happened, like the client closing the connection. To make things simple, we're just restart the connection if something isn't right.<br />
 <!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">if (bytes != imgsize) {<br />
&nbsp; &nbsp;  close(clientsock);<br />
&nbsp; &nbsp;  if ((clientsock = accept(serversock, NULL, NULL)) == -1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  quit(&quot;accept() failed&quot;, 1);<br />
&nbsp; &nbsp;  }<br />
&nbsp;}</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --> And the line:<br />
  pthread_testcancel(); <br />
 checks if main code has issued pthread_cancel() to terminate this thread.<br />
  <b>4. Implementation of the Client-side</b><br />
<br />
 With the server now has set up and ready to accept connection, now we want to write a client to receive and display the streaming video.<br />
 Just like the code at the server side, this one consists of two parts. One who connects to the server and receives the frames, and the other display the received frame whenever a newer version exist.<br />
 <a href="http://nashruddin.com/library/image.php?t=fig&amp;f=122.gif" target="_blank">http://nashruddin.com/library/image.php?t=fig&amp;f=122.gif</a><br />
Fig 3. Stream client diagram.<br />
 From the diagram above, we see that there are 2 threads running at the client code. Stream Client receives frames from server and store it to img, meanwhile Video Player reads img and display it in a player window.<br />
 Since the client receives frames from a TCP/IP network, it must specify the server's IP address and port number. They are passed as command line arguments when we run the code:<br />
 ./stream_client 192.168.0.1 8888 320 240<br />
 The last 2 arguments are the width and the height of the expected frame. Keep in mind that the server sends only the data, without the image header. So the client <i>must know</i> the width and the height of the expected frame.<br />
  <b>Q</b>: Why don't we make it that the image header also being sent?<br />
 <b>A</b>: For the sake of code simplicity.<br />
<br />
 <b>Q</b>: Where do we find the width and the height of the expected frame?<br />
 <b>A</b>: From <a href="http://nashruddin.com/code/stream_server.c" target="_blank">stream_server.c</a>. It prints out the width and the height of the frame it captured.<br />
<br />
 <b>Q</b>: What if I put numbers that don't match with the received frame?<br />
 <b>A</b>: It will give unpredictable results, if you're lucky.<br />
 <br />
 The full listing of the client side is in <a href="http://nashruddin.com/code/stream_client.c" target="_blank">stream_client.c</a>. Now we move into the details of the client side.<br />
  <b>4.a. Stream Client</b><br />
<br />
 This thread connects to the server, given its IP address and port number. Once the connection has established, it receives the frames sent from server.<br />
 Below is the code snippet from <a href="http://nashruddin.com/code/stream_client.c" target="_blank">stream_client.c</a>.<br />
 <b>Listing 3:</b> Stream Client<br />
<font face="monospace"><!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">...<br />
&nbsp;<br />
&nbsp;width&nbsp; = atoi(argv[3]);<br />
&nbsp;height = atoi(argv[4]);<br />
&nbsp;img&nbsp; &nbsp; = cvCreateImage(cvSize(width, height), IPL_DEPTH_8U, 1);<br />
&nbsp;<br />
&nbsp;...<br />
&nbsp;<br />
&nbsp;int&nbsp; imgsize = img-&gt;imageSize;<br />
&nbsp;char sockdata[imgsize];<br />
&nbsp;<br />
&nbsp;while(1) <br />
&nbsp;{<br />
&nbsp; &nbsp;  for (i = 0; i &lt; imgsize; i += bytes) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  if ((bytes = recv(sock, sockdata + i, imgsize - i, 0)) == -1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  quit(&quot;recv failed&quot;, 1);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  }<br />
&nbsp;<br />
&nbsp; &nbsp;  /* convert the received data to OpenCV's IplImage format, <br />
&nbsp; &nbsp; &nbsp; &nbsp; thread safe */<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  pthread_mutex_lock(&amp;mutex);<br />
&nbsp;<br />
&nbsp; &nbsp;  for (i = 0, k = 0; i &lt; img-&gt;height; i++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  for (j = 0; j &lt; img-&gt;width; j++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  ((uchar*)(img-&gt;imageData + i * img-&gt;widthStep))[j] = sockdata[k++];<br />
&nbsp; &nbsp; &nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  is_data_ready = 1;<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  pthread_mutex_unlock(&amp;mutex);<br />
&nbsp; &nbsp;  pthread_testcancel();<br />
&nbsp; &nbsp;  usleep(1000);<br />
&nbsp;}<br />
&nbsp;<br />
&nbsp;...</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></font><br />
 In the loop above, the client receives the data sent by server with recv() function. However, there is a chance that the delivery of an image is divided into several packets. So we put recv() in a loop to guarantee that we receive a complete image.<br />
 <!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">for (i = 0; i &lt; imgsize; i += bytes) {<br />
&nbsp; &nbsp;  if ((bytes = recv(sock, sockdata + i, imgsize - i, 0)) == -1) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  quit(&quot;recv failed&quot;, 1);<br />
&nbsp; &nbsp;  }<br />
&nbsp;}</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --> If nothing went wrong, now we have the image data in sockdata. We convert the data to OpenCV's IplImage format by copying it to img.<br />
 <!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">for (i = 0, k = 0; i &lt; img-&gt;height; i++) {<br />
&nbsp; &nbsp;  for (j = 0; j &lt; img-&gt;width; j++) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  ((uchar*)(img-&gt;imageData + i * img-&gt;widthStep))[j] = sockdata[k++];<br />
&nbsp; &nbsp;  }<br />
&nbsp;}</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --> The frame has successfully transmitted! Now its the turn for Video Player to read img and display it in a player window.<br />
  <b>4.b. Video Player</b><br />
<br />
 This should be the easiest part from the whole system. Basically it just display the image in a loop.<br />
 <b>Listing 4:</b> Video Player<br />
<font face="monospace">...<br />
 <br />
 <!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">/* run the stream client thread */<br />
&nbsp;if (pthread_create(&amp;thread_c, NULL, streamClient, NULL)) {<br />
&nbsp; &nbsp;  quit(&quot;pthread_create failed.&quot;, 1);<br />
&nbsp;}<br />
&nbsp;<br />
&nbsp;cvNamedWindow(&quot;stream_client&quot;, CV_WINDOW_AUTOSIZE);<br />
&nbsp;<br />
&nbsp;while(key != 'q') <br />
&nbsp;{<br />
&nbsp; &nbsp;  pthread_mutex_lock(&amp;mutex);<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  if (is_data_ready) {<br />
&nbsp; &nbsp; &nbsp; &nbsp;  cvShowImage(&quot;stream_client&quot;, img);<br />
&nbsp; &nbsp; &nbsp; &nbsp;  is_data_ready = 0;<br />
&nbsp; &nbsp;  }<br />
&nbsp; &nbsp;  <br />
&nbsp; &nbsp;  pthread_mutex_unlock(&amp;mutex);<br />
&nbsp;<br />
&nbsp; &nbsp;  key = cvWaitKey(10);<br />
&nbsp;}<br />
&nbsp;<br />
&nbsp;/* terminate the stream client thread */<br />
&nbsp;if (pthread_cancel(thread_c)) {<br />
&nbsp; &nbsp;  quit(&quot;pthread_cancel failed.&quot;, 1);<br />
&nbsp;}<br />
&nbsp;<br />
&nbsp;...</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></font><br />
 First, run the Stream Client thread:<br />
 pthread_create(&amp;thread_c, NULL, streamClient, NULL);<br />
 After that, Stream Client does its job nicely. It receives the frames and store it in the global variable img. And displaying the video cannot be simpler:<br />
 cvShowImage(&quot;stream_client&quot;, img);<br />
 Don't forget to terminate Stream Client when the program finished:<br />
 pthread_cancel(thread_c);<br />
 What else?<br />
  <b>5. Compiling</b><br />
<br />
 With <a href="http://nashruddin.com/code/stream_server.c" target="_blank">stream_server.c</a> and <a href="http://nashruddin.com/code/stream_client.c" target="_blank">stream_client.c</a> now in hand, we want to compile and try to stream our cool videos over the network. Here it is.<br />
 Compiling in *nix:<br />
 $ gcc stream_server.c -o stream_server \<br />
      `pkg-config --cflags opencv` \<br />
      `pkg-config --libs opencv` -lpthread<br />
<br />
$ gcc stream_client.c -o stream_client \<br />
      `pkg-config --cflags opencv` \<br />
      `pkg-config --libs opencv` -lpthread<br />
 Compiling in Windows (under <a href="http://cygwin.com/" target="_blank">Cygwin</a>):<br />
 $ gcc stream_server.c -o stream_server \<br />
      -I&quot;C:\OpenCV\cxcore\include&quot; \<br />
      -I&quot;C:\OpenCV\cv\include&quot; \<br />
      -I&quot;C:\OpenCV\otherlibs\highgui&quot; \<br />
      -L&quot;C:\OpenCV\lib&quot; -lcxcore -lcv -lhighgui -lpthread<br />
<br />
$ gcc stream_client.c -o stream_client \<br />
      -I&quot;C:\OpenCV\cxcore\include&quot; \<br />
      -I&quot;C:\OpenCV\cv\include&quot; \<br />
      -I&quot;C:\OpenCV\otherlibs\highgui&quot; \<br />
      -L&quot;C:\OpenCV\lib&quot; -lcxcore -lcv -lhighgui -lpthread<br />
 Replace C:\OpenCV with the directory where you installed OpenCV.<br />
  <b>6. Experiments &amp; Gallery</b><br />
<br />
 I tested the system on both Windows and BSD operating systems. The thing is, I only got one laptop, so I use <a href="http://www.vmware.com/" target="_blank">VMWare</a> to obtain virtual PCs and simulate TCP/IP network.<br />
 In my first test, I ran the stream server and stream client on Windows. The input was taken from an avi file which I obtained from <a href="http://www.amazon.com/dp/0596516134/?tag=nashramin-20" target="_blank">Learning OpenCV</a>'s code samples. The screenshot is shown below. Click it to view its original size.<br />
 <a href="http://nashruddin.com/library/image.php?t=fig&amp;f=123.jpg" target="_blank"><a href="http://nashruddin.com/library/image.php?t=fig&amp;w=200&amp;h=125&amp;f=123.jpg" target="_blank">http://nashruddin.com/library/image....=125&amp;f=123.jpg</a></a><br />
Fig 4. Windows - Windows streaming video.<br />
 In my second test, I ran the stream server on Windows and stream client on BSD. The input was taken from webcam. Here it is.<br />
 <a href="http://nashruddin.com/library/image.php?t=fig&amp;f=124.jpg" target="_blank"><a href="http://nashruddin.com/library/image.php?t=fig&amp;w=200&amp;h=125&amp;f=124.jpg" target="_blank">http://nashruddin.com/library/image....=125&amp;f=124.jpg</a></a><br />
Fig 5. Windows - BSD streaming video.<br />
 Note that I added face detection code at the client side. Obviously, you can do any image/video processing to the received video. That's the point of this project.<br />
 In my third test, I ran the stream server and stream client on BSD. The input was the movie <a href="http://en.wikipedia.org/wiki/300_movie" target="_blank">300</a>, in MPEG format. Note that you should compile OpenCV with ffmpeg for reading MPEG files.<br />
 <a href="http://nashruddin.com/library/image.php?t=fig&amp;f=125.jpg" target="_blank"><a href="http://nashruddin.com/library/image.php?t=fig&amp;w=200&amp;h=150&amp;f=125.jpg" target="_blank">http://nashruddin.com/library/image....=150&amp;f=125.jpg</a></a><br />
Fig 6. BSD - BSD streaming video.<br />
 And the last, BSD - Windows streaming server. The input was the movie <a href="http://en.wikipedia.org/wiki/Defiance_%282008_film%29" target="_blank">Defiance</a>, in MPEG format. Again, I added face detection code at the client side.<br />
 <a href="http://nashruddin.com/library/image.php?t=fig&amp;f=126.jpg" target="_blank"><a href="http://nashruddin.com/library/image.php?t=fig&amp;w=200&amp;h=125&amp;f=126.jpg" target="_blank">http://nashruddin.com/library/image....=125&amp;f=126.jpg</a></a><br />
Fig 7. BSD - Windows streaming video.<br />
 As you can see, the system runs very well and smooth. However, this streaming system uses <i>a lot of bandwidth</i>. This is true since the server streams raw data. You may have to add some video compression if you want to use the system on the Internet.<br />
  <b>7. Summary</b><br />
<br />
 In this article, I have showed you how to stream your OpenCV videos over TCP/IP network. With this system, you can have your webcam attached on a computer, and your video processing program resides on different computer.<br />
 While the project is far from perfect, generally it is all about <i>ideas</i>. Here are some other things that I'm planning to add to the code:<ul><li>Supports multiple clients.</li>
<li>Supports multiple webcams.</li>
<li>Streams Motion JPEG rather than raw data.</li>
<li>Web server to simulate IP cameras.</li>
<li>Video recording.</li>
<li>And many more.</li>
</ul>If you encounter any problem compiling and running the code above, feel free to mail <a href="http://javascript<b></b>:mailto(&#39;me%20&#91;at]%20nashruddin.com&#39;)" target="_blank">me [at] nashruddin.com</a>. Feedbacks are highly appreciated.</div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=173">Videosorveglianze - Videosurveillance</category>
			<dc:creator>Flavio58</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416769</guid>
		</item>
		<item>
			<title>Linux</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416768&amp;goto=newpost</link>
			<pubDate>Sun, 05 Sep 2010 12:00:56 GMT</pubDate>
			<description>*We...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div><b><a href="http://nashruddin.com/Web_Based_Surveillance_System_with_OpenCV_PHP_and_Javascript" target="_blank">Web Based Surveillance System with OpenCV, PHP and Javascript</a></b><br />
<br />
  Mar 6, 2009 | Tags: <a href="http://nashruddin.com/tag/opencv" target="_blank">OpenCV</a>, <a href="http://nashruddin.com/tag/php" target="_blank">PHP</a>, <a href="http://nashruddin.com/tag/projects" target="_blank">Projects</a> | <img src="http://nashruddin.com/media/__sys__/delicious.gif" border="0" alt="" /> <a href="http://nashruddin.com/submit/delicious/78" target="_blank">del.icio.us</a> | <img src="http://nashruddin.com/media/__sys__/digg.gif" border="0" alt="" /> <a href="http://nashruddin.com/submit/digg/78" target="_blank">Digg</a> <br />
  This is a simple web based <b>surveillance system</b> using OpenCV, PHP and Javascript. The system is designed to be low cost and simple, using only a webcam attached to a PC as the client. For the server side, you can use any regular web hosting.<br />
<br />
<br />
The system itself is very simple. It saves an image taken from the webcam in an interval of time. The image then submitted to web server and displayed in a web page to browser. Some Javascript code will refresh the image without reloading the whole page in an interval of time.<br />
 Such a system provides a low cost remote surveillance system. No need to buy expensive cameras or web hosting service that supports video streaming.<br />
 <b>The Design of the System</b><br />
<br />
 The system follows the Client-Server model. The client is a PC with a webcam attached to it. This is where you want to monitor things. The server is a regular web hosting. You can view the &quot;video stream&quot; using any PC connected to the Internet. The block diagram is shown in Figure 1.<br />
 <a href="http://nashruddin.com/library/image.php?t=fig&amp;f=91.gif" target="_blank">http://nashruddin.com/library/image.php?t=fig&amp;f=91.gif</a><br />
Fig 1. Block Diagram<br />
 The are 4 parts of code, reside on the client and server side:<ul><li>Frame Grabber (cam.c): Saves a frame to file in a specified interval of time.</li>
<li>Image Sender (sender.php): A daemon to POST the saved frame to web server.</li>
<li>Image Receiver (recv.php): Save the submitted image to disk.</li>
<li>Web Page (index.html): Page to display the image, with Javascript to auto refresh the image.</li>
</ul><b>Frame Grabber (cam.c)</b><br />
<br />
 Just like the name, Frame Grabber grabs the frames from webcam and display the video. The full listing is shown below. It makes use <a href="http://sourceforge.net/projects/opencvlibrary" target="_blank">OpenCV</a>, an open source computer vision library from Intel.<br />
 <b>Listing 1:</b> Frame Grabber with Autosave<br />
<font face="monospace"><!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">/**<br />
&nbsp;* Display the video from webcam and automatically save the frame<br />
&nbsp;* every 3 seconds.<br />
&nbsp;*/<br />
&nbsp;<br />
#include &lt;stdio.h&gt;<br />
#include &quot;cv.h&quot;<br />
#include &quot;highgui.h&quot;<br />
&nbsp;<br />
int main(int argc, char** argv)<br />
{<br />
&nbsp; &nbsp; CvCapture *capture;<br />
&nbsp; &nbsp; IplImage&nbsp; *frame;<br />
&nbsp; &nbsp; double&nbsp; &nbsp; t, ms = 0;<br />
&nbsp; &nbsp; int&nbsp; &nbsp; &nbsp;  key;<br />
&nbsp;<br />
&nbsp; &nbsp; /* initialize webcam */<br />
&nbsp; &nbsp; capture = cvCaptureFromCAM(0);<br />
&nbsp; &nbsp; cvNamedWindow(&quot;video&quot;, 1);<br />
&nbsp;<br />
&nbsp; &nbsp; while (key != 'q') {<br />
&nbsp; &nbsp; &nbsp; &nbsp; t = (double)cvGetTickCount();<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /* display video */<br />
&nbsp; &nbsp; &nbsp; &nbsp; frame = cvQueryFrame(capture);<br />
&nbsp; &nbsp; &nbsp; &nbsp; cvShowImage(&quot;video&quot;, frame);<br />
&nbsp; &nbsp; &nbsp; &nbsp; key = cvWaitKey(1);<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /* get elapsed time */<br />
&nbsp; &nbsp; &nbsp; &nbsp; t = (double)cvGetTickCount() - t;<br />
&nbsp; &nbsp; &nbsp; &nbsp; ms += t/((double)cvGetTickFrequency() * 1000.0);<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /* autosave every 3 seconds */<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (ceil(ms) &gt;= 3000) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cvSaveImage(&quot;img.jpg&quot;, frame);<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ms = 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; }<br />
&nbsp;<br />
&nbsp; &nbsp; /* free memory */<br />
&nbsp; &nbsp; cvReleaseCapture(&amp;capture);<br />
&nbsp; &nbsp; cvDestroyWindow(&quot;video&quot;);<br />
&nbsp;<br />
&nbsp; &nbsp; return 0;<br />
}</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></font><br />
 The code above display the video from webcam, and automatically save the frame to img.jpg every 3 seconds. The saved image then submitted to server by sender.php, described in the following section. I want to make things simple, so I choose PHP.<br />
 <b>Image Sender (sender.php)</b><br />
<br />
 This is a daemon (background process) that waits for a new image from the Frame Grabber. Once the image arrive, the script will send the image over HTTP to the server.<br />
 Basically, sender.php simulates a HTML form like this: <br />
<br />
<br />
<br />
<!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&lt;form action=&quot;http://nashruddin.com/surveillance/recv.php&quot; method=&quot;post&quot;&gt;<br />
&nbsp;&lt;input type=&quot;file&quot; name=&quot;img&quot; value=&quot;&quot; /&gt;<br />
&nbsp;&lt;input type=&quot;submit&quot; /&gt;<br />
&nbsp;&lt;/form&gt;</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --> <br />
 When the new image has come, it fills the value of &lt;input type=&quot;file&quot; /&gt; with img.jpg, and push the submit button. the code is shown below. <br />
<b>Listing 2:</b> Image Sender<br />
<font face="monospace"><!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&lt;?php<br />
/**<br />
&nbsp;* This script checks for a new image from Frame Grabber, and<br />
&nbsp;* POST the image to server.<br />
&nbsp;*<br />
&nbsp;* Run this script as daemon (background process)<br />
&nbsp;*/<br />
&nbsp;<br />
$recv = 'http://nashruddin.com/surveillance/recv.php';<br />
$file = 'img.jpg';<br />
$time = 0;<br />
&nbsp;<br />
while (true) {<br />
&nbsp; &nbsp; /* wait 1 second */<br />
&nbsp; &nbsp; <a href="http://www.php.net/sleep" target="_blank">sleep</a>(1);<br />
&nbsp;<br />
&nbsp; &nbsp; /* don't cache the file status */<br />
&nbsp; &nbsp; <a href="http://www.php.net/clearstatcache" target="_blank">clearstatcache</a>();<br />
&nbsp;<br />
&nbsp; &nbsp; /* if newer image exists */<br />
&nbsp; &nbsp; if (<a href="http://www.php.net/file_exists" target="_blank">file_exists</a>($file) &amp;&amp; <a href="http://www.php.net/filemtime" target="_blank">filemtime</a>($file) &gt; $time) <br />
&nbsp; &nbsp; {<br />
&nbsp; &nbsp; &nbsp; &nbsp; /* POST the file to server */<br />
&nbsp; &nbsp; &nbsp; &nbsp; send_file($recv, $file);<br />
&nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; /* save the file's modification time */<br />
&nbsp; &nbsp; &nbsp; &nbsp; $time = <a href="http://www.php.net/filemtime" target="_blank">filemtime</a>($file);<br />
&nbsp; &nbsp; }<br />
}</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></font><br />
 The script checks for new images by comparing the file's modification time. If a new image found, it will POST the image by calling send_file function.<br />
 send_file() is my custom function to make HTTP POST request. Of course one can use Curl library, but since Curl is not always available on some systems, I think it would be better to make a custom function when portability comes into mind.<br />
 <b>Listing 3:</b> Function to POST a file<br />
<font face="monospace"><!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">/**<br />
&nbsp;* Function to POST a file to server<br />
&nbsp;*<br />
&nbsp;* Parameters:<br />
&nbsp;* @handler&nbsp;  string&nbsp; the remote script that handles the incoming file<br />
&nbsp;* @filename&nbsp; string&nbsp; the file to be sent<br />
&nbsp;*/<br />
function send_file($handler, $filename) {<br />
&nbsp; &nbsp; /* check if file exists */<br />
&nbsp; &nbsp; if (!<a href="http://www.php.net/file_exists" target="_blank">file_exists</a>($filename)) return;<br />
&nbsp;<br />
&nbsp; &nbsp; /* get hostname and path of remote script */<br />
&nbsp; &nbsp; $host = <a href="http://www.php.net/parse_url" target="_blank">parse_url</a>($handler, PHP_URL_HOST);<br />
&nbsp; &nbsp; $path = <a href="http://www.php.net/parse_url" target="_blank">parse_url</a>($handler, PHP_URL_PATH);<br />
&nbsp;<br />
&nbsp; &nbsp; /* setup default path if empty */<br />
&nbsp; &nbsp; if (<a href="http://www.php.net/empty" target="_blank">empty</a>($path)) $path = '/';<br />
&nbsp;<br />
&nbsp; &nbsp; /* setup request header and body */<br />
&nbsp; &nbsp; $boundary = &quot;---------0123456789&quot;; <br />
&nbsp; &nbsp; $reqbody&nbsp; = &quot;--$boundary\r\n&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . &quot;Content-Disposition: form-data; name=\&quot;img\&quot;; filename=\&quot;$filename\&quot;\r\n&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . &quot;Content-Type: image/jpeg\r\n\r\n&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . <a href="http://www.php.net/file_get_contents" target="_blank">file_get_contents</a>($filename) . &quot;\r\n&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . &quot;--$boundary--\r\n&quot;;<br />
&nbsp; &nbsp; $reqhead&nbsp; = &quot;POST $path HTTP/1.1\r\n&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . &quot;Host: $host\r\n&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . &quot;Content-Type: multipart/form-data; boundary=$boundary\r\n&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . &quot;Content-Length: &quot; . <a href="http://www.php.net/strlen" target="_blank">strlen</a>($reqbody) . &quot;\r\n&quot;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; . &quot;Connection: Close\r\n\r\n&quot;;<br />
&nbsp;<br />
&nbsp; &nbsp; /* open socket connection to remote host on port 80 */<br />
&nbsp; &nbsp; $fp = <a href="http://www.php.net/fsockopen" target="_blank">fsockopen</a>($host, 80, $errno, $errmsg, 30);<br />
&nbsp;<br />
&nbsp; &nbsp; /* check the connection */<br />
&nbsp; &nbsp; if (!$fp) <a href="http://www.php.net/die" target="_blank">die</a>(&quot;Cannot connect to $host!\n&quot;);<br />
&nbsp;<br />
&nbsp; &nbsp; /* send request */<br />
&nbsp; &nbsp; <a href="http://www.php.net/fwrite" target="_blank">fwrite</a>($fp, $reqhead);<br />
&nbsp; &nbsp; <a href="http://www.php.net/fwrite" target="_blank">fwrite</a>($fp, $reqbody);<br />
&nbsp;<br />
&nbsp; &nbsp; /* close the connection */<br />
&nbsp; &nbsp; <a href="http://www.php.net/fclose" target="_blank">fclose</a>($fp);<br />
}</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></font><br />
 You must run the script sender.php as daemon (runs forever in the background), before you run the FrameGrabber. Simply type the command below in your console:<br />
 php sender.php &amp;<br />
 Note: remove the '&amp;' if you use Windows.<br />
 <b>Image Receiver (recv.php)</b><br />
<br />
 This part is very simple, it retrieves the submitted image and save it to disk.<br />
 <b>Listing 4:</b> Save the submitted file to disk<br />
<font face="monospace"><!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&lt;?php<br />
/**<br />
&nbsp;* Save the submitted file to disk<br />
&nbsp;*/<br />
if (<a href="http://www.php.net/is_uploaded_file" target="_blank">is_uploaded_file</a>($_FILES['img']['tmp_name'])) {<br />
&nbsp; &nbsp; <a href="http://www.php.net/move_uploaded_file" target="_blank">move_uploaded_file</a>($_FILES['img']['tmp_name'], &quot;img.jpg&quot;);<br />
}</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --><ol style="list-style-type: decimal"><li> </li>
</ol></font><br />
 <b>Web Page (index.html)</b><br />
<br />
 This page displays the image to browser. Some javascript code will refresh the image every 3 seconds without reloading the whole page.<br />
 <b>Listing 5:</b> HTML page with autorefresh<br />
<font face="monospace"><!-- BEGIN TEMPLATE: bbcode_code_printable -->
<div style="margin:20px; margin-top:5px">
	<div class="smallfont" style="margin-bottom:2px">Codice:</div>
	<hr /><code style="margin:0px" dir="ltr" style="text-align:left">&lt;html&gt; <br />
&lt;head&gt; <br />
&lt;title&gt;Remote Surveillance System&lt;/title&gt; <br />
&lt;/head&gt; <br />
&lt;body&gt; <br />
&nbsp;<br />
&lt;img name=&quot;frame&quot; src=&quot;&quot; border=&quot;0&quot; /&gt; <br />
&nbsp;<br />
&lt;script type=&quot;text/javascript&quot;&gt; <br />
function showFrame() { <br />
&nbsp; &nbsp; document.images.frame.src = &quot;img.jpg?&quot; + Math.random(); <br />
&nbsp; &nbsp; setTimeout(&quot;showFrame()&quot;, 3000); <br />
} <br />
showFrame(); <br />
&lt;/script&gt; <br />
&nbsp;<br />
&lt;/body&gt; <br />
&lt;/html&gt;</code><hr />
</div>
<!-- END TEMPLATE: bbcode_code_printable --></font></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=173">Videosorveglianze - Videosurveillance</category>
			<dc:creator>Flavio58</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416768</guid>
		</item>
		<item>
			<title>Moonstruck primates: Owl monkeys need moonlight as much as a biological clock for noc</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416767&amp;goto=newpost</link>
			<pubDate>Sat, 04 Sep 2010 20:09:48 GMT</pubDate>
			<description>An...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>An international collaboration led by a University of Pennsylvania anthropologist has shown that environmental factors, like temperature and light, play as much of a role in the activity of traditionally nocturnal monkeys as the circadian rhythm that regulates periods of sleep and wakefulness.<br />
<br />
<br />
<br />
<a href="http://www.physorg.com/news202756359.html" target="_blank"><br />
<br />
More...</a></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=359">Physicorg</category>
			<dc:creator>BiometricForumRSS</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416767</guid>
		</item>
		<item>
			<title><![CDATA[What's causing life-threatening blood clots in brain surgery patients?]]></title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416766&amp;goto=newpost</link>
			<pubDate>Sat, 04 Sep 2010 20:09:48 GMT</pubDate>
			<description>One...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>One of the most severe complications of brain surgery is a life-threatening blood clot in the lungs called a pulmonary embolism.<br />
<br />
<br />
<br />
<a href="http://www.physorg.com/news202756428.html" target="_blank"><br />
<br />
More...</a></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=359">Physicorg</category>
			<dc:creator>BiometricForumRSS</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416766</guid>
		</item>
		<item>
			<title>German court rules against YouTube over copyright</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416765&amp;goto=newpost</link>
			<pubDate>Sat, 04 Sep 2010 20:09:48 GMT</pubDate>
			<description>(AP...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>(AP) --  A German court ruled Friday that Google Inc.'s subsidiary YouTube LLC must pay compensation after users uploaded several videos of performances by singer Sarah Brightman in violation of copyright laws.<br />
<br />
<br />
<br />
<a href="http://www.physorg.com/news202756612.html" target="_blank"><br />
<br />
More...</a></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=359">Physicorg</category>
			<dc:creator>BiometricForumRSS</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416765</guid>
		</item>
		<item>
			<title>Texting on the rise among US adults: Pew survey</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416764&amp;goto=newpost</link>
			<pubDate>Sat, 04 Sep 2010 20:09:48 GMT</pubDate>
			<description>Mor...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>More American adults are texting but they are not tapping out nearly as many messages per day on their cellphones as teenagers, according to a new survey from the Pew Research Center.<br />
<br />
<br />
<br />
<a href="http://www.physorg.com/news202756805.html" target="_blank"><br />
<br />
More...</a></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=359">Physicorg</category>
			<dc:creator>BiometricForumRSS</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416764</guid>
		</item>
		<item>
			<title>Interview: Wikipedia founder bullish on news</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416763&amp;goto=newpost</link>
			<pubDate>Sat, 04 Sep 2010 20:09:48 GMT</pubDate>
			<description>(AP...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>(AP) --  Wikipedia founder Jimmy Wales believes relief may be in sight for the beleaguered news media industry.<br />
<br />
<br />
<br />
<a href="http://www.physorg.com/news202756574.html" target="_blank"><br />
<br />
More...</a></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=359">Physicorg</category>
			<dc:creator>BiometricForumRSS</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416763</guid>
		</item>
		<item>
			<title>Google to pay 8.5 million dollars to settle Buzz case</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416762&amp;goto=newpost</link>
			<pubDate>Sat, 04 Sep 2010 20:09:48 GMT</pubDate>
			<description>Goo...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>Google has agreed to pay 8.5 million dollars (US) to settle a privacy lawsuit over a Buzz social networking tool added to free email service Gmail in February, according to court documents.<br />
<br />
<br />
<br />
<a href="http://www.physorg.com/news202756695.html" target="_blank"><br />
<br />
More...</a></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=359">Physicorg</category>
			<dc:creator>BiometricForumRSS</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416762</guid>
		</item>
		<item>
			<title>Texas opens inquiry into Google search rankings (Update)</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416761&amp;goto=newpost</link>
			<pubDate>Sat, 04 Sep 2010 20:09:48 GMT</pubDate>
			<description>(AP...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>(AP) --  Google Inc.'s methods for recommending websites are being reviewed by Texas' attorney general in an investigation spurred by complaints that the company has abused its power as the Internet's dominant search engine.<br />
<br />
<br />
<br />
<a href="http://www.physorg.com/news202756643.html" target="_blank"><br />
<br />
More...</a></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=359">Physicorg</category>
			<dc:creator>BiometricForumRSS</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416761</guid>
		</item>
		<item>
			<title>Cholera kills 41 in Central African nation of Chad</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416760&amp;goto=newpost</link>
			<pubDate>Sat, 04 Sep 2010 20:09:48 GMT</pubDate>
			<description>(AP...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>(AP) --  Health officials in Chad say an outbreak of cholera in the Central African nation has killed at least 41 people.<br />
<br />
<br />
<br />
<a href="http://www.physorg.com/news202804776.html" target="_blank"><br />
<br />
More...</a></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=359">Physicorg</category>
			<dc:creator>BiometricForumRSS</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416760</guid>
		</item>
		<item>
			<title>French science vessel to start second leg of climate voyage</title>
			<link>http://www.bernardotti.it/portal/showthread.php?t=416759&amp;goto=newpost</link>
			<pubDate>Sat, 04 Sep 2010 20:09:48 GMT</pubDate>
			<description>The...</description>
			<content:encoded><![CDATA[<!-- BEGIN TEMPLATE: postbit_external -->
<div>The French yacht Tara leaves Sunday on the second leg of a three-year voyage across the world's oceans to chart the effects of climate change on micro-organisms which produce half our oxygen.<br />
<br />
<br />
<br />
<a href="http://www.physorg.com/news202804964.html" target="_blank"><br />
<br />
More...</a></div>


<!-- END TEMPLATE: postbit_external -->]]></content:encoded>
			<category domain="http://www.bernardotti.it/portal/forumdisplay.php?f=359">Physicorg</category>
			<dc:creator>BiometricForumRSS</dc:creator>
			<guid isPermaLink="true">http://www.bernardotti.it/portal/showthread.php?t=416759</guid>
		</item>
	</channel>
</rss>
