Пример #1
0
//! Run
void PS3::Run() {
	if ( !_bInitialized ) {
		return;
	}
	int width, height;
	//IplImage *pCapImage;

	_cam = CLEyeCreateCamera( _camGUID, _camColorMode, _camResolution, _frameRate );

	//Sleep( 300 );
	
	if ( _cam == NULL ) {
		printf( "\nPS3::Run()\tCould not create camera\n" );
		return;	//! Could not create camera
	}
	//printf( "\tPS3::Run()\t#1\n" );

	CLEyeCameraGetFrameDimensions( _cam, width, height );

	_pCapBuffer = new unsigned char[width * height * 4];
	//printf( "PS3::Run() p=%p\n", _pCapBuffer );

	//if ( _camColorMode == CLEYE_COLOR_PROCESSED || _camColorMode == CLEYE_COLOR_RAW ) {
	//	pCapImage = cvCreateImage( cvSize(width, height), IPL_DEPTH_8U, 4 );
	//} else {
	//	pCapImage = cvCreateImage( cvSize(width, height), IPL_DEPTH_8U, 1 );
	//}

	//! Set some camera parameters
	CLEyeSetCameraParameter( _cam, CLEYE_AUTO_GAIN, _bAutoGain );
	CLEyeSetCameraParameter( _cam, CLEYE_GAIN, _gainValue );
	CLEyeSetCameraParameter( _cam, CLEYE_AUTO_EXPOSURE, _bAutoExposure );
	CLEyeSetCameraParameter( _cam, CLEYE_EXPOSURE, _exposureValue );
	CLEyeSetCameraParameter( _cam, CLEYE_AUTO_WHITEBALANCE, _bAutoWhiteBalance );
	CLEyeSetCameraParameter( _cam, CLEYE_WHITEBALANCE_RED, _whiteBalanceRed );
	CLEyeSetCameraParameter( _cam, CLEYE_WHITEBALANCE_GREEN, _whiteBalanceGreen );
	CLEyeSetCameraParameter( _cam, CLEYE_WHITEBALANCE_BLUE, _whiteBalanceBlue );
	CLEyeSetCameraParameter( _cam, CLEYE_HFLIP, _bHFlip );
	CLEyeSetCameraParameter( _cam, CLEYE_VFLIP, _bVFlip );

	//! Start capturing
	if ( !CLEyeCameraStart( _cam ) ) {
		std::cout << "Could not start camera!\n" << std::endl;
		return;
	}
	//Sleep( 300 );

}
Пример #2
0
// ------------------------------------------------
// PRIVATE
// ------------------------------------------------
bool PS3::SetWhiteBalance( int color, int value ) {
	if ( _bRunning && !GetAutoWhiteBalance() ) {
		if ( _cam != NULL ) {
			switch ( color ) {
				case 0:	// Red
					if ( CLEyeSetCameraParameter( _cam, CLEYE_WHITEBALANCE_RED, value ) ) {
						_whiteBalanceRed = value;
						return true;
					}
					break;
				case 1:	// Green
					if ( CLEyeSetCameraParameter( _cam, CLEYE_WHITEBALANCE_GREEN, value ) ) {
						_whiteBalanceGreen = value;
						return true;
					}
					break;
				case 2:	// Blue
					if ( CLEyeSetCameraParameter( _cam, CLEYE_WHITEBALANCE_BLUE, value ) ) {
						_whiteBalanceBlue = value;
						return true;
					}
					break;
				default:
					break;
			}
		}
	} else {
		switch ( color ) {
			case 0:	// Red
				_whiteBalanceRed = value;
				break;
			case 1:	// Green
				_whiteBalanceGreen = value;
				break;
			case 2:	// Blue
				_whiteBalanceBlue = value;
				break;
		}
		return true;
	}

	return false;
}
 bool setProperty(int property_id, double value)
 {
     int val;
     if (!m_eye)
     {
         return false;
     }
     switch (property_id)
     {
     case CV_CAP_PROP_BRIGHTNESS:
         // [-500, 500]
         CLEyeSetCameraParameter(m_eye, CLEYE_LENSBRIGHTNESS, (int)value);
     case CV_CAP_PROP_CONTRAST:
         return false;
     case CV_CAP_PROP_EXPOSURE:
         CLEyeSetCameraParameter(m_eye, CLEYE_AUTO_EXPOSURE, value <= 0);
         if (value > 0)
         {
             //[0, 255] -> [0, 511]
             val = (int)(value * 2.0);
             CLEyeSetCameraParameter(m_eye, CLEYE_EXPOSURE, val);
         }
     case CV_CAP_PROP_FPS:
         return false; //TODO: Modifying FPS probably requires resetting the camera
     case CV_CAP_PROP_FRAME_HEIGHT:
         return false; //TODO: Modifying frame size probably requires resetting the camera
     case CV_CAP_PROP_FRAME_WIDTH:
         return false; //TODO: Modifying frame size probably requires resetting the camera
     case CV_CAP_PROP_GAIN:
         CLEyeSetCameraParameter(m_eye, CLEYE_AUTO_GAIN, value <= 0);
         if (value > 0)
         {
             //[0, 255] -> [0, 79]
             val = (int)ceil(value * 80.0 / 256.0);
             CLEyeSetCameraParameter(m_eye, CLEYE_GAIN, val);
         }
     case CV_CAP_PROP_HUE:
         return false;
     case CV_CAP_PROP_SHARPNESS:
         return false; // TODO: Using OpenCV interface, sharpness appears to work
     }
     return true;
 }
