added dilate to gate and an ignore top pixel option