Welcome, everyone! Get ready for a challenge designed to test your coding prowess, creativity, and performance optimization skills. This contest is all about having fun, and finding out who can create the most efficient solution to a unique problem.
| **Prize** | glory, and eternal bragging rights! plus, the winner can choose a [Yubikey 5 Series](https://www.yubico.com/id/store/yubikey-5-series/) or an equivalently prized mouse, keyboard or headset of your choosing. | |
Your mission is to build a high-performance web API that can dynamically stitch together tiled images, crop a specific region from the result, and serve a final, scaled image.
### Objective
Create an ASP.NET REST API endpoint that receives a JSON payload specifying a region of a conceptual grid, crops it, and resizes it.
### Provided Assets
You will be provided with a set of **1705** images files named according to a standard SBS plate coordinate system: `A1.png`, `A2.png`, ..., up to `AE55.png`. These are your source tiles. You must treat them as a single cohesive grid (A-AE as rows, 1-55 as columns). The size of each image is `720x720` pixels.
[Click here to download the images](https://drive.google.com/file/d/17i-KDjMlRJhmOY8kBIzG2eA-L2mCoqfN/view?usp=sharing).
### API Specification
***Endpoint:**`POST /api/image/generate`
***Request Body:**`application/json`
***Successful Response:**`200 OK` with the `Content-Type` of `image/png` and the image data in the body.
#### Request Body Structure:
```json
{
"canvas_rect": "A1:H12",
"crop_offset": [0.25, 0.25],
"crop_size": [0.5, 0.5],
"output_scale": 1.0
}
```
### Input Parameter Details
*`canvas_rect` (string)
* Defines the bounding box of tiles to stitch together *before* cropping.
* The format is `coordinate1:coordinate2`, e.g., `"C3:F6"`.
* Your code must be able to figure out the bounding box based on the coordinate only ( e.g. `"A1:H12"` and `"H1:A12"` are the same bounding box )
*`crop_offset` (array of floats)
* A normalized `[x, y]` offset for the crop, relative to the top-left corner of the stitched `canvas_rect` image.
* Values range from `0.0` to `1.0`. `[0, 0]` is the top-left of the stiched canvas.
*`crop_size` (array of floats)
* The normalized `[width, height]` of the crop, relative to the dimensions of the stitched `canvas_rect` image.
* Values range from `0.0` to `1.0`. `[1, 1]` would be the full stitched image.
*`output_scale` (float)
* A scaling factor applied to the cropped image before it's returned. `1.0` means original size, `0.5` is 50% smaller.
- Use environment variable `ASSET_PATH_RO` to locate the assets directory, on the benchmark machine this directory would be set to READ_ONLY (as this will be shared with the other participants).
- If you need to write to disk, use the OS temporary directory.
The output image from your API will be visually inspected using perceptual hashing or manually. If the stitched, cropped, and scaled image is not what is expected from the input parameters, the submission is considered incorrect and will not be benchmarked for performance. Unit tests will be provided by organizer (author: I haven't written them yet). **An incorrect submission receives no score.**
If the output is correct, your API will be benchmarked on two key metrics:
1.**Latency:** The average time taken to respond to a request across several test cases.
2.**Throughput:** The number of requests your API can handle per second under a sustained load. (author: I need to think about to do this in a consistent way)
The final results will be presented as a **comparative chart** showcasing the latency and throughput of all qualifying participants. This will allow us to visualize who built the fastest and most robust solutions. A final score will be derived from it.
- A pull request to this repository modifying `submission.txt` containing link to your private git repository on this git server and a tagged version. Please set your repository to private and invite me as collaborator.
* **Revision**
- You're allowed to submit revision. Please ensure the final, runnable version is on the `main` or `master` branch, and please put a semver tag.
* **Technology Stack:**
- The REST API **must** be built using **ASP.NET**. Other than that, you are free to use any open-source libraries (e.g., for image processing) as you see fit.
* **Setup:**
- Your repository **must** contain a clear `README.md` on how to build and run your project. **The easier you make it for me to run your code, the better.** I will not spend significant time debugging complex or undocumented setups.
- I highly discourage using work hours to work on this contest.
* **Use of Libraries:**
- You are free and encouraged to use any open-source libraries. No closed source or commercial solution allowed.
* **No-pre processing** can be performed before receiving the first API request.
* **Collaboration:**
- Collaboration or code sharing between different teams/individuals is forbidden. Otherwise it won't be fun.
* **Organizer's Discretion:**
- The contest organizer reserves the right to make final judgments on all matters, including disqualifying any entry that violates the spirit of fair and respectful competition