Sie sind auf Seite 1von 58

ParkIT Programmers Manual

Page 1/58

ParkIT Programmers Manual


For versions from 1.12.0.8 Document version: 12.09.19

Table of Contents
Introduction .................................................................................................................................................................................................................................... 4 The Camera Software ................................................................................................................................................................................................................... 4 The Camera Modules.................................................................................................................................................................................................................... 5 General Communication Interface .......................................................................................................................................................................................... 7 Setting Parameter Values ..................................................................................................................................................................................................... 7 Retrieving Parameter Values ............................................................................................................................................................................................... 7 Retrieving Parameter Ranges ............................................................................................................................................................................................. 8 Image Capturing Interface ......................................................................................................................................................................................................... 9 1. Introduction ......................................................................................................................................................................................................................... 9 2. Image Sensor .....................................................................................................................................................................................................................10 3. Frame Limiter.....................................................................................................................................................................................................................11 4. Flash Driver.........................................................................................................................................................................................................................11 5. De-Bayer ..............................................................................................................................................................................................................................12 6. Color Correction................................................................................................................................................................................................................12 7. Gamma Correction...........................................................................................................................................................................................................13 8. Mirroring and Rotation...................................................................................................................................................................................................14 9. Image Compressor...........................................................................................................................................................................................................14 10. Motion Detector.............................................................................................................................................................................................................15 11. Analyzer.............................................................................................................................................................................................................................17 12. Frame Buffers...................................................................................................................................................................................................................17 12.1 Getting Images from the Frame Buffer ................................................................................................................................................................18 13. Properties .........................................................................................................................................................................................................................19 System Hardware Date and Time ...........................................................................................................................................................................................21 1. Introduction .......................................................................................................................................................................................................................21 2. Retrieving Time Parameters ..........................................................................................................................................................................................21 Automatic Zoom Control ..........................................................................................................................................................................................................23 1. Manual Method.................................................................................................................................................................................................................23 2. Automatic Method...........................................................................................................................................................................................................23 3. Parameter Sets...................................................................................................................................................................................................................25 4. Errors.....................................................................................................................................................................................................................................25 Automatic Focus Control ..........................................................................................................................................................................................................26 1. Manual Method.................................................................................................................................................................................................................26 2. Autofocus............................................................................................................................................................................................................................26 3. Brightness and Autofocus .............................................................................................................................................................................................26 4. Parameters..........................................................................................................................................................................................................................27 5. Errors.....................................................................................................................................................................................................................................27 Automatic Brightness Control.................................................................................................................................................................................................28 1. Manual Mode.....................................................................................................................................................................................................................28 2. BrightNow!..........................................................................................................................................................................................................................28 3. Automatic Mode...............................................................................................................................................................................................................28 4. Module Parameters..........................................................................................................................................................................................................29 5. Operation of Strategies ..................................................................................................................................................................................................30 6. Errors.....................................................................................................................................................................................................................................30 Illuminator Configuration Manager ......................................................................................................................................................................................30 Scheduler Trigger.........................................................................................................................................................................................................................31 1. Introduction .......................................................................................................................................................................................................................31 2. Basic Parameters...............................................................................................................................................................................................................31 3. Level and Edge Control ..................................................................................................................................................................................................32 4. Errors.....................................................................................................................................................................................................................................32

ParkIT Programmers Manual

Page 2/58

Upload Manager ..........................................................................................................................................................................................................................33 1. Introduction .......................................................................................................................................................................................................................33 2. Parameters..........................................................................................................................................................................................................................33 3. Processing Logging Data ...............................................................................................................................................................................................35 4. Errors.....................................................................................................................................................................................................................................35 Event Manager..............................................................................................................................................................................................................................36 1. Short Description .............................................................................................................................................................................................................36 2. Detailed Description .......................................................................................................................................................................................................36 3. Commands and Parameters..........................................................................................................................................................................................37 Software Trigger...........................................................................................................................................................................................................................39 1. Short Description .............................................................................................................................................................................................................39 2. Detailed Description .......................................................................................................................................................................................................39 3. Parameters..........................................................................................................................................................................................................................39 GPIO Trigger ..................................................................................................................................................................................................................................40 1. Short Description .............................................................................................................................................................................................................40 2. Detailed Description .......................................................................................................................................................................................................40 3. Parameters..........................................................................................................................................................................................................................40 UART Trigger..................................................................................................................................................................................................................................41 1. Short Description .............................................................................................................................................................................................................41 2. Detailed Description .......................................................................................................................................................................................................41 3. Parameters..........................................................................................................................................................................................................................41 Interface to Camera Peripherals .............................................................................................................................................................................................42 1. Short Description .............................................................................................................................................................................................................42 2. Detailed Description .......................................................................................................................................................................................................42 3. Parameters..........................................................................................................................................................................................................................43 Logging...........................................................................................................................................................................................................................................45 1. Short Description .............................................................................................................................................................................................................45 2. Filtering Log Records.......................................................................................................................................................................................................45 Backup System .............................................................................................................................................................................................................................46 1. Short Description .............................................................................................................................................................................................................46 2. Module Parameters..........................................................................................................................................................................................................46 System Update .............................................................................................................................................................................................................................47 1. Short Description .............................................................................................................................................................................................................47 2. Uploading Backup File....................................................................................................................................................................................................47 ARHIP - PC API Description.......................................................................................................................................................................................................48 Module Initialization and Closure ...................................................................................................................................................................................48 Functions of Communication (query/answer)............................................................................................................................................................48 Handling of Data Streams ..................................................................................................................................................................................................49 Creating Backup File with ARHIP PCAPI ........................................................................................................................................................................53 Uploading Backup File (Update) with ARHIP PCAPI..................................................................................................................................................54 Getting Images from the Scapture Module .................................................................................................................................................................55 Contact Information ...................................................................................................................................................................................................................58

ParkIT Programmers Manual

Page 3/58

Introduction
Welcome to the Programmer's Manual of the ParkIT series cameras. This document is intended to provide you a complete understanding on the wide range of possibilities of integrating your ParkIT into your system. The ParkIT series of cameras are specially developed and optimized for license plate reading (ANPR) applications while offering a great deal of flexibility to suit your special needs. The two main capabilities of the ParkIT camera are capturing images optimized for ANPR and forwarding them via a selected protocol to your application. The special hardware features, such as for example the built-in high power pulsed-infra LED illumination, or the extended I/O capabilities backed up with software developed with device integration in mind, such as the built-in hardware motion detector, ensure that the unit should fit into your system quickly and easy. The camera is equipped with a DSP-based intelligent processing core and with large internal memory for image buffering. This core is hosting a Linux operating system and an intuitive web based control interface. Image processing in the camera is divided among modules: each module is responsible for a specific task. The camera can be configured and used by communicating with these modules.

The Camera Software


The core of the camera software consists of modules that are responsible for handling different features of the device. (e.g. zooming is executed by the hwlayer/zoomcontrol module while trigger events are handled by the trigger/eventman module). Every module has a name and a group e.g. setup/network where setup is the group and network is the name and is responsible for setting up network connections of the camera. All features and functions of the camera are accessible by users through the camera software to an extent determined by their privileges.

ParkIT Programmers Manual

Page 4/58

The Camera Modules


Every module of the camera is responsible for certain task(s) and has unique commands and functions. MODULE CATEGORIES, module groups and module names: [modulegroup/modulename] description: MONITORING __________________________________________________________________________________
STAT

[stat/memory] Memory Statistics [stat/listmodules] Module List


LOGGING

[logging/logstream] Device Log Streamer

SETTING ______________________________________________________________________________________
HWLAYER

[hwlayer/cphw] CP Hardware Interface [hwlayer/cperiph] Camera Peripherals


SETUP

[setup/profiles] Profile Manager [setup/users] Set Users and Groups [setup/network] Network Setup [setup/exit] Shutdown/Restart Manager [setup/hwmotdet] Hardware Motion Detection Parameter Manager [setup/time] System/Hardware Date and Time [setup/imagepar] Image Parameter Manager
FILE

[file/reader] HTML Template Parser


CONFIG

[config/ledcfg] Illuminator Configuration Manager [config/cfgman] Configuration Manager

IMAGE ________________________________________________________________________________________
SCAPTURE

[scapture/default] Image Capture Interface


MCAPTURE

[mcapture/default] Image Stream Interface


CONTROL

[control/focuscontrol] Automatic Focus Control [control/zoomcontrol] Automatic Zoom Control [control/brightnesscontrol] Automatic Brightness Control

TRIGGER-UPLOAD ______________________________________________________________________________
TRIGGER

[trigger/eventman] Event Manager [trigger/swtrigger] Software Trigger [trigger/uarttrigger] UART Trigger [trigger/gpiotrigger] GPIO Trigger [trigger/scheduler] Scheduler Trigger
UPLOAD

[upload/uploadman] Upload Manager

UPDATE-MAINTENANCE _________________________________________________________________________
UPDATE

[update/default] System Update


BACKUP

[backup/default] Backup System

ParkIT Programmers Manual

Page 5/58

Modules in bold text can be accessed and managed with camera commands as described in the following chapters. Other modules are intended for internal usage. To communicate with these modules, three methods are available: Through the web interface of the ParkIT camera by submitting the forms on the pages. For more information see ParkIT Users Manual. As HTTP requests e.g. in browsers address bar according to syntaxes detailed below. Through the PC API (for the C programming language) of the ParkIT camera (see PC API Description). The WEB interface is recommended for users, as it is very easy to use while the other methods are intended for programmers (C, C++ and HTML.) NOTE: For application development purposes, Mozilla Firefox is strongly recommended. In the following sections of this manual, the ParkIT camera modules and the ParkIT PC API are described.

ParkIT Programmers Manual

Page 6/58

General Communication Interface


You can set up and monitor the camera by using parameters. Parameters are composed of a name and a value. The value of a parameter has a type (int, string, etc.) and validity limits. Each of the modules listed in the previous chapter has a parameter list, which consists of the parameters that the given module accepts. In this chapter, we will deal with the issue of getting, setting and retrieving these parameter lists and ranges. Parameters can be read only (RO), in this case only a get operation is allowed on them, or read/write (RW), in which case both a get and a set operation is allowed. There are certain special parameters (for example commands), which are by nature write only (WO).

Setting Parameter Values


Syntax: http://[camera ip]/[module group]/[module name]?[parameter name 1]=[parameter value 1]&[parameter name 2]=[parameter value 2]&... Example: Query: http://192.0.2.3/control/zoomcontrol?zoom=32 Answer: multipart=1 mimetype=text/html estr= eparams= zoom=32 NOTES: 1) You can set multiple properties in one query. 2) In the answer, the module may include more properties, other than those queried (see the documentation of the modules below). 3) In general, the answer will contain the previous value of the parameter in the answer. To make sure that the parameter value is accepted and set, query it with the get command.

Retrieving Parameter Values


Syntax: http://[camera ip]/[module group]/[module name]?get[parameter name 1]&get[parameter name 2]&... Example: Query: http://192.0.2.125/control/zoomcontrol?getzoom Answer: multipart=1 mimetype=text/html estr= eparams= zoom=32

ParkIT Programmers Manual

Page 7/58

Special parameters multipart=1 Both image and image data are transferred (multipart=0: image only) ajaxcall=1 Query/set data are displayed on the web interface (ajaxcall=0: can be save as file) cameraapi=1 Substitutes the multipart=1 parameter when communicating with the [setup/time] module.

Retrieving Parameter Ranges


All modules (except scapture/default, which because its large number of parameters uses a different syntax, see its documentation below) return the validity range using the following syntax: http://[camera ip]/[module group]/[module name]?query[parameter name 1]&query[parameter name 2]&... Example: Query: http://192.0.2.125/trigger/gpiotrigger?querysamplerate_hz&queryinvert Answer: listsamplerate_hz=1,2,5,10,20,50,100,200,500,1000,2000,5000,10000 listinvert=0,1 mimetype=text/plain multipart=1 Answers come in two types list and bound. Syntaxes: list[parameter name]=[valid value1],[valid value2],... bound[parameter name]=[minimum value], [maximum value], [default value, or -1 if not applicable]

