Design of MJPEG network camera based on Android

In-depth study of the MJPEG video compression algorithm, elaborated the algorithm implementation process, and designed a 3G mobile phone network camera client software based on the Android operating system. This system achieves the expected effect through field installation and testing, breaks through the limitation of the traditional network camera client's fixed area, and has good application prospects.

1 System hardware composition and network architecture

The camera hardware core adopts the S3C2440A chip based on the ARM9 architecture launched by Samsung. The main frequency of the processor can reach 400 MHz to meet real-time compression, and the MJPEG video stream can reach the performance requirements of 320 & TImes; 240 resolution 25 fps. The peripheral is equipped with 64 MB SDRAM, 256 MB NAND Flash, the network function is responsible for the DM9000 Ethernet MAC control chip, the camera module is controlled by the USB controller, the system power supply is composed of 3 pieces of LM71117, respectively output 3.3 V, 1.8 V, 1.25 V voltage, auxiliary The peripheral interface constitutes the camera hardware structure. The hardware block diagram of the S3C2440A system is shown in Figure 1.

The network camera is a TCP / IP device on the Internet. The system network topology is shown in Figure 2. Among them, according to the characteristics of security in the home area, arrange cameras in the door corridor, living room, balcony area, and then connect to the router by network cable, configure the router parameters to map each camera independent port and IP address, that is, complete Internet access. The remote end is composed of a PC in a fixed location, a 3G notebook in a mobile location, and a 3G Android mobile phone that you carry with you. The PC can access and control the network camera through a WEB browser, and the Android mobile phone can be accessed in real time through the client.

2 System software design

2.1 Network camera software design

Building a camera requires a Linux system environment. First, transplant the bootloader, crop the Linux 2.6.32 kernel, load the Linux UVC (USB video device class) driver and related drivers, and burn the compiled Linux system image to the ARM board Nand Flash. If the bootloader is not set to the boot address, the software operating environment is completed.

To analyze the performance requirements and scalability of network cameras, the following conditions must be met:

â—† Real-time video surveillance;

â—† Support simultaneous connection of multiple clients;

â—† Image recognition algorithm or reserved interface;

â—† Functional modularity can meet the later development and scalability.

Therefore, the multi-threaded architecture and the mutual exclusion lock mechanism are adopted to ensure the real-time and modular design code structure. The main flow of the software program is shown in Figure 3.

The main functions are as follows.

â‘  Initialize the Linux V4L2 interface, the structure must be initialized according to the V4L2 standard structure, including struct v412_capability cap; struct v412_format fmt; struct v412_buffer buf; struct v412_requestbuffers rb; struct v412_streamparm setfps. In addition, the video device name, video width, video height, frame rate, video format and capture method are passed to the function init_videoIn (struct vdIn * vd, char * device, int width, intheight, int fps, int format, int grabmethod) initialization. It is worth noting that many USB cameras do not support JPEG format video stream direct capture, but YUYV format capture is widely supported. In the later stage of image recognition algorithm operation, the YUYV original image data is directly analyzed, which will save a lot of calculation overhead of converting the JPEG compressed data into the original image data, so the YUYV capture mode is adopted.

â‘¡ Create a core image processing thread. Implemented in this thread: grab function.

â—† UVC equipment single frame capture, uvcGrab (struct vdIn * vd) function realizes the copy of the original image in a single frame YUYV format to the memory, and uses the efficient mmap memory mapping method to read

â—† The JPEG core algorithm is implemented, and the JPEG compression algorithm takes up a lot of CPU time, which will be discussed in detail in the next section.

â‘¢ Create a socket interface. In order to achieve the simultaneous connection of multiple users to the network camera, a socket service thread must be used. When a new user connects, a new thread is generated at the same time, corresponding to the simultaneous monitoring of multiple users.

â‘£Build a Web homepage based on the Web browser access method. Embedded device resources are limited, and the lightweight Web Server mainly includes: Boa, Httpd, Thttpd and so on. This design selects open source Boa, cross-compiles Boa source code, configures boa.conf file, configures the system etc to start the shell to join the Boa program, and puts the HTML page file into the corresponding www directory in the system to work normally.

Evaporative Air Cooler is a new kind of cooling machine which can save more energy but also has strong cooling ability. With ice box and cooling pad, the air cooler can make your room temperature lower and lower. It is widely used in hotels, restaurants, supermarkets and factories. 

Our well-equipped facilities and excellent quality control throughout all stages of production enable us to guarantee total customer satisfaction. Besides, we have received CE, CB, RoHS and CCC certifications.

As a result of our high quality products and outstanding customer service, we have gained a global sales network reaching America, Asia, Europe, Africa, the Middle East and other countries and regions.

If you are interested in any of our products or would like to discuss a custom order, please feel free to contact us. We are looking forward to forming successful business relationships with new clients around the world in the near future.



Evaporative Air Cooler

Room Air Cooler,Water Air Cooler,Arctic Air Cooler,Air Water Cooler

Ningbo Banshen Electric Appliance Co., Ltd , https://www.banshendq.com

Posted on