Пример #4
0
bool PS3::DecrementParam( int  param ) {
	if ( !_cam ) {
		return false;
	}
	int nowValue = CLEyeGetCameraParameter( _cam, (CLEyeCameraParameter)param );
	printf( "CLEyeGetParameter %d\n", nowValue );
	
	//! We decrease value by 10
	CLEyeSetCameraParameter( _cam, (CLEyeCameraParameter)param, nowValue - 10);

	return true;
}
 bool open(int _index) {
     close();
     int cams = CLEyeGetCameraCount();
     std::cout << "CLEyeGetCameraCount() found " << cams << " devices." << std::endl;
     if (_index < cams)
     {
         std::cout << "Attempting to open camera " << _index << " of " << cams << "." << std::endl;
         GUID guid = CLEyeGetCameraUUID(_index);
         m_eye = CLEyeCreateCamera(guid, CLEYE_COLOR_PROCESSED, CLEYE_VGA, 75);
         CLEyeCameraGetFrameDimensions(m_eye, m_width, m_height);
         
         m_frame4ch = cvCreateImage(cvSize(m_width, m_height), IPL_DEPTH_8U, 4);
         m_frame = cvCreateImage(cvSize(m_width, m_height), IPL_DEPTH_8U, 3);
         
         CLEyeCameraStart(m_eye);
         CLEyeSetCameraParameter(m_eye, CLEYE_AUTO_EXPOSURE, false);
         CLEyeSetCameraParameter(m_eye, CLEYE_AUTO_GAIN, false);
         m_index = _index;
     }
     return isOpened();
 }
