Modify newPoints() function to ensure safe ROI

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