ParkIT Programmers Manual

Page 8/58

Image Capturing Interface


[scapture/default]

1. Introduction
The scapture/default module is responsible for the basic image capturing tasks detailed below. With the help of the module, it is possible to get camera images (in JPEG format) and to set and get image capturing parameters. Images returned by the camera have a parameter list attached. In this list, each value is listed twice: with and without the 'img' prefix. The parameter value with the 'img' prefix represents the value of the parameter at the time the image was captured, while the one without it represents the actual value. Steps of Image Processing: Image Processing Pipeline

ParkIT Programmers Manual

Page 9/58

2. Image Sensor
Camera images are captured by the image sensor. This sensor can be color or B&W as described in the scolor (0=B&W, 1=color) property. Pixels are captured with 12-bit depth. The image sensor also has attributes describing the number of vertical and horizontal pixels (described in the xsize and ysize parameters). Image sensors include a boost circuit to increase the brightness of the camera image. The extent of this boost can be adjusted through the gain parameter. Note that the higher the gain value is, the noisier the images will be. To make the camera image brighter, the exposure time can also be used. This time defines the length of time during which the sensor is collecting light. It can be set in microseconds through the shutter parameter. The longer the image sensor collects light, the brighter the camera image will be. In case of high shutter values, motion blur effect may occur in case of rapid motions. The image capturing frequency of the sensor is defined in FPS (describing the number of captured Frames Per Seconds) and can be adjusted by the ifps parameter. The actual number of processed images can be adjusted with the Frame Limiter (see below). The following parameters depend on the type of the camera image sensor:

Parameters of the Camera Image Sensor


imgsize imgxsize imgysize RO The size of the image in bytes (read only). If the amount of data exceeds this value then there it is extra data included (e.g. histogram information, etc.). In the sent data package, always the image comes first and then comes the extra data. X (width) size of the image in pixels Y (height) size of the image in pixels Querying the frame capturing speed of the sensor (read-only). This value depends on the camera sensor according to the followings: ifps RO 752x480: 0, 60.0 = 60Hz (default), 50.0 = 50Hz 1280x960: 0, 22.5 = 22.5Hz (default), 11.25 = 11.25Hz 1600x1200: 0, 8.5 = 8.5Hz (default), 4.25 = 4.25Hz (Flashing effect on the camera image caused by interference with camera environment light sources can be avoided by this option). imgifps imgscolor RO RO actual ifps value influenced by iskipframes (see below) Camera sensor color information. 0 = B&W sensor 1= Color sensor Gain value for image capturing. In case of sensors: 752x480: it is represented in percentage (1.0 = 100%) 1280x960 and 1600x1200: it is represented in decibels NOTE: Adjusting gain is strongly recommended through the brightness control module. used gain value when the image was captured value of shutter in s (fractions can also be provided) NOTE: Adjusting shutter is strongly recommended through the brightness control module. used shutter value when the image was captured

RO RO

gain

RW

imggain shutter imgshutter

RO RW RO

ParkIT Programmers Manual

Page 10/58

3. Frame Limiter
In many cases, the speed with which the sensor captures images is too quick for image processing or it is unnecessary to operate the system at full speed (e.g. in case of parking facilities, 10 FPS is satisfactory). In these cases, the number of captured frames should be limited with the frame filter module that is capable of dropping frames from the incoming stream of from the sensor. When adjusting the number of dropped frames, it must be specified that after processing an image, how many should the module drop (ignore). The number of dropped images may vary between 0 and 15. If 0 is set, all images are forwarded (0 is dropped) while if 15 is set, the system drops 15 images after every processed one. The number of skipped frames can be set by the iskipframes property. E.g. iskipframes=3:

Before limiter After limiter

1 1

2 X

3 X

4 X

5 2

6 X

7 X

8 X

9 3

In the first row, the incoming frame indexes are enlisted, while in the second row, indexes of forwarded images are marked with green, indexes of dropped (ignored) images are marked with red.

Parameters of Frame Management


Number of frames skipped at capturing. 0 = no skipping 1 = every second is processed 2 = every third is processed RO max. 15 = every fifteenth is processed) The ifps and iskipframes parameters refer to data received from the sensor. The two parameters together define the number of frames downloaded from the camera. imgiskipframes imgframetimems RO RW Used iskipframes value when the image was captured. Time of frame capturing in msecs (system time). Updating system time changes this parameter. Time of frame capturing according to a clock counting monotonically starting from the timestamp at camera startup, thus unaffected by time synchronization effects and manual time setting to ensure the order of images in time. * Frame index of the image stored in 32 bit. It may overflow.

iskipframes

imgframemonotimems imgframeindex

RW RW

4. Flash Driver
The flash module works with images filtered by the frame limiter. The flash control can be set to flash differently on images with odd/even frame index with the help of the flashmode property. (If the camera uses visible light for illumination, disturbing flashing (stroboscopic) effect may occur. To avoid this phenomenon, the flash1persec property can be used that defines the minimal number of flashes in one second. If there is no such phenomenon, then set this parameter to 0 to flash only at image capturing.)

Timestamp in ms-s counted from the Unix epoch 1970.01.01 0:00:00.00 +0000 UTC

ParkIT Programmers Manual

Page 11/58

Parameters of Flashing
NOTE: Setting the flash mode is strongly recommended through the camera web interface: Setup/Advanced Setup/Flash Control. The camera can be set up to flash the illuminator on even/odd frames. Adjust flashing mode according to the followings: (0=turned off, one of the bits is 1 then turned on 0xF to make all of them available). 1. bit set to 1: emitting strobe signal to the illuminator on odd frames 3. bit set to 1: emitting strobe signal to the illuminator on even frames 4. bit: set to 0= even/odd frame differentiation is disabled set to 1= even/odd frame differentiation is enabled E.g. to flash all light sources continuously: enable the 1. and the 3. bits: 10102=1010 Delay of flashing on the built-in illuminator in milliseconds. This value can be negative as well. NOTE: This value is factory preset. Do not alter. Minimal number of flashes in one second on the built-in illuminator. It always flashes once on a strobe signal. By this parameter, the number of flashes on the illuminator in one second can be defined (it is divided equally). If it is 0 then only one flash will occur on a strobe signal.

flashmode*

RW

flash1delay*

RW

flash1persec*

RW

5. De-Bayer
This option is available only at color cameras. Most color sensors send images according to the so-called Bayer Pattern. The task of the De-Bayer module is to convert the pixels to the RGB color space. (During the conversion and further image processing tasks, calculating accuracy needed by the incoming 12bit accurate data exceeds the 24bit accuracy. To achieve better image quality, the algorithm uses weighted average calculation).

6. Color Correction
Pixels, converted to RGB are exposed to further image processing which includes the following procedures:

white balance contrast saturation

With the help of the whitebalance parameter, the gain of the individual color channels can be adjusted: the red, green and blue components can be enhanced (moved to positive direction) and reduced (moved to negative direction). As a result of such adjustments, shade of the image color can be altered. With the help of the contrast and saturation parameters, the corresponding values can be adjusted. The adjustment can be negative (minimum -1.0) or positive (maximum +1.0). In case of 0, no modification is executed. A further task of the color correction module is to convert the pixels from RGB to the YUV color space. This color space is appropriate for JPEG and H264 compressions and is suitable for the motion detector.

*These parameters cannot be adjusted in case of 1.3MP ParkIT camera models.

ParkIT Programmers Manual

Page 12/58

Parameters of Color Correction


saturation imgsaturation contrast imgcontrast whitebalance imgwhitebalance RW RO RW RO RW RO Adjusting saturation (between -1.0 and +1.0) This parameter is available only at color cameras. used saturation value when the image was captured contrast value (between -1.0 and +1.0) used contrast value when the image was captured values of white balance between -1.0 and +1.0 (R, G, B) e.g. whitebalance=0.0,0.1,0.8 used white balance values when the image was captured

7. Gamma Correction
The gamma correction enables to enhance dark pixels differently from bright ones. This kind of modification helps to render the details of dark image sections (more) visible. The characteristic of the gamma curve is described by a number between 0.2 and 6.0. Values below 1.0 result in reduction of dark sections, while values above 1.0 mean the extension of them. The value 1.0 does not have any affect on the image. The average used gamma is 1.6 while 2.2 is considered to be strong gamma correction. This value can be set by the gamma property. Camera image can be darkened or brightened with the help of the brightness parameter. This parameter equally alters dark and bright parts of the image. The value -1.0 results in the darkest image, while 1.0 results in the brightest value. The value 0.0 does not have any effect on the image. It may occur that not even the darkest pixel on the camera image is black. To solve this problem, the blacklevel property can be used. The value of this parameter may vary between 0.0 and 1.0 where 1.0 stands for 100%. Default value: 0.0. The whitest pixel on the camera image can be adjusted with the help of the whitelevel property. The value of this parameter may vary between 0.0 and 1.0 where 1.0 stands for 100%. Default value: 1.0.

Parameters of Gamma Correction


gamma imggamma blacklevel imgblacklevel whitelevel imgwhitelevel brightness imgbrightness RW RO RW RO RW RO RW RO 1.0=no correction (linear), x=correction is used (between 0.2 and 6.0) Values must be rounded to tenth (e.g. 0.2, 0.3 5.9, 6.0). used gamma value when the image was captured Defines the lowest pixel value that stands for black. This will be the starting point of the gamma curve. Values between 0 and 1.0 are valid. NOTE: The blacklevel value must be lower than whitelevel. used black level value when the image was captured Defines the highest pixel value that stands for white. This will be the end of the gamma curve. Values between 0 and 1.0 are valid. NOTE: The blacklevel value must be lower than whitelevel. used white level value when the image was captured Adjusting brightness (it moves the gamma curve to Y direction). Valid values are between -1.0 and +1.0 Default: 0.0 used brightness value when the image was captured

ParkIT Programmers Manual

Page 13/58

8. Mirroring and Rotation


In some special cases, (e.g. when the camera is installed upside down or aimed at a mirror) mirroring the camera image vertically or horizontally or rotating it by 90 degrees to any direction may provide a solution. Note that rotation is not supported by every camera model. Most camera models support only horizontal (smirrhoriz property) and vertical (smirrvert property) mirroring and 180-degree rotation (srotate property). Note that in case of rotations by 90 and 270 degrees, the aspect ratio changes (e.g. 752x480 image turns to 480x752).

Parameters of Mirroring
smirrhoriz smirrvert RO RO 1: horizontal mirroring is enabled 0: horizontal mirroring is disabled 1: vertical mirroring is enabled 0: vertical mirroring is disabled 0: image rotation is disabled 90: camera image is rotated by 90 degrees 180: camera image is rotated by 180 degrees 270: camera image is rotated by 270 degrees

srotate

RO

9. Image Compressor
The image compressor is capable of converting the pixels into JPEG images or H264 stream. Note that not every camera model supports the H264 format. In case of JPEG compression, the quality of the images can be adjusted by the jpegquality parameter between 0 and 100 where 0 results in the smallest but poorest quality image and 100 means the best quality but largest image file. The default value is 75. Since good quality images can be created with 80, providing greater ones is not recommended to avoid increased bandwidth usage and disk space consumption. NOTE: The jpegquality parameter can be adjusted through the camera web interface by the Compress Rate option according to the following formula: jpegquality=100-Compress Rate, that means 0 is the best quality/largest file combination and 100 is the smallest file/poorest quality. Most of the enlisted properties are read-only and contain information related to the captured image.

Parameters of Image Compression


Parameter name RO/RW Selecting channel, see above. 0 = normal image from the sensor in high resolution (default) 1 = minified grayscale image from the motion detector module (optionally colored), H264_I_PCM format 2 = JPEG stream 3 = H264 stream NOTE: If not the default (0) format is used, it must be marked in every query. Image format (cannot be altered at runtime- also depends on the profile). Possible values are: Description

