예제 #1
0
파일: cap_ximea.cpp 프로젝트: 4ker/opencv
// Enumerate connected devices
void CvCaptureCAM_XIMEA::init()
{
#if defined WIN32 || defined _WIN32
    xiGetNumberDevices( &numDevices);
#else
    // try second re-enumeration if first one fails
    if (xiGetNumberDevices( &numDevices) != XI_OK)
    {
        xiGetNumberDevices( &numDevices);
    }
#endif
    hmv = NULL;
    frame = NULL;
    timeout = 0;
    memset(&image, 0, sizeof(XI_IMG));
}
예제 #2
0
파일: cap_ximea.cpp 프로젝트: abak/opencv
// Enumerate connected devices
void CvCaptureCAM_XIMEA::init()
{
    xiGetNumberDevices( &numDevices);
    hmv = NULL;
    frame = NULL;
    timeout = 0;
    memset(&image, 0, sizeof(XI_IMG));
}
예제 #3
0
void CaptureCAM_XIMEA::init()
{
    stat = xiGetNumberDevices(&numDevices);
//     cout << "Number of connected devices: " << numDevices << endl;
    HandleResult(stat,"xiGetNumberDevices (no camera found)");
    try{
        if (!numDevices)
        {
            throw "No camera found\n";
        }
        hmv = NULL;
        isopened=false;
        timeout = 0;
        memset(&image, 0, sizeof(XI_IMG));
    }catch(const char* e){
        cout<< "An Exception occured. Exception: "<<e<<endl;
        close();
    }
}
예제 #4
0
std::vector<CameraInfo> CameraXIMEA::getCameraList(){

    XI_RETURN stat = XI_OK;
    DWORD numCams;
    stat = xiGetNumberDevices(&numCams);
    HandleResult(stat, "xiGetNumberDevices");

    std::vector<CameraInfo> ret(numCams);
    for(unsigned int i=0; i<numCams; i++){
        CameraInfo info;
        info.vendor = "Ximea";
        char name[20];
        xiGetDeviceInfoString(i, XI_PRM_DEVICE_NAME, name, 20);
        info.model = name;
        info.busID = i;
        ret[i] = info;
    }
    return ret;
}
예제 #5
0
파일: CRCamera.cpp 프로젝트: cryeo/snowtire
void CRCamera::initialize() {
    DWORD dwNumberOfDevices = 0;
    float maxFps;

    xiGetNumberDevices(&dwNumberOfDevices);
    if (!dwNumberOfDevices) {
        LOG("Camera was NOT found.");
    }

    xiOpenDevice(0, &this->xiH);

    int exposure = (int)(1000000.0 / Global::crConfig->frameRate);

    xiSetParamInt(this->xiH, XI_PRM_EXPOSURE, exposure);
    xiGetParamFloat(this->xiH, XI_PRM_FRAMERATE XI_PRM_INFO_MAX, &maxFps);

    LOG("Max framerate : %f [fps]", maxFps);
    LOG("Exposure time : %d [us]", exposure);

    xiSetParamInt(this->xiH, XI_PRM_ACQ_TIMING_MODE, XI_ACQ_TIMING_MODE_FRAME_RATE);
    xiSetParamFloat(this->xiH, XI_PRM_FRAMERATE, Global::crConfig->frameRate);
    xiSetParamInt(this->xiH, XI_PRM_IMAGE_DATA_FORMAT, XI_RGB24);
}
예제 #6
0
bool Camera::open(int serial) {
	std::cout << "! Searching for a camera with serial: " << serial << std::endl;

    DWORD deviceCount = 0;
    xiGetNumberDevices(&deviceCount);

    if (deviceCount == 0) {
        std::cout << "- Failed to detect any cameras" << std::endl;

        return false;
    }

	if (serial != 0) {
		std::cout << "  > found " << deviceCount << " available devices" << std::endl;
	}

    int sn = 0;

    bool found = false;

    for (unsigned int i = 0; i < deviceCount; i++) {
		std::cout << "  > opening camera #" << i << ".. ";
        xiOpenDevice(i, &device);
		std::cout << "done!" << std::endl;

        xiGetParamInt(device, XI_PRM_DEVICE_SN, &sn);
        std::cout << "  > found camera with serial number: " << sn << ".. ";

        if (serial == 0 || serial == sn) {
            found = true;

			std::cout << "match found!" << std::endl;

			break;
        } else {
			std::cout << "not the right one, closing it" << std::endl;

            xiCloseDevice(device);
        }
    }

    if (!found) {
        std::cout << "- No camera with serial #" << serial << " could be found" << std::endl;

        return false;
    }

    xiSetParamInt(device, XI_PRM_EXPOSURE, 16000);
    //xiSetParamInt(device, XI_PRM_IMAGE_DATA_FORMAT, XI_MONO8);
    //xiSetParamInt(device, XI_PRM_IMAGE_DATA_FORMAT, XI_RGB24);
    xiSetParamInt(device, XI_PRM_BUFFER_POLICY, XI_BP_UNSAFE);
    //xiSetParamInt(device, XI_PRM_FRAMERATE, 60);
    //xiSetParamInt(device, XI_PRM_DOWNSAMPLING, 2); // @TEMP
    //xiSetParamInt(device, XI_PRM_DOWNSAMPLING_TYPE, XI_BINNING);
    //xiSetParamFloat(device, XI_PRM_GAIN, 5.0f);
    //xiSetParamInt(device, XI_PRM_ACQ_BUFFER_SIZE, 70*1000*1000);
    xiSetParamInt(device, XI_PRM_BUFFERS_QUEUE_SIZE, 1);
    //xiSetParamInt(device, XI_PRM_RECENT_FRAME, 1);
    xiSetParamInt(device, XI_PRM_AUTO_WB, 0);
    //xiSetParamFloat(device, XI_PRM_WB_KR, 1.0f);
    //xiSetParamFloat(device, XI_PRM_WB_KG, 1.0f);
    //xiSetParamFloat(device, XI_PRM_WB_KB, 1.0f);
    //xiSetParamFloat(device, XI_PRM_GAMMAY, 1.0f);
    //xiSetParamFloat(device, XI_PRM_GAMMAC, 1.0f);
    //xiSetParamFloat(device, XI_PRM_SHARPNESS, 0.0f);
    xiSetParamInt(device, XI_PRM_AEAG, 0);
    //xiSetParamInt(device, XI_PRM_BPC, 1); // fixes bad pixel
    //xiSetParamInt(device, XI_PRM_HDR, 1);

    opened = true;
	serialNumber = serial;

    return true;
}
예제 #7
0
// Enumerate connected devices
void CvCaptureCAM_XIMEA::init()
{
	xiGetNumberDevices( &numDevices);
	hmv = NULL;
}