////////////////////////////////////////////////////////////////////////////////// // setOptimalCameraTiming -------------------------------------------------------- ////////////////////////////////////////////////////////////////////////////////// int ofxUeye::setColorCorrection(double factor){ _colorCorrection = factor; if(_colorCorrection < getColorCorrectionMin()) _colorCorrection = getColorCorrectionMin(); else if(_colorCorrection > getColorCorrectionMax()) _colorCorrection = getColorCorrectionMax(); if(_colorCorrection==0) return is_SetColorCorrection(m_hCam, IS_CCOR_DISABLE, &_colorCorrection); else return is_SetColorCorrection(m_hCam, IS_CCOR_ENABLE_NORMAL, &_colorCorrection); }
static int ids_core_Camera_setcolor_correction(ids_core_Camera *self, PyObject *value, void *closure) { int ret; double factor; PyObject *exception; if (value == NULL) { PyErr_SetString(PyExc_TypeError, "Cannot delete attribute 'color_correction'"); return -1; } /* Disable color correction */ if (value == Py_False) { ret = is_SetColorCorrection(self->handle, IS_CCOR_DISABLE, &factor); switch (ret) { case IS_SUCCESS: return 0; default: raise_general_error(self, ret); return -1; } } factor = PyFloat_AsDouble(value); exception = PyErr_Occurred(); if (exception) { PyErr_SetString(exception, "Color correction factor must be a number, or False to disable"); return -1; } ret = is_SetColorCorrection(self->handle, IS_CCOR_SET_IR_AUTOMATIC, &factor); switch (ret) { case IS_SUCCESS: return 0; case IS_INVALID_PARAMETER: PyErr_SetString(PyExc_ValueError, "Color correction factor out of range (0 to 1)"); break; default: raise_general_error(self, ret); return -1; } return -1; }
static PyObject *ids_core_Camera_getcolor_correction(ids_core_Camera *self, void *closure) { double factor; int ret; ret = is_SetColorCorrection(self->handle, IS_GET_CCOR_MODE, &factor); switch (ret) { case IS_CCOR_ENABLE_NORMAL: case IS_CCOR_ENABLE_BG40_ENHANCED: case IS_CCOR_ENABLE_HQ_ENHANCED: Py_INCREF(Py_True); return Py_True; case IS_CCOR_DISABLE: Py_INCREF(Py_False); return Py_False; default: raise_general_error(self, ret); return NULL; } }