imgchannel

RO

imgformat

RO

ParkIT Programmers Manual

Page 14/58

jpegquality

RW

0 = Automatic 1 = RAW format 2 = JPEG (in case of imgchannel 0 and 2) 3 = BMP (in case of imgchannel 1 for creating grayscale images) 4 = H264 I_PCM frame (only in special cases) in case of imgchannel 1 5 = H264 (in case of imgchannel 0 and 3) NOTE: H264 compression is not available in every camera model. The quality of JPEG images can be set by this parameter (a number between 0 and 100). The higher this value is, the better the quality of the images will be. Default=75. NOTE: Images of better quality are greater in size therefore, they increase network load. Suggested values are between 60 and 80. used jpeg quality value when the image was captured. recommended file extension (string, e.g. .jpg) (read only) It returns the type of the data e.g. image/jpeg.

imgjpegquality fileext mimetype

RO RO RO

10. Motion Detector


With the help of the built-in motion detector, the camera is capable of detecting motions in image streams based on the pixel differences between consequent frames. This motion detector can be customized for different purposes through its parameters detailed below and can be used to launch trigger events on motions. For more information on triggering, see Event Manager description. Operation A speed and a sensitivity value can be specified for the motion detector. Based on these values, a new value is calculated (imgmdbgresult) from the learnt background and the changes (imgmdxresult) between the current image. It is advisable to use the latter parameter for motion detection. A limit value can also be set, above which motion is detected in the imgmdresult parameter. Motions can be framed as well. Images containing motions are organized into sequences to which numbers (IDs) are assigned (imgmdsequence). Within sequences, the frames are also counted (imgmdseqframe). If frames with no motion are found after motion sequences, these frames are inserted into the end of the previous motion sequence. By the imgmdresult parameter, it can be decided whether was there any motion in the given sequence or was not.

Parameters of the Motion Detector


mdmode RW Turning motion detection on/off: 0 = turned off, 3 = turned on The speed of the motion detector. Both the speed of the background image and the motion image are set by this option. Setting speed is independent from the FPS. It is compensated automatically. 0 = slow100 = very quick. Default value: 75 Setting the sensitivity of the motion detector. 0 = the least sensitive 100 = very sensitive Default value: 75 Setting sensitivity for defining motion detection frame. 0 = the least sensitive 100 = very sensitive Default value: 75 The output of the motion detector (minified image). 0 = minified grayscale image 1 = output of the motion detector (0=no movements, 0xFF=largest

mdspeed

RW

mdsensitivity

RW

mdrectsens

RW

mdoutimg

RW

ParkIT Programmers Manual

Page 15/58

mdreslevel

RW

mddebug

RW

mdmask00 .. mdmaskFF RW

imgmdwin imgmdbgresult imgmdxresult

RO RO RO

imgmdresult

RO

imgmdsequence imgmdseqframe

RO RO

movement) 2 = bitmask (in which position has the motion detection been enabled) Motion limit. The extent of pixel changes above which the detected motion is handled as motion (it is not ignored). Suggested value: 20 This parameter is for testing the motion detector. 0 = no debug information appears on the minified image (default) 1 = areas included in the frame are marked with blue A so-called forbidding mask can be set for the motion detector to mark areas to be excluded from motion detection. The image is divided into 16x16 pixel blocks. For every block, a bit belongs. If an image cannot be divided by 256 then the bits in the last block do not count. Because of this e.g. in case of a 752x480 image 48x30 bit is stored instead of 47x30. If a bit is 1 that represents disabling, if 0 then it represents enabling (by default). The motion detector defines a frame within which motion detection is executed. The coordinates of this frame are represented by this read-only parameter according to the followings: imgmdwin=x1,y1,x2,y2 Difference against the background. It is executed on every block and it sums the absolute values of differences. Read only parameter. Motion value for the entire image based on the pixel changes. It is advisable to use this parameter for motion detection. Note that this parameter is read only. With the help of this parameter, it can be checked if there has been any motion on the given image or has not. Note that this parameter is read only. 0 = no motion has occurred 1 = motion has occurred Motion detection sequences have unique IDs. This ID is a read-only 32 bit counter. The number of frames within sequences is counted by this 32 bit counter and can be queried only.

If there are parts in the image in which motion should be ignored (for example traffic on another lane, on the sidewalk or just a tree on the side of the road blown by the wind), then this part should be masked out. Masks can be drawn most freely with the commands below.

Motion Detection Mask Commands


mdfillmask Filling the entire mask with the specified value. 0= disabling every mask position (no motion detection) 1= enabling all mask position (motion detection is enabled) Drawing a full circle on the specified position of the motion detection mask. Command format: mddraw=x,y,t,s x= X coordinate of the normal image y= Y coordinate of the normal image t= Operation to be executed: 0=erasing, 1=adding, 2=inverting s= Size of the brush: 0=1 pixel, 1=3 pixel, 2=5 pixel Saving the created mask file under the current profile. Loading mask file from the current profile.

mddraw

mdsavemask mdloadmask

ParkIT Programmers Manual

Page 16/58

11. Analyzer
The analyzer module provides data for sharpness adjustment and brightness control to other modules. These data consist of the followings: Data for sharpness adjustment Data for brightness control (shutter, gain, iris)

12. Frame Buffers


Captured images and image data are stored in the camera memory, in a dynamic buffer. Depending on the settings, even hundreds of images (max. 1024) can be stored in this way. User applications may get previous images based on their image index or image time. Every image has a monotonic counter called the frame index. This index is represented by the frameindex parameter. Furthermore, every image has two different timestamps. The first one is the system time (frametimems), the second one is a monotonic clock measuring in milliseconds that starts counting after turning on the camera (framemonotimems, see above). System time can be altered by setting the clock (manually or automatically e.g. through an NTP server). With the help of the getframe property, users can specify if they want to download image, image data or both. The scapture module is capable of retaining the last queried image for every connection. Because of this, it is easy to query the following (next) or the closest (by frameindex or timestamp) image (best). If the last queried image is needed, the last value must be used with the capture parameter.

Commands of Frame Management


The state of returning images. It advisable to use this option when setting/querying parameters and no image is necessary from the camera. With the help of this command, the unnecessary network load can be avoided. getframe 0=no image is returned (only parameters and data are transferred) 1=image and data are returned (all data are transferred). Default option. 2=image is taken inside the camera but only the image parameters are returned. Specifies a frame to be taken from the buffer. Buffering is executed by an other (hwlayer) module. The scapture gets images from this buffer. next = returns the next available image related to the previously downloaded one last = returns the last captured image from the buffer best = returns the most appropriate image from the buffer (Setting one parameter among the frametimems, framemonotimems and frameindex is mandatory for this parameter. Otherwise, it takes the last from the buffer). local = By default, it returns the image last queried by the scapture module (if there has not been such image then it returns the last one from the central buffer. Querying specific boundary groups (see below).

capture

query{groupname}

ParkIT Programmers Manual

Page 17/58

12.1 Getting Images from the Frame Buffer


12.1.1 Operation of the Frame Buffer
The buffer stores the latest captured frames. The number of these frames is variable: it depends on more factors e.g. on the size of the images.

12.1.2 Parameters of Captured Frames (Images)


The scapture module returns three parameters for every captured frame: imgframeindex, imgframetimems and imgframemonotimems. imgframeindex: After camera startup, captured frames are counted. This parameter provides the number of the frame. imgframetimems: Time elapsed since 1st January 1970 until the capturing of the frame in milliseconds. imgframemonotimems: Time elapsed since camera startup until the capturing of the frame in milliseconds. The above parameters can be used to determine the time of capturing when getting frames from the scapture module. These parameters can be displayed in browsers as a part of a parameter list according to the followings: http://192.0.2.3/scapture?multipart=1&ajaxcall=1 In case of the above query, no image is displayed. To display the image, the parameters are valid on, the multipart=1 and the ajaxcall=1 parameters must be omitted: http://192.0.2.3/scapture

12.1.3 The Capture Parameter

capture=last
http://192.0.2.3/scapture?capture=last It returns the last captured image. No other parameter is necessary for this query. Example to return the parameters of the last captured image: http://192.0.2.3/scapture?capture=last&multipart=1&ajaxcall=1

capture=next
It returns the frame that follows the last returned (queried) one. If this frame is not in the buffer anymore, (too much time has elapsed and it has been rewritten by newer images), it returns the oldest image from the buffer. The capture=next can be used by itself or together with the framemonotimems, imgframetimems and frameindex parameters: In these cases, frames, following the specified number/timestamp are returned (if they are still in the buffer): Examples: capture=next&framemonotimems=98741855 capture=next&imgframetimems=1337679820180 capture=next&frameindex=8390

ParkIT Programmers Manual

Page 18/58

capture=best
It returns the frame that is closest (before or after) to the specified timestamp or frame index. If the buffer does not contain such a frame, the oldest one is returned. If the specified timestamp (framemonotimems, imgframetimems) or frameindex value is too high (refers to a yet non-existing frame) then the newest frame from the buffer is returned. Examples: capture=best&framemonotimems=106964188 capture=best&imgframetimems=1337695009069 capture=best&frameindex=193390 For more information on handling the above parameters through the ARHIP PCAPI, see PCAPI description.

13. Properties
By default, the system does not return all the properties together with images. If we need to query the remaining properties, then the get prefix must be used before the name of the property. Validity limits of properties can be queried with the query prefix. get{propertyname}=1 query{groupname}=1 Getting the value of the property Querying specific boundary groups or possible value(s) seen below. In case of returning boundaries, the returned values are as follows: [min. value], [max. value], [default value] Queryable parameters and groups

Groupname

Returned value
boundimgchannel 0,1,0 0 jpg listimgformat listfileext listcapture boundimgframetimems

Sample value

modefmt

next,last,best,local 0,18446744073709551615,0 0,4294967295,0 0,4294967295,0 752 480 60.0,50.0 0,15,0 0,1 0,1 0.25,4.0,1.0

frame

boundimgframemonotimems 0,18446744073709551615,0 boundimgframeindex boundimgsize

imgsize

listimgxsize listimgysize listifps boundiskipframes listgetframe listgetmcount boundgain

capfps data param

ParkIT Programmers Manual

Page 19/58

boundshutter boundgamma boundbrightness boundsaturation boundcontrast boundjpegquality boundwhitebalance boundcmatrix paramadv boundcyuvadd boundblacklevel boundwhitelevel boundflashmode flash boundflash1delay boundflash1persec gpi boundgpifreq boundgpidebounce mdmode boundmdspeed boundmdsensitivity md boundmdrectsens boundmdoutimg boundmddebug boundmdreslevel listsmirrhoriz smirrot listsmirrvert listsrotate

31.25,15000,1000 0.2,6.0,1.0 -1.0,1.0,0.0 -1.0,1.0,0.0 -1.0,1.0,0.0 0,100,80 -1.0,1.0,0.0 -127.0,127.0,0.0 -127.0,127.0,0.0 0.0,1.0,0.0 0.0,1.0,1.0 0,31,31 -1000.0,1000.0,0.0 0,200,0 1,250000,25 1,255,5 1,3,3 0,100,75 0,100,75 0,100,75 0,3,1 0,1,0 0,255,50 0,1,0 0,1,0 0,180,0

Example:
Query: http://192.0.2.180/scapture/default?querydata=1 Answer: listgetframe=0,1 listgetmcount=0,1 It is necessary to make a single connection capable of querying an image and its data in two separate queries. In this case, the web server has to assign the opened channels to the HTTP session.

ParkIT Programmers Manual

Page 20/58

System Hardware Date and Time


[setup/time]

1. Introduction
With the help of this module, formatted time and date values can be queried from the camera. NOTE: When communicating with the setup/time module, the cameraapi=1 parameter must be used instead of the multipart=1.

2. Retrieving Time Parameters


Sample URL request:
http://192.0.2.3/setup/time?multipart=1&ajaxcall=1&cameraapi=1&g_ftime=$a, $d $h $Y $T GMT $Q

Sample answer to the URL request:


Fri, 12 Jul 2002 15:22:10 GMT 529 a_localtimems=1026480130051 a_monotimems=49108 a_tzcode=400#CET-1CEST,M3.5.0,M10.5.0/3 a_year=2002 a_month=7 a_day=12 a_hour=15 a_min=22 a_sec=10 a_ntp=0 a_ntpip= multipart=1 mimetype=text/html

where the first line is the formatted time (specified with $a, $d $h $Y $T GMT $Q) and the rest of the values are always returned by the module. These values contain the following information (separated by enter-s): a_localtimems: local timestamp in milliseconds counted from the Epoch: 1970-01-01 00:00:00 +0000 UTC. a_monotimems: Time elapsed since camera startup in milliseconds. a_tzcode: code of the local time zone a_year: year of local time a_month: month of local time a_day: day of local time a_hour: hour of local time a_min: minute of local time a_sec: second of local time a_ntp: returns whether NTP synchronization is turned on or not. a_ntpip: IP address of the NTP server In order to configure the content and structure of the returned time information (first line of the answer), the following arguments can be used:

Arguments are the same as the strftime functions usable in C++ except the Q.

ParkIT Programmers Manual

Page 21/58

2.1 Querying Custom Time Information


Argument
%a %A %b %B %c %C %d %D %e %E %F %G %g %h %H %I %j %k %l %m %M %n %O %p %P %Q %r %R %s %S %t %T %u %U %V %w %W %x %X %y %Y %z %Z %+ %%

Description
The abbreviated weekday name according to the current locale. The full weekday name according to the current locale. The abbreviated month name according to the current locale. The full month name according to the current locale. The preferred date and time representation for the current locale. The century number (year/100) as a 2-digit integer. The day of the month as a decimal number (range 01 to 31). Equivalent to %m/%d/%y. Like %d, the day of the month as a decimal number, but a leading zero is replaced by a space. Modifier: use alternative format, see below. Equivalent to %Y-%m-%d (the ISO 8601 date format). The ISO 8601 week-based year with century as a decimal number. The 4-digit year corresponding to the ISO week number (see %V). This has the same format and value as %Y, except that if the ISO week number belongs to the previous or next year, that year is used instead. Like %G, but without century, that is, with a 2-digit year (00-99). Equivalent to %b. The hour as a decimal number using a 24-hour clock (range 00 to 23). The hour as a decimal number using a 12-hour clock (range 01 to 12). The day of the year as a decimal number (range 001 to 366). The hour (24-hour clock) as a decimal number (range 0 to 23); single digits are preceded by a blank. (See also %H.) The hour (12-hour clock) as a decimal number (range 1 to 12); single digits are preceded by a blank. (See also %I.) The month as a decimal number (range 01 to 12). The minute as a decimal number (range 00 to 59). A newline character. Modifier: use alternative format, see below. Either "AM" or "PM" according to the given time value, or the corresponding strings for the current locale. Noon is treated as "PM" and midnight as "AM". Like %p but in lowercase: "am" or "pm" or a corresponding string for the current locale. millisecond part of the current time (3 digits) The time in a.m. or p.m. notation. In the POSIX locale this is equivalent to %I:%M:%S %p. The time in 24-hour notation (%H:%M). For a version including the seconds, see %T below. The number of seconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC). The second as a decimal number (range 00 to 60). (The range is up to 60 to allow for occasional leap seconds.) A tab character. The time in 24-hour notation (%H:%M:%S). The day of the week as a decimal, range 1 to 7, Monday is 1. See also %w. The week number of the current year as a decimal number, range 00 to 53, starting with the first Sunday as the first day of week 01. See also %V and %W. The ISO 8601 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the new year. See also %U and %W. The day of the week as a decimal, range 0 to 6, Sunday is 0. See also %u. The week number of the current year as a decimal number, range 00 to 53, starting with the first Monday as the first day of week 01. The preferred date representation for the current locale without the time. The preferred time representation for the current locale without the date. The year as a decimal number without a century (range 00 to 99). The year as a decimal number including the century. The +hhmm or -hhmm numeric time zone (that is, the hour and minute offset from UTC). The time zone or name or abbreviation. The date and time in date(1) format. A literal '%' character.

