1 /************************************************** 2 this is the second version of release ASI Camera ASIs 3 any question feel free contact us:software@zwoptical.com 4 5 here is the suggested procedure to operate the camera. 6 7 --> ASIGetNumOfConnectedCameras 8 ----> ASIGetCameraProperty for each camera 9 10 --> ASIOpenCamera 11 --> ASIInitCamera 12 --> ASIGetNumOfControls 13 ----> ASIGetControlCaps for each contronl and set or get value from them 14 15 --> ASISetROIFormat 16 17 --> ASISetCameraMode 18 19 --> ASIStartVideoCapture 20 21 //this is recommended to do in another thread 22 while(1) 23 { 24 ASIGetVideoData 25 ... 26 } 27 28 29 ***************************************************/ 30 #ifndef ASICAMERA2_H 31 #define ASICAMERA2_H 32 33 34 35 36 #ifdef _WINDOWS 37 #define ASICAMERA_API __declspec(dllexport) 38 #else 39 #define ASICAMERA_API 40 #endif 41 42 #define ASICAMERA_ID_MAX 128 43 44 typedef enum ASI_BAYER_PATTERN{ 45 ASI_BAYER_RG=0, 46 ASI_BAYER_BG, 47 ASI_BAYER_GR, 48 ASI_BAYER_GB 49 }ASI_BAYER_PATTERN; 50 51 typedef enum ASI_IMG_TYPE{ //Supported Video Format 52 ASI_IMG_RAW8 = 0, 53 ASI_IMG_RGB24, 54 ASI_IMG_RAW16, 55 ASI_IMG_Y8, 56 ASI_IMG_END = -1 57 58 }ASI_IMG_TYPE; 59 60 typedef enum ASI_GUIDE_DIRECTION{ //Guider Direction 61 ASI_GUIDE_NORTH=0, 62 ASI_GUIDE_SOUTH, 63 ASI_GUIDE_EAST, 64 ASI_GUIDE_WEST 65 }ASI_GUIDE_DIRECTION; 66 67 68 69 typedef enum ASI_FLIP_STATUS { 70 ASI_FLIP_NONE = 0,//: original 71 ASI_FLIP_HORIZ,//: horizontal flip 72 ASI_FLIP_VERT,// vertical flip 73 ASI_FLIP_BOTH,//:both horizontal and vertical flip 74 75 }ASI_FLIP_STATUS; 76 77 typedef enum ASI_CAMERA_MODE { 78 ASI_MODE_NORMAL = 0, 79 ASI_MODE_TRIG_SOFT_EDGE, 80 ASI_MODE_TRIG_RISE_EDGE, 81 ASI_MODE_TRIG_FALL_EDGE, 82 ASI_MODE_TRIG_SOFT_LEVEL, 83 ASI_MODE_TRIG_HIGH_LEVEL, 84 ASI_MODE_TRIG_LOW_LEVEL, 85 ASI_MODE_END = -1 86 }ASI_CAMERA_MODE; 87 88 typedef enum ASI_TRIG_OUTPUT { 89 ASI_TRIG_OUTPUT_PINA = 0,//: Only Pin A output 90 ASI_TRIG_OUTPUT_PINB,//: Only Pin B output 91 ASI_TRIG_OUTPUT_NONE = -1 92 }ASI_TRIG_OUTPUT_PIN; 93 94 typedef enum ASI_ERROR_CODE{ //ASI ERROR CODE 95 ASI_SUCCESS=0, 96 ASI_ERROR_INVALID_INDEX, //no camera connected or index value out of boundary 97 ASI_ERROR_INVALID_ID, //invalid ID 98 ASI_ERROR_INVALID_CONTROL_TYPE, //invalid control type 99 ASI_ERROR_CAMERA_CLOSED, //camera didn't open 100 ASI_ERROR_CAMERA_REMOVED, //failed to find the camera, maybe the camera has been removed 101 ASI_ERROR_INVALID_PATH, //cannot find the path of the file 102 ASI_ERROR_INVALID_FILEFORMAT, 103 ASI_ERROR_INVALID_SIZE, //wrong video format size 104 ASI_ERROR_INVALID_IMGTYPE, //unsupported image formate 105 ASI_ERROR_OUTOF_BOUNDARY, //the startpos is out of boundary 106 ASI_ERROR_TIMEOUT, //timeout 107 ASI_ERROR_INVALID_SEQUENCE,//stop capture first 108 ASI_ERROR_BUFFER_TOO_SMALL, //buffer size is not big enough 109 ASI_ERROR_VIDEO_MODE_ACTIVE, 110 ASI_ERROR_EXPOSURE_IN_PROGRESS, 111 ASI_ERROR_GENERAL_ERROR,//general error, eg: value is out of valid range 112 ASI_ERROR_INVALID_MODE,//the current mode is wrong 113 ASI_ERROR_END 114 }ASI_ERROR_CODE; 115 116 typedef enum ASI_BOOL{ 117 ASI_FALSE =0, 118 ASI_TRUE 119 }ASI_BOOL; 120 121 typedef struct _ASI_CAMERA_INFO 122 { 123 char Name[64]; //the name of the camera, you can display this to the UI 124 int CameraID; //this is used to control everything of the camera in other functions.Start from 0. 125 long MaxHeight; //the max height of the camera 126 long MaxWidth; //the max width of the camera 127 128 ASI_BOOL IsColorCam; 129 ASI_BAYER_PATTERN BayerPattern; 130 131 int SupportedBins[16]; //1 means bin1 which is supported by every camera, 2 means bin 2 etc.. 0 is the end of supported binning method 132 ASI_IMG_TYPE SupportedVideoFormat[8]; //this array will content with the support output format type.IMG_END is the end of supported video format 133 134 double PixelSize; //the pixel size of the camera, unit is um. such like 5.6um 135 ASI_BOOL MechanicalShutter; 136 ASI_BOOL ST4Port; 137 ASI_BOOL IsCoolerCam; 138 ASI_BOOL IsUSB3Host; 139 ASI_BOOL IsUSB3Camera; 140 float ElecPerADU; 141 int BitDepth; 142 ASI_BOOL IsTriggerCam; 143 144 char Unused[16]; 145 } ASI_CAMERA_INFO; 146 147 #define ASI_BRIGHTNESS ASI_OFFSET 148 #define ASI_AUTO_MAX_BRIGHTNESS ASI_AUTO_TARGET_BRIGHTNESS 149 150 typedef enum ASI_CONTROL_TYPE{ //Control type// 151 ASI_GAIN = 0, 152 ASI_EXPOSURE, 153 ASI_GAMMA, 154 ASI_WB_R, 155 ASI_WB_B, 156 ASI_OFFSET, 157 ASI_BANDWIDTHOVERLOAD, 158 ASI_OVERCLOCK, 159 ASI_TEMPERATURE,// return 10*temperature 160 ASI_FLIP, 161 ASI_AUTO_MAX_GAIN, 162 ASI_AUTO_MAX_EXP,//micro second 163 ASI_AUTO_TARGET_BRIGHTNESS,//target brightness 164 ASI_HARDWARE_BIN, 165 ASI_HIGH_SPEED_MODE, 166 ASI_COOLER_POWER_PERC, 167 ASI_TARGET_TEMP,// not need *10 168 ASI_COOLER_ON, 169 ASI_MONO_BIN,//lead to less grid at software bin mode for color camera 170 ASI_FAN_ON, 171 ASI_PATTERN_ADJUST, 172 ASI_ANTI_DEW_HEATER, 173 174 }ASI_CONTROL_TYPE; 175 176 typedef struct _ASI_CONTROL_CAPS 177 { 178 char Name[64]; //the name of the Control like Exposure, Gain etc.. 179 char Description[128]; //description of this control 180 long MaxValue; 181 long MinValue; 182 long DefaultValue; 183 ASI_BOOL IsAutoSupported; //support auto set 1, don't support 0 184 ASI_BOOL IsWritable; //some control like temperature can only be read by some cameras 185 ASI_CONTROL_TYPE ControlType;//this is used to get value and set value of the control 186 char Unused[32]; 187 } ASI_CONTROL_CAPS; 188 189 typedef enum ASI_EXPOSURE_STATUS { 190 ASI_EXP_IDLE = 0,//: idle states, you can start exposure now 191 ASI_EXP_WORKING,//: exposing 192 ASI_EXP_SUCCESS,//: exposure finished and waiting for download 193 ASI_EXP_FAILED,//:exposure failed, you need to start exposure again 194 195 }ASI_EXPOSURE_STATUS; 196 197 typedef struct _ASI_ID{ 198 unsigned char id[8]; 199 }ASI_ID; 200 201 typedef ASI_ID ASI_SN; 202 203 typedef struct _ASI_SUPPORTED_MODE{ 204 ASI_CAMERA_MODE SupportedCameraMode[16];// this array will content with the support camera mode type.ASI_MODE_END is the end of supported camera mode 205 }ASI_SUPPORTED_MODE; 206 207 #ifndef __cplusplus 208 #define ASI_CONTROL_TYPE int 209 #define ASI_BOOL int 210 #define ASI_ERROR_CODE int 211 #define ASI_FLIP_STATUS int 212 #define ASI_IMG_TYPE int 213 #define ASI_GUIDE_DIRECTION int 214 #define ASI_BAYER_PATTERN int 215 #endif 216 217 #ifdef __cplusplus 218 extern "C" { 219 #endif 220 221 /*************************************************************************** 222 Descriptions: 223 this should be the first API to be called 224 get number of connected ASI cameras, 225 226 Paras: 227 228 return:number of connected ASI cameras. 1 means 1 camera connected. 229 ***************************************************************************/ 230 ASICAMERA_API int ASIGetNumOfConnectedCameras(); 231 232 /*************************************************************************** 233 Descriptions: 234 get the product ID of each supported camera, at first set pPIDs as 0 and get length and then malloc a buffer to contain the PIDs 235 236 Paras: 237 int* pPIDs: pointer to array of PIDs 238 239 Return: length of the array. 240 ***************************************************************************/ 241 ASICAMERA_API int ASIGetProductIDs(int* pPIDs); 242 243 /*************************************************************************** 244 Descriptions: 245 get the property of the connected cameras, you can do this without open the camera. 246 here is the sample code: 247 248 int iNumofConnectCameras = ASIGetNumOfConnectedCameras(); 249 ASI_CAMERA_INFO **ppASICameraInfo = (ASI_CAMERA_INFO **)malloc(sizeof(ASI_CAMERA_INFO *)*iNumofConnectCameras); 250 for(int i = 0; i < iNumofConnectCameras; i++) 251 { 252 ppASICameraInfo[i] = (ASI_CAMERA_INFO *)malloc(sizeof(ASI_CAMERA_INFO )); 253 ASIGetCameraProperty(ppASICameraInfo[i], i); 254 } 255 256 Paras: 257 ASI_CAMERA_INFO *pASICameraInfo: Pointer to structure containing the property of camera 258 user need to malloc the buffer 259 int iCameraIndex: 0 means the first connect camera, 1 means the second connect camera 260 261 return: 262 ASI_SUCCESS: Operation is successful 263 ASI_ERROR_INVALID_INDEX :no camera connected or index value out of boundary 264 265 ***************************************************************************/ 266 ASICAMERA_API ASI_ERROR_CODE ASIGetCameraProperty(ASI_CAMERA_INFO *pASICameraInfo, int iCameraIndex); 267 268 269 /*************************************************************************** 270 Descriptions: 271 get the property of the connected cameras by ID. 272 273 Paras: 274 ASI_CAMERA_INFO *pASICameraInfo: Pointer to structure containing the property of camera 275 user need to malloc the buffer 276 277 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 278 279 return: 280 ASI_SUCCESS : Operation is successful 281 ASI_ERROR_CAMERA_CLOSED : camera didn't open 282 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 283 ***************************************************************************/ 284 ASICAMERA_API ASI_ERROR_CODE ASIGetCameraPropertyByID(int iCameraID, ASI_CAMERA_INFO *pASICameraInfo); 285 286 287 /*************************************************************************** 288 Descriptions: 289 open the camera before any operation to the camera, this will not affect the camera which is capturing 290 All APIs below need to open the camera at first. 291 292 Paras: 293 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 294 295 return: 296 ASI_SUCCESS: Operation is successful 297 ASI_ERROR_INVALID_ID : no camera of this ID is connected or ID value is out of boundary 298 ASI_ERROR_CAMERA_REMOVED: failed to find the camera, maybe camera has been removed 299 300 ***************************************************************************/ 301 ASICAMERA_API ASI_ERROR_CODE ASIOpenCamera(int iCameraID); 302 303 /*************************************************************************** 304 Descriptions 305 306 Initialise the camera after open, this function may take some while, this will affect the camera which is capturing 307 308 Paras: 309 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 310 311 return: 312 ASI_SUCCESS : Operation is successful 313 ASI_ERROR_CAMERA_CLOSED : camera didn't open 314 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 315 ***************************************************************************/ 316 ASICAMERA_API ASI_ERROR_CODE ASIInitCamera(int iCameraID); 317 318 /*************************************************************************** 319 Descriptions: 320 you need to close the camera to free all the resource 321 322 323 Paras: 324 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 325 326 return: 327 ASI_SUCCESS :it will return success even the camera already closed 328 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 329 330 ***************************************************************************/ 331 ASICAMERA_API ASI_ERROR_CODE ASICloseCamera(int iCameraID); 332 333 334 335 336 /*************************************************************************** 337 Descriptions: 338 Get number of controls available for this camera. the camera need be opened at first. 339 340 341 342 Paras: 343 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 344 int * piNumberOfControls: pointer to an int to save the number of controls 345 346 return: 347 ASI_SUCCESS : Operation is successful 348 ASI_ERROR_CAMERA_CLOSED : camera didn't open 349 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 350 ***************************************************************************/ 351 ASICAMERA_API ASI_ERROR_CODE ASIGetNumOfControls(int iCameraID, int * piNumberOfControls); 352 353 354 /*************************************************************************** 355 Descriptions: 356 Get controls property available for this camera. the camera need be opened at first. 357 user need to malloc and maintain the buffer. 358 359 360 361 Paras: 362 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 363 int iControlIndex: index of control, NOT control type 364 ASI_CONTROL_CAPS * pControlCaps: Pointer to structure containing the property of the control 365 user need to malloc the buffer 366 367 return: 368 ASI_SUCCESS : Operation is successful 369 ASI_ERROR_CAMERA_CLOSED : camera didn't open 370 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 371 ***************************************************************************/ 372 ASICAMERA_API ASI_ERROR_CODE ASIGetControlCaps(int iCameraID, int iControlIndex, ASI_CONTROL_CAPS * pControlCaps); 373 374 /*************************************************************************** 375 Descriptions: 376 Get controls property value and auto value 377 note:the value of the temperature is the float value * 10 to convert it to long type, control name is "Temperature" 378 because long is the only type for control(except cooler's target temperature, because it is an integer) 379 380 Paras: 381 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 382 int ControlType: this is get from control property use the API ASIGetControlCaps 383 long *plValue: pointer to the value you want to save the value get from control 384 ASI_BOOL *pbAuto: pointer to the ASI_BOOL type 385 386 return: 387 ASI_SUCCESS : Operation is successful 388 ASI_ERROR_CAMERA_CLOSED : camera didn't open 389 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 390 ASI_ERROR_INVALID_CONTROL_TYPE, //invalid Control type 391 ***************************************************************************/ 392 ASICAMERA_API ASI_ERROR_CODE ASIGetControlValue(int iCameraID, ASI_CONTROL_TYPE ControlType, long *plValue, ASI_BOOL *pbAuto); 393 394 /*************************************************************************** 395 Descriptions: 396 Set controls property value and auto value 397 it will return success and set the max value or min value if the value is beyond the boundary 398 399 400 Paras: 401 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 402 int ControlType: this is get from control property use the API ASIGetControlCaps 403 long lValue: the value set to the control 404 ASI_BOOL bAuto: set the control auto 405 406 return: 407 ASI_SUCCESS : Operation is successful 408 ASI_ERROR_CAMERA_CLOSED : camera didn't open 409 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 410 ASI_ERROR_INVALID_CONTROL_TYPE, //invalid Control type 411 ASI_ERROR_GENERAL_ERROR,//general error, eg: value is out of valid range; operate to camera hareware failed 412 ***************************************************************************/ 413 ASICAMERA_API ASI_ERROR_CODE ASISetControlValue(int iCameraID, ASI_CONTROL_TYPE ControlType, long lValue, ASI_BOOL bAuto); 414 415 /*************************************************************************** 416 Descriptions: 417 set the ROI area before capture. 418 you must stop capture before call it. 419 the width and height is the value after binning. 420 ie. you need to set width to 640 and height to 480 if you want to run at 640X480@BIN2 421 ASI120's data size must be times of 1024 which means width*height%1024=0 422 Paras: 423 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 424 int iWidth, the width of the ROI area. Make sure iWidth%8 == 0. 425 int iHeight, the height of the ROI area. Make sure iHeight%2 == 0, 426 further, for USB2.0 camera ASI120, please make sure that iWidth*iHeight%1024=0. 427 int iBin, binning method. bin1=1, bin2=2 428 ASI_IMG_TYPE Img_type: the output format you want 429 430 return: 431 ASI_SUCCESS : Operation is successful 432 ASI_ERROR_CAMERA_CLOSED : camera didn't open 433 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 434 ASI_ERROR_INVALID_SIZE, //wrong video format size 435 ASI_ERROR_INVALID_IMGTYPE, //unsupported image format, make sure iWidth and iHeight and binning is set correct 436 ***************************************************************************/ 437 ASICAMERA_API ASI_ERROR_CODE ASISetROIFormat(int iCameraID, int iWidth, int iHeight, int iBin, ASI_IMG_TYPE Img_type); 438 439 440 /*************************************************************************** 441 Descriptions: 442 Get the current ROI area setting . 443 444 Paras: 445 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 446 int *piWidth, pointer to the width of the ROI area 447 int *piHeight, pointer to the height of the ROI area. 448 int *piBin, pointer to binning method. bin1=1, bin2=2 449 ASI_IMG_TYPE *pImg_type: pointer to the output format 450 451 return: 452 ASI_SUCCESS : Operation is successful 453 ASI_ERROR_CAMERA_CLOSED : camera didn't open 454 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 455 456 ***************************************************************************/ 457 ASICAMERA_API ASI_ERROR_CODE ASIGetROIFormat(int iCameraID, int *piWidth, int *piHeight, int *piBin, ASI_IMG_TYPE *pImg_type); 458 459 460 /*************************************************************************** 461 Descriptions: 462 Set the start position of the ROI area. 463 you can call this API to move the ROI area when video is streaming 464 the camera will set the ROI area to the center of the full image as default 465 at bin2 or bin3 mode, the position is relative to the image after binning 466 467 468 Paras: 469 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 470 int iStartX, pointer to the start X 471 int iStartY pointer to the start Y 472 473 return: 474 ASI_SUCCESS : Operation is successful 475 ASI_ERROR_CAMERA_CLOSED : camera didn't open 476 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 477 ASI_ERROR_OUTOF_BOUNDARY: the start x and start y make the image out of boundary 478 479 ***************************************************************************/ 480 ASICAMERA_API ASI_ERROR_CODE ASISetStartPos(int iCameraID, int iStartX, int iStartY); 481 482 /*************************************************************************** 483 Descriptions: 484 Get the start position of current ROI area . 485 486 Paras: 487 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 488 int *piStartX, pointer to the start X 489 int *piStartY pointer to the start Y 490 491 return: 492 ASI_SUCCESS : Operation is successful 493 ASI_ERROR_CAMERA_CLOSED : camera didn't open 494 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 495 496 ***************************************************************************/ 497 ASICAMERA_API ASI_ERROR_CODE ASIGetStartPos(int iCameraID, int *piStartX, int *piStartY); 498 499 /*************************************************************************** 500 Descriptions: 501 Get the droped frames . 502 drop frames happen when USB is traffic or harddisk write speed is slow 503 it will reset to 0 after stop capture 504 505 Paras: 506 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 507 int *piDropFrames pointer to drop frames 508 509 return: 510 ASI_SUCCESS : Operation is successful 511 ASI_ERROR_CAMERA_CLOSED : camera didn't open 512 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 513 514 ***************************************************************************/ 515 ASICAMERA_API ASI_ERROR_CODE ASIGetDroppedFrames(int iCameraID,int *piDropFrames); 516 517 /*************************************************************************** 518 Descriptions: 519 provide a dark file's path to the function and enable dark subtract 520 this is used when there is hot pixel or need to do long exposure 521 you'd better make this dark file from the "dark subtract" funtion 522 of the "video capture filter" directshow page. 523 the dark file's size should be the same of camera's max width and height 524 and should be RGB8 raw format.it will on even you changed the ROI setting 525 it only correct the hot pixels if out put isn't 16bit. 526 527 it will be remembered in registry. so "Dark subtract" is on next time if you close your app. 528 529 530 Paras: 531 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 532 char *pcBMPPath: the path to the bmp dark file. 533 return: 534 ASI_SUCCESS : Operation is successful 535 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 536 ASI_ERROR_CAMERA_CLOSED : camera didn't open 537 ASI_ERROR_INVALID_PATH, //cannot find the path of the file 538 ASI_ERROR_INVALID_FILEFORMAT, //the dark file's size should be the same of camera's max width and height 539 540 ***************************************************************************/ 541 ASICAMERA_API ASI_ERROR_CODE ASIEnableDarkSubtract(int iCameraID, char *pcBMPPath); 542 543 /*************************************************************************** 544 Descriptions: 545 Disable the dark subtract function. 546 you'd better call it at start if you don't want to use it. 547 because dark subtract function is remembered on windows platform 548 549 550 Paras: 551 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 552 553 return: 554 ASI_SUCCESS : Operation is successful 555 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 556 ASI_ERROR_CAMERA_CLOSED : camera didn't open 557 ***************************************************************************/ 558 ASICAMERA_API ASI_ERROR_CODE ASIDisableDarkSubtract(int iCameraID); 559 560 /*************************************************************************** 561 Descriptions: 562 Start video capture 563 then you can get the data from the API ASIGetVideoData 564 565 566 Paras: 567 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 568 569 return: 570 ASI_SUCCESS : Operation is successful, it will return success if already started 571 ASI_ERROR_CAMERA_CLOSED : camera didn't open 572 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 573 ASI_ERROR_EXPOSURE_IN_PROGRESS: snap mode is working, you need to stop snap first 574 ***************************************************************************/ 575 ASICAMERA_API ASI_ERROR_CODE ASIStartVideoCapture(int iCameraID); 576 577 /*************************************************************************** 578 Descriptions: 579 Stop video capture 580 581 582 Paras: 583 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 584 585 return: 586 ASI_SUCCESS : Operation is successful, it will return success if already stopped 587 ASI_ERROR_CAMERA_CLOSED : camera didn't open 588 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 589 590 ***************************************************************************/ 591 ASICAMERA_API ASI_ERROR_CODE ASIStopVideoCapture(int iCameraID); 592 593 /*************************************************************************** 594 Descriptions: 595 get data from the video buffer.the buffer is very small 596 you need to call this API as fast as possible, otherwise frame will be discarded 597 so the best way is maintain one buffer loop and call this API in a loop 598 please make sure the buffer size is biger enough to hold one image 599 otherwise the this API will crash 600 601 602 Paras: 603 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 604 unsigned char* pBuffer, caller need to malloc the buffer, make sure the size is big enough 605 the size in byte: 606 8bit mono:width*height 607 16bit mono:width*height*2 608 RGB24:width*height*3 609 610 int iWaitms, this API will block and wait iWaitms to get one image. the unit is ms 611 -1 means wait forever. this value is recommend set to exposure*2+500ms 612 613 return: 614 ASI_SUCCESS : Operation is successful 615 ASI_ERROR_CAMERA_CLOSED : camera didn't open 616 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 617 ASI_ERROR_TIMEOUT: no image get and timeout 618 ***************************************************************************/ 619 ASICAMERA_API ASI_ERROR_CODE ASIGetVideoData(int iCameraID, unsigned char* pBuffer, long lBuffSize, int iWaitms); 620 621 622 /*************************************************************************** 623 Descriptions: 624 PulseGuide of the ST4 port on. this function only work on the module which have ST4 port 625 626 627 Paras: 628 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 629 ASI_GUIDE_DIRECTION direction the direction of guider 630 631 return: 632 ASI_SUCCESS : Operation is successful 633 ASI_ERROR_CAMERA_CLOSED : camera didn't open 634 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 635 636 ***************************************************************************/ 637 ASICAMERA_API ASI_ERROR_CODE ASIPulseGuideOn(int iCameraID, ASI_GUIDE_DIRECTION direction); 638 639 /*************************************************************************** 640 Descriptions: 641 PulseGuide of the ST4 port off. this function only work on the module which have ST4 port 642 make sure where is ASIPulseGuideOn and there is ASIPulseGuideOff 643 644 Paras: 645 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 646 ASI_GUIDE_DIRECTION direction the direction of guider 647 648 return: 649 ASI_SUCCESS : Operation is successful 650 ASI_ERROR_CAMERA_CLOSED : camera didn't open 651 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 652 653 ***************************************************************************/ 654 ASICAMERA_API ASI_ERROR_CODE ASIPulseGuideOff(int iCameraID, ASI_GUIDE_DIRECTION direction); 655 656 657 /*************************************************************************** 658 Descriptions: 659 Start camera exposure. the following 4 API is usually used when long exposure required 660 start exposure and check the exposure status then get the data 661 662 663 Paras: 664 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 665 ASI_BOOL bIsDark: means dark frame if there is mechanical shutter on the camera. otherwise useless 666 667 return: 668 ASI_SUCCESS : Operation is successful 669 ASI_ERROR_CAMERA_CLOSED : camera didn't open 670 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 671 ASI_ERROR_VIDEO_MODE_ACTIVE: video mode is working, you need to stop video capture first 672 ***************************************************************************/ 673 ASICAMERA_API ASI_ERROR_CODE ASIStartExposure(int iCameraID, ASI_BOOL bIsDark); 674 675 /*************************************************************************** 676 Descriptions: 677 to cancel the long exposure which is on. 678 679 680 Paras: 681 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 682 683 684 return: 685 ASI_SUCCESS : Operation is successful 686 ASI_ERROR_CAMERA_CLOSED : camera didn't open 687 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 688 689 ***************************************************************************/ 690 ASICAMERA_API ASI_ERROR_CODE ASIStopExposure(int iCameraID); 691 692 /*************************************************************************** 693 Descriptions: 694 to get the exposure status, work with ASIStartExposure. 695 you can read the data if get ASI_EXP_SUCCESS. or have to restart exposure again 696 if get ASI_EXP_FAILED 697 698 Paras: 699 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 700 ASI_EXPOSURE_STATUS *pExpStatus: the exposure status 701 702 703 return: 704 ASI_SUCCESS : Operation is successful 705 ASI_ERROR_CAMERA_CLOSED : camera didn't open 706 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 707 708 ***************************************************************************/ 709 710 ASICAMERA_API ASI_ERROR_CODE ASIGetExpStatus(int iCameraID, ASI_EXPOSURE_STATUS *pExpStatus); 711 712 /*************************************************************************** 713 Descriptions: 714 get data after exposure. 715 please make sure the buffer size is biger enough to hold one image 716 otherwise the this API will crash 717 718 719 Paras: 720 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 721 unsigned char* pBuffer, caller need to malloc the buffer, make sure the size is big enough 722 the size in byte: 723 8bit mono:width*height 724 16bit mono:width*height*2 725 RGB24:width*height*3 726 727 728 return: 729 ASI_SUCCESS : Operation is successful 730 ASI_ERROR_CAMERA_CLOSED : camera didn't open 731 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 732 ASI_ERROR_TIMEOUT: no image get and timeout 733 ***************************************************************************/ 734 ASICAMERA_API ASI_ERROR_CODE ASIGetDataAfterExp(int iCameraID, unsigned char* pBuffer, long lBuffSize); 735 736 /*************************************************************************** 737 Descriptions: 738 get camera id stored in flash, only available for USB3.0 camera 739 740 Paras: 741 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 742 ASI_ID* pID: pointer to ID 743 744 return: 745 ASI_SUCCESS : Operation is successful 746 ASI_ERROR_CAMERA_CLOSED : camera didn't open 747 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 748 ***************************************************************************/ 749 ASICAMERA_API ASI_ERROR_CODE ASIGetID(int iCameraID, ASI_ID* pID); 750 751 /*************************************************************************** 752 Descriptions: 753 write camera id to flash, only available for USB3.0 camera 754 755 Paras: 756 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 757 ASI_ID ID: ID 758 759 return: 760 ASI_SUCCESS : Operation is successful 761 ASI_ERROR_CAMERA_CLOSED : camera didn't open 762 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 763 ***************************************************************************/ 764 ASICAMERA_API ASI_ERROR_CODE ASISetID(int iCameraID, ASI_ID ID); 765 766 /*************************************************************************** 767 Descriptions: 768 get pre-setting parameter 769 Paras: 770 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 771 Offset_HighestDR: offset at highest dynamic range, 772 Offset_UnityGain: offset at unity gain 773 int *Gain_LowestRN, *Offset_LowestRN: gain and offset at lowest read noise 774 775 return: 776 ASI_SUCCESS : Operation is successful 777 ASI_ERROR_CAMERA_CLOSED : camera didn't open 778 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 779 ***************************************************************************/ 780 ASICAMERA_API ASI_ERROR_CODE ASIGetGainOffset(int iCameraID, int *pOffset_HighestDR, int *pOffset_UnityGain, int *pGain_LowestRN, int *pOffset_LowestRN); 781 782 /*************************************************************************** 783 Descriptions: 784 get version string, like "1, 13, 0503" 785 ***************************************************************************/ 786 ASICAMERA_API char* ASIGetSDKVersion(); 787 788 /*************************************************************************** 789 Description: 790 Get the camera supported mode, only need to call when the IsTriggerCam in the CameraInfo is true. 791 Paras: 792 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 793 ASI_SUPPORTED_MODE: the camera supported mode 794 795 return: 796 ASI_SUCCESS : Operation is successful 797 ASI_ERROR_CAMERA_CLOSED : camera didn't open 798 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 799 ***************************************************************************/ 800 ASICAMERA_API ASI_ERROR_CODE ASIGetCameraSupportMode(int iCameraID, ASI_SUPPORTED_MODE* pSupportedMode); 801 802 /*************************************************************************** 803 Description: 804 Get the camera current mode, only need to call when the IsTriggerCam in the CameraInfo is true 805 Paras: 806 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 807 ASI_CAMERA_MODE *mode: the current camera mode 808 809 return: 810 ASI_SUCCESS : Operation is successful 811 ASI_ERROR_CAMERA_CLOSED : camera didn't open 812 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 813 ***************************************************************************/ 814 ASICAMERA_API ASI_ERROR_CODE ASIGetCameraMode(int iCameraID, ASI_CAMERA_MODE* mode); 815 816 /*************************************************************************** 817 Description: 818 Set the camera mode, only need to call when the IsTriggerCam in the CameraInfo is true 819 Paras: 820 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 821 ASI_CAMERA_MODE: this is get from the camera property use the API ASIGetCameraProperty 822 823 return: 824 ASI_SUCCESS : Operation is successful 825 ASI_ERROR_CAMERA_CLOSED : camera didn't open 826 ASI_ERROR_INVALID_SEQUENCE : camera is in capture now, need to stop capture first. 827 ASI_ERROR_INVALID_MODE : mode is out of boundary or this camera do not support this mode 828 ***************************************************************************/ 829 ASICAMERA_API ASI_ERROR_CODE ASISetCameraMode(int iCameraID, ASI_CAMERA_MODE mode); 830 831 /*************************************************************************** 832 Description: 833 Send out a softTrigger. For edge trigger, it only need to set true which means send a 834 rising trigger to start exposure. For level trigger, it need to set true first means 835 start exposure, and set false means stop exposure.it only need to call when the 836 IsTriggerCam in the CameraInfo is true 837 Paras: 838 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 839 ASI_BOOL starts:send a softTrigger start/stop signal 840 841 return: 842 ASI_SUCCESS : Operation is successful 843 ASI_ERROR_CAMERA_CLOSED : camera didn't open 844 ***************************************************************************/ 845 ASICAMERA_API ASI_ERROR_CODE ASISendSoftTrigger(int iCameraID, ASI_BOOL bStart); 846 847 /*************************************************************************** 848 Description: 849 Get a serial number from a camera. 850 It is 8 ASCII characters, you need to print it in hexadecimal. 851 Paras: 852 int CameraID: this is get from the camera property use the API ASIGetCameraProperty 853 ASI_SN* pSN: pointer to SN 854 855 return: 856 ASI_SUCCESS : Operation is successful 857 ASI_ERROR_CAMERA_CLOSED : camera didn't open 858 ASI_ERROR_GENERAL_ERROR : camera does not have Serial Number 859 ***************************************************************************/ 860 ASICAMERA_API ASI_ERROR_CODE ASIGetSerialNumber(int iCameraID, ASI_SN* pSN); 861 862 /*************************************************************************** 863 Description: 864 Config the output pin (A or B) of Trigger port. If lDuration <= 0, this output pin will be closed. 865 Only need to call when the IsTriggerCam in the CameraInfo is true 866 867 Paras: 868 int CameraID: this is get from the camera property use the API ASIGetCameraProperty. 869 ASI_TRIG_OUTPUT_STATUS pin: Select the pin for output 870 ASI_BOOL bPinHigh: If true, the selected pin will output a high level as a signal 871 when it is effective. Or it will output a low level as a signal. 872 long lDelay: the time between the camera receive a trigger signal and the output 873 of the valid level.From 0 microsecond to 2000*1000*1000 microsecond. 874 long lDuration: the duration time of the valid level output.From 0 microsecond to 875 2000*1000*1000 microsecond. 876 877 return: 878 ASI_SUCCESS : Operation is successful 879 ASI_ERROR_CAMERA_CLOSED : camera didn't open 880 ASI_ERROR_GENERAL_ERROR : the parameter is not right 881 ***************************************************************************/ 882 ASICAMERA_API ASI_ERROR_CODE ASISetTriggerOutputIOConf(int iCameraID, ASI_TRIG_OUTPUT_PIN pin, ASI_BOOL bPinHigh, long lDelay, long lDuration); 883 884 885 /*************************************************************************** 886 Description: 887 Get the output pin configuration, only need to call when the IsTriggerCam in the CameraInfo is true 888 Paras: 889 int CameraID: this is get from the camera property use the API ASIGetCameraProperty. 890 ASI_TRIG_OUTPUT_STATUS pin: Select the pin for getting the configuration 891 ASI_BOOL *bPinAHigh: Get the current status of valid level. 892 long *lDelay: get the time between the camera receive a trigger signal and the output of the valid level. 893 long *lDuration: get the duration time of the valid level output. 894 895 return: 896 ASI_SUCCESS : Operation is successful 897 ASI_ERROR_CAMERA_CLOSED : camera didn't open 898 ASI_ERROR_INVALID_ID :no camera of this ID is connected or ID value is out of boundary 899 ASI_ERROR_GENERAL_ERROR : the parameter is not right 900 ***************************************************************************/ 901 ASICAMERA_API ASI_ERROR_CODE ASIGetTriggerOutputIOConf(int iCameraID, ASI_TRIG_OUTPUT_PIN pin, ASI_BOOL *bPinHigh, long *lDelay, long *lDuration); 902 903 #ifdef __cplusplus 904 } 905 #endif 906 907 #endif 908