void IPLMorphologyHitMiss::init()
{
    // init
    _result = NULL;

    // basic settings
    setClassName("IPLMorphologyHitMiss");
    setTitle("Hit-Miss Morphology");
    setCategory(IPLProcess::CATEGORY_MORPHOLOGY);

    // default value
    // 0 0 0
    // 0 1 0
    // 0 0 0
    int nrElements = 9;
    _kernel.clear();
    for(int i=0; i<nrElements; i++)
    {
        _kernel.push_back((i==4 ? 1 : 0));
    }

    // inputs and outputs
    addInput("Image", IPL_IMAGE_BW);
    addOutput("Image", IPL_IMAGE_BW);

    // properties
    addProcessPropertyVectorInt("kernel", "Kernel", "", _kernel, IPL_WIDGET_BINARY_MORPHOLOGY_TRISTATE);
}
void IPLConvolutionFilter::init()
{
    // init
    _result     = NULL;
    _offset     = 0;
    _divisor    = 0;
    _borders    = 0;
    _kernel.clear();

    // basic settings
    setClassName("IPLConvolutionFilter");
    setTitle("2D Convolution");
    setKeywords("filter");
    setCategory(IPLProcess::CATEGORY_LOCALOPERATIONS);
    setDescription("Convolution of a kernel with image.");
    setOpenCVSupport(IPLOpenCVSupport::OPENCV_OPTIONAL);

    // default values
    // 0 0 0
    // 0 1 0
    // 0 0 0
    int nrElements = 9;
    for(int i=0; i<nrElements; i++)
    {
        // set the center to 1, all others to 0
        _kernel.push_back(i == nrElements/2 ? 1 : 0);
    }

    // inputs and outputs
    addInput("Image", IPLData::IMAGE_COLOR);
    addOutput("Image", IPLData::IMAGE_COLOR);

    // properties
    addProcessPropertyVectorInt("kernel", "Kernel", "", _kernel, IPL_WIDGET_KERNEL);
    addProcessPropertyBool("normalize", "Normalize", "Divisor is computed automatically", true, IPL_WIDGET_CHECKBOXES);
    addProcessPropertyInt("divisor", "Divisor", "", 1, IPL_WIDGET_SLIDER, 1, 512);
    addProcessPropertyDouble("offset", "Offset", "", 0.0, IPL_WIDGET_SLIDER, -1.0, 1.0);
    addProcessPropertyInt("borders", "Borders:Crop|Extend|Wrap", "Wrap is not available under OpenCV.", 0, IPL_WIDGET_RADIOBUTTONS, 0, 0);
}
Example #3
0
void IPLMorphologyBinary::init()
{
    // init
    _result = NULL;

    // basic settings
    setClassName("IPLMorphologyBinary");
    setTitle("Binary Morphology");
    setCategory(IPLProcess::CATEGORY_MORPHOLOGY);
    setOpenCVSupport(IPLOpenCVSupport::OPENCV_OPTIONAL);

    // default value
    // 0 0 0
    // 0 1 0
    // 0 0 0
    int nrElements = 9;
    _kernel.clear();
    for(int i=0; i<nrElements; i++)
    {
        _kernel.push_back((i==4 ? 1 : 0));
    }

    _operation = 0;
    _iterations = 1;

    // inputs and outputs
    addInput("Image", IPLImage::IMAGE_BW);
    addOutput("Image", IPLImage::IMAGE_BW);

    // properties
    addProcessPropertyVectorInt("kernel", "Kernel", "", _kernel, IPL_WIDGET_BINARY_MORPHOLOGY);
    addProcessPropertyInt("iterations", "Iterations",
                          "Run the algorithm x times\nCaution: big kernels and too many iterations can take a long time to compute!",
                          _iterations, IPL_WIDGET_SLIDER, 1, 16);
    addProcessPropertyInt("operation", "Operation:Dilate|Erode|Opening|Closing", "", _operation, IPL_WIDGET_RADIOBUTTONS);
}