ParkIT Programmers Manual

Page 22/58

Automatic Zoom Control


[control/zoomcontrol]
Zoom adjustment is possible in two ways: manually by automatic zoom Zoom From Geometry (ZFG) mode

1. Manual Method
Select the manual method by setting the mode parameter to 0. After that, the following parameters can be used to adjust the zoom. Parameter name mode zoom Mandatory yes RO/RW RW Valid values 0: manual zoom 1: automatic (ZFG) [zoom_min..zoom_max] integer integer Description mode of zooming to zoom to a specified position to query the minimal zoom position of the camera to query the maximal zoom position of the camera value of zoom in percentage

no

RW

zoom_min

no

RO

zoom_max

no

RO

integer

zoom_pc

no

RW

[0..100]

NOTE: Minimum, maximum and default values of zoom and zoom_pc can be queried by queryzoom and queryzoom_pc. Values are returned as: {minimum value}, {maximum value}, {default value}. Sample query: http://192.168.2.235/control/zoomcontrol?queryzoom&ajaxcall=1 Sample answer: boundzoom=0,90,-1 (-1 refers to a non-existing value).

2. Automatic Method
In automatic mode, the camera calculates the best zoom position (so that the pixel size of the license plate will correspond to the set char_pxl value) based on the ZFG parameters provided by the user (certain requirements and constraints can be specified as well). Moreover, the camera is capable of setting the appropriate LED power and flashing time as well, for the above set parameters. Requirements of automatic zoom set the mode parameter to 1 provide all of the following parameters:

ParkIT Programmers Manual

Page 23/58

2.1 Mandatory Parameters for Automatic (ZFG) Zooming


Parameter name cam_d_mm cam_h_mm char_mm char_pxl plate_d_mm plate_w_mm plate_h_mm plate_h0_mm Mandatory only for ZFG only for ZFG only for ZFG only for ZFG only for ZFG Parameter title Camera offset (mm) Camera height (mm) Character height (mm) Character height (pixel) Plate distance (mm) RO/RW RW RW RW RW RW Description horizontal offset between the centre of the number plate and the camera distance between the ground and the camera physical character height in millimeters desired character height in pixels distance between the camera and the number plate measured according to the figure below width of the number plate in millimeters height of the number plate in millimeters distance between the ground and the centre of the number plate

only for ZFG only for ZFG only for ZFG

Plate width (mm) Plate height (mm) Plate elevation (mm)

RW RW RW

NOTE: Legal values of the above parameters depend on the ANPR environment. Combinations, which describe physically impossible parameters, are rejected.

Visual interpretation of ZFG parameters

After setting the ZFG parameters, the camera adopts the best zoom value and calculates additional information can be queried by the user. These read-only parameters provide useful information for camera installment and operation:

ParkIT Programmers Manual

Page 24/58

Read-only post ZFG information parameters


Parameter name best_zoom f_mm hfov_deg vfov_deg pan_deg tilt_deg roi_left roi_right roi_top roi_bottom led_time led_level estr eparam RO RO RO RO suggested LED flashing time, s suggested LED voltage level, index error description (if there is any) list of invalid parameters (if there is any) RO These parameters represent the coordinates of the number plate bounding box. For more information see chapter Automatic Focus Control. RO/RW RO RO RO RO RO RO Description best zoom position best focal length horizontal field-of-view (in degrees) vertical field-of-view (in degrees) camera pan angle (see below) camera tilt angle (see below)

Camera pan and tilt angles

3. Parameter Sets
The default parameter set is updated after a complete and valid request has sent to the module. If a parameter set is invalid, the module sends back detailed description of the error and the list of the invalid parameter names. If a parameter set is incomplete, the module sends back the default parameter set.

4. Errors
In case of invalid parameters, the detailed description of the error is sent back in the estr parameter and the names of the invalid parameters are listed in "eparam". These special parameters (estr and eparams) cannot be queried directly.

ParkIT Programmers Manual

Page 25/58

Automatic Focus Control


[control/focuscontrol]
Focus adjustment of the camera image can be executed in two ways: manually and automatically (by autofocus).

1. Manual Method
Select the manual method by setting the mode parameter to 0 then set the focus manually by the focus parameter within the boundaries of focus_min and focus_max values.

2. Autofocus
When using autofocus, focusing is controlled entirely by the module (no manual adjustments are possible). After auto focusing, the module switches back to manual mode (in case of both a successful and an unsuccessful focusing). Progress of autofocus can be queried anytime through the progress parameter.

2.1 The ROI (Region of Interest) Box


The Automatic Focus Control (AFC) module is able to focus in a region of the image called ROI (Region of Interest) box. This region can be the rectangle returned by the ZFG process. However, the position of this box can specified manually with the help of the following parameters: Parameter name roi_left** roi_right** roi_top** roi_bottom** RO/RW RW RW RW RW Description distance of the left side of the ROI box from the top left corner of the camera image in pixels distance of the right side of the ROI box from the top left corner of the camera image in pixels* distance of the upper side of the ROI box from the top left corner of the camera image in pixels* distance of the lower side of the ROI box from the top left corner of the camera image in pixels*

** Camera model (optics and sensor) dependent properties. NOTE: Using the same ROI coordinates at zoom and focus is recommended. NOTE: The coordinates of the ROI must be set according to the resolution of the camera. E.g. 752x480.

3. Brightness and Autofocus


Criteria of successful auto-focusing: the brightness must be set to reach optimal contrast the camera must be targeted to capture stable images containing fine details in the ROI (edges, textures)

The auto-focusing algorithm waits for stable brightness while the autobrightness function is running on the camera. During this waiting process, the automatic focus control is in paused mode (mode=2). As soon as the brightness is stable, the module switches back to auto mode and starts the auto-focusing process.

Values are rounded to 16 multiples.

ParkIT Programmers Manual

Page 26/58

4. Parameters
Parameter name RO/RW Valid values Description mode of focusing 0: manual 1: auto 2: paused (can not be activated by users but the system only) focus position minimal focus position maximal focus position [1..100] [0..100] progress of the autofocus represented in percentage focus position in percentage

mode

RW

[0,1,2]

focus focus_min** focus_max** progress focus_pc

RW R R R RW

[focus_min..focus_max]

** Camera model (optics) dependent properties. NOTE: Minimum, maximum and default values of focus and fous_pc can be queried by queryfocus and queryfocus_pc. Values are returned as: {minimum value}, {maximum value}, {default value}. Sample query: http://192.168.2.235/control/focuscontrol?queryfocus&ajaxcall=1 Sample answer: boundfocus=0,90,-1 (-1 refers to a non-existing value).

5. Errors
In case of invalid parameters, the detailed description of the error is sent back in the estr parameter and the names of the invalid parameters are listed in eparam. These special parameters (estr and eparams) cannot be queried directly.

ParkIT Programmers Manual

Page 27/58

Automatic Brightness Control


[control/brightnesscontrol]
Brightness adjustment of the camera image can be executed in two ways: manually and automatically (with the help of strategies).

1. Manual Mode
In manual mode (mode=0), the gain, shutter and iris can be adjusted separately between the boundaries returned by the module. Values are represented according to the followings: gain - in percentage or decibel, depending on the camera model shutter - in microseconds iris - position iris_pc - in percentage

NOTE: Although, gain and shutter adjustment can also be executed through the scapture/default module, setting these values is strongly recommended through the Brightness module.

2. BrightNow!
Use the BrightNow! function for single, quick and simple adjustments. Send mode=3 and a target value (see below) to the brightness module then the function executes a quick but less accurate adjustment which will end in couple of steps (this mode will not engage again until started manually). After this, the previously set mode is activated. NOTE: Always send the target first, or together with the mode in order the avoid malfunction.

