> For the complete documentation index, see [llms.txt](https://docs.vida.id/identity-stack/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vida.id/identity-stack/verify/document-ai/ocr-and-document-verification/ocr-and-document-verification-v2/full-details-endpoint/iqa-and-card-classification.md).

# IQA & Card-Classification

The **Image Quality Assessment (IQA)** and **Card Classification** steps are **pre-processing** operations executed **before** performing any requested tasks.&#x20;

If these steps **fail**, the execution stops, and an **error** is returned in the response body.

***

### Card-Classification&#x20;

**Purpose:** Determines the type of card being processed and includes these details in the response.

<details>

<summary>Sample Card Classification Response</summary>

```json
"card": {
    "country": "Country Name Of Which the Card Belongs To",
    "type": "Name of the card type that was sent, ex - MyKad , KTP, etc",
    "isoAlpha3CountryCode": "iso Alpha 3 Country Code of the country the card belongs to",
    "isoAlpha2CountryCode": "iso Alpha 2 Country Code of the country the card belongs to"
},
```

</details>

{% hint style="info" %}
Note: If an error occurs, the card classification details will not be included in the response.
{% endhint %}

***

### Image Quality Assessment&#x20;

**Purpose:** Evaluates the **idFrontSideImage and idBackSideImage&#x20;*****(if enabled)*** quality based on different parameters like:\
✔ **Glare** – Checks if glare affects the captured image.\
✔ **Blurriness** – Detects if the image is blurry.\
✔ **Low Light** – Ensures the image is not underexposed.

**Response:**

* **Success:** If the image passes all quality checks, an **`imageQualityResult`** object is included in the response.
* **Failure:** If any check fails, the request **errors out**, and a warning is returned.

<details>

<summary>Sample Success Response </summary>

<pre class="language-json"><code class="lang-json">{
   "imageQualityResult": {
        "front": {
            "glare": {
                "score": 0,
                "threshold": 0.95
            },
            "blurriness": {
                "score": 0.000001,
                "threshold": 0.95
            },
            "lowLight": {
                "score": 0.081468,
                "threshold": 0.95
            }
        }
<strong>}
</strong></code></pre>

</details>

<details>

<summary>Sample Success Response Front Side and Back Side</summary>

<pre class="language-json"><code class="lang-json">{
   "imageQualityResult": {
        "front": {
                "glare": {
                "score": 0,
                "threshold": 0.95
                },
                "blurriness": {
                "score": 0.008268,
                "threshold": 0.95
                },
                "lowLight": {
                "score": 0.029575,
                "threshold": 0.95
            }
        },
        "back": {
                 "blurriness": {
                 "score": 0.008268,
                 "threshold": 0.95
                 },
                 "lowLight": {
                 "score": 0.029575,
                 "threshold": 0.95
                 }
         }
    }
<strong>}
</strong></code></pre>

</details>

{% hint style="info" %}
**Note:**

🔹 **Glare models** are currently **only available** for **MyKad (Front Side Only) and KTP** cards.\
🔹 **Glare detection** will **only return high scores** if the glare **obscures essential fields** such as **Name, ID Number, or Portrait Image**.
{% endhint %}

### Sample Failure Response:

**In this case no image quality results are provided in the response, the request errors out.**

<details>

<summary>Sample Failure Response</summary>

```json
{
    "transactionId": "Transaction id generated for the request",
    "partnerTrxId": "Partner transaction id sent by the client",
    "groupId": "Group id sent by the client",
    "errors": [
        {
            "message": "Quality check failed. Image is too blurry. (123005)",
            "code": 5202,
            "operations": [
                "ocr",
                "idVerification"
            ]
        }
    ]
}
```

</details>

{% hint style="info" %}
Note:&#x20;

1. *Image Quality Assessment (IQA) responses are currently only available for* **Malaysian** *and* **KTP cards**.
2. For other document types, such as **passports**, these details will **not** be included in the response.
   {% endhint %}