Пример #6
0
//--------------------------------------------------------------
void ofxCLEye::setAutoWhiteBalance(bool autoWhiteBalance){
	if(!initialized){
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_AUTO_WHITEBALANCE, (int)autoWhiteBalance);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "AUTO WHITE BALANCE: " << (autoWhiteBalance ? "ON" : "OFF");
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setAutoWhiteBalance(): " << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #7
0
bool PS3::SetExposure( int value ) {
	if ( _bRunning && !GetAutoExposure() ) {
		if ( _cam != NULL && CLEyeSetCameraParameter( _cam, CLEYE_EXPOSURE, value ) ) {
			_exposureValue = value;
			return true;
		}
	} else {
		_exposureValue = value;
		return true;
	}

	return false;
}
Пример #8
0
bool PS3::SetGainValue( int value ) {
	if ( _bRunning && !GetAutoGain() ) {	// Could not set the gain value when auto mode on
		if ( _cam != NULL && CLEyeSetCameraParameter( _cam, CLEYE_GAIN, value ) ) {
			_gainValue = value;
			return true;
		}
	} else {
		_gainValue = value;
		return true;
	}

	return false;
}
Пример #9
0
//--------------------------------------------------------------
void ofxCLEye::setAutoExposure(bool autoExposure){
	if(!initialized){
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_AUTO_EXPOSURE, (int)autoExposure);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "AUTO EXPOSURE: " << (autoExposure ? "ON" : "OFF");
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setAutoExposure():" << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #10
0
//--------------------------------------------------------------
void ofxCLEye::setAutoGain(bool autoGain){
	if(!initialized){
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_AUTO_GAIN, (int)autoGain);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "AUTO GAIN: " << (autoGain ? "ON" : "OFF");
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setAutoGain(): " << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #11
0
//--------------------------------------------------------------
void ofxCLEye::setHorizontalFlip(bool hFlip){
	if(!initialized){
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_HFLIP, (int)hFlip);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "HORIZONTAL FLIP: " << (hFlip ? "ON" : "OFF");
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setHorizontalFlip(): " << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #12
0
void camera_control_set_parameters(CameraControl* cc, int autoE, int autoG, int autoWB, int exposure, int gain, int wbRed, int wbGreen, int wbBlue, int contrast, int brightness) 
{
#if defined(CAMERA_CONTROL_USE_CL_DRIVER)
	if (autoE >= 0)
		CLEyeSetCameraParameter(cc->camera, CLEYE_AUTO_EXPOSURE, autoE > 0);
	if (autoG >= 0)
		CLEyeSetCameraParameter(cc->camera, CLEYE_AUTO_GAIN, autoG > 0);
	if (autoWB >= 0)
		CLEyeSetCameraParameter(cc->camera, CLEYE_AUTO_WHITEBALANCE, autoWB > 0);
	if (exposure >= 0)
		CLEyeSetCameraParameter(cc->camera, CLEYE_EXPOSURE, round((511 * exposure) / 0xFFFF));
	if (gain >= 0)
		CLEyeSetCameraParameter(cc->camera, CLEYE_GAIN, round((79 * gain) / 0xFFFF));
	if (wbRed >= 0)
		CLEyeSetCameraParameter(cc->camera, CLEYE_WHITEBALANCE_RED, round((255 * wbRed) / 0xFFFF));
	if (wbGreen >= 0)
		CLEyeSetCameraParameter(cc->camera, CLEYE_WHITEBALANCE_GREEN, round((255 * wbGreen) / 0xFFFF));
	if (wbBlue >= 0)
		CLEyeSetCameraParameter(cc->camera, CLEYE_WHITEBALANCE_BLUE, round((255 * wbBlue) / 0xFFFF));
#elif defined(CAMERA_CONTROL_USE_PS3EYE_DRIVER)
	//autoE... setAutoExposure not defined in ps3eye.h
	ps3eye_set_parameter(cc->eye, PS3EYE_AUTO_GAIN,				autoG > 0);
	ps3eye_set_parameter(cc->eye, PS3EYE_AUTO_WHITEBALANCE,		autoWB > 0);
	ps3eye_set_parameter(cc->eye, PS3EYE_EXPOSURE,				(int)round((511 * exposure) / 0xFFFF));
	ps3eye_set_parameter(cc->eye, PS3EYE_GAIN,					(int)round((79 * gain) / 0xFFFF));
	ps3eye_set_parameter(cc->eye, PS3EYE_BRIGHTNESS,			(int)round((255 * brightness) / 0xFFFF));

	//ps3eye_set_parameter(cc->eye, PS3EYE_REDBALANCE, round((255 * wbRed) / 0xFFFF));
	//wbGreen... setGreenBalance not defined in ps3eye.h
	//ps3eye_set_parameter(cc->eye, PS3EYE_BLUEBALANCE, round((255 * wbBlue) / 0xFFFF));
	//ps3eye_set_parameter(cc->eye, PS3EYE_CONTRAST, contrast);  // Transform unknown.
	//ps3eye_set_parameter(cc->eye, PS3EYE_BRIGHTNESS, brightness);  // Transform unknown.

	/** The following parameters could be set but are not passed into this function:
	* ps3eye_set_parameter(cc->eye, PS3EYE_SHARPNESS, ??);
	* ps3eye_set_parameter(cc->eye, PS3EYE_HUE, ??);
	* ps3eye_set_parameter(cc->eye, PS3EYE_HFLIP, ??);
	* ps3eye_set_parameter(cc->eye, PS3EYE_VFLIP, ??);
	**/
#else
	int val;
	HKEY hKey;
	DWORD l = sizeof(DWORD);
	char* PATH = CL_DRIVER_REG_PATH;
	int err = RegOpenKeyEx(HKEY_CURRENT_USER, PATH, 0, KEY_ALL_ACCESS, &hKey);
	if (err != ERROR_SUCCESS) {
		printf("Error: %d Unable to open reg-key:  [HKCU]\%s!", err, PATH);
		return;
	}
Пример #13
0
//--------------------------------------------------------------
void ofxCLEye::setVerticalFlip(bool vFlip){
	if(!initialized){
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_VFLIP, (int)vFlip);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "VERTICAL FLIP: " << (vFlip ? "ON" : "OFF");
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setVerticalFlip(): " << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #14
0
bool PS3::SetAutoWhiteBalance( bool autoBalance ) {
	if ( _bRunning ) {
		if ( _cam != NULL
			&& CLEyeSetCameraParameter( _cam, CLEYE_AUTO_WHITEBALANCE, autoBalance ) ) {
				_bAutoWhiteBalance = autoBalance;
				return true;
		}
	} else {
		_bAutoWhiteBalance = autoBalance;
		return true;
	}

	return false;
}
Пример #15
0
bool PS3::SetAutoGain( bool autoGain ) {
	if ( _bRunning ) {
		if ( _cam != NULL
			&& CLEyeSetCameraParameter( _cam, CLEYE_AUTO_GAIN, autoGain ) ) {
			_bAutoGain = autoGain;
			return true;
		}
	} else {
		_bAutoGain = autoGain;
		return true;
	}

	return false;
}
Пример #16
0
bool PS3::SetVFlip( bool flip ) {
	if ( _bRunning ) {
		if ( _cam != NULL
			&& CLEyeSetCameraParameter( _cam, CLEYE_VFLIP, flip ) ) {
			_bVFlip = flip;
			return true;
		}
	} else {
		_bVFlip = flip;
		return true;
	}

	return false;
}
Пример #17
0
bool PS3::SetAutoExposure( bool autoExposure ) {
	if ( _bRunning ) {
		if ( _cam != NULL
			&& CLEyeSetCameraParameter( _cam, CLEYE_AUTO_EXPOSURE, autoExposure ) ) {
				_bAutoExposure = autoExposure;
				return true;
		}
	} else {
		_bAutoExposure = autoExposure;
		return true;
	}

	return false;
}
Пример #18
0
//--------------------------------------------------------------
void ofxCLEye::setLensBrightness(int brightness){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setLensBrightness():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(brightness < -500 || brightness > 500){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setLensBrightness():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_LENSBRIGHTNESS, brightness);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "LENS BRIGHTNESS: " << brightness;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setLensBrightness(): " << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #19
0
//--------------------------------------------------------------
void ofxCLEye::setLensCorrection3(int correction){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setLensCorrection3():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(correction < -500 || correction > 500){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setLensCorrection3():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_LENSCORRECTION3, correction);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "LENS CORRECTION 3: " << correction;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setLensCorrection3(): " << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #20
0
//--------------------------------------------------------------
void ofxCLEye::setWhiteBalanceGreen(int green){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setWhiteBalanceGreen():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(green < 0 || green > 255){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setWhiteBalanceGreen():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_WHITEBALANCE_GREEN, green);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "WHITE BALANCE (GREEN): " << green;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setWhiteBalanceGreen():" << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #21
0
//--------------------------------------------------------------
void ofxCLEye::setGain(int gain){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setGain():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(gain < 0 || gain > 79){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setGain():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_GAIN, gain);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "GAIN: " << gain;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setGain():" << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #22
0
//--------------------------------------------------------------
void ofxCLEye::setVerticalKeystone(int vKeystone){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setVerticalKeystone():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(vKeystone < -500 || vKeystone > 500){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setVerticalKeystone():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_VKEYSTONE, vKeystone);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "VERTICAL KEYSTONE: " << vKeystone;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setVerticalKeystone(): " << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #23
0
//--------------------------------------------------------------
void ofxCLEye::setHorizontalKeystone(int hKeystone){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setHorizontalKeystone():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(hKeystone < -500 || hKeystone > 500){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setHorizontalKeystone():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_HKEYSTONE, hKeystone);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "HORIZONTAL KEYSTONE: " << hKeystone;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setHorizontalKeystone(): " << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #24
0
//--------------------------------------------------------------
void ofxCLEye::setWhiteBalanceBlue(int blue){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setWhiteBalanceBlue():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(blue < 0 || blue > 255){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setWhiteBalanceBlue():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_WHITEBALANCE_BLUE, blue);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "WHITE BALANCE (BLUE): " << blue;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setWhiteBalanceBlue():" << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #25
0
//--------------------------------------------------------------
void ofxCLEye::setExposure(int exposure){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setExposure():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(exposure < 0 || exposure > 511){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setExposure():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_EXPOSURE, exposure);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "EXPOSURE: " << exposure;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setExposure():" << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #26
0
//--------------------------------------------------------------
void ofxCLEye::setWhiteBalanceRed(int red){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setWhiteBalanceRed():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(red < 0 || red > 255){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setWhiteBalanceRed():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_WHITEBALANCE_RED, red);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "WHITE BALANCE (RED): " << red;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setWhiteBalanceRed():" << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #27
0
//--------------------------------------------------------------
void ofxCLEye::setYOffset(int yOffset){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setYOffset():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(yOffset < -500 || yOffset > 500){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setYOffset():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_YOFFSET, yOffset);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "Y OFFSET: " << yOffset;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setYOffset(): " << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #28
0
//--------------------------------------------------------------
void ofxCLEye::setZoom(int zoom){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setZoom():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(zoom < -500 || zoom > 500){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setZoom():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_ZOOM, zoom);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "ZOOM: " << zoom;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setZoom(): " << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
Пример #29
0
//--------------------------------------------------------------
void ofxCLEye::setRotation(int rotation){
	if(!initialized){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setRotation():" << OFX_CLEYE_GRABBER_ERROR;
		return;
	}

	if(rotation < -500 || rotation > 500){
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setRotation():" << OFX_CLEYE_INVALID_VALUE;
		return;
	}

	bool success = CLEyeSetCameraParameter(cam, CLEYE_ROTATION, rotation);
	if(success){
		ofLogVerbose(OFX_CLEYE_MODULE_NAME) << "ROTATION: " << rotation;
	}
	else{
		ofLogWarning(OFX_CLEYE_MODULE_NAME) << "setRotation(): " << OFX_CLEYE_SET_PROPERTY_ERROR;
	}
}
void EyeCameraCapture::SetCameraParameter(CLEyeCameraParameter param, int value) {
	if(!_cam) return;
	printf("CLEyeGetCameraParameter %d\n", CLEyeGetCameraParameter(_cam, (CLEyeCameraParameter)param));
	CLEyeSetCameraParameter(_cam, (CLEyeCameraParameter)param, value);
}