3. Automatic Mode
For automatic brightness adjustment, the following strategies are available: Overview strategy (for overview camera purposes), mode=1 ANPR strategy (for ANPR purposes), mode=2 Quick strategy (for quick adjustment), mode=4 Common features of strategies All the three strategies receive brightness target value from the user between -100 and 100. When a target value is set, the strategies set shutter, iris and gain automatically to reach and to maintain this value executing continuous adjustment on brightness changes. This value can be adjusted according to the figure below and is used mutually by the strategies so it is sufficient to provide it for one.

For all strategies, the boundaries and step values can be set for gain, shutter and iris respectively. Day and night configuration settings can also be provided for each strategy containing the previously mentioned boundaries and steps. The strategies switch between day and night modes automatically with the help of the camera light sensor. Both the actual value of the light sensor and the current strategy can be queried from the module (0 stands for day mode, 1 for night mode). Note that currentset cannot be queried if the brightness control mode is manual. Boundaries (minimal and maximal values) and current values can be queried anytime regardless the controlling mode.

ParkIT Programmers Manual

Page 28/58

4. Module Parameters
Name mode gain gain_min1 gain_max1 shutter shutter_min1 shutter_max1 iris iris_pc iris_min1 iris_max1 target current_set light_sensor RO/RW RW RW RO RO RW RO RO RW RW RO RO RW RW RO [-100..+100] integer [0,1] [iris_min..iris_max] [0..100] [shutter_min..shutter_max] Valid values [0,1,2,3,4] [gain_min..gain_max] Description controlling strategy value of gain in percentage minimal value of gain in percentage minimal value of gain in percentage value of shutter in secs minimal value of shutter in secs maximal value of shutter in secs iris position iris value in percentage minimal iris value maximal iris value target brightness value for strategies to set and maintain day (0) or night (1) configuration (only if autobrightness is on) value of the light sensor State of the brightness controller. 1: stable (target is reached) [0,1,2] 2: working (to reach the target) 3: unreachable (the target can not be reached with the current light conditions) returns histogram values in numeric format: 256 pcs. of comma separated 0.-255. values represent the cardinality of the integers between 0 and 255 given grayscale pixel intensity normalized to 100. where X stands for the highest 256. value represents the average pixel intensity. pixel intensity appearing on the screen

state

RO

histogram

RO

Camera model (optics) dependent properties, query these parameters to get their values.

NOTE: Minimum, maximum and default values of iris, shutter and gain can be queried by queryiris, queryiris_pc, queryshutter and querygain. Values are returned as: {minimum value}, {maximum value}, {default value}. Sample query: http://192.168.2.235/control/brightnesscontrol?queryiris&ajaxcall=1 Sample answer: boundiris=0,47,-1 (where -1 refers to a non-existing value).

ParkIT Programmers Manual

Page 29/58

5. Operation of Strategies
NOTE: It may take seconds to minutes for the current strategy to settle depending on its settings.

5.1 ANPR and Overview Strategies


The overview strategy prioritizes gain over shutter and shutter over iris. That means it prefers adjusting gain (if possible) to shutter and prefers adjusting shutter to iris within their boundaries. The ANPR strategy uses a special function and a further controller method to provide appropriate image for license plate recognition it never lets the image burn out. The overview strategy does not have this protection the image of the observed area may burn out to maintain visibility in the entire image.

5.2 The Quick Strategy


With the help of the quick brightness adjuster method, appropriate brightness can be reached quickly but less accurately. Adjustments are applied according to the above-mentioned priority. When the target level is approached as close as a defined limit value, the adjustment stops until lighting conditions change. If the target level cannot be reached with given number of steps, the quick adjusting method gives up. It chooses between day and night configurations at startup and does not query the light sensor after all (to increase speed). It uses the selected configuration until finished.

6. Errors
In case of an inappropriate parameter sending, the description of the error will be in the estr answer parameter. These special answer parameters (estr and eparams) cannot be queried directly.

Illuminator Configuration Manager


[config/ledcfg]
With the help of the Illuminator Configuration Manager, default flash settings can be customized for the different brightness modes and strategies on the built-in illuminator unit according to the followings: SETTING: http://{IP address}/config/ledcfg?{strategy}_{mode}_led_pcdose={value} E.g. http://192.0.2.170/config/ledcfg?overview_night_ledpcdose=45 As a result of the above command, the built-in illuminator flashes with 45 pc_dose value when the mode is night and the strategy is overview. QUERY: http://{IP address}/config/ledcfg?get{strategy}_{mode}

Possible parameter values


Strategy [anpr, overview, quick, manual] Mode [day, night] led_pcdose [0..100]

NOTE: Values will be applied after saving settings and quick restart of the camera.

ParkIT - Programmers Manual

Page 30/58

Scheduler Trigger
[trigger/scheduler]

1. Introduction
With the help of this module, it is possible to schedule trigger events. On these events, certain tasks can be executed (e.g. uploading files to an FTP server).

2. Basic Parameters
Name Mandatory Values Description on which day(s) of the week should the timer be active example: wday=tue where day_1 < day_2: wday=tue-sat example: wday=wed;sun example: wday=every on which day(s) of the month should the timer be active example: day=23-31 example: day=1;3;31 example: day=every in which hour(s) of the day should the timer be active example: hour=8 example: hour=0;5;10 example: hour=every in which minute(s) of the hour should the timer be active example: min=1 example: min=15;23;42 example: min=every in which second(s) should the timer be active example: min=1 example: min=15;23;42 example: min=every example: output=1 returns the number of scheduler outputs Edge controlled or level controlled timer. level: level controlled (see below) edge: edge controlled (see below) Enabling or disabling a scheduler trigger

wday

yes

[mon,tue,...,sat,sun] [day_1-day_2] [mon;tue;...] [every]

day

yes

[1-31] [1;2;...] [every]

hour

yes

[0-23] [0;1;2;...] [every]

min

yes

[0-59] [0;1;2;...] [every] [0-59] [0;1;2;...] [every] [0-(noutputs-1)] [uint] [level,edge] [true,false]

sec output noutput drive enabled

yes yes no yes no

Query example: http://192.0.2.45/trigger/scheduler?output=0&gethour Example for setting: http://192.0.2.45/trigger/scheduler?cmd=init&output=0&enabled=true&drive=edge&w day=mon-fri&day=1-31&hour=8-20&min=every&sec=every NOTE: Accepted parameters are saved to the configuration file and will be applied at the next startup.

ParkIT - Programmers Manual

Page 31/58

2.1 Information Commands


Command Name Format Example Description returns already set timer parameters

getparams

{ip_address}/trigger/scheduler? getparams&output=1

http://192.0.2.33/trigger/ scheduler?output=1&getparams

3. Level and Edge Control


Drive of trigger signals can be edge controlled or level controlled. 3.1 Edge controlled trigger signals last for a very short time instant (startms = endms).

3.2 Level controlled trigger signals on the other hand are always last for a period according to the followings:

If sec!=0-59 23:12:12.000 23:12:12.999 If sec=0-59 and min=0-59 23:00:00.000 23:59:59.999 If sec=0-59 and min!=0-59 23:12:00.000 23:12:59.999

So, if the timer uses level control then: if not every second is active (If sec!=0-59) then startms = start of the second, endms = 999 msecs later if every second and every minute is active (If sec=0-59 and min=0-59 ) then startms is the first msec of the hour while endms is the last msec of the hour if every second is active (If sec=0-59 and min!=0-59) then startms is the first msec of the minute while endms is the last msec of the minute

4. Errors
In case of invalid parameters, the module returns the following: estr=Invalid parameter eparams= {invalid parameters separated by colons}

ParkIT - Programmers Manual

Page 32/58

Upload Manager
[upload/uploadman]

1. Introduction
With the help of the upload/uploadman module, a protocol can be selected (FTP, SMTP or HTTP POST) via which image, image data (sent by the Event Manager) and trigger information will be forwarded from the camera. For sending trigger information, see Event Manager Description. Names of uploaded files can be specified in the filenametemplate parameter, image data is uploaded in text files of the following form: filenametemplate.params.txt

2. Parameters
General Parameters (for every protocol) Name cmd method Mandatory yes yes Values [init] [ftp,smtp,post] Description initializing protocol selecting protocol e.g. method=ftp returns the actual protocol: 0: FTP 1: SMTP 2: HTTP POST type of data to be sent; if not set then both image and image data are uploaded (data=0)

currentmethod

no

[0,1,2] [0,1,2] 0: image + event data 1: image 2: data

data

no

Parameters for the HTTP POST Protocol Name url filenametemplate Mandatory yes yes Values [text] [$y,$r,$o,$d,$h,$m,$s,$l,$t,text] $y: year (4 characters) $r: year (2 characters) $o: month $d: day $h: hour $m: minute $s: second $l: millisecond $t: frametimems $i: motion sequence ID (hexadecimal number) $x: frame index within a sequence (hexadecimal number) text: string Description web server address

definition of arguments

Filename template example: filenametemplate=$y-$o_$d-text-$d$m-text-$s-$l.JPEG Results in e.g. 2011-01_01-text-0113-text-12-123.JPEG Example: specifying parameters for HTTP POST protocol
cmd=init&method=post&url=testserver/index.php&filenametemplate==$y/$o_$d/text-$d$mtext-$s-$l.JPEG&data=1

ParkIT - Programmers Manual

Page 33/58

NOTES: it is not mandatory to use all of the arguments it is possible to use an argument at more places in the same command it is advisable to specify the extension of the file (as text)

Parameters for the FTP Protocol


Name url username password filenametemplate Example:
cmd=init&method=ftp&url=testserver&username=testuser&password=testpassword&filenametemp late=$y/$o_$d/text-$d$m-text-$s-$l.JPEG&data=0

Mandatory yes no no yes

Values [text] [text] [text] [text]

Description FTP server address FTP account username FTP account password see above

NOTE: Setting the username and password are not mandatory. User name and password is stored in the camera unencrypted.

Parameters for the SMTP Protocol


Name url username password filenametemplate from to Example:
cmd=init&method=smtp&url=testserver&username=testuser&password=testpassword&filenametem late=$y/$o_$d/text$d$m-text-$s-$l.JPEG &from=sender@testserver&to=recipient@testserver2&data=2

Mandatory yes no no yes no yes

Values [text] [text] [text] [$y,$r,$o,$d,$h,$m,$s,$l,$t,text] [email address] [email1,email2,...]

Description SMTP server address SMTP account username SMTP account password see above sender of the e-mail recipient(s) of the e-mail

NOTE: Setting the username and password are not mandatory. User name and password is stored in the camera unencrypted.

ParkIT - Programmers Manual

Page 34/58

Information Commands (to query previously set parameters) Name Mandatory Values Description The set FTP parameters. Returned values:
url= filenametemplate= username= password= curltimeoutms= data= currentmethod=

getftpparams

no

Returns SMTP parameters. Returned values: url= filenametemplate= from= to= curltimeoutms= data= currentmethod=

getsmtpparams

no

getpostparams

no

cmd

no

[getlog]

returns HTTP POST parameters: url= filenametemplate= data= currentmethod= returns logging data in the dataset section of the answer

Query example: http://192.0.2.11/upload/uploadman?getftpparams

3. Processing Logging Data


A record of the log file is built-up as follows:
upload1_var_1,upload1_var_2,upload1_var_3,upload1_var_4,upload1_var_5;

Fields are separated by commas while records are separated by semicolons. Sample record:
0,02/02-01-25-25-972.JPEG,0,0,No error;0,02/02-01-25-45-175.JPEG,0,0,No error;

