if (this.dh != null && !this.dh.isEmpty()) {
jjil.core.Gray8Image imMask = null;
jjil.core.Image image = dh.getFront();
if (image instanceof jjil.core.Gray8Image) {
imMask = (Gray8Image) image;
GrayConnComp gcc = new GrayConnComp();
gcc.push(imMask);
if (gcc.getComponents()> 0) {
// found a face
Rect r = gcc.getComponent(0);
// calculate center of face in mask coordinates
int x = r.getLeft() + r.getWidth() / 2;
int y = r.getTop() + r.getHeight() / 2;
// convert from mask to original image
x = (x * this.imInput.getWidth()) / imMask.getWidth();