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:


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

for(int i=0; i<5; ++i){

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”;
cvErode( cvImage, cvImageTemp, 0, _ni );

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