Description of variables: var_1 : upload method var_2 : filename var_3 : type of uploaded data var_4 : success of uploading var_5 : error string [0,1,2,3] <=> [ftp,smtp,http post,invalid] [0,1,2] <=> [image+data,image,data [0,1,2] <=> [OK,failed,image ok + data failed] [No error, or error message]

4. Errors
In case of invalid parameters, the module returns the followings: estr=invalid parameter eparams= invalid parameters separated by colons

ParkIT - Programmers Manual

Page 35/58

Event Manager
[trigger/eventman]

1. Short Description
The Event Manager monitors the state of multiple trigger sources (such as Hardware Motion Detector or GPIO input), evaluates a user defined logical conjunction between these trigger source states and depending on the result of this evaluation initiates the uploading of a sequence of images. The Event Manager also implements image and trigger buffering, thus it offers greater flexibility with trigger timing.

2. Detailed Description
2.1 Trigger Inputs and Master Output
The Event Manager can be imagined as a combinatorial logic network with multiple inputs and a single output. The inputs and the output may be either asserted or not asserted. The output becomes asserted if the inputs are asserted in such a combination, that the user defined logic expression (formula, see below) evaluates to 'true'. The inputs are labeled with capital letters from A to U (V-Z are reserved).

2.2 Registering
The inputs can be assigned to various trigger sources. This process is called registering. If a trigger source has multiple outputs, it can be assigned to different inputs of the Event Manager.

2.3 Formula
The trigger control formula of the Event Manager can be defined by using the capital letters and the logic symbols defined below. The shorthands 'each' for AND-ing all the inputs, or 'any' for OR-ing all the inputs can be used. The following logic symbols can be used: - & (web interface) or * (URL) for AND - | (web interface) or + (URL) for OR - ! for NOT - ( and ) for bracketing Valid formulas are for example: - A&B&C (Web interface) - (A+B)*C (URL) -A - A&!B (Web interface) NOTE: Spaces are not allowed in formulas.

2.4 Trigger Action


There is a process within the Event Manager, which monitors the Master Output, and acts while it is asserted. This action is forwarding the images to the Upload Manager, which in turn will handle uploading of these images according to its current setup.

ParkIT - Programmers Manual

Page 36/58

3. Commands and Parameters


The event manager can be configured wit the help of the commands below. Structure of a command: cmd=[command]&[param1=value1]&...&[paramN=valueN]

3.1 Commands
Command
register

Format
cmd=register&module_name= [Module name]&output=[Output index]&input=[Input index] cmd=freeinput&input=[Input index] cmd=setformula&formula=[Logic expression] cmd=start

Example
cmd=register&module_name= trigger/swtrigger &output=0&input=D cmd=freeinput&input=D cmd=setformula&formula= (D+A)*B cmd=start

Description
registers the module's given output to the given input unregisters the module registered at the given input sets the logic expression the Event Manager evaluates starts the Trigger Action process of the Event Manager stops the Trigger Action process of the Event Manager resets the Event Manager returns the current configuration of the Event Manager. The answer is a semicolonseparated list of entries in the format of [Module name]/[Output index]: [Input index] returns the current formula of the Event Manager returns all available trigger sources

freeinput

setformula

start

stop reset

cmd=stop cmd=reset

cmd=stop cmd=reset

getconfig

cmd=getconfig

cmd=getconfig

getformula getsources

cmd=getformula cmd=getsources

cmd=getformula cmd=getsources

ParkIT - Programmers Manual

Page 37/58

3.2 Parameters
Parameter name
send_trginfo

Mandatory
no

Values
[0,1]

Description
0: trigger information is included 1: trigger information is not included

If send_trginfo is set to 1 then a .trg file is uploaded together with images, data or both. This file includes the following information:

Trigger Information
output startms endms index upload_type cmd fileext source output of the trigger source Note that different outputs of the same source are marked with different frame indexes. trigger start time trigger end time trigger index (images of a trigger have the same index) type of the upload task to be executed on the trigger extension of the trigger information file source (sender) of the trigger event

Information provided by trigger information is intended to determine that which images belong to the same trigger (with the help of the index).

ParkIT - Programmers Manual

Page 38/58

Software Trigger
[trigger/swtrigger]

1. Short Description
The Software Trigger module serves as a user-triggerable trigger source.

2. Detailed Description
A trigger signal can be sent to the Event Manager (see above) from user applications or from the web interface using this module.

3. Parameters
The software trigger module has the following parameters: Name noutputs cmd RO/RW RO W Mandatory no yes Legal values [uint] [sendtrigger] Description returns the maximum number of software trigger outputs sends a trigger to the Event Manager, use with the parameters that follow trigger data included in the image parameters (.par file); BASE64 encoded, URL pre-coded characters remain e.g. '%22' Suitable for logging information from serial port to images. trigger start timestamp trigger end timestamp the value to be added to the trigger start timestamp the value to be added to the trigger end timestamp specifies the selected output

trigger_data

RW

no

[string] max 256 bytes [timestamp] [timestamp] [-1000-1000] [-1000-1000]

startms* endms* prems postms

W W RW RW

no no no no

output RW yes [0-(noutputs-1)] *If not specified, the actual system time is used. Example:

http://192.0.2.20/trigger/swtrigger?cmd=sendtrigger&output=0&startms= 1336744931805&endms=1336744931905&trigger_data=[NTIuMTsxMzM2Ow0K] Trigger data containing multiple traffic sensor information explanation: Encoded: 'NTIuMTsxMzM2Ow0K' (0x35 0x32 0x2E 0x31 0x3B 0x31 0x33 0x33 0x36 0x3B 0xD 0xA) Decoded 12 bytes: '52.1;1336;' where: vehicle height in inches: 52.1, vehicle weight in kilograms: 1336 NOTE: To provide vehicle height and weight information, special external devices are (sensors) necessary.

ParkIT - Programmers Manual

Page 39/58

GPIO Trigger
[trigger/gpiotrigger]

1. Short Description
The GPIO Trigger module provides user access to the GPIO facility of the device, and serves as a trigger source.

2. Detailed Description
Users can access the General Purpose In and Outputs (GPIO) of the device through the GPIO Trigger Module. Users can set the GP output and get the GP input of the device by issuing an HTTP command. This module also serves as a trigger source relaying trigger signals from the GP input to the Event Manager. The duration of the relayed trigger signal can be extended by the module by adding a predefined value to the timestamps of the trigger signal received on the input.

3. Parameters
The trigger/gpiotrigger module has the following parameters: NOTE: When querying parameters, the output must be defined. Otherwise, data of the 0 output are returned. Name output noutputs setoutput prems postms samplerate_hz RO/RW RW RO RW RW RW RW Mandatory yes no no no no no Legal values [0-(noutputs-1)] uint [0,1] [-1000-1000] [-1000-1000] [1-1000] Description specifies the output; If not defined, 0 is used Get the number of outputs (of the trigger source). Set the GP Output of the device to the value. the value to be added to the trigger start timestamp the value to be added to the trigger end timestamp the sample rate with which the GP input is sampled* Drive of the trigger signal. For more information see Scheduler. 0: level 1: rising 2: falling the logic level of the input can be inverted (0 - active high, 1 - active low). the current status of the GP input can be queried by this parameter: 0: no signal 1: active level -1: invalid value NOTE: The default value is -1 (until the first signal arrives). *Use the lowest possible sample rate to avoid bouncing of the input.

edge

RW

no

[0,1,2]

invert

RW

no

[0,1]

input

RO

no

[0,1,-1]

ParkIT - Programmers Manual

Page 40/58

UART Trigger
[trigger/uarttrigger]

1. Short Description
UART Trigger monitors the user UART of the device for trigger signals and relays these to the Event Manager.

2. Detailed Description
UART Trigger monitors the user UART of the device for arriving data, and if these correspond to a user specified byte sequence, then sends a trigger signal to the Event Manager. The duration of the relayed trigger signal can be extended by the module by adding a predefined value to the timestamps of the trigger signal received on the UART.

3. Parameters
The UART Trigger module has the following parameters: Name output noutputs prems postms RO/RW RW RO RW RW Mandatory yes no no no Legal values [0-(noutputs-1)] uint [-1000-1000] [-1000-1000] Description specifies the output get the number of outputs (of the trigger source) the value to be added to the trigger start timestamp the value to be added to the trigger end timestamp Drive of the trigger signal. For more information see Scheduler. 0: level 1: rising 2: falling UART Baud rate (standard values) UART byte size UART parity (1 - use, 0 - do not use) UART number of stop bits trigger start byte value (256 means the first byte is the start byte regardless the byte value) trigger end byte

edge

RW

no

[0,1,2]

baudrate bytesize parity stopbits starttoken endtoken

RW RW RW RW RW RW

no no no no no no

[1200,2400,...,115200] [8,9,...] [0,1] [1,2] [0x00-0xFF,0x100] [0x00-0xFF]

ParkIT - Programmers Manual

Page 41/58

Interface to Camera Peripherals


[hwlayer/cperiph]

1. Short Description
This module provides access to some of the camera peripherals, such as the built-in LED light source, diagnostic values (temperature, light sensor, etc.), direct access and calibration of the motorized optics, etc.

2. Detailed Description
The module provides access to the following groups of peripherals, which are detailed below: Built-in LED light source Motorized optics and filter switching unit Diagnostics

2.1 Built-in LED Light Source


NOTE: In case of 1.3MP camera models, adjusting flashing intensity and frequency are not supported! The intensity of the built-in light source of the camera can be set and queried by two methods. The first is to enter a 0-100 % value using the parameter led_pcdose, which changes the light output accordingly.

2.1.1 Advanced LED Control


For more control, the amplitude of the flash can be set with ledpwr to: 0 - low 1 - medium 2 - high and set the flash time in microseconds using the parameter ledtimeus. NOTES: It is not recommended to set higher pulse width than the length of the shutter, because this will not make the image any brighter. In case of too high LED powers with too long pulse width and too high frame rate, the camera will protect the LEDs by disabling them for a couple of frames.

Safe Voltage/FPS Limits Voltage FPS 10 12 15 20 30 50 60 Low 950 s* 950 s* 950 s* 950 s* 950 s* 600 s 600 s Normal 950 s* 950 s* 950 s* 950 s* 800 s 400 s 400 s High 950 s* 950 s* 800 s 600 s 400 s 200 s 200 s

* 950 sec= max. allowed LED impulse width LEDs can be turned on/off by using the leden parameter (1 - on, 0 - off ).

ParkIT - Programmers Manual

Page 42/58

2.1.2 Frame Parity Flashing


NOTE: This function is required only under such special circumstances when the recognition of both reflective and non-reflective number plates is necessary. NOTE: In case of 1.3MP camera models, this function is not available! The Frame Parity Flashing option can be used to setup the camera for reading both reflective and non-reflective license plates. This task is realized by switching to lower and higher light output between odd and even frames. With this illuminating technique, the camera captures images with more and less intensive illumination. The former images will be suitable for the recognition of non-reflective license plates, while the latter ones are for reflective plates. If led_diff_en is enabled, then the illuminating light output used on odd frames will be different from the illuminating light output used on even frames. The extent of difference can be adjusted with the help of the led_diff_pc parameter according to the followings: the illuminating light output on odd frames will be reduced to led_diff_pc percentage of the illuminating light output on even frames. E.g. if led_pcdose is set to 50 and led_diff_pc is set to 20 then the camera will flash with 50% power on even frames and 10% (20% of the 50%) on odd frames.

2.2 Motorized Optics and Filter Switching Unit


Use this module to access and calibrate the motorized optics of the camera. The motorized optics can be turned in finite many steps. Calibration means rescanning the entire range of the optics to measure the exact position and length of control to compensate deviation (if there is any). The state of the filter switching unit can also be set here, that is to insert different kinds (e.g. infrared cut) filters in front of the optics, depending on the hardware configuration of the camera.

2.3 Diagnostics
Through diagnostics, the following diagnostic values and controls can be accessed: camera temperature (Celsius scale) light sensor value (0-255) green status LED to display status

3. Parameters
Built-in light source Name leden ledpwr* ledtimeus* led_pcdose led_diff_en ledtimeus2 RO/RW RW RW RW RW RW RW Legal Values [0,1] [0,1,2] [5-950] [0-100] [0,1] [5-950] Description 0 - disables built in light source,1 enables it LED power: 0 - low, 1 - medium, 2 - high LED flash pulse length in microseconds LED illumination value in percentage 1- enabling, 0-disabling Frame Parity Flashing flashing time in seconds on odd frames NOTE: It is valid only if led_diff_en=1! illuminating value for odd frames represented as a percentage of the led_pcdose value used on even frames. -1: frame illumination difference is disabled (it has the same effect as led_diff_en=0)
Page 43/58

led_diff_pc

RW

[0-100], -1

ParkIT - Programmers Manual

Motorized optics and Filter Switching Unit Name iris_pos iris_pc iris_min iris_max iris_moving focus_pos focus_pc* focus_min focus_max focus_moving zoom_pos zoom_pc* zoom_min zoom_max zoom_moving calibrate filter iris focus zoom Name overdrive temperature lightsensor status_g RO/RW RW RW RO RO RO RW RW RO RO RO RW RW RO RO RO RO RW RO RO RO RO/RW RO RO RO RW Legal Values [*] [0-100] [uint] [uint] [0,1] [*] [0-100] [uint] [uint] [0,1] [*] [0-100] [uint] [uint] [0,1] [0-100] [0,1] [uint] [uint] [uint] Legal Values [0,1] [uint] [0-255] [0,1] Description Iris position in steps (* between iris_min and iris_max) Iris position in percentage (if queried, it returns limits for iris (percentage)) Iris minimum position (steps) Iris maximum position (steps) 1 if iris is moving focus position in steps (* between focus_min and focus_max) focus position in percentage focus minimum position (steps) focus maximum position (steps) 1 if focus is moving zoom position in steps (* between zoom_min and zoom_max) zoom position in percentage zoom minimum position (steps) zoom maximum position (steps) 1 if zoom is moving progress of calibration (if running) status of filter switcher: 0 - IR cut, 1 all pass returns limits for iris (steps) returns limits for focus (steps) returns limits for zoom (steps) Description 1 if LED protection is active camera temperature (Celsius) light sensor value 1 - green status LED is on

Diagnostics

*usable with query as well e.g. 192.0.2.60/hwlayer/cperiph?queryledpwr=1 uint [0..232-1]

ParkIT - Programmers Manual

Page 44/58

Logging
[logging/logstream]

1. Short Description
Camera events are logged into the central log file for administrative and error management purposes. The lines (records) of the log can be filtered for specific events according to the specified characters. Note, that the log file content is erased after restarting the camera. The log file can be saved and returned by the following command:

http://{IP address}/logging/logstream?getlog&ajaxcall=1

2. Filtering Log Records


Log events can be filtered for defined character strings. To use this option, the filter parameter must be used according the followings:

http://{IPaddress}/logging/logstream?filter={stringtofind}&ajaxcall=1
Previously set filter can be queried as follows:

http://{IP address}/logging/logstream?getfilter&ajaxcall=1 Logging Commands


Command name getlog Format http://{IP address}/logging/logstream?getlog&aj axcall=1 http://{IP address}/logging/logstream?getfilter& ajaxcall=1 http://{IPaddress}/logging/logstream?s etfilter={stringtofind}&ajaxcall=1 Example Description opening the log file retrieving previously set characters used to filter for setting characters to filter for

http://192.0.2.31{/log ging/logstream?getlog& ajaxcall=1 http://192.0.2.31/logg ing/logstream?getfilte r&ajaxcall=1 http://192.0.2.31/logg ing/logstream?filter=2 0110820&ajaxcall=1

getfilter

setfilter

ParkIT - Programmers Manual

Page 45/58

Backup System
[backup/default]

1. Short Description
With the help of the Backup module, various settings of the camera can be saved into a .tar.gz archive. After saving, this file can be uploaded to other ParkIT cameras. The following functions are available on the camera web interface as well by the Export profiles, Export profiles, users and groups and Export all buttons. For creating backup file with the help of the ARHIP PCAPI, see ARHIP - PCAPI description.

2. Module Parameters
Name pipe mode Mandatory yes no Legal Values [1] int[1..31] Description specifying pipe for the backup process it specifies the data to be saved: 1: Saving one profile only. This profile can be specified with the profile (see below) parameter. If not specified, the default profile is saved. 2: Saving all profiles that the user have access for. 4: Saving users, groups and passwords NOTE: This mode includes saving the root password as well! 8: Saving reserved memory area. Note that this area is empty by default. 16: Saving network and time settings (parameters of the Network and Date and Time tabs). NOTE: Saving various functions can be combined by simply summing their parameter values. E.g. mode=20 equals to 16+4 and means saving users, groups, passwords, network and date and time settings. NOTE: this parameter can be used only if mode=1; it specifies the name of the profile to be saved

profile

no

[string]

http://{IP address}/backup/default?pipe=1&mode={value} Sample #1: Saving users, groups and passwords http://192.0.2.170/backup/default?pipe=1&mode=4 Sample #2: Saving a profile named profile1 http://192.0.2.170/backup/default?pipe=1&mode=1&profile=profile1 Sample #3: Saving all profiles, users, groups, passwords, date and time settings http://192.0.2.170/backup/default?pipe=1&mode=22

ParkIT - Programmers Manual

Page 46/58

System Update
[update/default]

1. Short Description
With the help of the Update module, backup settings saved by the Backup module or factory backup configurations can be uploaded to the camera. This function is available on the camera web interface (Update tab) as well on the. NOTE: Uploading backup settings cannot be executed from a browsers command line (URL).

2. Uploading Backup File


In order to upload backup file without ARHIP PCAPI, a HTTP query must be sent. This query will contain the update information of a .tar.gz file. For creating backup file with the help of the ARHIP PCAPI, see ARHIP - PCAPI description. POST /update?pipe=1 HTTP/1.1\r\n Host: 192.0.2.3:80\r\n IP address and port of the target device User-Agent: ARHIP\r\n Keep-Alive: 300\r\n Connection: keep-alive\r\n Content-Type: multipart/form-data; boundary=--------------------------7327659421310868402068919661\r\n Content-Length: 48123\r\n Here, the sample value of 48123 refers to the number of characters (bytes) from the first character of the following boundary (after the following line break) to the end of the entire query (marked with two line breaks). \r\n -----------------------------7327659421310868402068919661\r\n Content-Disposition: form-data; name="p_apifilename"; filename="samplefirmwarefilename.tar.gz"\r\n Content-Type: application/octet-stream\r\n \r\n The content of the tar.gz file as data \r\n -----------------------------7327659421310868402068919661--\r\n After sending the above query to the device, the following HTML answer returns in case of successful update:
<html><head><title>title - Update is successfully done</title></head><body><h2>title Update is successfully done</h2></body></html>

ParkIT - Programmers Manual

Page 47/58

ARHIP - PC API Description


The PC API consists of the following files: arhip.h: C/C++ file containing function descriptions arhip.dll, arhip.lib: for Windows projects libarhip.so: for Linux projects With the help of the ARHIP, it is possible to connect to a cameras built-in web server from a user-written piece of software, delivering the user from the burden of implementing e.g. the TCP/IP communication protocol and providing tools for ParkIT-specific functions. The ARHIP is capable of retrieving images from received MJPEG streams. Besides, the API is also capable of sending queries to the camera and receiving the answers. E.g. capturing an image, downloading its data and adjusting parameters. Before calling the functions below, the corresponding structures must be filled with zeros with the memset function. Filling with zeros between function calls is not necessary because the arhip_freeanswer function does that for you. The web interface can be accessed through browsers and from the ARHIP as well. Queries related to certain functions and operations are the same as the variables of the corresponding HTML requests. The ARHIP supports both the GET and POST methods. Data are returned in the content type section of the HTTP response as parameter types. File and module names are the same as in case of accessing from browsers.

Module Initialization and Closure


int arhip_init(void); This function is for initializing the module. In case of error, it returns a negative number. If it returns a positive number or 0 then no error has occurred. Negative values are standard POSIX error codes. void arhip_cleanup(void); This function is for closing the module.

Functions of Communication (query/answer)


Establishing Connection with the Device
int arhip_connect(const char *host); Parameters: host: Link to the device that can be a hostname, IPv4 or IPv6 address and port. Port can be specified after a colon. IPv6 addresses have to be enclosed in square brackets (as in browsers).

Examples: IPv4: http://10.0.0.1:80 IPv6: http://[2001:4860:0:2001::80]/ The default port is 80.


Page 48/58

ParkIT - Programmers Manual

Returned values: If negative then error occurred. The error code is included. If 0 or any positive number then the handle is returned, this handle has to be passed to the other functions.

Disconnecting from the Device


int arhip_disconnect(int handle); Parameters: handle: Closing the channel opened by the arhip_connect function. Returned values: If negative then error occurred. The error code is included. If 0 or any positive number then the function was successful.

Handling of Data Streams


In case of data streams, the device executes data sending continuously. The data stream can be e.g. an MJPEG stream (in this case the data stream consists of JPEG images).

Opening a Stream
int arhip_openstream(const char *host); Parameters: host: Link to the device that can be a hostname, IPv4 or IPv6 address and port. Port can be specified after a colon. IPv6 addresses have to be enclosed in square brackets (as in browsers). Examples: IPv4: http://10.0.0.1:80 IPv6: http://[2001:4860:0:2001::68]/ The default port is 9901. Returned values: If negative then error occurred. The error code is included. If 0 or positive then the handle is returned which has to be passed to the other functions.

ParkIT - Programmers Manual

Page 49/58

Closing the Data Stream


int arhip_closestream(int handle); Parameter: handle: Closing the channel opened by the arhip_openstream. Returned values: If negative then error occurred. The error code is included. If 0 or any positive number then the function was successful.

Querying a Frame from the Stream


Frames can be queried from opened streams. The answer can be freed with the arhip_freeanswer function as described above.

Getting a frame from the stream:


int arhip_getdata(int handle, struct ARHIP_ANSWER *answer, int timeoutms); Parameters: handle: Channel opened by the arhip_openstream function. answer: The answer will be in this parameter. timeoutms: Maximal length of waiting time for the answer. Returned values: If negative then error occurred. The error code is included. If 0 or any positive number then the function was successful. If the amount of returned data would exceed eight Mbytes then an error is returned (EINVAL). Eight Mbytes is the maximal amount of data that can be returned. Before calling the functions, the ARHIP_ANSWER structure has to be filled with zeros with the memset function. Filling with zeros between function calls is not necessary because the arhip_freeanswer function does that for you.

Sending a Query and Waiting for the Answer


The API sends a query to the device then waits for the answer. Both the query and the answer are placed into structures. Structure of the query: struct ARHIP_QUERY { const char *modtypeandname; int sessionid; const char *param; const void *data; int datalen; const char *filename; };

ParkIT - Programmers Manual

Page 50/58

Before sending a query, the following fields must be set: modtypeandname: The type and name of the module. It is not URL coded, the accepted characters are '/' plus the alphanumeric characters. It must be a standard '\0' terminated string and must be set according to the following template: 'moduletype/modulename' or 'path/filename' (do not begin with '/'). Setting this field is mandatory; its maximal length is 128 bytes. sessionid: The identifier of the session. If it is not 0 then a new session will open (default session ID is 0). param: Parameter string. Parameters have to be defined as follows: name=value. Note that every parameter must be set in separate lines (1 parameter/1 line, separated by '\r\n'). These lines will be parameter/1 line). These lines will be URL encoded except the following characters: - _ . ~ = and ,. Note that this field cannot be NULL but empty string only. Its maximal length is 3072 bytes. data: Data to be sent. If not used, it must be set to NULL. datalen: Length of data in bytes. Values between 0 and 32768 (32 Mbytes) are valid. filename: This filename will be used at upload when sending data. Its maximal length is 64 characters. If no filename is set then the default file name 'apidata.dat' is used. If the field is not used it must be set to NULL. (E.g. when sending a file to the update/default module this field will contain the name of the file while the data will contain the bytes of the file. Structure of the answer: struct ARHIP_ANSWER { char *param; void *data; int datalen; void *exdata; int exdatalen;

};
Before calling the function, this structure has to be filled with zeros with the memset function. After the answer has been processed, call the arhip_freeanswer function to free memory allocated by the arhip_iterate function in the answer. param: Returned ASCII string parameters. These parameters are stored separately (one line/one parameter, separated by \r\n) as follows: name=value. It can be NULL if there are no parameters. data: Returned data. It can be NULL if there is no data. It is e.g. a JPEG image. datalen: Length of data in bytes. exdata: Returned extra data. It can be NULL if there is no data. It may contain extra image data. Such data are e.g. a histogram, motion detection or DCT information, etc. exdatalen: Length of extra data in bytes.

ParkIT - Programmers Manual

Page 51/58

Sending a query for the device and requesting the answer: int arhip_iterate(int handle, struct ARHIP_QUERY *query, struct ARHIP_ANSWER *answer, int timeoutms); Parameters:

handle: Channel opened by the arhip_connect function. query: The query has to be passed in this parameter. answer: This parameter will contain the answer. timeoutms: Maximal waiting time for answer and sending.

Returned values: If negative then error occurred. The error code is included. If 0 or any positive number then the function was successful. If the data, received from the server, contains any error (HTTP protocol error) then the arhip_iterate() function returns with the EINVAL (22) error code. If a query that the server cannot answer any content arrives, (non-existing file or module, or the module cannot create answer data) then 404 is returned in the parameter field of the ARHIP_ANSWER structure.

Deleting the Answer


void arhip_freeanswer(struct ARHIP_ANSWER *answer); Parameter: answer: Pointer to the received answer. After the arhip_iterate and arhip_getdata function calls, the answer must be deleted with this function to free the allocated areas. If the answer pointer itself points to an allocated area then this area must be freed by the programmer.

ParkIT - Programmers Manual

Page 52/58

Creating Backup File with ARHIP PCAPI


//Creating Backup File with ARHIP PCAPI //Includes for Linux: #include <stdio.h> #include <string.h> #include "arhip.h" //Includes for Windows: #include "arhip.h" #include <stdio.h> #include <tchar.h> #include <windows.h> int main(int argc, char *argv[]) { arhip_init(); arhip_handle connected=arhip_connect("192.0.2.27",1); //IP address of the device if(connected){ struct ARHIP_QUERY qpr; struct ARHIP_ANSWER apr; memset(&qpr,0,sizeof(qpr)); qpr.modtypeandname="backup"; qpr.param="pipe=1=2"; //the mode specifies what to save memset(&apr,0,sizeof(apr)); int ec=arhip_iterate(connected, &qpr, &apr, 5000); //the more data you want to save the more timeout you need if(ec>0 && apr.data){ FILE* flet=fopen("backup.tar.gz","wb"); //the backup file fwrite(apr.data,1,apr.datalen,flet); fclose(flet); arhip_freeanswer(&apr); } else{ perror("arhip_iterate() "); } arhip_disconnect(connected); } else{ perror("arhip_connect()"); } arhip_cleanup(); return 0; }

ParkIT - Programmers Manual

Page 53/58

Uploading Backup File (Update) with ARHIP PCAPI


//Includes for Linux: #include <malloc.h> #include <string.h> #include "arhip.h" //Includes for Windows: #include "arhip.h" #include <stdio.h> #include <tchar.h> #include <windows.h> #include <malloc.h> int main(int argc, char *argv[]) { arhip_init(); arhip_handle connected=arhip_connect("192.0.2.27",1); //IP address of the device if(connected){ struct ARHIP_QUERY qpr; struct ARHIP_ANSWER apr; memset(&qpr,0,sizeof(qpr)); qpr.modtypeandname="update"; qpr.param="pipe=1"; qpr.sessionid=0; FILE* df=fopen("backup.tar.gz","rb"); //backup file to be uploaded fseek(df, 0, SEEK_END); size_t len = ftell(df); fseek(df, 0, SEEK_SET); void* load=malloc(len); fread(load, len, 1, df); fclose(df); qpr.data=load; qpr.datalen=len; memset(&apr,0,sizeof(apr)); int ec=arhip_iterate(connected, &qpr, &apr, 5000); //the more data you want to save the more timeout you need free(load); if(ec>0 && apr.data){ FILE* flet=fopen("answ.txt","wb"); //to show the result fwrite(apr.data,1,apr.datalen,flet); fclose(flet); arhip_freeanswer(&apr); } else{ perror("arhip_iterate() "); } arhip_disconnect(connected); } else{ perror("arhip_connect()"); } arhip_cleanup(); return 0; }

ParkIT - Programmers Manual

Page 54/58

Getting Images from the Scapture Module


/* This sample program saves three images into jpeg files according to the followings: First, it saves the latest captured image and its parameters. Then, it saves the image captured right after the previously saved image (with the help of the images exact time of capturing). Finally, it saves the image captured closest to the time (timestamp) 2 seconds before the image saved first. */ #ifdef WIN32 #include <windows.h> #include <stdio.h> #define snprintf _snprintf #define sleep Sleep #define TSLEEP 1000 #else #include <malloc.h> #include <string.h> #include <unistd.h> #include "arhip.h" #define TSLEEP 1 #endif #include <time.h> #include <stdlib.h> #include "arhip.h" //This function processes the camera answer: extracts the parameters from the scapture answer, prints them to the console, saves an image and returns the absolute value of the time of capturing in the second parameter. // @param answ the camera (as server) answer structure. // @param frmt absolute value of time of capturing in milliseconds void parse_vals(struct ARHIP_ANSWER answ, unsigned long long* frtm ); int main(int argc, char* argv[]) { unsigned long long frtm=0; //variable of the time of frame capturing (timestamp) arhip_init(); //ARHIP PCAPI initialization arhip_handle connected=arhip_connect("192.0.2.3",1); //opening connection to the camera with the specified IP address if(connected){ //if connecting was successful struct ARHIP_QUERY qpr; //query for the camera struct ARHIP_ANSWER apr; //answer from the camera memset(&qpr,0,sizeof(qpr)); //filling the memory area of the variable with zeroes qpr.modtypeandname="scapture"; //querying the image from the scapture module qpr.param="capture=last=1"; //scapture module is called with the specified parameters: querying the latest captured image and its parameters memset(&apr,0,sizeof(apr)); // filling the memory area of the variable with zeroes int ec=arhip_iterate(connected, &qpr, &apr, 1000); //sending the query and requesting for the answer if(ec>=0){ //if the iterate function was successful if(apr.data && apr.param ){ //if there is any returned data (image) parse_vals(apr, &frtm); //processing } arhip_freeanswer(&apr); //freeing the memory area of the answer } else{ perror("arhip_iterate() "); //returning error code in case of error } sleep(TSLEEP);//waiting 1 sec //querying another image follows char s_last[128]; snprintf(s_last,sizeof(s_last),"capture=next=%llu=1", frtm); //querying the image captured right after the previous one with the help of the exact time of capturing of the image queried first qpr.param=s_last; memset(&apr,0,sizeof(apr)); ec=arhip_iterate(connected, &qpr, &apr, 1000); // sending the query and requesting for the answer if(ec>=0){ if(apr.data && apr.param ){ // if there is any returned data (image) parse_vals(apr, &frtm); // processing } arhip_freeanswer(&apr); } else{ perror("arhip_iterate() "); } sleep(TSLEEP); // waiting 1 sec

ParkIT - Programmers Manual

Page 55/58

// querying another image follows snprintf(s_last,sizeof(s_last),"capture=best=%llu=1", frtm-2000); //querying the image captured closest to the time (timestamp) 2 seconds before the image saved first in this program qpr.param=s_last; memset(&apr,0,sizeof(apr)); ec=arhip_iterate(connected, &qpr, &apr, 1000); // sending the query and requesting for the answer if(ec>=0){ if(apr.data && apr.param ){ // if there is any returned data (image) parse_vals(apr, &frtm); // processing } arhip_freeanswer(&apr); } else{ perror("arhip_iterate() "); } arhip_disconnect(connected); //disconnecting } else{ perror("arhip_connect()"); } arhip_cleanup(); //closing ARHIP PCAPI getchar(); return 0; } void parse_vals(struct ARHIP_ANSWER answ, unsigned long long* frtm ) { const char* m_frtm="imgframetimems="; const char* m_frix="imgframeindex="; const char* m_frmo="imgframemonotimems="; char* s_frtm=NULL; char* s_frix=NULL; char* s_frmo=NULL; unsigned int msec=0; char* p_frtm=strstr(answ.param, m_frtm); if(p_frtm){ char* p_ent=strstr(p_frtm, ""); if(p_ent){ unsigned int l_val=p_ent-(p_frtm+strlen(m_frtm)); s_frtm=(char*)malloc(l_val+1); s_frtm[l_val]=0; memcpy(s_frtm,p_frtm+strlen(m_frtm),l_val); sscanf(s_frtm,"%llu",frtm); msec=(*frtm)%1000; } } char* p_frix=strstr(answ.param, m_frix); if(p_frix){ char* p_ent=strstr(p_frix, ""); if(p_ent){ unsigned int l_val=p_ent-(p_frix+strlen(m_frix)); s_frix=(char*)malloc(l_val+1); s_frix[l_val]=0; memcpy(s_frix,p_frix+strlen(m_frix),l_val); } } char* p_frmo=strstr(answ.param, m_frmo); if(p_frmo){ char* p_ent=strstr(p_frmo, ""); if(p_ent){ unsigned int l_val=p_ent-(p_frmo+strlen(m_frmo)); s_frmo=(char*)malloc(l_val+1); s_frmo[l_val]=0; memcpy(s_frmo,p_frmo+strlen(m_frmo),l_val); } } if(s_frtm && s_frix && s_frmo){ time_t frmtsec=(*frtm)/1000; tm* tm_loc=localtime(&frmtsec); printf("frametime:%s (%d.%d.%d %d:%d:%d.%d):%s:%s",s_frtm, tm_loc->tm_year+1900, tm_loc>tm_mon+1, tm_loc->tm_mday, tm_loc->tm_hour, tm_loc->tm_min, tm_loc->tm_sec, msec, s_frix, s_frmo ); char fname[128]; snprintf(fname, sizeof(fname),"%s.jpg", s_frtm); FILE* fs_jpgres=fopen(fname,"wb"); fwrite(answ.data,1,answ.datalen,fs_jpgres); fclose(fs_jpgres);

ParkIT - Programmers Manual

Page 56/58

} if(s_frtm) free(s_frtm); if(s_frix) free(s_frix); if(s_frmo) free(s_frmo); return; }

