Design of Multi-channel Image Acquisition System in Agricultural Environment Monitor

In recent years, with the development of high-tech such as computer image processing technology, artificial intelligence methods, image pattern recognition, and multi-spectral recognition, computer image processing technology has also become more mature. It has been widely used in agriculture, and its main applications are focused on the detection of crop seed resources. , agricultural product classification, agricultural machine vision, agricultural product growth detection, fine irrigation, agricultural environmental monitoring instrument, etc. As the front end of image processing, image acquisition is an important part, which transforms the visual images and features of objects into data that can be processed by computers. Therefore, the stability of the image acquisition system has a direct influence on the effect of image processing. At present, there are many methods for image acquisition. The most commonly used image acquisition method is the form of an image acquisition card. The work process of the image capture card is to obtain the video signal from the video source through the video interface, then the video signal is subjected to analog-to-digital conversion and decoded by the decoder so that the video data can be processed.
This paper studies and implements an embedded digital image acquisition system for agricultural environmental monitoring instrument. The system is based on ARMS3C2440-Linux 2.6.3. 4 platform. USB2.0 digital camera is used to obtain images. Video is programmed using V4L2 API. Under the USB gadget, the USB device module opens up space on the flash memory as a shared space between the host computer and the PC, the lower computer, and other processing terminals, and the image data is shared in this space. In this way, the upper computer can achieve image acquisition by accessing this space, providing a stable and high-quality image source for the next image processing.

Figure 1 System structure diagram of agricultural environmental monitoring instrument

The agricultural environmental monitoring system processor adopts s3c2440. The chip is a 16/32 RISC processor introduced by Samsung and adopts ARM920T core. The overall design incorporates MMU, AMBABUS and Harvard architecture, and has an independent 16kB instruction cache and 16kB data cache. The Linux kernel uses Linux 2.6.3. The image acquisition device adopts the Zhongxing Micro ZC301 digital camera, which is a USB interface. The system structure of this terminal is shown in Figure 1.
ARM-Linux platform for agricultural environmental monitoring instruments: Linux kernel porting and configuration The Linux kernel is the core of the Linux operating system. It mainly includes the following parts: storage management, CPU and process management, file system, device management and driver, network communication, and system initialization (booting) and system calls.
The software part of this system includes the system initialization boot loader boot loader, Linux 2.6.30.4 operating system kernel, yaffs file system, USB camera driver, Frame buffer device driver, V4L2API and USB device driver. The Linux kernel implements functions such as system memory management, software program management, hardware management, and file system management. With the continuous development of the kernel, the function of the kernel has gradually increased, but the directory has not changed much. This article wants to achieve multi-channel image acquisition, you first need to transplant kernel Linux 2.6.30.4, the main steps are as follows: Because you need to use the yaffs2 file system, you must first add yaffs2 patch to the kernel; modify the machine code to make it with boot Loader's machine code is consistent; specify the target board, compiler and compiler path; increase devfs file system manager support; modify the crystal frequency; modify mtd partition; modify the NandFlash driver, support K9F1G08 Nand Flash; the default configuration of s3c2440 write Enter the fig file; configure the kernel.
Configure CPU options:
Configure CPU options
Added support for the ZC301USB camera:
Add support for the ZC301 USB camera
Of course, we must also choose the Support for Host-side USB, USB device file system, USB device class-devices, OHCIHCD support and other options to support the USBhost interface. Finally make zIm-age, generate a kernel image.
The cross-compilation tool is installed on a Linux system. The tool chain is a necessary program section for generating a kernel image. The work process of the tool chain is from the output of one tool to the input of the next tool. The Linux tool chain consists of three parts: Com-piler, Assembler, Linker. GCC is a C/C++ language compiler for Linux. This system uses RedHat9 in the virtual machine as the compiler environment of the cross compiler 3.4.1 and compresses the compiler cross-3.4.1. Tar. Bz2 is copied into a directory on Linux, enter the directory to extract, modify the /etc/bashrc file, and add the extracted 3.4.1/bin directory to the named default path. The compiling and loading of modules of the agricultural environment monitor use the command make modulesM=. /drivers/usb/gadget compiles and generates s3c2410_udc. Ko and file_storage. Ko; Then download it to the target Linux 2.6.30.4/lib/modules/2.6.30.4 directory, using insmods3c2410_udc. Ko and insmodg_file_storage. Kofile=floppy. Img removable respectively loaded; waiting for the module to load, re-plug the USBdevice interface, PC-side removable storage devices, Nand Flash simulation U disk successfully; and then formatted as FAT file system.
V4L2 image acquisition part of agricultural environmental monitoring instrument: V4L2 important interface function and data structure Video for Linux (abbreviated as V4L) is a set of APIs for supporting image equipment in Linux. It can cooperate with appropriate video capture equipment and corresponding drivers. Realize the functions of image acquisition, AM/FM wireless broadcast, image CODEC and channel switching. The existing version is Video4Linux2 (abbreviated as V4L2), which was developed based on V4L, from 2.5. After the x version began to join the Linux kernel.
The so-called V4L2 has two meanings: the application program can access the video device and obtain the image information according to this framework; in Linux, the video device is the device file, and can be read and written like an ordinary file, and the camera is at /dev/video0. under. The main functions are open(), close(), ioctl(), mmap(), write(), read() and so on. The main data structures involved are: structv4l2_buffer, structv4l2_re-quest_buffers, structv4l2_capability, structv4l2_crop-cap, structv4l2_crop, structv4l2_format, etc.
Agricultural environment monitor user space video collection process First, during the makemenuconfig operation, the Video for Linux option in the mul time-dia device menu is selected, so that the kernel is configured with Video4Linux to provide interfaces for the agricultural environment monitor to obtain video equipment. . The flow of the user space application program under V4L2 is as follows: first open the video device with the open system call, read the device information via io ctl and initialize the device; change the current settings of the device. There are two methods for video capture: memory mapping or reading directly from the device; processing the captured video; turning off the video device. In the transmission of video data, the read(), write() system call is generally not used to run directly. In most cases, a memory-mapped streaming method is used, and the streaming method does not copy the actual data. Only the driver and the application program are used to transfer data. Need to exchange the pointer of the mapped memory on it.
The flow chart is shown as 2.

