📄 camera.h
字号:
/******************************************************************************
* Module Name : Camera.h
*
* Project : HTC Camera SDK
*
* Purpose: The header file define the Camera API and the support properties
* and property values of sensor
*
* Copyright (c) 2006, HTC, Inc.
*
******************************************************************************/
#ifndef _CAMERA_H_
#define _CAMERA_H_
#ifdef CAMERA_EXPORT
#define CAMERA_API(type) EXTERN_C __declspec(dllexport) type WINAPI
#else
#define CAMERA_API(type) EXTERN_C __declspec(dllimport) type WINAPI
#endif
// for c++ modificator
#ifdef __cplusplus
extern "C" {
#endif
// Camera Property ID
#define CAMERA_FLICKER 0x01
#define CAMERA_WHITEBALANCE 0x02
#define CAMERA_EXPOSURE 0x03 // Not supported
#define CAMERA_CONTRAST 0x04
#define CAMERA_BRIGHTNESS 0x05
#define CAMERA_SATURATION 0x06
#define CAMERA_HUE 0x07
#define CAMERA_GAMMA 0x08 // Not supported
#define CAMERA_SHARPNESS 0x09
#define CAMERA_EFFECT 0x0A
// available range of property value
// Light frequency (Flicker Setting)(flicker bits)
#define CAMERA_FLICKER_AUTO 0x1
#define CAMERA_FLICKER_50HZ 0x2
#define CAMERA_FLICKER_60HZ 0x4
// White balance (white balance bits)
#define CAMERA_WHITEBALANCE_AUTO 0x01
#define CAMERA_WHITEBALANCE_DAYLIGHT 0x02 // under normal daylight
#define CAMERA_WHITEBALANCE_INCANDESCENT 0x04 // under yellow light
#define CAMERA_WHITEBALANCE_FLUORESCENT 0x08 // under white light
// effects bits
#define CAMERA_COLOR_NORMAL 0x01
#define CAMERA_COLOR_GRAYSCALE 0x02 // black and white
#define CAMERA_COLOR_SEPIA 0x04 // yellowish 'old' look, like pictures that are kept for very long time and grown yellowish
#define CAMERA_COLOR_COOL 0x08 // bluish tint
#define CAMERA_COLOR_NEGATIVE 0x10 // Not supported.
#define CAMERA_COLOR_DIM 0x20
// If you change effect, you must disable the previous effect first, then set the effect.
#define CAMERA_COLOR_DISABLE_GRAYSCALE 0xF1
#define CAMERA_COLOR_DISABLE_SEPIA 0xF2
#define CAMERA_COLOR_DISABLE_COOL 0xF4
#define CAMERA_COLOR_DISABLE_NEGATIVE 0xF8
// Brightness
#define CAMERA_BRIGHTNESS_MIN 0
#define CAMERA_BRIGHTNESS_MAX 8
// Saturation
#define CAMERA_SATURATION_MIN 0
#define CAMERA_SATURATION_MAX 4
// Contrast
#define CAMERA_CONTRAST_MIN 0
#define CAMERA_CONTRAST_MAX 4
// Color hue
#define CAMERA_HUE_MIN 0
#define CAMERA_HUE_MAX 4
// Sharpness
#define CAMERA_SHARPNESS_MIN 0
#define CAMERA_SHARPNESS_MAX 4
// the returned buffer type in the Callback function
#define BUFFER_TYPE_NONE 0 // don't return any buffer
#define BUFFER_TYPE_JPEG 1 // Not supported.
#define BUFFER_TYPE_YUV 2 /* return the YUV data frame buffer
the format is YUV422 and the order is V-Y2-U-Y1 */
#define BUFFER_TYPE_MPEG 3 // Not supported.
// the support options for the bModeType (in the struct DSCAMEARAPARAMS)
// Not supported.
#define MODE_PREVIEW_FLASH_ON 1
#define MODE_PREVIEW_FLASH_OFF 2
#define MODE_IMAGE_FLASH_ON 3
#define MODE_IMAGE_FLASH_OFF 4
#define MODE_VIDEO_FLASH_ON 5
#define MODE_VIDEO_FLASH_OFF 6
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Callback function phototype
// pJPEGBuf - the pointer to the returned buffer.
// nJPEGBufLen - Specifies the size, in bytes,
// of the buffer pointed to by the pJPEGBuf member.
// pnIsAcquire - Not supported.
/////////////////////////////////////////////////////////////////////////////////////////////////////
typedef void (CALLBACK *CAMERAPROC)(unsigned char *pJPEGBuf, int nJPEGBufLen, int *pnIsAcquire);
typedef struct _CAMERAPARAMS
{
unsigned char bModeType; /***** Not supported. *****/
int nSourceWidth, // Specifies the size of the sensor output window, in pixels,
nSourceHeight; // This sensor only provides two kinds of resolution: 640x480 and 320x240
int nSourceLeft,
nSourceTop,
nSourceRight,
nSourceBottom; // Specifies the cropping rectangle in the sensor output window.
unsigned char bPreview; /***** Not supported. *****/
int nScreenLeft,
nScreenTop,
nScreenRight,
nScreenBottom; /***** Not supported. *****/
unsigned char nKeyColorR,
nKeyColorG,
nKeyColorB; /***** Not supported. *****/
CAMERAPROC fpCameraCallback; // Specifies the pointer to the CALLBACK function.
unsigned char bJPEGBuf; // Specifies if the callback function needs to bring application the frame buffer.
// TRUE indicates Yes.
// If bJPEGBuf is set to FALSE,
// the pJPEGBuf member is set to NULL and the nJPEGBufLen member is set to zero.
// (the input parameters in the callback function)
int nEncodeLeft,
nEncodeTop,
nEncodeRight,
nEncodeBottom; /***** Not supported. *****/
} DSCAMEARAPARAMS, *PCAMERAPARAMS;
// Initialize the chip and camera (including Power-On)
typedef BOOL (WINAPI *CAMERA_INIT)(int *ErrorNumber);
// Deinitialize the chip and camera (including Power-Off)
typedef BOOL (WINAPI *CAMERA_DEINIT)();
// Begin a new operation mode (preview, capture, ...)
typedef BOOL (WINAPI *CAMERA_BEGIN)(PCAMERAPARAMS pCamParams);
// Finish the last operation mode
typedef BOOL (WINAPI *CAMERA_END)();
// Enable the flasg light
typedef BOOL (WINAPI *CAMERA_FLASH)(BOOL bEnable);
// Get the camera property
typedef BOOL (WINAPI *CAMERA_GET_PROPERTY)(int nPropertyID, DWORD *pdwParam);
// Set the camera property
typedef BOOL (WINAPI *CAMERA_SET_PROPERTY)(int nPropertyID, DWORD dwParam);
//BOOL LoadCameraLib();
//void FreeCameraLib();
// for c++ modificator
#ifdef __cplusplus
}
#endif
#endif // _CAMERA_H_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -