ofxOpenCV dilate and erode - why no iterations function?

Is there a nice way of setting the number of iterations on a dilute or erode call in the ofxOpenCV library? Something like:

image.erode(5);

Or should I loop through the iterations and calls the function?

for(int i=0; i<5; ++i){
    image.erode();
}

look at the ofxOpenCV code.

erode() is actually just calling cvErode(cvImage, cvImageTemp, 0, 1);

the last input variable is number of iterations. You should be able to just up this if you want more iterations. You could probably alter “erode()” to handle this for you:

void ofxCvImage::erode(int _ni) {
if( !bAllocated ){
ofLogError(“ofxCvImage”) << “erode(): image not allocated”;
return;
}
cvErode( cvImage, cvImageTemp, 0, _ni );
swapTemp();
flagImageChanged();
}

haven’t tried it… but that’s where i’d start.