Console/terminal demo of coordinate remapping with OpenCV, supporting Windows 11 and Ubuntu Linux 24.04, based on the OpenCV remap tutorial. cv2.remap takes a map that says, for every pixel of the output, which source coordinate to read from — so by writing a different map you get a different geometric transform, without changing the image data itself. Four mappings are demonstrated: a 2× zoom into the centre of the image, a vertical flip, a horizontal flip, and both flips at once (a 180-degree rotation). Two example images ship under data/ and the results are saved to model/remap/. No GPU is involved.
[Folder Structure]
- CLAUDE.md / AGENT.md: program specification (identical content).
- CHANGELOG.md: change log.
- copyright.txt: copyright notice.
- data/: the example images Lena.png (the notebook's example) and sample.png.
- model/remap/: the results remap_zoom.png, remap_flip_v.png, remap_flip_h.png and remap_flip_both.png (ship with the Lena examples).
- tool/tools.py: shared helpers.
- src/: the demo, the launcher scripts and this document.
- venv/: Python virtual environment, created by step 1.
[Prerequisites]
- Operating system: Windows 11 or Ubuntu Linux 24.04.
- Python 3 and pip.
- Dependencies are listed in src/requirements.txt and installed by step 1.
- No GPU required.
[Instructions]
Step 1: create the virtual environment
Delete the old venv/, create a fresh one and install src/requirements.txt. Aborts loudly if pip fails.
Windows 11: src\01_venv_create.bat
Ubuntu 24.04: bash src/01_venv_create.sh
Step 2: activate the virtual environment
Activate the venv you just created. On Linux, source it so the environment variables apply to the current shell.
Windows 11: src\02_venv_activate.bat
Ubuntu 24.04: source src/02_venv_activate.sh
Step 3: run the remap demo
Build each map, remap the image and save the results. Extra arguments are forwarded to the Python script.
Windows 11: src\03_remap.bat
Ubuntu 24.04: bash src/03_remap.sh
Your own image, or only some of the mappings:
bash src/03_remap.sh --source data/sample.png --modes zoom,flip_h
Step 4: clear the virtual environment (optional)
Delete the venv/ folder to free disk space when you no longer need it.
Windows 11: src\99_venv_clear.bat
Ubuntu 24.04: bash src/99_venv_clear.sh
[Python Entry Point]
- src/remap.py: [--source IMG] [--modes zoom,flip_v,flip_h,flip_both] [--output-dir DIR] [--show].
- --source: input image, default data/Lena.png.
- --modes: which mappings to run, by default all four of the notebook's mappings.
- --output-dir: output folder, default model/remap/. --show also opens the results in windows.
- Saves one remap_{mode}.png per mapping.
- In the zoom mapping everything outside the centre region maps to the source pixel (0, 0), so that output has a flat border. This matches the tutorial's behaviour and is not a bug.
[References]
- OpenCV remap tutorial (the notebook's source): docs.opencv.org/master/d1/da0/tutorial_remap.html
This SDK is built in AppForAI - AI Dev Tools.
Purchase license separately: USD 600, permanent authorization, single APP authorization, single machine authorization, one-year activation, one-year download, one-year update, one-year email technical support.