Modify newPoints() function to ensure safe ROI

Adding the condition to make sure top-left and bottom-right corners of ROI are inside the image captured (no smaller than 0 and no bigger than the resolution of the webcam).