The use of digital camera image capture SDK to develop applications Author: Chen Shu Xin Yang Article Type: application design article Joined: In 2003 at 11:57 on December 16 article Source: Application of Electronic Technique
Summary: Introduction Kodak's digital camera development kit SDK DC280, SDK structure and its function classification, and provides a typical programming instance.
Keywords: SDK digital camera development
As a common consumer commodity, the digital camera is the basic working principle to convert the optical signal into an electrical signal using the CCD optocouple device. After the A / D conversion, data compression, etc., after the serial port or USB port is applied in PC. Under the program control, the picture (more JPEG format) is transferred to the hard disk of the PC. At present, the PC-side application is provided by the camera manufacturer. Few people noticed that some digital camera manufacturers provide developers with relatively rich SDK (Software Development Kit) resources, which facilitates the development of image acquisition and monitoring of digital cameras. The SDK development kit is typically composed of a header file (.h), library file (.lib), and dynamic link library file (.dll). US Kodak is a leading soldier in the world's camera manufacturing and many imaging standards. This article will introduce SDK and its application as an example to make the developer of interest to the program to apply data cameras in engineering projects.
1 SDK structure diagram
The DC280 SDK principle block diagram is shown in Figure 1. The SDK control layer is located between the application and the specified SDK control layer (for the DS280 camera is DC280SDK control layer), its main function is to receive the DC280_OpenCamera () instruction of the application, and transfer the specified camera SDK control layer to the memory area. Receive the DC2x0_closecamera () instruction, and release the memory area occupied by the specified camera SDK control layer. The specified camera SDK layer is located under the SDK control layer, which supports all functions of all access cameras, and transmits the function execution result status code (ie, error code) to the application via the SDK control layer. Specifies the lower layer of the camera control layer to drive the program layer. The driver is used to deal with external devices.
2 SDK function classification
The function in the SDK can be divided into the following categories according to the type of action:
(1) Camera initialization function: mainly includes _closecamera () and _opencamera ().
(2) Camera control function: mainly includes _GetStatus (), _ getConfig (), _ setConfig (), _ controlcameratime (), _ controlcameraid (), _ controlcameraid (), _ recillcamera ().
(3) Picture management function: _TakePicture (), _ resetcamera ().
(4) Image information acquisition function: _GetcameraPictinfo (), _ getAllPictureName (), _ getnativePicture ().
(5) File transfer function: _GetfileformCamera (), _ setfiletocamera.
(6) Other types of functions: including battery power data acquisition functions, last operation return code acquisition function, etc.
3 A typical example of SDK usage
The simple instance of shooting pictures will make readers generally understand the general mode of programming, and the process is shown in Figure 2. The first is that the camera is initialized to open the camera, and then read the parameter settings in the current camera, modify certain parameter settings as needed, then take pictures, and finally turn off the camera to release memory. The routines are as follows: The following is a typical routine of the SDK usage: #include "f210.h"
Oserr Ret;
DC280_CAMERA; Camera;
DC280_IMGPROCDATA thumbimginfo;
DC280_TakePictinfo TakePictinfo;
DC280_PICTINFO GenericPictinfo;
DC280_SpecificPictinfo SpecificPictInfo; // Open Camera
DC280_OpenCamera (VersionData, CameraData); // Get Camera Setting Parameters
Ret = DC280_ControlTakePicture (& Camera, True, 0L, (Voidptr & Takepictinfo);
// Modify parameters that need to change
RET = DC280_ControlTakePicture (& Camera, False, (Voidptr & Takepictinfo); // Photo
Ret = DC280_TakePicture (& Camera, True, & thumbimginfo, & genericpictinfo, (voidptr) & specificPictinfo;
// You can add file transfer function as needed, etc.
DC210_Closecamera (CameraData); // Turn off the camera
The second parameter of DC280_ControlTakePicture is getSetflag. When it is True, it means that the setting parameter is acquired from the camera; when it is false, it means to deliver the changed parameters to the camera. The data structure of DC280_CAMERA is as follows:
TypedEf struct {dc210_portnum portnum;
DC210_bitrate bitrate;
DC210_CAMERATYPE CAMTYPE;
Bool Cameraopenflag;
Voidptrinly;
} DC280_CAMERA;
This article briefly introduces SDK and uses it to develop camera applications through Kodak's DC280 SDK development tools. Other company's SDK's use is basically similar, but the function name is slightly different, and the method is consistent. Detailed description of the function and its parameters in the SDK can be found in the development tool list on the camera manufacturer's English website.