double QuantixCamera::getFrameRefreshTime(EventMetadatum &eventMetadatum) { uns16 pixelWriteTimeNS; double parallelShiftTimeNS = 80000; // 80 microseconds double serialDiscardRateNS = 100; // 0.1 microseconds double serialRecordRateNS; int16 pixTime; if (!pl_get_param (cameraHandle, PARAM_PIX_TIME, ATTR_CURRENT, &pixTime)) throw CameraException("Can't access pixel time for frame refresh"); serialRecordRateNS = (double) pixTime; if(!pl_get_param(cameraHandle, PARAM_PIX_TIME, ATTR_CURRENT, (void *) &pixelWriteTimeNS)) { char msg[ERROR_MSG_LEN]; // for error handling pl_error_message(pl_error_code(), msg); std::cerr << "Pixel readout time error: " << msg << std::endl; throw CameraException("Error getting pixel readout time."); } int parallelRows = (cameraState->imageWidth.getSize()); int totalPixels = (cameraState->imageHeight.getSize())*(cameraState->imageWidth.getSize()); int recordedRows = eventMetadatum.cropVector.at(2) + 1; int recordedPixels = recordedRows*(eventMetadatum.cropVector.at(3) + 1); int binSize; if (!STI::Utils::stringToValue(cameraState->binSize.get(), binSize)) throw CameraException("Error transforming string to value"); //Based off the 6303 data sheet double refreshTime = 0; refreshTime += recordedRows*parallelShiftTimeNS; //Time to shift relevant rows. refreshTime += recordedPixels*serialRecordRateNS / binSize / binSize; //Time to record (and discard?) relevent pixels refreshTime += (totalPixels - recordedPixels)*serialDiscardRateNS; //Time to discard non-relevant pixels std::cerr << "Frame Rate (s): " << refreshTime/1000000000 << std::endl; return refreshTime; }
void QuantixCamera::printError() { char msg[ERROR_MSG_LEN]; // for error handling pl_error_message(pl_error_code(), msg); std::cout << "Quantix Camera error: " << msg << std::endl; }
int main(void) { /*camera name */ char cam_name[CAM_NAME_LEN]; /*camera handle */ int16 hCam; /*initialize PVCAM library, before this runs only error checking function "pl_error_code" will work */ rs_bool init_error = pl_pvcam_init(); /*error checking*/ if(init_error == TRUE) { printf("Library initialization error: << %i >>.\n ", pl_error_code() ); }//if else { printf("PVCAM successfully initialized.\n") }//else /*get name of camera, takes parameters referring to cameras starting from 0, which is the first camera by definition*/ rs_bool name_error = pl_cam_get_name(0, cam_name); /*error checking*/ if(name_error == TRUE){ printf("Camera name error: << %i >>.\n ", pl_error_code() ); }//if else { printf("Camera found: << %s >>.\n", cam_name); }//else /*reserves and initializes camera hardware. provides sole camera access to current user, until "pl_pvcam_uninit" is called*/ rs_bool camera_error = pl_cam_open(cam_name, &hCam, OPEN_EXCLUSIVE); /*error checking*/ if(camera_error == TRUE){ printf("Camera initialization error: << %i >>.\n ", pl_error_code() ); }//if else { printf("Camera initialized, ready to accepts commands. You can try collecting data now.\n"); }//else /*close current camera*/ pl_cam_close(hCam); /*un-initialize the PVCAM library and free all resources used by it*/ pl_pvcam_uninit(); return EXIT_SUCCESS; }//main