//Applies the requested filter to the corresponding source stream Mat* Filters::applyFilter(char s, Mat* src){ if(s == 't'){ return thresholdFilter(src); }else if(s == 'e'){ return erosionFilter(thresholdFilter(src)); }else if(s == 'i'){ return dilationFilter(erosionFilter(thresholdFilter(src))); }else{ return src; } };
float FostroDescriptor::calcPerimeter(FostroImage* image){ FostroErosionFilter erosionFilter(3,3); FostroImage* tmpImage = erosionFilter.applyFilter(image, GRAY); tmpImage->setFilePath("erosionPerim.png"); tmpImage->saveImage(); float erodedArea = calcArea(tmpImage); return (area - erodedArea); }