This will check if finger is a good scan, so you only send clean once to your server:
Check if whole finger is scanned:
- Put a boundingbox around the scanned finger and check if it has a required size.
- Maybe: Check if enough of your picture is black, so you avoid "hovering" of finger
Check if Finger touches border:
- Much more difficult, you could forbid it (check for overlap of boundingbox and edge of scanner) but that might be too strict
- Maybe you can check the direction of the finger and forbid it if the finger is not vertical enough (do that by recognizing outer edge of finger with canny edge detection, compute the boundingbox (a rotatedrect) and check the angle of it.
This Tutorial shows how you can generate a rotated bounding box (a RotatedRect Object).
Here is described how you can get the angle of the box.
For the intersection: Test if the corner of your RotatedRect are inside the 'normal' area.