void S60CameraImageProcessingControl::setProcessingParameter(
    QCameraImageProcessingControl::ProcessingParameter parameter, QVariant value)
{
    switch (parameter) {
        case QCameraImageProcessingControl::Contrast:
            setContrast(value.toInt());
            break;
        case QCameraImageProcessingControl::Saturation:
            setSaturation(value.toInt());
            break;
        case QCameraImageProcessingControl::Brightness:
            setBrightness(value.toInt());
            break;
        case QCameraImageProcessingControl::Sharpening:
            if (isSharpeningSupported())
                setSharpeningLevel(value.toInt());
            break;
        case QCameraImageProcessingControl::Denoising:
            if (isDenoisingSupported())
                setDenoisingLevel(value.toInt());
            break;
        case QCameraImageProcessingControl::ColorTemperature:
            setManualWhiteBalance(value.toInt());
            break;

        default:
            break;
    }
}
Beispiel #2
0
int main(int argc, char *argv[])
{
	int mFd = open("/dev/fb0", O_RDWR);
	if (!strcmp(argv[1], "contrast")) {
		setContrast(mFd, atoi(argv[2]));
		printf("please enter a number (0 ~ 100)\n");
	}

	if (!strcmp(argv[1], "brightness")) {
		setBrightness(mFd, atoi(argv[2]));
		printf("please enter a number (0 ~ 100)\n");
	}

	if (!strcmp(argv[1], "hue")) {
		setHue(mFd, atoi(argv[2]));
		printf("please enter a number (0 ~ 100)\n");
	}

	if (!strcmp(argv[1], "saturation")) {
		setSaturation(mFd, atoi(argv[2]));
		printf("please enter a number (0 ~ 100)\n");
	}

	if (!strcmp(argv[1], "gamma")) {
		setGamma(mFd, atoi(argv[2]));
		printf("please enter a number (0 ~ 100)\n");
	}

	if (!strcmp(argv[1], "vee")) {
		setVee(mFd, atoi(argv[2]));
		printf("please enter a number (0 ~ 100)\n");
	}

	return 0;
}
Beispiel #3
0
void BCGFilter::filterImage()
{
    setGamma(d->settings.gamma);
    setBrightness(d->settings.brightness);
    setContrast(d->settings.contrast);
    applyBCG(m_orgImage);
    m_destImage = m_orgImage;
}
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 TImageSnapshot::showParams()
{
    QImage tempImg = wgt->image;
    if (manipulatorIsClosed) {
        manip = new ImageManipulator(QList<QVariant>()
                << imageParams.brightness
                << imageParams.contrast
                << wgt->imageTransform.rotate + serverValues[0]
                << imageParams.gamma
                << picMode->getLBorder()
                << picMode->getRBorder()
                << wgt->imageTransform.horFlip
                << wgt->imageTransform.verFlip
                << wgt->imageTransform.imageScale
                << picMode->_maxContrast
                << _timer
                << picMode->getPictureMode()
                << wgt->imageTransform.fullPictureMode
                << wgt->moveX
                << wgt->moveY
                << dimX / picMode->getDelimitr() << dimY,
                val16, tempImg);
        manip->setAttribute(Qt::WA_DeleteOnClose);
        manipulatorIsClosed = false;
        manip->setModal(true);

        connect(manip, SIGNAL(destroyed()), this, SLOT(manipDestroed()));
        connect(manip, SIGNAL(setBr(QVariant)), this, SLOT(setBrightness(QVariant)));
        connect(manip, SIGNAL(setCon(QVariant)), this, SLOT(setContrast(QVariant)));
        connect(manip, SIGNAL(setGm(QVariant)), this, SLOT(setGamma(QVariant)));
        connect(manip, SIGNAL(setLBorder(unsigned short)), this, SLOT(setLBorder(unsigned short)));
        connect(manip, SIGNAL(setRBorder(unsigned short)), this, SLOT(setRBorder(unsigned short)));
        connect(manip, SIGNAL(sendRotationVal(QVariant)), this, SLOT(setRotate(QVariant)));
        connect(manip, SIGNAL(sendHorFlipVal(QVariant)), this, SLOT(setHFlip(QVariant)));
        connect(manip, SIGNAL(sendVerFlipVal(QVariant)), this, SLOT(setVFlip(QVariant)));
        //connect(manip, SIGNAL(changeFormatOfColor(int)), this, SLOT(setImageType(int)));
        connect(manip, SIGNAL(changePictureModeSignal(int)), this, SLOT(setImageType(int)));
        connect(manip, SIGNAL(setTime(int)), this, SLOT(sendTimer(int)));
        connect(manip, SIGNAL(setScaleSignal(double)), this, SLOT(setScale(double)));
        connect(manip, SIGNAL(fullScreenMode(bool)), this, SLOT(setFullscreenMode(bool)));
        connect(manip, SIGNAL(getDataHistogram()), this, SLOT(drawHistogram()));

        connect(manip, SIGNAL(chPicX(int)), wgt, SLOT(setMoveX(int)));
        connect(manip, SIGNAL(chPicY(int)), wgt, SLOT(setMoveY(int)));
        connect(wgt, SIGNAL(showPictureSize(int, int, int, int)), manip, SLOT(setShowPicSize(int, int, int, int)));
        setImage(wgt->image);
        manip->show();
    }
}
void ofxRPiCameraVideoGrabber::setup(CameraState cameraState)
{
    setup(cameraState.cameraSettings);
    map<string, string> keyValueMap = cameraState.keyValueMap;
    for(auto iterator  = keyValueMap.begin(); iterator != keyValueMap.end(); iterator++) 
    {
        string key = iterator->first;
        string value = iterator->second;
        //ofLogVerbose(__func__) << "key: " << key << " value: " << value;

        if(key == "sharpness")  setSharpness(ofToInt(value));
        if(key == "contrast")   setContrast(ofToInt(value));
        if(key == "brightness") setBrightness(ofToInt(value));
        if(key == "saturation") setSaturation(ofToInt(value));
        if(key == "ISO")        setISO(ofToInt(value));
        if(key == "AutoISO")    setAutoISO(ofToBool(value));
        if(key == "DRE")        setDRE(ofToInt(value));
        if(key == "cropRectangle") 
        {
            vector<string> rectValues = ofSplitString(value, ",");
            if(rectValues.size() == 4)             
            {
                setSensorCrop(ofToInt(rectValues[0]),
                                            ofToInt(rectValues[1]),
                                            ofToInt(rectValues[2]),
                                            ofToInt(rectValues[3])); 
            }
        }
        if(key == "zoomLevelNormalized")    setZoomLevelNormalized(ofToFloat(value));
        if(key == "mirror")                 setMirror(value);
        if(key == "rotation")               setRotation(ofToInt(value));
        if(key == "imageFilter")            setImageFilter(value);
        if(key == "exposurePreset")         setExposurePreset(value);
        if(key == "evCompensation")         setEvCompensation(ofToInt(value));
        if(key == "autoShutter")            setAutoShutter(ofToBool(value));
        if(key == "shutterSpeed")           setShutterSpeed(ofToInt(value));
        if(key == "meteringType")           setMeteringType(value);
        
        if(key == "SoftwareSaturationEnabled") setSoftwareSaturation(ofToBool(value));
        if(key == "SoftwareSharpeningEnabled") setSoftwareSharpening(ofToBool(value));
    }
}
int GStreamerPlayer::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 13)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 13;
    } else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
        if (_id < 13)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 13;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< int*>(_v) = getBrightness(); break;
        case 1: *reinterpret_cast< int*>(_v) = getContrast(); break;
        case 2: *reinterpret_cast< int*>(_v) = getHue(); break;
        case 3: *reinterpret_cast< int*>(_v) = getSaturation(); break;
        case 4: *reinterpret_cast< bool*>(_v) = getPlaying(); break;
        case 5: *reinterpret_cast< bool*>(_v) = getPaused(); break;
        case 6: *reinterpret_cast< bool*>(_v) = getStopped(); break;
        default: break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setBrightness(*reinterpret_cast< int*>(_v)); break;
        case 1: setContrast(*reinterpret_cast< int*>(_v)); break;
        case 2: setHue(*reinterpret_cast< int*>(_v)); break;
        case 3: setSaturation(*reinterpret_cast< int*>(_v)); break;
        case 4: setPlaying(*reinterpret_cast< bool*>(_v)); break;
        case 5: setPaused(*reinterpret_cast< bool*>(_v)); break;
        case 6: setStopped(*reinterpret_cast< bool*>(_v)); break;
        default: break;
        }
        _id -= 7;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 7;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 7;
    } else if (_c == QMetaObject::RegisterPropertyMetaType) {
        if (_id < 7)
            *reinterpret_cast<int*>(_a[0]) = -1;
        _id -= 7;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
void NewhavenDisplay::setContrastDefault()
{
  setContrast(CONTRAST_PERCENT_DEFAULT);
}
void Handler(void *CallBackRef, u32 Event, unsigned int EventData)
{
	/*
	 * All of the data has been sent
	 */
	if (Event == XUARTPS_EVENT_SENT_DATA);

	/*
	 * All of the data has been received
	 */
	if (Event == XUARTPS_EVENT_RECV_DATA) {
		XUartPs_Recv(&Uart_Ps, uartBuffer, UART_BUFFER_SIZE);
		//XUartPs_Send(&Uart_Ps, RecvBuffer, TEST_BUFFER_SIZE);
		if(uartBuffer[2] == 0x41){//Up Arrow: 1B 5B 41
			if(contrast != 8)
				contrast++;
		}
		if(uartBuffer[2] == 0x42){//Down Arrow: 1B 5B 42
			if(contrast != 0)
				contrast--;
		}
		if(uartBuffer[2] == 0x43){//Right Arrow: 1B 5B 43
			roadPosition++;
		}
		if(uartBuffer[2] == 0x44){//Left Arrow: 1B 5B 44
			roadPosition--;
		}
		setContrast();


	}

	/*
	 * Data was received, but not the expected number of bytes, a
	 * timeout just indicates the data stopped for 8 character times
	 */
	if (Event == XUARTPS_EVENT_RECV_TOUT){
		XUartPs_Recv(&Uart_Ps, uartBuffer, UART_BUFFER_SIZE);
		//Letter characters received are ascii
		//w and s used to increase and shrink the size of the road
		XUartPs_Send(&Uart_Ps, uartBuffer, 1);
		switch(uartBuffer[0]){
		case 0x77://w: 0x77
			roadSizeRight++;
			break;
		case 0x73://s: 0x73
			roadSizeRight--;
			break;
		case 0x71://q: 0x71
			roadSizeLeft++;
			break;
		case 0x61://a: 0x61
			roadSizeLeft--;
			break;
		case 0x63://c: 0x63
			calibrate = !calibrate;
			break;
		case 0x74://t: 0x74
			if( blanking_position < 15)
				blanking_position++;
			setThreshold();
			break;
		case 0x67://g: 0x67
			if(blanking_position > 0)
				blanking_position--;
			setThreshold();
			break;
		case 0x31://1: 0x31
			cross_row = 0;
			break;
		case 0x32://2: 0x32
			start_blink = 1;
			break;
		case 0x33://3: 0x33
			schl_xing_row = 0;
			break;
		case 0x72://r: 0x72
			start_recording = 1;
			break;
		case 0x70://p 0x70
			playback_idx = 0;
			break;
		case 0x65://e 0x65
			if(frameRateSelect < 3)
				frameRateSelect++;
			framerate = FRAME_RATE_VALS[frameRateSelect];
			printf("Framerate: %f", framerate);
			break;
		case 0x64://d
			if(frameRateSelect > 0)
				frameRateSelect--;
			framerate = FRAME_RATE_VALS[frameRateSelect];
			printf("Framerate: %f", framerate);
			break;
		case 0x79://y
			road_vert_pos--;
			break;
		case 0x68://h
			road_vert_pos++;
			break;
		}
	}


	/*
	 * Data was received with an error, keep the data but determine
	 * what kind of errors occurred
	 */
	if (Event == XUARTPS_EVENT_RECV_ERROR);
}