⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lv20x0.pas

📁 相机传输图像程序源代码 拜耳模式(RAW格式文件)与RGB图像数据互相转换函数库
💻 PAS
📖 第 1 页 / 共 3 页
字号:
unit Lv20x0;

interface

uses Windows;

// LV20x0 DLL - DLL for control of LV20x0 camera series via RS-232c
// ================================================================

// The constants ending with _B1 and _B2 should be used as the FIRST and the
// SECOND parameter in LvSendByteCmd() and LvSendByteCmdEx() functions.
// 
// Examples:
//  LvSendByteCmd(LV_PRESET_STORE_ZOOM_EXT_B1, IndexZoomHi, ZoomLo, CameraID);
//  LvSendByteCmdEx(LV_EXPO_SET_AGC_B1, LV_SET_EXPO_AGC_B2, Agc, CameraID, 
//                  ucReturn1, ucReturn2, ucReturn3, ucReturn4);
// 
// The DWORD constants can be used in LvSendCmd(), LvSendCmdEx() functions.
// The 4. byte (less significant) is the camera ID - by default it is 0;
// use the bitwise OR operator or PLUS operator to add camera ID.
// 
// Examples:
//  LvSendCmd(LV_EXPO_SET_MODE_AUTO + CameraID);
//  LvSendCmdEx(LV_EXPO_GET_MODE + CameraID, ucReturn1, ucReturn2, ucReturn3, ucReturn4);
//  
// 
// The constants are grouped according to the manual of LV2010/2020
// 
// First, constants that can be used for all types (LV2000, LV2010 and LV2020)
// are listed. Then constants specific to a camera type are listed:

const

// *** CAMERA ID ***************************************************************
  LV_CAMERA_ID_GET            = $CC000000; // Get camera ID
  LV_CAMERA_ID_SET_B1         = $78;       // Set camera ID - set ID in uCameraID of LvSendByteCmd
  LV_CAMERA_ID_TOGGLE_DISPLAY = $AA6A0000; // Toggle the Camera ID Display ON/OFF

// ~~~ LV2010, LV2020 ~~~
  LV_CAMERA_ID_POS_CHANGE     = $80000000; // change ID number position - BR->TL->TR->no_pos->BR->...

// *** WHITE BALANCE MODE ******************************************************
  LV_WB_SET_MODE_AUTO         = $AA650000; // Set White Balance mode to AUTO (ATW)
  LV_WB_SET_MODE_INDOOR       = $AA650200; // Set White Balance mode to INDOOR
  LV_WB_SET_MODE_OUTDOOR      = $AA650300; // Set White Balance mode to OUTDOOR
  LV_WB_SET_MODE_MANUAL       = $AA650400; // Set White Balance mode to MANUAL

// ~~~ LV2000 ~~~
  LV_WB_SET_MODE_SPECIAL      = $AA650100; // Set White Balance mode to SPECIAL
  LV_WB_SET_MODE_PUSHAUTO     = $AA650500; // Set White Balance mode to PUSH AUTO

// ~~~ LV2010, LV2020 ~~~
  LV_WB_SET_MODE_AWC          = $AA650500; // Set White Balance mode to AWC (One Push Mode)
  LV_WB_GET_MODE              = $AA830000; // Get White Balance mode
                                           //   return values (in pucReturn1):
                                           //    0 - ATW mode
                                           //    2 - INDOOR WB
                                           //    3 - OUTDOOR WB
                                           //    4 - MANUAL WB
                                           //    5 - AWC mode
  LV_WB_SET_ATW               = $AA680000; // Set ATW mode (Auto Trace White balance)
  LV_WB_SET_MWB               = $AA690000; // Set WB MANUAL mode

  LV_WB_SET_AWC_LOCK          = $AA780000; // Set AWC mode "Lock"
  LV_WB_SET_AWC_PUSH          = $AA780100; // Set AWC mode "Push

  LV_WB_GET_HUE               = $AA870000; // Get Hue in WB manual mode
                                           //   value 0-99 in pucReturn1
  LV_WB_SET_HUE_B1            = $AA;       // Set Hue in WB manual mode - first byte
  LV_WB_SET_HUE_B2            = $77;       // Set Hue in WB manual mode - second byte
                                           //   value 0-99 - third byte

  LV_WB_SET_ATW_RED_B1        = $AA;       // Set RED data at ATW WB mode - first byte
  LV_WB_SET_ATW_RED_B2        = $75;       // Set RED data at ATW WB mode - second byte
                                           //   third byte - value -3 ($FD) ... +3 ($03)
  LV_WB_GET_ATW_RED           = $AA850000; // Get RED data at ATW WB mode
                                           //   return values (in pucReturn1):
                                           //   -3 ($FD) ... +3 ($03)

  LV_WB_SET_ATW_BLUE_B1       = $AA;       // Set BLUE data at ATW WB mode - first byte
  LV_WB_SET_ATW_BLUE_B2       = $76;       // Set BLUE data at ATW WB mode - second byte
                                           //   third byte - value -3 ($FD) ... +3 ($03)
  LV_WB_GET_ATW_BLUE          = $AA860000; // Get BLUE data at ATW WB mode
                                           //   return values (in pucReturn1):
                                           //   -3 ($FD) ... +3 ($03)

