// scale the mask to the new size
Gray8RectStretch grs = new Gray8RectStretch(nTargetWidth, nTargetHeight);
grs.push(imMask);
imMask = (Gray8Image) grs.getFront();
// combine the image and mask to make a masked image
Gray8MaskedImage gmi = new Gray8MaskedImage(imShrunk, imMask);
// pass the masked image to a subimage generator
MaskedGray8SubImgGen mgsi = new MaskedGray8SubImgGen(
this.hcc.getWidth(),
this.hcc.getHeight(),
Math.max(1, gmi.getWidth() / 30),
Math.max(1, gmi.getHeight() / 30));
mgsi.push(gmi);
// now run Haar detection on each scaled image
int nxLastFound = -hcc.getWidth();
int nyLastFound = -hcc.getHeight();
while (!mgsi.isEmpty()) {