Figure 2 V4L2 image acquisition flowchart

The user program at this time needs to include the header <Linux/video-dev2. h> Compile with arm-linux-gcc and download it to the target board.
Multi-way coordination of agricultural environmental monitoring instruments This article uses two-way video as an example. A process is an address space that runs one or more thread threads and the system resources required by those threads. It is the basic unit of Linux operation. All processes have their own independent processing environment and system resources. The environment of the process is determined by the current system state and its parent process information. For a single-CPU system, although the Linux operating system is a multi-user, multi-tasking operating system, only one process can be in a running state at a certain moment, and each task constantly switches between these states according to a scheduling algorithm. . In the Linux 2.6 kernel, a user-level process has the following states: ready/running state, waiting state (can be interrupted), waiting state (cannot be interrupted), stop state, and zombie state. Each process is controlled by scheduling policies and priorities. These parameters can be specified through the application display execution sched_setscheduler() and sched_setparam() functions.
The user process state transition is shown in Figure 3.

Figure 3 User space process state transition diagram

Experimental results collection process: USB camera configuration, continuous capture of 10 pictures, respectively, take the first and 10th images for analysis and comparison tests. The effect is shown in Figure 4.

Figure 4 Effect Comparison

As can be seen from Fig. 4, the image is right-shifted at 200 gray scales. The actual performance is that the brightness becomes larger and the image quality becomes clearer and clearer. This indicates that the initial period of the image acquisition device has a short adjustment process, and the quality of the adjusted image is significantly improved.
VC++ Interface Design Under Windows, any communication with a USB peripheral needs to be driven by the device. This driver knows how to communicate with the system's USB driver and the application program of the access device. Windows contains a variety of information needed for application and USB communication, no need to install drivers; Win32 application program interface (API) functions, enabling device drivers to communicate with applications, and development of applications do not need to understand the complex USB protocol. The main steps are: setting up the MFC AppWizard (exe) project; opening the device and returning the device handle; acquiring the device information; identifying the interface information; identifying the device path name; setting the device. To exchange data with the device, the device is first opened, and each device under windows is accessed as a folder. Each file has a file name. After the file is opened, Read File and Write File can be used to read and write files.
The system uses Nand Flash to simulate the interaction area between the PC and the lower computer to achieve image storage and access. It has the following advantages: the structure level is clear; the image transmission can be continuous; the image acquisition is controllable; and the image quality is high. However, since FAT is not designed for Flash, it is necessary to access Nand Flash through FTL. In addition, the synchronization problem between the PC and the lower computer needs further research and improvement.
Image processing and identification as a more intuitive approach are increasingly used in the agricultural field of agricultural environmental monitoring devices. This paper designs a kind of embedded Linux image acquisition system, and focuses on the process of Nand Flash analog USB device to realize image storage. Experiments have shown that the high quality and stable image sources provided by this system can be applied to agricultural environments.

Wheel Crawler Excavator

Wheel Crawler Excavator 8 Ton,X9 Wheel Crawler Excavator,Rhinoceros Wheel Crawler Excavator,Iso Wheel Crawler Excavator

SHANDONG KEN STONE HEAVY MACHINERY CO.,LTD , https://www.chinaexcavator.com