// *** EXPOSURE MODE ***********************************************************

  LV_EXPO_SET_MODE_AUTO       = $AA600000; // Set exposure mode to AUTO
  LV_EXPO_SET_MODE_SHUTTER    = $AA600100; // Set exposure mode to SHUTTER FIX (Iris, AGC remains AUTO)
  LV_EXPO_SET_MODE_IRIS       = $AA600200; // Set exposure mode to IRIS FIX    (Shutter, AGC remains AUTO)
  LV_EXPO_SET_MODE_AGC        = $AA600300; // Set exposure mode to AGC FIX     (Shutter, Iris remains AUTO)
  LV_EXPO_SET_MODE_MANUAL     = $AA600400; // Set exposure mode to MANUAL

// ~~~ LV2010, LV2020 ~~~
  LV_EXPO_SET_WEIGHT_B1       = $AA;
  LV_EXPO_SET_WEIGHT_B2       = $6C;
  LV_EXPO_GET_WEIGHTS         = $AA6B0000; // Get auto exposure weighting values
                                           //   return value (in pucReturn1):
                                           //   upper 4 bits area 1, lower 4 bits area 2
                                           //   See also LvGetAutoExpAreaWeights(),
                                           //            LvSetAutoExpAreaWeights()

  LV_EXPO_GET_MODE            = $AA840000; // Get exposure mode
                                           //   return values (in pucReturn1):
                                           //   0 - AUTO
                                           //   1 - SHUTTER FIX
                                           //   2 - IRIS FIX
                                           //   3 - AGC FIX
                                           //   4 - MANUAL

  LV_EXPO_GET_AGC             = $AA8C0000; // Get AGC level
                                           //   return value (in pucReturn1):
                                           //   51..232
  LV_EXPO_SET_AGC_B1          = $AA;       // Set AGC level - first byte
  LV_EXPO_SET_AGC_B2          = $7D;       // Set AGC level - second byte
                                           //   third byte - value between 51 and 232

// ~~~ LV2010 ~~~
  LV_EXPO_SET_SENS_HIGH       = $AA5D0000; // Set auto exposure sensitivity to fast
  LV_EXPO_SET_SENS_NORMAL     = $AA5D0100; // Set auto exposure sensitivity to normal

// *** IRIS MODE ***************************************************************
// ~~~ LV2010, LV2020 ~~~
  LV_IRIS_SET_MODE_AUTO       = $AA660000; // Set IRIS mode to AUTO
  LV_IRIS_SET_MODE_MANUAL     = $AA670000; // Set IRIS mode to MANUAL

  LV_IRIS_GET                 = $AA8B0000; // Get IRIS level
                                           //   return value (in pucReturn1):
                                           //   51...205

  LV_IRIS_SET_B1              = $AA;       // Set IRIS level - first byte
  LV_IRIS_SET_B2              = $7C;       // Set IRIS level - second byte
                                           //   third byte - value between 51..205

  LV_SHUTTER_GET              = $AA8A0000; // Get SHUTTER speed
                                           //   return value (in pucReturn1):
                                           //   0..27: 0 - longest shutter,
                                           //   1=1/125, 2=1/150 ... 27=1/10000

  LV_SHUTTER_SET_B1           = $AA;       // Set SHUTTER speed - first byte
  LV_SHUTTER_SET_B2           = $7B;       // Set SHUTTER speed - second byte
                                           //   third byte - value between 0..27

// *** FOCUS MODE **************************************************************
// ~~~ LV2010, LV2020 ~~~
  LV_FOCUS_SET_MODE_AUTO      = $AA580000; // Set FOCUS mode to AUTO
  LV_FOCUS_SET_MODE_MANUAL    = $AA590000; // Set FOCUS mode to MANUAL

  LV_FOCUS_SAVE_MODE          = $AA500000; // Save the focus mode to EEPROM

  LV_FOCUS_SET_MANUAL_FAR_B1  = $AA;       // Adjust FOCUS manual mode to FAR, byte 1
  LV_FOCUS_SET_MANUAL_FAR_B2  = $5A;       // Adjust FOCUS manual mode to FAR, byte 2
                                           //   byte 3 = focusing speed 1..15 (only LV2020)
  LV_FOCUS_SET_MANUAL_NEAR_B1 = $AA;       // Adjust FOCUS manual mode to FAR, byte 1
  LV_FOCUS_SET_MANUAL_NEAR_B2 = $5B;       // Adjust FOCUS manual mode to FAR, byte 2
                                           //   byte 3 = focusing speed 1..15 (only LV2020)
  LV_FOCUS_SET_MANUAL_STOP    = $AA5C0000; // Adjust FOCUS manual mode to STOP

  LV_FOCUS_SET_PUSH_AUTO_ON   = $AA730100; // Set the push-auto focus mode
  LV_FOCUS_SET_PUSH_AUTO_OFF  = $AA730000; // Set the auto/manual focus mode


