How to design a video surveillance system with ARM embedded?

Currently, embedded systems are more and more widely used in video surveillance. With the powerful functions of the network, video surveillance focuses more on network surveillance solutions, requiring small size, remoteness, low cost, low power consumption, and user-friendly operation interface. This system is based on the embedded Linux platform using a USB camera to collect video images, through video image compression and combined with the network for video image transmission, making remote monitoring possible.

1 System overview

The video image monitoring system consists of 4 parts, which are video image collection, video image processing, video image transmission, and video image display. The video image acquisition part is composed of a digital camera, a USB channel and an embedded processor. The video image processing is mainly video image compression, which is realized by algorithms. The video image transmission is mainly realized by the video server. The video image display is mainly on the remote host. To realize the browsing, saving and processing of video images, it is realized by the application program on the Linux host, and realized by the JAVA program on the browser on the Windows host. The system principle block diagram is shown as in Fig. 1.

How to design a video surveillance system with ARM embedded?

Figure 1 System block diagram

2 System hardware

The CPU processor uses Samsung S3C2440A, the main frequency is 400 MHz, and the maximum is 533 MHz; 64 M SDRAM, 32 bit data bus, SDRAM clock frequency 100 MHz; 256 M/1 GB Nand Flash, power-down nonvolatile, 2 M NorFlash, power down Electric non-volatile; Topo 3.5 true color LCD, screen integrated 4-wire resistive touch screen, screen resolution can reach 1024 × 768 pixels; 100 M Ethernet RJ-45 interface (using DM9000 network chip), serial port, USB Host, USB Slave Type B interface, SD card storage interface, stereo audio output interface, microphone interface, JTAG interface, 4 USER Leds, 6 USER buttons (with lead-out socket), I2C bus AT24C08 chip, 20 pin camera interface; camera Use Liangtian, compatible with the driver of SN9C20X series chips, which is integrated in the kernel of this system.

3 System software

3.1 Linux kernel porting

The main purpose of porting the new kernel is to add corresponding driver support for LCD and camera. Open the kernel directory in Fedora 9 and use the default configuration file for configuration: add V4L support to the kernel and add the universal USB camera driver GSPCA.

3.2 Image acquisition program based on V4L2

The cross-compilation tool used by the system is arm-linux-gcc-4.3.2. The application program used in the design must be compiled by the compiler and downloaded to the development board to run. Cross compile the compiled application V4L2.c and download it to the board.

V4L (Video for Linux) is an audio and video interface specification provided under Linux, and all audio and video driver writing must use these interfaces.

V4L began to appear in the kernel version of 2.4.1.x. The Video for Linux2 (V4L2 for short) designed and used is an improved version of V4L, which fixes some of the bugs in the first generation.

The designed image acquisition and processing program is mainly based on the V4L2 architecture, and realizes the opening of the video equipment, image acquisition and processing, and image display by calling some ioctl functions. An introduction to several main ioctl functions:

1) ioctl (fd,VIDIOC_S_FMT, &fmt): used to set the image format.

2) ioctl (fd, VIDIOC_REQBUFS, &req): apply for a buffer to the memory, and the number of buffers applied for is stored in count.

3) ioctl (fd, VIDIOC_QUERYBUF, &buf): Query the related information of the allocated V4L2 video buffer, including the use status of the video buffer, the offset address in the kernel space, and the length of the buffer.

4) ioctl (fd, VIDIOC_QBUF, &buf): put an empty video buffer into the video buffer input queue. After the function is executed successfully, the instruction video buffer enters the video input queue. When the video device is started to capture images, the corresponding The video data is saved to the corresponding video buffer in the video input queue.

5) ioctl (fd, VIDIOC_STREAMON, &type): start the video capture command, the application calls VIDIOC_STREAMON to start the video capture command, the video device driver starts to capture video data, and saves the captured video data to the video buffer of the video driver in.

The image acquisition processing flowchart is shown in Figure 2.

How to design a video surveillance system with ARM embedded?

Figure 2 Image acquisition and processing flow chart

3.3 Web server

The system uses Boa server. Boa is a very small web server, its executable code is only about 60 kB. As a single-task Web server, Boa can only complete user requests in sequence. Boa supports CGI and can fork a process for CGI programs to execute. Migrate the server on the board, the Boa server will automatically run after booting by default, and configure the conf file.

The server-side application uses servfox, servfox-R1_1_3 to decompress and modify the Makefile: CC=arm-linux-gcc, the executable file servfox is obtained after compilation, download it to the board, and enter the command chmod +x servfox to add executable attributes to it.

The client program uses spcawiew, which is used to monitor the server on the Linux host and does not need to be transplanted. Compile spcaview on Linux. Because this package depends on libsdl, you need to install SDL-1.2.13 before installing spcaview. After installing the spcaview software, there are 3 executable files in the source file directory, spcacat: simple picture The crawling tool cannot be used for the network monitoring client. Spcaserv: streaming media server, Spcaview: used to record data streams, can also be used to play data, and can also be used as a network monitoring client.

4 Monitoring process

4.1 Monitoring on Linux operating system

Start and run the development board normally, and run the server-side program servfox: servfox-d /dev/video0-s 320x240-w 7070.

Run on Linux: ./spcaview-gs 320x240-w 10.1.91.230:7070

10.1.91.230 is the IP address of the server, so you can see the data collected by the USB camera on the PC.

The system is a fedora 9 linux system installed in a virtual machine, and you can smoothly observe the camera monitoring area.

4.2 Monitoring on Windows operating system

For the network monitoring client, the only tool that can cross-platform is currently the browser, through the browser to monitor, whether it is Linux, Windows, MacOS or other UNIX systems, as long as there is a browser with a graphical interface, it can be used in the desktop environment. Monitor the range "controlled" by the remote camera.

There is already a Boa server available on Mini2440. The http-java-applet folder in Spcaview already contains a web page that can be used for monitoring. Copy this folder to the main folder /www of the Boa server.

Since the main web page (Index.html) contained in the http-java-applet folder contains JAVA controls, first install the JAVA environment on the host so that the browser supports JAVA plug-ins.

After installing JRE, enter the server address in the browser's address bar to realize remote monitoring.

4.3 Remote Snapshot

Submit the CGI through the web form to run the application.

The Common Gateway Interface (CGI) specification allows Web servers to execute other programs and store their output in the text, graphics, and audio sent to the Web browser. The combination of server and CGI program can expand the capabilities of World WideWeb.

CGI programs can be written in popular programming languages ​​such as C, Perl, or UNIX Shell script.

In this design, the button shoot the picture on the web page submits a CGI file v4l.cgi named V4L, which is written in a shell script and is used to run the compiled image acquisition program on the board and take a snapshot. Return to the newly opened webpage for viewing.

The contents of the Shell script (v4l.cgi) are as follows:

#! /bin/sh

/

echo "Content-type: text/html; charset=gb2312"

echo

echo "……"

echo "

"

exit 0

5 concluding remarks

The system adopts the open source Linux system, which reduces the development cost, and can tailor and formulate the kernel arbitrarily, which is convenient for transplantation. Compared with the traditional PC monitoring system, this system has the advantages of small size, low cost, and strong reliability. The system also has a certain degree of scalability, and appropriate function extensions can be added to meet the higher requirements of users, such as adding control functions such as intrusion detection or alarming at the image acquisition end.

Flat Patch Cable

The unique flat cable shape allows for a cleaner and safer installation. You can easily and seamlessly make the cable run along walls, follow edges&corners or even make it completely invisible by sliding it under a carpet.

CAT8 Flat Etherente Cables

Flat patch cable include cat8 flat patch cable, cat7 flat patch cable, cat6 flat patch cable and CAT5E Flat Patch Cable.

CAT8 patch cable Support bandwidth up to 2000MHz & transmitting data at speeds of up to 40Gbps,connect to LAN/WAN segments and networking gear at maximum speed.

CAT7 cable Support bandwidth up to 1000MHz & transmitting data at speeds of up to 10Gbps,connect to LAN/WAN segments and networking gear at maximum speed.

CAT6 Flat Ethernet Cable provides high performance, as it uses 250Mhz to transfer data up to 1Gbps, faster than CAT5E. Allowing for greater bandwidth and, therefore, home and office productivity.

CAT5e cable Support bandwidth up to 100MHz & transmitting data at speeds of up to 1000bps,connect to LAN/WAN segments and networking gear at maximum speed.

Flat Cable,Flat Extension Cord,Flat Ribbon Cable,Flexible Flat Cable

Shenzhen Kingwire Electronics Co., Ltd. , https://www.kingwires.com

This entry was posted in on