void QCamVesta::setWhiteBalanceMode(int val) { if (val == whiteBalanceMode_) { return; } if (val != PWC_WB_AUTO) { if ( val != PWC_WB_MANUAL) { whiteBalanceMode_=val; setWhiteBalance(); } whiteBalanceMode_=PWC_WB_AUTO; setWhiteBalance(); getWhiteBalance(); } if (guiBuild()) { if (val == PWC_WB_MANUAL || ( liveWhiteBalance_ && (val ==PWC_WB_AUTO))) { remoteCTRLWBred_->setEnabled(true); remoteCTRLWBblue_->setEnabled(true); } else { remoteCTRLWBred_->setEnabled(false); remoteCTRLWBblue_->setEnabled(false); } } whiteBalanceMode_=val; setWhiteBalance(); getWhiteBalance(); }
void ofxRPiCameraVideoGrabber::applyAllSettings() { setExposurePreset(exposurePreset); setMeteringType(meteringType); setAutoISO(autoISO); setISO(ISO); setAutoShutter(autoShutter); setShutterSpeed(shutterSpeed); setSharpness(sharpness); setContrast(contrast); setBrightness(brightness); setSaturation(saturation); setFrameStabilization(frameStabilization); setWhiteBalance(whiteBalance); setImageFilter(imageFilter); setColorEnhancement(false); //TODO implement setDRE(dreLevel); setSensorCrop(cropRectangle); setDigitalZoom(); setRotation(rotation); setMirror(mirror); setSoftwareSharpening(doDisableSoftwareSharpen); setSoftwareSaturation(doDisableSoftwareSaturation); applyExposure(__func__); //Requires gpio program provided via wiringPi //sudo apt-get install wiringpi ofFile gpioProgram("/usr/bin/gpio"); hasGPIOProgram = gpioProgram.exists(); if(hasGPIOProgram) { LED_PIN = getLEDPin(); stringstream command; command << "gpio export "; command << LED_PIN; command << " out"; if(system(command.str().c_str()) == 0) { //silence compiler warning } LED = true; setLEDState(LED); } }
void Colorduino::initWhiteBalance() { enum {N_COLORS = 3}; uint8_t colors[N_COLORS] = {}; for (int i = 0; i < N_COLORS; ++i) { colors[i] = eeprom_read_byte(mWhiteBalanceAddress+i); if (colors[i] > MAX_WHITE_BALANCE) { colors[i] = MAX_WHITE_BALANCE; } } setWhiteBalance(Color(colors[0],colors[1],colors[2]),0); }
OMX_ERRORTYPE ofxRPiCameraVideoGrabber::setWhiteBalance(string name) { return setWhiteBalance(GetWhiteBalance(name)); }
void QCamVesta::setWhiteBalanceBlue(int val) { whiteBalanceMode_ = PWC_WB_MANUAL; whiteBalanceBlue_=val; setWhiteBalance(); }
void DC1394Camera::init(core::ConfigNode config, uint64_t guid) { LOGGER.infoStream() << guid << ": Initializing camera "; m_guid = guid; // Grab our camera m_camera = dc1394_camera_new(s_libHandle, guid); if (!m_camera) { LOGGER.errorStream() << "Failed to initialize camera with guid: " << guid; assert(m_camera && "Couldn't initialize camera"); } // Determines settings and frame size dc1394error_t err = DC1394_FAILURE; dc1394video_mode_t videoMode = DC1394_VIDEO_MODE_640x480_RGB8; dc1394framerate_t frameRate = DC1394_FRAMERATE_15; // Check for the whitebalance feature dc1394feature_info_t whiteBalance; whiteBalance.id = DC1394_FEATURE_WHITE_BALANCE; err = dc1394_feature_get(m_camera, &whiteBalance); assert(DC1394_SUCCESS == err && "Could not get white balance feature info"); bool hasWhiteBalance = (whiteBalance.available == DC1394_TRUE); uint32_t uValue, vValue; if (hasWhiteBalance) { err = dc1394_feature_whitebalance_get_value(m_camera, &uValue, &vValue); LOGGER.infoStream() << m_guid << ": Current U: " << uValue << " V: " << vValue; } // Actually set the values if the user wants to if (config.exists("uValue") && config.exists("vValue")) { bool uAuto = boost::to_lower_copy(config["uValue"].asString("auto")) == "auto"; bool vAuto = boost::to_lower_copy(config["vValue"].asString("auto")) == "auto"; bool autoVal = uAuto && vAuto; if ((uAuto || vAuto) && !autoVal) { assert(false && "Both Whitebalance values must either be auto or manual"); } if (autoVal) { setWhiteBalance(0, 0, true); } else { // Read in config values uint32_t u_b_value = static_cast<uint32_t>(config["uValue"].asInt()); uint32_t v_r_value = static_cast<uint32_t>(config["vValue"].asInt()); // Set values setWhiteBalance(u_b_value, v_r_value); } } else if (config.exists("uValue") || config.exists("vValue")) { assert(false && "Must set both the U and V values for white balance"); } err = dc1394_feature_whitebalance_get_value(m_camera, &uValue, &vValue); LOGGER.infoStream() << m_guid << ": Set U: " << uValue << " V: " << vValue; if (config.exists("brightness")) { // Read in and set values if (boost::to_lower_copy(config["brightness"].asString("auto")) == "auto") { setBrightness(0, true); } else { uint32_t value = static_cast<uint32_t>(config["brightness"].asInt()); setBrightness(value); } } if (config.exists("exposure")) { // Read in and set values if (boost::to_lower_copy(config["exposure"].asString("auto")) == "auto") { setExposure(0, true); } else { uint32_t value = static_cast<uint32_t>(config["exposure"].asInt()); setExposure(value); } } // Grab image size err = dc1394_get_image_size_from_video_mode(m_camera, videoMode, &m_width, &m_height); assert(DC1394_SUCCESS == err && "Could not get image size"); float fRate; err = dc1394_framerate_as_float(frameRate, &fRate); assert(DC1394_SUCCESS == err && "Could not get framerate as float"); m_fps = fRate; // Setup the capture err = dc1394_video_set_iso_speed(m_camera, DC1394_ISO_SPEED_400); assert(DC1394_SUCCESS == err && "Could not set iso speed"); err = dc1394_video_set_mode(m_camera, videoMode); assert(DC1394_SUCCESS == err && "Could not set video mode"); err = dc1394_video_set_framerate(m_camera, frameRate); assert(DC1394_SUCCESS == err && "Could not set framerate"); // Start data transfer err = dc1394_video_set_transmission(m_camera, DC1394_ON); assert(DC1394_SUCCESS == err && "Could not start camera iso transmission"); err = dc1394_capture_setup(m_camera, DMA_BUFFER_SIZE, DC1394_CAPTURE_FLAGS_DEFAULT); assert(DC1394_SUCCESS == err && "Could not setup camera make sure" " that the video mode and framerate are supported by your camera"); }