// ~~~ LV2010 ~~~
  LV_FOCUS_SET_SENS_HIGH      = $AA5E0000; // Set Auto focus sensitivity to High (fast)
  LV_FOCUS_SET_SENS_LOW       = $AA5E0100; // Set Auto focus sensitivity to Low (stable)

  LV_FOCUS_SET_ONE_SHOT_TIME_B1= $58;      // Set one shot auto focus time - first byte
                                           //   second byte - 1..9 (seconds)

  LV_FOCUS_SET_MIN_DIST_B1    = $59;       // Adjust minimum distance - first byte
                                           //   second byte - 0..6:
                                           //   0=1cm, 1=10cm, 2=50cm, 3=1m, 4=3m,
                                           //   5=10m, 6=infinity

// *** PRESET ******************************************************************

  LV_PRESET_GET_ZOOM_POS      = $36000000; // Get Zoom Lens Position
  LV_PRESET_GET_FOCUS_POS     = $37000000; // Get Focus Lens Position

// ~~~ LV2000, LV2010 ~~~
  LV_PRESET_STORE_ZOOM_EXT_B1 = $49;       // Store zoom lens position to RAM
                                           //   byte 2 - upper 4 bits - index 0..7,
                                           //     lower 4 bits is upper byte of zoom lens position
                                           //   byte 3 - lower byte of the zoom lens position
  LV_PRESET_STORE_FOCUS_EXT_B1= $4A;       // Store focus lens position to RAM
                                           //   byte 2 - upper 4 bits - index 0..7,
                                           //     lower 4 bits is upper byte of focus lens position
                                           //   byte 3 - lower byte of the focus lens position
  LV_PRESET_STORE_DZOOM_EXT_B1= $4B;       // Store digital zoom data to RAM
                                           //   byte 2 - index 0..7,
                                           //   byte 3 - digital zoom data

  LV_PRESET_LOAD_EXT_0        = $4D000000; // Load and set Preset 0
  LV_PRESET_LOAD_EXT_1        = $4D010000; // Load and set Preset 1
  LV_PRESET_LOAD_EXT_2        = $4D020000; // Load and set Preset 2
  LV_PRESET_LOAD_EXT_3        = $4D030000; // Load and set Preset 3
  LV_PRESET_LOAD_EXT_4        = $4D040000; // Load and set Preset 4
  LV_PRESET_LOAD_EXT_5        = $4D050000; // Load and set Preset 5
  LV_PRESET_LOAD_EXT_6        = $4D060000; // Load and set Preset 6
  LV_PRESET_LOAD_EXT_7        = $4D070000; // Load and set Preset 7

// ~~~ LV2010 ~~~
  LV_PRESET_LOAD_EXT_B1       = $4D;       // Load and set preset (without zoom tracking)
                                           //   byte 2 - index 0..7

// ~~~ LV2010, LV2020 ~~~
// Internal preset - stored to EEPROM (64 presets)
// External preset - stored to RAM of camera microcontoller (8 presets) - LV2000 has only external preset

  LV_PRESET_WRITE_INT_B1      = $1F;       // Write zoom, d-zoom and focus to EEPROM - 1 byte of 4-byte record
                                           //   byte 2 - address in EEPROM (0..255)
                                           //   byte 3 - 1 byte of the record
                                           //   record: 0: lens zoom pos. lower byte
                                           //           1: lens focus pos. lower byte
                                           //           2: upper 4 bits - zoom + lower 4 bits - focus (higher bytes)
                                           //           3: digital zoom data
  LV_PRESET_READ_INT_B1       = $F1;       // Read zoom, d-zoom and focus from EEPROM - 1 byte of 4-byte record
                                           //   byte 2 - address in EEPROM (0..255)
                                           //   return value (in pucReturn1): one byte of the record
  LV_PRESET_STORE_INT_B1      = $79;       // Store current zoom, d-zoom and focus to EEPROM
                                           //   byte 2 - index in EEPROM (0..63) ???
  LV_PRESET_LOAD_INT_B1       = $4D;       // Load preset and move zoom (without tracking) and focus to it
                                           //   byte 2 - index in EEPROM (0..7)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -