I tried to remove rebox using ofxCV's InPaint()

Hi, All.

I tried to remove redbox using ofxCV’s InPaint() .


first: original redbox image & HSV slider panel
2nd: inRange() mask from HSV slider value
3rd: removed result.

As above, I well select the redBox, but not removed --;
What’s wrong to me?

//--------------------------------------------------------------
void ofApp::setup(){

gui.setup();
// init value, value range
gui.add(hue.setup("Hue", 90, 10, 169));
gui.add(sat.setup("Saturation", 128, 50, 205));
gui.add(val.setup("Value", 128, 50, 205));

before.load("/Users/kerbal/Desktop/crack.jpg");

src = toCv(before);

// RGB to HSV
cvtColor(src, src_hsv, COLOR_RGB2HSV);

}

//--------------------------------------------------------------
void ofApp::update(){

// make mask
Mat mask, mask2;
inRange(src_hsv, Scalar(hue-10, sat-50, val-50), Scalar(hue+10, sat+50, val+50), mask);
toOf(mask, ofmask);

// dilate mask
dilate(mask, mask2, Mat());
toOf(mask2, ofmask2);
// inpainting
Mat dst;
inpaint(src, mask2, dst, 3, INPAINT_TELEA);

toOf(dst, after);
ofmask.update();
ofmask2.update();
after.update();

}

//--------------------------------------------------------------
void ofApp::draw(){

//ofDrawCircle(ofGetWidth()/2, ofGetHeight()/2, radius);
ofSetColor(255);
before.draw(0, 0, 512, 512);
ofmask2.draw(512, 0, 512, 512);
after.draw(1024, 0, 512, 512);
gui.draw();

}