Difference between revisions of "Upload images to a remote FTP server"
From ElphelWiki
(Created page with "<font size='2'> ==Description== The camera can be set up to upload images on a remote ftp server periodically. ==Additional features== * Launch a php script on the server - for ...") |
(No difference)
|
Latest revision as of 11:31, 2 October 2012
Contents
Description
The camera can be set up to upload images on a remote ftp server periodically.
Additional features
- Launch a php script on the server - for example, to resize or move the images.
- Download and update the camera parameters from a configuration file stored on the server.
Quick Instructions
- Server: create an ftp user/password pair for the camera.
- Camera: edit /etc/conf.d/ccamftp.conf
- Camera: enable ftp uploading
1. 192.168.0.9 -> Parameter Editor -> check the camftp-group -> View/Edit link -> set DAEMON_EN_CCAMFTP to 1 2. 192.168.0.9 -> Parameter Editor -> scroll down to the second table and save the configuration.
Camera: /etc/ccamftp.conf
- Able to launch a specified php script on the server - to resize images, for example.
- Listing:
; Configuration file for the "webcam" mode fro the automatic upload of the images to the remote ftp server over the ftp. ;Enable the script by specifying a non-zero value in the next line ENABLE=0 ; This file should be placed to the /etc/conf.d/ccamftp.conf ; The the camera will automatically start ftp upload as soon as it is powered up if/etc/conf.d/ccamftp.conf exists and is not disabled ; To disable the script from running - remove or rename this file in the camera ; ;here are parameters written in the camera itself - will use if no remote configuration is available ;remore server parameters ;file name .jpeg will be added for the images to upload (i.e. sample_camera.jpeg), .conf - for the remote configuration file (i.e. sample_camera.conf) INAME=sample_camera ;ftp server ip (should be numerical) SERVER=127.0.0.1 ;user name and password for ftp access to the remote server USER=some_user PASSWORD=some_password ;directory path on the remote server to uplooad the files REMOTE_DIR=some_image_directory ;directory on the remote server where camera will try to look for the configuration data REMOTE_CONF_DIR=some_conf_directory REMOTE_SCRIPT_PATH=http://some_server_ip/some_directory/some_script.php #should be IP, not host name ; you may create the file on the remote server with the same lines as the following, they will be used instead of this configuration file when the camear will contact the server. ;upload repetition period in seconds (300= one frame each 5 minutes PERIOD=120 ;specify how long the script should wait for data upload/download operations before giving up current attempt (it will try again and again next periods) TIMEOUT=60
Update the camera's configuration from the server
- If there's no need for updating the configuration the file does not have to exist.
- The file name must be exactly as the INAME parameter value in /etc/conf.d/ccamftp.conf plus the .conf extenstion, example:
INAME=sample_camera => sample_camera.conf
- In the end of the configuration file there must be "FINISH=1" - this is done to make sure the whole configuration file is downloaded to the camera.
- All the parameters names can be found at 192.168.0.9->"Parameter Editor" or on the camera in /etc/autocampars.xml
- sample_camera.conf example listing:
;External FTP server configuration file - downloaded and used by the camera for updating parameters ;All the parameters names can be found at 192.168.0.9->"Parameter Editor" or in /etc/autocampars.xml FTP_PERIOD=180 ; image update period FTP_TIMEOUT=300 ; allowed image upload time FTP_UPDATE=600 ; configuration file download period ;Image parameters WOI_TOP=0 ; window top WOI_LEFT=0 ; window left WOI_WIDTH=2592 ; window width WOI_HEIGHT=1936 ; window height QUALITY=80 ; JPEG quality (%) COLOR=1 ; image format: 0 = mono , 1 = JPEG, 5 = JP$ COLOR_SATURATION_RED=250 ; color saturation red COLOR_SATURATION_BLUE=250 ; color saturation blue ; Parameters for black level and gamma (learn about them from the camera interface) GTAB_R=171508736 GTAB_G=171508736 GTAB_GB=171508736 GTAB_B=171508736 ;Autoexposure parameters AUTOEXP_ON=1 ; 1 - auto, 0 -manual AUTOEXP_EXP_MAX=100000 ; Maximum autoexposure value, 100000=100ms AEXP_LEVEL=63488 ; level for AEXP_FRACPIX AEXP_FRACPIX=65408 ; fraction of pixels to be below AEXP_LEVEL ;White balance parameters WB_EN=1; WB_SCALE_GB=65536 ; additional correction for green2/green1 WB_SCALE_R=65536 ; additional correction for red/green1 WB_SCALE_B=65536 ; additional correction for blue/green1 ;Autoexposure and white balance window position and dimensions HISTWND_RWIDTH=0x8000 ; width, 50% of WOI_WIDTH HISTWND_RHEIGHT=0x8000 ; height, 50% of WOI_HEIGHT HISTWND_RTOP=0x8000 ; position, 50% of WOI_HEIGHT HISTWND_RLEFT=0x8000 ; position, 50% of WOI_WIDTH ;The next line is just to make sure the configuration file is read from the server completely (without it the file will be ignored) FINISH=1
- Put the configuration file on the remote server to "REMOTE_CONF_DIR" (set in the /etc/conf.d/ccamftp.conf)