Skip to content

Commit 3bda9ee

Browse files
author
Marco Dalla Vecchia
committed
added little documentation and changed default colors
1 parent d539366 commit 3bda9ee

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

episodes/fig/blur-demo.gif

0 Bytes
Loading
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Simple blur animation of image
2+
## Installation
3+
Use the provided `env.yml` environment file to install dependencies:
4+
```bash
5+
$ conda env install -f env.yml
6+
```
7+
8+
## Usage
9+
1. Navigate to script directory:
10+
```bash
11+
$ cd ./image-processing/episodes/files/source-code/blur-animation
12+
```
13+
14+
2. Run the script using the installed virtual environment:
15+
```bash
16+
$ conda activate anim-env
17+
$ python create_blur_animation.py
18+
```
19+
20+
3. Follow prompt (choose kernel size) and press Enter.
21+
22+
23+
## Author
24+
@marcodallavecchia

episodes/files/source-code/blur-animation/create_blur_animation.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222

2323
# Fix image path depending from where you run this script -> this should run as is, from the repo structure
2424
img_path = "../../../data/A.tif"
25-
25+
# Change here colors to improve accessibility
26+
kernel_color = "tab:red"
27+
center_color = "tab:olive"
2628

2729
### ANIMATION FUNCTIONS
2830
def init():
@@ -110,8 +112,8 @@ def update(frame):
110112
im = ax2.imshow(img_convolved, animated=True, cmap='gray')
111113

112114
# Define rectangular patches to identify moving kernel
113-
k_rect = p.Rectangle((-0.5,-0.5), kernel_size, kernel_size, linewidth=2, edgecolor='tab:red', facecolor='none', alpha=0.8) # kernel rectangle
114-
c_rect1 = p.Rectangle(((kernel_size/2 - 1), (kernel_size/2 - 1)), 1, 1, linewidth=2, edgecolor='tab:orange', facecolor='none') # central pixel rectangle
115+
k_rect = p.Rectangle((-0.5,-0.5), kernel_size, kernel_size, linewidth=2, edgecolor=kernel_color, facecolor='none', alpha=0.8) # kernel rectangle
116+
c_rect1 = p.Rectangle(((kernel_size/2 - 1), (kernel_size/2 - 1)), 1, 1, linewidth=2, edgecolor=center_color, facecolor='none') # central pixel rectangle
115117
# Add them to the figure
116118
ax1.add_patch(k_rect)
117119
ax1.add_patch(c_rect1)

0 commit comments

Comments
 (0)