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;
    }
}
Exemple #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;
}
Exemple #3
0
void HSLFilter::filterImage()
{
    setHue(d->settings.hue);
    setSaturation(d->settings.saturation);
    setLightness(d->settings.lightness);
    applyHSL(m_orgImage);
    m_destImage = m_orgImage;
}
Exemple #4
0
void RenderParams::update(ConstCDLOpDataRcPtr & cdl)
{
    double slope[4], offset[4], power[4];
    cdl->getSlopeParams().getRGBA(slope);
    cdl->getOffsetParams().getRGBA(offset);
    cdl->getPowerParams().getRGBA(power);

    const float saturation = (float)cdl->getSaturation();
    const CDLOpData::Style style = cdl->getStyle();

    m_isReverse
        = (style == CDLOpData::CDL_V1_2_REV)
        || (style == CDLOpData::CDL_NO_CLAMP_REV);

    m_isNoClamp
        = (style == CDLOpData::CDL_NO_CLAMP_FWD)
        || (style == CDLOpData::CDL_NO_CLAMP_REV);

    if (isReverse())
    {
        // Reverse render parameters
        setSlope(Reciprocal((float)slope[0]),
                 Reciprocal((float)slope[1]),
                 Reciprocal((float)slope[2]),
                 Reciprocal((float)slope[3]));
   
        setOffset((float)-offset[0], (float)-offset[1], (float)-offset[2], (float)-offset[3]);
   
        setPower(Reciprocal((float)power[0]),
                 Reciprocal((float)power[1]),
                 Reciprocal((float)power[2]),
                 Reciprocal((float)power[3]));
       
        setSaturation(Reciprocal(saturation));
    }
    else
    {
        // Forward render parameters
        setSlope((float)slope[0], (float)slope[1], (float)slope[2], (float)slope[3]);
        setOffset((float)offset[0], (float)offset[1], (float)offset[2], (float)offset[3]);
        setPower((float)power[0], (float)power[1], (float)power[2], (float)power[3]);
        setSaturation(saturation);
    }
}
Exemple #5
0
    HueColorMap( int formatType ):
        QwtHueColorMap( QwtColorMap::Indexed )
    {
        setFormat( ( QwtColorMap::Format ) formatType );

        //setHueInterval( 240, 60 );
        //setHueInterval( 240, 420 );
        setHueInterval( 0, 359 );
        setSaturation( 150 );
        setValue( 200 );
    }
WindowPaintData::WindowPaintData(EffectWindow* w)
    : PaintData()
    , shader(NULL)
    , d(new WindowPaintDataPrivate())
{
    quads = w->buildQuads();
    setOpacity(w->opacity());
    setDecorationOpacity(1.0);
    setSaturation(1.0);
    setBrightness(1.0);
}
Exemple #7
0
WindowPaintData::WindowPaintData(EffectWindow* w)
    : PaintData()
    , shader(nullptr)
    , d(new WindowPaintDataPrivate())
{
    quads = w->buildQuads();
    setOpacity(w->opacity());
    setDecorationOpacity(1.0);
    setSaturation(1.0);
    setBrightness(1.0);
    setScreen(0);
    setCrossFadeProgress(1.0);
}
Exemple #8
0
WindowPaintData::WindowPaintData(EffectWindow* w, const QMatrix4x4 &screenProjectionMatrix)
    : PaintData()
    , shader(nullptr)
    , d(new WindowPaintDataPrivate())
{
    d->screenProjectionMatrix = screenProjectionMatrix;
    quads = w->buildQuads();
    setOpacity(w->opacity());
    setSaturation(1.0);
    setBrightness(1.0);
    setScreen(0);
    setCrossFadeProgress(1.0);
}
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);
    } 
}
WindowPaintData::WindowPaintData(const WindowPaintData &other)
    : PaintData()
    , quads(other.quads)
    , shader(other.shader)
    , d(new WindowPaintDataPrivate())
{
    setXScale(other.xScale());
    setYScale(other.yScale());
    setZScale(other.zScale());
    translate(other.translation());
    setRotationOrigin(other.rotationOrigin());
    setRotationAxis(other.rotationAxis());
    setRotationAngle(other.rotationAngle());
    setOpacity(other.opacity());
    setDecorationOpacity(other.decorationOpacity());
    setSaturation(other.saturation());
    setBrightness(other.brightness());
}
void QgsHueSaturationFilter::readXml( const QDomElement& filterElem )
{
  if ( filterElem.isNull() )
  {
    return;
  }

  setSaturation( filterElem.attribute( QStringLiteral( "saturation" ), QStringLiteral( "0" ) ).toInt() );
  mGrayscaleMode = ( QgsHueSaturationFilter::GrayscaleMode )filterElem.attribute( QStringLiteral( "grayscaleMode" ), QStringLiteral( "0" ) ).toInt();

  mColorizeOn = ( bool )filterElem.attribute( QStringLiteral( "colorizeOn" ), QStringLiteral( "0" ) ).toInt();
  int mColorizeRed = filterElem.attribute( QStringLiteral( "colorizeRed" ), QStringLiteral( "255" ) ).toInt();
  int mColorizeGreen = filterElem.attribute( QStringLiteral( "colorizeGreen" ), QStringLiteral( "128" ) ).toInt();
  int mColorizeBlue = filterElem.attribute( QStringLiteral( "colorizeBlue" ), QStringLiteral( "128" ) ).toInt();
  setColorizeColor( QColor::fromRgb( mColorizeRed, mColorizeGreen, mColorizeBlue ) );
  mColorizeStrength = filterElem.attribute( QStringLiteral( "colorizeStrength" ), QStringLiteral( "100" ) ).toInt();

}
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));
    }
}
    void assign(const FluidState& fs)
    {
        if (enableTemperature || enableEnergy)
            setTemperature(fs.temperature(/*phaseIdx=*/0));

        unsigned pvtRegionIdx = getPvtRegionIndex_<FluidState>(fs);
        setPvtRegionIndex(pvtRegionIdx);
        setRs(Opm::BlackOil::getRs_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx));
        setRv(Opm::BlackOil::getRv_<FluidSystem, FluidState, Scalar>(fs, pvtRegionIdx));

        for (unsigned phaseIdx = 0; phaseIdx < numPhases; ++phaseIdx) {
            setSaturation(phaseIdx, fs.saturation(phaseIdx));
            setPressure(phaseIdx, fs.pressure(phaseIdx));
            setDensity(phaseIdx, fs.density(phaseIdx));

            if (enableEnergy)
                setEnthalpy(phaseIdx, fs.enthalpy(phaseIdx));

            setInvB(phaseIdx, getInvB_<FluidSystem, FluidState, Scalar>(fs, phaseIdx, pvtRegionIdx));
        }
    }