IMPORTANT: Note that samples are instructional and may not include all security mechanisms required for a production environment.

ParkIT - Programmers Manual

Page 57/58

Contact Information
Should you have any problem during operating the ParkIT camera, our support team is at your disposal. Please try to explain the problem as detailed as possible and do not forget to send the following information to make it easier to help you:

The name of your company (for administration purposes). The exact type of the product you have (serial number is appreciated). If you have problems during recognition, send images in the original file format. If there is any error code or message appearing, please send us the code snippet where it occurs (a screenshot may also be helpful). If you noticed the problem while running a Demo or a sample application, please let us know the name of the application you tested. If you have some problem while developing your own application, please specify the followings: o your programming language o your operating system o the name and version number of the compiler you use o the programming technology (e.g. native C/C++ / ActiveX / .NET) o If possible please send a short part of the source code. Please try to determine the place where the error occurs (e.g. the scapture?getshutter command returns a negative number).

IMPORTANT NOTES: Before sending back a faulty device, always contact ARH Support Team. Repairs may be executed by the manufacturer only!

Office address: ARH Inc. 41 Alkots Road HU-1123 Budapest Hungary Phone: +36 1 2019650 Web: www.arhungary.hu Email: support@arh.hu

Service address: ARH Inc. Ipari Park HRSZ 1113/1 HU-2074 Perbl Hungary Phone: +36 1 2019650 Web: www.arhungary.hu Email: rmarequest@arh.hu

ParkIT - Programmers Manual

Page 58/58

Das könnte Ihnen auch gefallen