private void refinePupilPosition(final int resolution) {
Image image = ImageUtil.resizeImage(mImage, resolution, false);
List<PupilCenterInfo> pupilCenterInfoList = new ArrayList<>();
int pupilXCenter = (int) Math.round(mPupilXCenter * image.getWidth());
int pupilYCenter = (int) Math.round(mPupilYCenter * image.getHeight());
<BUG>int pupilRadius = (int) Math.round(mPupilRadius * Math.min(image.getWidth(), image.getHeight()));
</BUG>
boolean isStable = false;
for (int step = 0; step < MAX_REFINEMENT_STEPS && !isStable; step++) {
for (int x = pupilXCenter - 1; x <= pupilXCenter + 1; x++) {

private void refinePupilPosition(final int resolution) {
Image image = ImageUtil.resizeImage(mImage, resolution, false);
List<PupilCenterInfo> pupilCenterInfoList = new ArrayList<>();
int pupilXCenter = (int) Math.round(mPupilXCenter * image.getWidth());
int pupilYCenter = (int) Math.round(mPupilYCenter * image.getHeight());
int pupilRadius = (int) Math.round(mPupilRadius * Math.max(image.getWidth(), image.getHeight()));
boolean isStable = false;
for (int step = 0; step < MAX_REFINEMENT_STEPS && !isStable; step++) {
for (int x = pupilXCenter - 1; x <= pupilXCenter + 1; x++) {
