API Reference

This section describes in detail how to perform proper validation on documents that have two sides - ID cards

In order to validate both front and back sides, the front-end needs to memorize which side was validated, and validate the other side, and then when both sides are validated, submit them onto extraction.

The pseudocode is as follows:

var image_front
var image_back
var image

do while same image side not validated 3 times in a row

	image <- capture image from video stream
	x, y <- image.shape()
	resizing_coef <- max(x, y) / 384
	xx, yy <- x / resizing_coef, y / resizing_coef
	
	resized_image <- image.resize(xx, yy)

	result <- check_validity(resized_image)
end

if result.side is 'FRONT':
	image_front = image
else:
	image_back = image

validated_side = result.side

print("Flip the document please")

do while same image side not validated 3 times in a row and result.side != validate_side

	image <- capture image from video stream
	x, y <- image.shape()
	resizing_coef <- max(x, y) / 384
	xx, yy <- x / resizing_coef, y / resizing_coef
	
	resized_image <- image.resize(xx, yy)

	result <- check_validity(resized_image)
end

if result.side = 'FRONT':
	image_front = image
else:
	image_back = image

do_extraction(image_front, image_back)