A console/terminal demo of the OpenCV averaging blur, supporting Windows 11 and Ubuntu Linux 24.04. Gaussian and salt-and-pepper noise is added to the input image, which is then smoothed with cv2.blur at several kernel sizes: 5×5, 11×11 and the directional 31×3 by default. Two example images ship under data/ (Lena and sample), and the results are saved to model/blur/. 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 and sample.png.
  • model/blur/: the results noise.png (the noisy image), blur_5x5.png, blur_11x11.png and blur_31x3.png; the Lena examples are included.
  • tool/tools.py: shared helpers.
  • src/: the demo, the launcher scripts and this document.
  • venv/: Python virtual environment, created by step 01.

[Prerequisites]

  • Operating system: Windows 11 or Ubuntu Linux 24.04.
  • Python 3 and pip.
  • No GPU required; an ordinary CPU is enough.

[Instructions]

Step 1: Create the virtual environment

Delete the old venv/, create a fresh one and install the packages listed in src/requirements.txt. The script aborts loudly if pip fails.

 

Windows: src\01_venv_create.bat

Linux: bash src/01_venv_create.sh

Step 2: Activate the virtual environment

Activate the venv. On Linux, source the script.

 

Windows: src\02_venv_activate.bat

Linux: source src/02_venv_activate.sh

Step 3: Run the averaging-blur demo

Run the demo. Any extra arguments are forwarded to the program.

 

Windows: src\03_blur.bat

Linux: bash src/03_blur.sh

To use your own image and kernels, for example:

bash src/03_blur.sh --source data/sample.png --kernels 3x3,9x9

 

Step 4: Remove the virtual environment

Delete the venv/ folder.

 

Windows: src\99_venv_clear.bat

Linux: bash src/99_venv_clear.sh

[Python Entry Point]

  • src/blur.py: [--source IMG] [--kernels 5x5,11x11,31x3] [--gaussian-var 0.01] [--sp-amount 0.05] [--seed 0] [--output-dir DIR] [--show]. --kernels takes a comma-separated list of kernel sizes. The noise matches the skimage.util.random_noise defaults used by the earlier example, but is reimplemented with numpy, so scikit-image is not required, and it is seeded for reproducible output. It saves noise.png and one blur_WxH.png per kernel to model/blur/; --show also opens the results in windows.

[References]

 

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.