Exemple #14
0
WindowPaintData::WindowPaintData(const WindowPaintData &other)
    : PaintData()
    , quads(other.quads)
    , shader(other.shader)
    , d(new WindowPaintDataPrivate())
{
    setXScale(other.xScale());
    setYScale(other.yScale());
    setZScale(other.zScale());
    translate(other.translation());
    setRotationOrigin(other.rotationOrigin());
    setRotationAxis(other.rotationAxis());
    setRotationAngle(other.rotationAngle());
    setOpacity(other.opacity());
    setSaturation(other.saturation());
    setBrightness(other.brightness());
    setScreen(other.screen());
    setCrossFadeProgress(other.crossFadeProgress());
    setProjectionMatrix(other.projectionMatrix());
    setModelViewMatrix(other.modelViewMatrix());
    d->screenProjectionMatrix = other.d->screenProjectionMatrix;
}
Exemple #15
0
// Default constructor.
HSIColor::HSIColor(void) {
  setHue(0);
  setSaturation(0);
  setIntensity(0);
}
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;
}
Exemple #17
0
int main(int argc, char **argv) {

    int commandArgs = 1;
    int i;
    char x;
    char performContrast = 0;
    char fft_filename[FILENAME_LENGTH];
    char cdf_filename[FILENAME_LENGTH];
    char histo_filename[FILENAME_LENGTH];
    float contrastLow = 0.0;
    float contrastHigh = 0.0;
    float highpasslevel;
    float lowpasslevel;
    float percentCorrupt;
    float sigma;
    float brightness;
    float sat;
    int m;
    int replaceWithM;
    int performHistogram = 0;
    int performCDF = 0;
    int performFFT = 0;
    int performVectorMedianFilter = 0;
    int performMedianFilter = 0;
    int performMeanFilter = 0;
    int performSpacialFilter = 0;
    int performLevelSlicing = 0;
    int performEqualize = 0;
    int performColorScale = 0;
    int performSpatialReduceWidth  = 0;
    int performSpatialReduceHeigth = 0;
    int performHighpass = 0;
    int performLowpass = 0;
    int performComponentMedianFilter = 0;
    int performVectorOrderStatistic = 0;
    int performVectorSpacialOrderStatistic = 0;
    int performVectorMedianOrderStatistic = 0;
    int performMinkowskiAddition = 0;
    int performMinkowskiSubtraction = 0;
    int performMinkowskiOpening = 0;
    int performMinkowskiClosing = 0;
    int performEdgeDetectOne = 0;
    int performEdgeDetectTwo = 0;
    int performEdgeDetectThree = 0;
    int performEdgeDetectFour = 0;
    int performAddGaussianNoise = 0;
    int performAddSaltPepperNoise = 0;
    int performSetBrightness = 0;
    int performSetSaturation = 0;
    int performBrightFilter = 0;
    int imageWriteNecessary = 0;
    int maskwidth = 0;
    int maskheight = 0;
    int maskrepeat = 0;
    FILE *in = stdin;
    FILE *out = stdout;
    struct portImage *pi;

    if (argc < 3) {
        printf("\n");
        printf("  Usage: %s [inputFile] ([outputFile]) [option] ([option] ...)\n", argv[0]);
        printf("\n");
        printf("  InputFile: Either a filename or '-' for stdin.\n");
        printf("  OutputFile: Either a filename or '-' for stdout. (Not needed if no output necessary.)\n");
        printf("\n");
        printf("  Options:\n");
        printf("  -ghisto FILENAME       Graph Histogram\n");
        printf("  -gcdf FILENAME         Graph Cumulative Distribution\n");
        printf("  -gfft FILENAME         Graph FFT plot\n");
        printf("  -color n               Reduce color scale to n\n");
        printf("  -spatial WIDTH-HEIGHT  Perform spacial reduction to Width and Height\n");
        printf("  -level n               Perform level slicing from graylevel n to graylevel n+10\n");
        printf("  -con LOW-HIGH          Scale image contrast from LOW graylevel percentage to HIGH graylevel percentage\n");
        printf("  -equ                   Histogram Eqaulization\n");
        printf("  -medianf n             Simple Median Filter of window size n*n\n");
        printf("  -meanf n               Simple Mean Filter of window size n*n\n");
        printf("  -cmf n                 Component Median Filter of window size n*n\n");
        printf("  -vmf n                 Vector Median Filter of window n*n\n");
        printf("  -sf                    Spacial Filter\n");
        printf("  -vos n v               Vector Order Stat of window size n*n and value v\n");
        printf("  -vmos n m [01]         Vector Median Order Stat of window size n*n, m threshold, and 0 or 1(True) replace with m\n");
        printf("  -vsos n m [01]         Vector Spacial Order Stat of window size n*n, m threshold, and 0 or 1(True) replace with m\n");
        printf("  -brightf n             Perform an Brightness filter using HSV colorspace on size n*n window.\n");
        printf("  -bright %%              Set brightness to %% percent\n");
        printf("  -sat %%                 Set saturation to %% percent\n");
        printf("  -hp %%                  Highpass filter of %% percent\n");
        printf("  -lp %%                  Lowpass filter of %% percent\n");
        printf("  -ma NxM R              Perform Minkowski Addition using NxM mask, repeated R times.\n");
        printf("  -ms NxM R              Perform Minkowski Subtraction using NxM mask, repeated R times.\n");
        printf("  -mo NxM R              Perform Minkowski Opening using NxM mask, repeated R times.\n");
        printf("  -mc NxM R              Perform Minkowski Closing using NxM mask, repeated R times.\n");
        printf("  -e1                    Perform Edge Detection using X/(X – B)\n");
        printf("  -e2                    Perform Edge Detection using (X + B)/X\n");
        printf("  -e3                    Perform Edge Detection using [(X+B)/(X-B)]-B\n");
        printf("  -e4 n                  Experimental Edge Detection on Color Images using n*n window.\n");
        printf("  -noiseG p s            Add Gaussian noise to p (0 to 1 floating) percent of image with s sigma noise.\n");
        printf("  -noiseSP p             Add Salt and Pepper noise to p (0 to 1 floating) percent of image.\n");
        printf("\n");
        return(1);
    }

    if (strcmp(argv[commandArgs], "-") != 0) {
        in = fopen(argv[1],"r");

        if (in == NULL) {
            fprintf(stderr, "File '%s' failed to open for reading.\n", argv[1]);
            exit(1);
        }
    }
    commandArgs++;

    if (strcmp(argv[commandArgs], "-") != 0 && argv[commandArgs][0] != '-') {
        commandArgs++;
        out = fopen(argv[2],"w");

        if (out == NULL) {
            fprintf(stderr, "File '%s' failed to open for writing.\n", argv[2]);
            exit(1);
        }
    }

    for (; commandArgs < argc; commandArgs++) {
        if (strcmp(argv[commandArgs], "-color") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &performColorScale);
        }

        if (strcmp(argv[commandArgs], "-spatial") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d%c%d", &performSpatialReduceWidth, &x, &performSpatialReduceHeigth);
        }

        if (strcmp(argv[commandArgs], "-level") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &performLevelSlicing);
        }

        if (strcmp(argv[commandArgs], "-con") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%f%c%f", &contrastLow, &performContrast, &contrastHigh);
        }

        if (strcmp(argv[commandArgs], "-vos") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &performVectorOrderStatistic);
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &m);
        }

        if (strcmp(argv[commandArgs], "-vmf") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &performVectorMedianFilter);
        }

        if (strcmp(argv[commandArgs], "-sf") == 0) {
            imageWriteNecessary = 1;
            performSpacialFilter = 1;
        }

        if (strcmp(argv[commandArgs], "-vmos") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &performVectorMedianOrderStatistic);
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &m);
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &replaceWithM);
        }

        if (strcmp(argv[commandArgs], "-vsos") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &performVectorSpacialOrderStatistic);
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &m);
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &replaceWithM);
        }

        if (strcmp(argv[commandArgs], "-cmf") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &performComponentMedianFilter);
        }

        if (strcmp(argv[commandArgs], "-medianf") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &performMedianFilter);
        }

        if (strcmp(argv[commandArgs], "-meanf") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &performMeanFilter);
        }

        if (strcmp(argv[commandArgs], "-equ") == 0) {
            imageWriteNecessary = 1;
            performEqualize = 1;
        }

        if (strcmp(argv[commandArgs], "-hp") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            performHighpass = 1;
            sscanf(argv[commandArgs], "%f", &highpasslevel);
        }

        if (strcmp(argv[commandArgs], "-lp") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            performLowpass = 1;
            sscanf(argv[commandArgs], "%f", &lowpasslevel);
        }

        if (strcmp(argv[commandArgs], "-brightf") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &performBrightFilter);
        }

       if (strcmp(argv[commandArgs], "-bright") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            performSetBrightness = 1;
            sscanf(argv[commandArgs], "%f", &brightness);
        }

        if (strcmp(argv[commandArgs], "-sat") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            performSetSaturation = 1;
            sscanf(argv[commandArgs], "%f", &sat);
        }

        if (strcmp(argv[commandArgs], "-ghisto") == 0) {
            commandArgs++;
            performHistogram = 1;
            strncpy(histo_filename, argv[commandArgs], FILENAME_LENGTH);
        }

        if (strcmp(argv[commandArgs], "-gcdf") == 0) {
            commandArgs++;
            performCDF = 1;
            strncpy(cdf_filename, argv[commandArgs], FILENAME_LENGTH);
        }

        if (strcmp(argv[commandArgs], "-gfft") == 0) {
            commandArgs++;
            performFFT = 1;
            strncpy(fft_filename, argv[commandArgs], FILENAME_LENGTH);
        }

        if (strcmp(argv[commandArgs], "-ma") == 0) {
            imageWriteNecessary = 1;
            performMinkowskiAddition = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d%c%d", &maskwidth, &x, &maskheight);
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &maskrepeat);
        }

        if (strcmp(argv[commandArgs], "-ms") == 0) {
            imageWriteNecessary = 1;
            performMinkowskiSubtraction = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d%c%d", &maskwidth, &x, &maskheight);
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &maskrepeat);
        }

        if (strcmp(argv[commandArgs], "-mo") == 0) {
            imageWriteNecessary = 1;
            performMinkowskiOpening = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d%c%d", &maskwidth, &x, &maskheight);
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &maskrepeat);
        }

        if (strcmp(argv[commandArgs], "-mc") == 0) {
            imageWriteNecessary = 1;
            performMinkowskiClosing = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d%c%d", &maskwidth, &x, &maskheight);
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &maskrepeat);
        }

        if (strcmp(argv[commandArgs], "-e1") == 0) {
            imageWriteNecessary = 1;
            performEdgeDetectOne = 1;
        }

        if (strcmp(argv[commandArgs], "-e2") == 0) {
            imageWriteNecessary = 1;
            performEdgeDetectTwo = 1;
        }

        if (strcmp(argv[commandArgs], "-e3") == 0) {
            imageWriteNecessary = 1;
            performEdgeDetectThree = 1;
        }

        if (strcmp(argv[commandArgs], "-e4") == 0) {
            imageWriteNecessary = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%d", &performEdgeDetectFour);
        }

        if (strcmp(argv[commandArgs], "-noiseG") == 0) {
            imageWriteNecessary = 1;
            performAddGaussianNoise = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%f", &percentCorrupt);
            commandArgs++;
            sscanf(argv[commandArgs], "%f", &sigma);
        }

        if (strcmp(argv[commandArgs], "-noiseSP") == 0) {
            imageWriteNecessary = 1;
            performAddSaltPepperNoise = 1;
            commandArgs++;
            sscanf(argv[commandArgs], "%f", &percentCorrupt);
        }
    }

    pi = readImage(in);

    if (performHighpass || performLowpass || performFFT) {
        FFT2D(pi);
        if (performHighpass)  highpass(pi, highpasslevel);
        if (performLowpass)   lowpass(pi, lowpasslevel);
        if (performFFT)       graph_fftlogplot(pi, fft_filename);
        IFFT2D(pi);
    }

    if (performEdgeDetectOne || performEdgeDetectTwo || performEdgeDetectThree ||
        performMinkowskiAddition || performMinkowskiSubtraction || performMinkowskiOpening || performMinkowskiClosing)
        thresholdImage(pi);

    if (performAddGaussianNoise)             addGaussianNoise(pi, percentCorrupt, sigma);
    if (performAddSaltPepperNoise)           addSaltPepperNoise(pi, percentCorrupt);
    if (performMedianFilter)                 simpleMedianFilter(pi, performMedianFilter);
    if (performMeanFilter)                   simpleMeanFilter(pi, performMeanFilter);
    if (performComponentMedianFilter)        componentMedianFilter(pi, performComponentMedianFilter);
    if (performVectorOrderStatistic)         vectorOrderStatistic(pi, performVectorOrderStatistic, m);
    if (performVectorSpacialOrderStatistic)  vectorSpacialOrderStatistic(pi, performVectorSpacialOrderStatistic, m, replaceWithM);
    if (performVectorMedianOrderStatistic)   vectorMedianOrderStatistic(pi, performVectorMedianOrderStatistic, m, replaceWithM);
    if (performVectorMedianFilter)           vectorMedianFilter(pi, performVectorMedianFilter);
    if (performSpacialFilter)                spacialFilter(pi);
    if (performBrightFilter)                 HSV_ValueFilter(pi, performBrightFilter);
    if (performColorScale)                   scale_reduce(pi,performColorScale);
    if (performSetBrightness)                setBrightness(pi,brightness);
    if (performSetSaturation)                setSaturation(pi,sat);
    if (performSpatialReduceWidth)           spacial_reduce(pi,performSpatialReduceWidth, performSpatialReduceHeigth);
    if (performContrast)                     contrast_stretching(pi, contrastLow, contrastHigh);
    if (performLevelSlicing)                 level_slice(pi, performLevelSlicing);
    if (performEqualize)                     equalize(pi);
    if (performHistogram)                    graph_histogram(pi, histo_filename);
    if (performCDF)                          graph_cdf(pi, cdf_filename);

    if (performMinkowskiAddition)
        for (i = 0; i < maskrepeat; i++)
            minkowskiAddition(pi, maskwidth, maskheight);

    if (performMinkowskiSubtraction)
        for (i = 0; i < maskrepeat; i++)
            minkowskiSubtraction(pi, maskwidth, maskheight);

    if (performMinkowskiOpening)
        for (i = 0; i < maskrepeat; i++)
            minkowskiOpening(pi, maskwidth, maskheight);

    if (performMinkowskiClosing)
        for (i = 0; i < maskrepeat; i++)
            minkowskiClosing(pi, maskwidth, maskheight);

    if (performEdgeDetectOne) {
        struct portImage *pc = copyImage(pi);
        imageWriteNecessary = 1;

        minkowskiSubtraction(pc, 3, 3);
        minkowskiDivision(pi, pc);

        freeImage(pc);
    }

    if (performEdgeDetectTwo) {
        struct portImage *pc = copyImage(pi);
        imageWriteNecessary = 1;

        minkowskiAddition(pi, 3, 3);
        minkowskiDivision(pi, pc);

        freeImage(pc);
    }

    if (performEdgeDetectThree) {
        struct portImage *pd = copyImage(pi);
        maskrepeat = 3;
        imageWriteNecessary = 1;

        for (i = 0; i < maskrepeat; i++) {
            minkowskiAddition(pi, 3, 3);
            minkowskiSubtraction(pd, 3, 3);
        }

        minkowskiDivision(pi, pd);
        minkowskiSubtraction(pi, 3, 3);

        freeImage(pd);
    }

    if (imageWriteNecessary)
        writeImage(pi, out);

    freeImage(pi);
    if (in  != stdin)  fclose(in);
    if (out != stdout) fclose(out);
    return 0;
} /* End Main */
Exemple #18
0
void HSIColor::setHSI(float hue, float saturation, float intensity) {
  setHue(hue);
  setSaturation(saturation);
  setIntensity(intensity);
}