stitch, crop and scale
Find a file
2025-07-31 17:05:09 +00:00
README.md update readme around timeline 2025-07-31 06:52:52 +00:00
submission.txt url to tag 2025-07-31 17:05:09 +00:00

Stitch-a-ton Contest Guidelines

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.

1. Quick Info

Category Details
Contest Format Compete individually or in a team of two. Senior level can join but won't be elligible for the prize.
Timeline Accepting submission until August 1st 2025 end of day.
Technology ASP.NET for REST API is mandatory. Other libraries/tools are your choice.
Prize glory, and eternal bragging rights! plus, the winner can choose a Yubikey 5 Series or an equivalently prized mouse, keyboard or headset of your choosing.
Questions? Submit an issue on this repository.

2. The Challenge: The Image Stitcher API

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.

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:

{
  "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.
    • Values range from 0 > scale >= 1.0

Canvas Visual Guide

     Origin (0,0)                                                       
             ┌─────────────────┬───────────────────────────────────────┐
             │                 │                                       │
    x+       │                 │offset.y                               │
   ┌────►    │                 │                                       │
   │         │                 │                                       │
y+ │         ├────────────────►▼ ┌──────────────────┐ ▲                │
   ▼         │     offset.x      │                  │ │                │
             │                   │                  │ │                │
             │                   │    FINAL IMAGE   │ │ size.y         │
             │                   │                  │ │                │
             │                   │                  │ │                │
             │                   └──────────────────┘ ▼                │
             │                   ◄──────────────────►                  │
             │                          size.x                         │
             │                                                         │
             │                                                         │
             └─────────────────────────────────────────────────────────┘

Implementation notes

  • You may assume all parameters passed to this API are always valid.
  • When converting from a floating point to integer (unit pixel), truncate it instead of rounding.
  • 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.

3. Evaluation Criteria

Evaluation is a two-step process. Submissions must pass Step 1 to be considered for Step 2.

Step 1: Correctness (Pass/Fail)

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.

Step 2: Performance Benchmarking

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 benchmark machine

  • Raspberry Pi CM5 w/ Debian Bookworm 64-bit

The Scoreboard

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.

4. Submission Guidelines

  • To be submitted

    • 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.

! Plese do not check in the provided assets in the git repository

5. Rules & Fair Play

I know it's for fun but it's a good thing to have rules.

  • Do it on your free time

    • 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

6. Special category

If you do have ideas that require pre processing the provided assets, I'd like to see it. I may put it on a special category.

Good luck, have fun, and let the coding begin