Image Acquisition and display in Embedded Linux

Source: Internet
Author: User
Article Title: image acquisition and display in embedded Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source. 1. hardware structure of the system platform

The hardware function box of the system platform used in this article shows that the platform uses Samsung's processor S3C2410. This processor is integrated with a 32 B Microcontroller with ARM's arm920T processor core. It has abundant resources, including 16 KB Instruction Cache and 16 KB data Cache, LCD controller, RAM controller, and NAND FLASH memory controller, three UART, four DMA, four Timer with PWM, parallel I/O port, eight 10-bit ADC, Touch Screen interface, I2C interface, i2S interface, Two USB interface controllers, and two SPI, with a clock speed up to 203 MHz. Based on rich processor resources, related configuration and expansion are also carried out. The platform is configured with 16 MB 16 B FLASH and 64 MB 32-bit SDRAM, an Ethernet controller chip AX88796 is used to expand a network port and a host usb interface is introduced. An external camera with USB port is connected to the USB interface. In addition, an LCD with a resolution of 320x240,256 colors is provided.


 
 
2 Introduction to embedded Linux

The Linux operating system has many advantages. Its kernel is stable, powerful, supports a variety of hardware platforms, and the source code is completely open. The features of cutting down and low cost are very suitable for embedded applications, in addition, Linux directly provides the complete TCP/IP protocol for convenient network applications. However, the Linux kernel itself does not have strong real-time performance, and the kernel size is large, and the hardware resources of the embedded system are limited. Therefore, to use Linux in an embedded system, real-time and embedded Linux must be implemented, that is to say, by configuring the kernel, you can cut off shell and Embedded C library customization for the system, so that the entire system can be stored in FLASH with a smaller capacity, and Linux dynamic modules can be loaded, it makes Linux cutting extremely convenient, and highly modular components make it easy to add.

The entire system software is built on the basis of embedded Linux. The Linux Kernel used by the S3C2410 platform is compiled by patch-2.4.18-S3C2410 in the Linux-2.4.18 kernel. The file system for the S3C2410 platform is yaffs. The file system includes applications, modules, configuration files, and libraries. Image Acquisition and display are built on the embedded Linux kernel, the entire software system 2 is shown.

Generally, the host machine and the target board have different processors. The host machine is usually an Intel processor, while the target board 1 shows SAMSUNG S3C2410, therefore, the program must use a processor-specific compiler to generate code that can run on the corresponding platform. The GNU Compiler provides such a function. during compilation, you can select the host machine and target machine required for development to establish the development environment. The first step before developing embedded systems is to use a PC as the host machine and install the specified operating system on it. For Embedded Linux, the Linux system should be installed on the host PC. Then, create a development environment for cross-compilation and debugging on the host machine. The specific establishment of the development environment will not be discussed here. This article uses C language, which is highly portable, to compile a video collection program on the host, use the cross-compilation and debugging tool to compile links to generate executable code, and finally port the program to the target platform.

3. Image Acquisition Based on Video4Linux

Video4Linux is the kernel driver for video devices in Linux. It provides a series of interface functions for Video device application programming. In Linux, the normal use of Video Capture Devices depends on the support for the Video4 Linux Standard. If you use Video4Linux, You must select the Video for Linux option under Multimedia Devices when compiling the kernel. The device file for this article is/dev/video, the device is an OV511-based USB camera. Before running the program, you must first load the driver module of the USB and OV511 devices, and load the Video4Linux module. Run the commands modprobe usbcore, modprobe usbohci, modprobe videodev, and modprobe ov511 respectively, to ensure that the device file/dev/video is generated, if the Linux operating system used does not support the modprobe command, you can also use the insmod command. Generally speaking, the procedure 3 for Image Acquisition Based on Video4Linux is shown in.

Write, here only the key part of the implementation code.

First, you must declare that the file contains two headers:

After obtaining the image information, you can change the information as needed, such as the contrast, brightness, and color palette. The specific method is to first assign a new value to the corresponding variable in video_picture, and then use the VIDIOCSPICT ioct1 function.

Part 1: Single-frame image acquisition using mmap:



 

[1] [2] Next page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.