| 23 | #include <numeric> |
| 24 | |
| 25 | void IPLMorphologyBinary::init() |
| 26 | { |
| 27 | // init |
| 28 | _result = NULL; |
| 29 | |
| 30 | // basic settings |
| 31 | setClassName("IPLMorphologyBinary"); |
| 32 | setTitle("Binary Morphology"); |
| 33 | setCategory(IPLProcess::CATEGORY_MORPHOLOGY); |
| 34 | setOpenCVSupport(IPLOpenCVSupport::OPENCV_OPTIONAL); |
| 35 | |
| 36 | // default value |
| 37 | // 0 0 0 |
| 38 | // 0 1 0 |
| 39 | // 0 0 0 |
| 40 | int nrElements = 9; |
| 41 | _kernel.clear(); |
| 42 | for(int i=0; i<nrElements; i++) |
| 43 | { |
| 44 | _kernel.push_back((i==4 ? 1 : 0)); |
| 45 | } |
| 46 | |
| 47 | _operation = 0; |
| 48 | _iterations = 1; |
| 49 | |
| 50 | // inputs and outputs |
| 51 | addInput("Image", IPL_IMAGE_BW); |
| 52 | addOutput("Image", IPL_IMAGE_BW); |
| 53 | |
| 54 | // properties |
| 55 | addProcessPropertyVectorInt("kernel", "Kernel", "", _kernel, IPL_WIDGET_BINARY_MORPHOLOGY); |
| 56 | addProcessPropertyInt("iterations", "Iterations", |
| 57 | "Run the algorithm x times\nCaution: big kernels and too many iterations can take a long time to compute!", |
| 58 | _iterations, IPL_WIDGET_SLIDER, 1, 16); |
| 59 | addProcessPropertyInt("operation", "Operation:Dilate|Erode|Opening|Closing", "", _operation, IPL_WIDGET_RADIOBUTTONS); |
| 60 | } |
| 61 | |
| 62 | void IPLMorphologyBinary::destroy() |
| 63 | { |
nothing calls this directly
no test coverage detected