Cotton code
300 lines · 6.5 KB · JSONRaw
{  "about": "Face crop and alignment test vectors for the Rust core (scripts/albums-align-vectors.py; README.md).",  "template": {    "side": 112,    "points": [      [        38.2946,        51.6963      ],      [        73.5318,        51.5014      ],      [        56.0252,        71.7366      ],      [        41.5493,        92.3655      ],      [        70.7299,        92.2041      ]    ],    "order": [      "eye left in picture",      "other eye",      "nose tip",      "mouth corner left in picture",      "other corner"    ]  },  "coordinates": "pixel index: the centre of the top-left pixel is (0, 0); x right, y down",  "interpolation": "bilinear over pixel centres; outside the picture is black; round halves away from zero; clamp",  "tolerance": {    "transform": 0.0001,    "crop_byte": 1  },  "cases": [    {      "name": "identity",      "why": "points already on the template: the crop is the picture",      "width": 112,      "height": 112,      "source": "identity-source.png",      "source_rgb_sha256": "827607081fe649824a880c7f821d81a081f3c8c52123ec5d3f19d21cd5f13cc2",      "points": [        [          38.2946,          51.6963        ],        [          73.5318,          51.5014        ],        [          56.0252,          71.7366        ],        [          41.5493,          92.3655        ],        [          70.7299,          92.2041        ]      ],      "transform": {        "a": 1.0,        "b": 0.0,        "tx": 0.0,        "ty": 0.0      },      "crop": "identity-crop.png",      "crop_rgb_sha256": "827607081fe649824a880c7f821d81a081f3c8c52123ec5d3f19d21cd5f13cc2"    },    {      "name": "larger",      "why": "a face twice the template's size",      "width": 320,      "height": 240,      "source": "larger-source.png",      "source_rgb_sha256": "3d8ee4ac711d4e569c597cff71f842e340410804b884c9337fed9f6d81b08c3a",      "points": [        [          114.53688,          79.59104        ],        [          185.01128,          79.20124        ],        [          149.99808,          119.67164        ],        [          121.04628,          160.92944        ],        [          179.40748,          160.60664        ]      ],      "transform": {        "a": 0.5,        "b": 0.0,        "tx": -18.973839999999996,        "ty": 11.900779999999997      },      "crop": "larger-crop.png",      "crop_rgb_sha256": "f201fc8c75bdf1133ed9c965841ee4ddeba5fd143e7819a199bfc46e2b02bcb3"    },    {      "name": "turned",      "why": "turned 20 degrees",      "width": 300,      "height": 300,      "source": "turned-source.png",      "source_rgb_sha256": "ddea07f8df8e9ee4f37081a0b3f5311e79f5691b3d7ec189993754864590d677",      "points": [        [          134.396997,          119.919118        ],        [          187.483071,          138.909015        ],        [          150.088401,          159.752629        ],        [          117.034968,          182.84667        ],        [          160.996562,          198.572568        ]      ],      "transform": {        "a": 0.5873078879911928,        "b": -0.2137625895785429,        "tx": -66.27203753124576,        "ty": 9.995906358190595      },      "crop": "turned-crop.png",      "crop_rgb_sha256": "aafec15d35401b10b5fd33466bb4f8fbc188431d85a1faa27ce33af8284b2389"    },    {      "name": "small-turned",      "why": "a small face (about 16 px between the eyes), turned -35 degrees",      "width": 360,      "height": 270,      "source": "small-turned-source.png",      "source_rgb_sha256": "bf0c620fb23aba9d381a0043a23733d5e2f9720e99c5fd9fb3f635f95dc353db",      "points": [        [          188.248854,          87.128939        ],        [          201.18763,          77.962043        ],        [          199.95727,          89.939728        ],        [          199.945699,          101.280286        ],        [          210.660547,          93.689004        ]      ],      "transform": {        "a": 1.8203378761977598,        "b": 1.2746143030023247,        "tx": -193.32612796934274,        "ty": -346.8524894582633      },      "crop": "small-turned-crop.png",      "crop_rgb_sha256": "9136a1f122ee69a977883c2d1c377ca5ae1c10d30eac823af4134c579e1f560a"    },    {      "name": "jittered",      "why": "points off the template by noise: least squares",      "width": 400,      "height": 300,      "source": "jittered-source.png",      "source_rgb_sha256": "74606fb0d991f604fd82517d7115ccf0e7b5ffb3df3932d1bc32500501b5bc06",      "points": [        [          190.830644,          111.229828        ],        [          235.815411,          115.57021        ],        [          209.346462,          138.301        ],        [          187.750871,          165.736323        ],        [          224.517149,          167.867011        ]      ],      "transform": {        "a": 0.7599092997842024,        "b": -0.09107151527139105,        "tx": -116.0168394316957,        "ty": -15.196274783087873      },      "crop": "jittered-crop.png",      "crop_rgb_sha256": "1bb9f4af90942c86c82b59e3358dbcc7d160559b7f1f5bfe8ff7c24888716ac8"    },    {      "name": "edge",      "why": "a face at the corner: the crop reaches outside the picture (black)",      "width": 200,      "height": 150,      "source": "edge-source.png",      "source_rgb_sha256": "9e4613c8b76c934ef4b49454ce3782fc57d3b4ae527a39d1846daa6f4018206e",      "points": [        [          -1.277872,          5.754624        ],        [          41.006768,          5.520744        ],        [          19.998848,          29.802984        ],        [          2.627768,          54.557664        ],        [          37.644488,          54.363984        ]      ],      "transform": {        "a": 0.8333333333333334,        "b": 2.909853071927307e-17,        "tx": 39.35949333333334,        "ty": 46.90078      },      "crop": "edge-crop.png",      "crop_rgb_sha256": "35a3e33a85523f5824599bbe154965d5ccc0df353abb9867032971ef9464d273"    },    {      "name": "no-spread",      "why": "all five points the same: an error, never a crop",      "width": 112,      "height": 112,      "points": [        [          50.0,          60.0        ],        [          50.0,          60.0        ],        [          50.0,          60.0        ],        [          50.0,          60.0        ],        [          50.0,          60.0        ]      ],      "error": true    }  ]}