added ROI detection