Vietnamese ID Card Quality Check
Requirements
- The input image size does not exceed 5 MB.
 
Request
Request Url
- 
Only quality check:
 - 
Using before OCR:
 - 
Using before fraud check:
POST https://api.fpt.ai/vision/vnm/id-fraudcheck?quality_check=1
 
In the case that quality check is used before OCR or fraud check:
- If the quality check result is failed, the final result only includes quality check result (no OCR or fraud check result).
 - If the quality check result is passed, the final result includes both quality check result and OCR or fraud check result.
 
Request Headers
| Parameter | Required | Default | Description | 
|---|---|---|---|
| api_key | Yes | Your api key ( get from console.fpt.ai ) | 
Request Body
FormData contain a single image to check the quality.
| Parameter | Required | Description | 
|---|---|---|
| image | Yes | 
Sample Request
curl -X POST https://api.fpt.ai/vision/idr-qual/vnm -H "api-key: xxxxxx" -F "image=@path/to/image"
Response
JSON
{
    "errorCode" : x,
    "errorMessage" : "xxxx",
    "data" : [xxxx]
}
The system is able to check the quality of a photo of old or new types of Vietnamese ID card.
After successfully sending the request, the system will return a json file that includes text information about the image quality using the format below:
- errorCode: value is 0 if the request was successful with no error occurred
 - errorMessage: value is equal to empty string if the request was successful with no error occurred
 - data: include all information about the image quality if the request succeeds without errors or return empty list [] if an error occurs. Also included with the information returned is the probability that indicates the reliability of the returned results.
 
(The detail of the errors that might occure include both errorCode and errorMessage is described on Errors)
Data
{
    "errorCode": 0,
    "errorMessage": "",
    "data": [
        {
            "bright_spots_score": "xxxx",
            "blur_score": "xxxx",
            "luminance_score": "xxxx",
            "resolution": "xxxxxxxxx",
            "document_area_ratio_score": "xxxx",
            "final_result": {
                "lowResolutionLikelihood": "unlikely",
                "lowDocumentAreaRatioLikelihood": "unlikely"
                "havingBrightSpotsLikelihood": "unlikely",
                "blurredLikelihood": "unlikely",
                "badLumimanceLikelihood": "unlikely"
            }
        }
    ]
}
The API Responses composes of 5 data fields:
| Field | Description | 
|---|---|
| bright_spots_score | Probability that the image have bright spots | 
| blur_score | Probability that the image is blurred | 
| luminance_score | Luminous intensity of the image | 
| resolution | Resolution of the image | 
| document_area_ratio_score | Ratio of the document area in the overall area of the image | 
| final_result | Conclusion about the image quality | 
The final_result includes following criteria (the result of each criteria are likely/unlikely):
- lowResolutionLikelihood: Low resolution. The minimum resolution should be 640x480 for unlikely result, otherwise likely.
 - havingBrightSpotsLikelihood: Having bright spot. The bright_spots_score should be lower than 90 for unlikely result, otherwise likely.
 - blurredLikelihood: Is blurry. The blur_score should be lower than 71 for unlikely result, otherwise likely.
 - badLumimanceLikelihood: Having bad lunimance. The luminance_score should be lower than 93 and higher than 32 for unlikely result, otherwise likely.
 - lowDocumentAreaRatioLikelihood: The ratio of document area over the image area is too small. The lowDocumentAreaRatioLikelihood should be higher than 15 (%) for unlikely result, otherwise likely.
 
Errors
The system uses the error codes as follows:
| Error Code | Meaning | 
|---|---|
| 0 | No error -- This is a successful call, no error | 
| 1 | Invalid Parameters or Values! -- Wrong parameter in the request (e.g. no key or image in the request body). | 
| 3 | Unable to find ID card in the image -- The system cannot find the Vietnamese ID card in the image or the image is of poor quality (too blur, too dark/bright). | 
| 5 | No URL in the request -- The request uses the image_url key but the value is left blank. | 
| 6 | Failed to open the URL! -- The request uses the image_url key but the system cannot open this URL. | 
| 7 | Invalid image file -- The uploaded file is not an image file. | 
| 8 | Bad data -- The uploaded image file is corrupted or the format is not supported. | 
| 9 | No string base64 in the request -- The request uses image_base64 key but the value is left blank. | 
| 10 | String base64 is not valid -- The request uses image_base64 key but the provided string is invalid. |