Skip to content

Commit c3f65f4

Browse files
committed
[update] add assets
1 parent 5b8c822 commit c3f65f4

5 files changed

+104
-14
lines changed

README.md

+104-14
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,12 @@ Check it on [Pypi](https://pypi.org/project/BlurGenerator/).
1919
## Usage
2020

2121
```bash
22-
usage: blurgenerator [-h] [--input INPUT] [--output OUTPUT] [--type TYPE] [--motion_blur_size MOTION_BLUR_SIZE] [--motion_blur_angle MOTION_BLUR_ANGLE]
23-
[--lens_radius LENS_RADIUS] [--lens_components LENS_COMPONENTS] [--lens_exposure_gamma LENS_EXPOSURE_GAMMA]
24-
[--gaussian_kernel GAUSSIAN_KERNEL]
25-
26-
optional arguments:
27-
-h, --help show this help message and exit
28-
--input INPUT Specific path of image as `input`.
29-
--output OUTPUT Specific path for `output`. Default is `./result.png`.
30-
--type TYPE Blur type of `motion`, `lens`, or `gaussian`. Default is `motion`.
31-
--motion_blur_size MOTION_BLUR_SIZE
22+
blurgenerator --help
23+
```
24+
25+
```bash
26+
usage: blurgenerator [-h] [--input INPUT] [--input_depth_map INPUT_DEPTH_MAP] [--output OUTPUT] [--type TYPE] [--motion_blur_size MOTION_BLUR_SIZE] [--motion_blur_angle MOTION_BLUR_ANGLE] [--lens_radius LENS_RADIUS] [--lens_components LENS_COMPONENTS]
27+
[--lens_exposure_gamma LENS_EXPOSURE_GAMMA] [--gaussian_kernel GAUSSIAN_KERNEL] [--depth_num_layers DEPTH_NUM_LAYERS] [--depth_min_blur DEPTH_MIN_BLUR] [--depth_max_blur DEPTH_MAX_BLUR]
3228
Size for motion blur. Default is 100.
3329
--motion_blur_angle MOTION_BLUR_ANGLE
3430
Angle for motion blur. Default is 30.
@@ -40,13 +36,23 @@ optional arguments:
4036
Exposure gamma for lens blur. Default is 2.
4137
--gaussian_kernel GAUSSIAN_KERNEL
4238
Kernel for gaussian. Default is 100.
39+
--depth_num_layers DEPTH_NUM_LAYERS
40+
Layer for depth blur. Default is 3.
41+
--depth_min_blur DEPTH_MIN_BLUR
42+
Min. blur for depth blur. Default is 1.
43+
--depth_max_blur DEPTH_MAX_BLUR
44+
Max. blur for depth blur. Default is 100.
4345
```
4446

4547
## Example and Result
4648

49+
### Common use
50+
4751
- Original image
4852

49-
![original image](https://github.com/NatLee/Blur-Generator/blob/main/doc/test.png?raw=true)
53+
![original image](./doc/test.png)
54+
55+
#### Usage
5056

5157
- Motion blur
5258

@@ -57,9 +63,10 @@ import cv2
5763
from blurgenerator import motion_blur
5864
img = cv2.imread('test.png')
5965
result = motion_blur(img, size=100, angle=30)
66+
cv2.imwrite('./output.png', result)
6067
```
6168

62-
![motion blur image](https://github.com/NatLee/Blur-Generator/blob/main/doc/motion.png?raw=true)
69+
![motion blur image](./doc/motion.png)
6370

6471
- Lens blur
6572

@@ -70,9 +77,10 @@ import cv2
7077
from blurgenerator import lens_blur
7178
img = cv2.imread('test.png')
7279
result = lens_blur(img, radius=5, components=4, exposure_gamma=2)
80+
cv2.imwrite('./output.png', result)
7381
```
7482

75-
![lens blur image](https://github.com/NatLee/Blur-Generator/blob/main/doc/lens.png?raw=true)
83+
![lens blur image](./doc/lens.png)
7684

7785
- Gaussian blur
7886

@@ -83,6 +91,88 @@ import cv2
8391
from blurgenerator import gaussian_blur
8492
img = cv2.imread('test.png')
8593
result = gaussian_blur(img, 100)
94+
cv2.imwrite('./output.png', result)
95+
```
96+
97+
![gaussian blur image](./doc/gaussian.png)
98+
99+
### With depth map
100+
101+
Feature from this [issue](https://github.com/NatLee/Blur-Generator/issues/1).
102+
103+
- Original image
104+
105+
![photo](./doc/depth-test.jpg)
106+
107+
- Depth map
108+
109+
![depth map](./doc/depth-map-test.png)
110+
111+
#### Usage
112+
113+
- Motion blur with depth map
114+
115+
`blurgenerator --input .\doc\depth-test.jpg --type motion --input_depth_map .\doc\depth-map-test.png --depth_num_layers 5 --depth_min_blur 1 --depth_max_blur 50 --output .\doc\depth-motion-output.png`
116+
117+
```python
118+
import cv2
119+
from blurgenerator import motion_blur_with_depth_map
120+
img = cv2.imread('test.jpg')
121+
depth_img = cv2.imread('test-depth.png')
122+
result = motion_blur_with_depth_map(
123+
img,
124+
depth_map=depth_img,
125+
angle=30,
126+
num_layers=10,
127+
min_blur=1,
128+
max_blur=50
129+
)
130+
cv2.imwrite('./output.png', result)
131+
```
132+
133+
![depth motion blur image](./doc/depth-motion-output.png)
134+
135+
- Lens blur with depth map
136+
137+
`blurgenerator --input .\doc\depth-test.jpg --type lens --input_depth_map .\doc\depth-map-test.png --depth_num_layers 3 --depth_min_blur 1 --depth_max_blur 50 --output .\doc\depth-lens-output.png`
138+
139+
```python
140+
import cv2
141+
from blurgenerator import lens_blur_with_depth_map
142+
img = cv2.imread('test.jpg')
143+
depth_img = cv2.imread('test-depth.png')
144+
result = lens_blur_with_depth_map(
145+
img,
146+
depth_map=depth_img,
147+
components=5,
148+
exposure_gamma=5,
149+
num_layers=10,
150+
min_blur=1,
151+
max_blur=50
152+
)
153+
cv2.imwrite('./output.png', result)
154+
```
155+
156+
![depth lens blur image](./doc/depth-lens-output.png)
157+
158+
- Gaussian blur with depth map
159+
160+
`blurgenerator --input .\doc\depth-test.jpg --type gaussian --input_depth_map .\doc\depth-map-test.png --depth_num_layers 3 --depth_min_blur 1 --depth_max_blur 50 --output .\doc\depth-gaussian-output.png`
161+
162+
```python
163+
import cv2
164+
from blurgenerator import gaussian_blur_with_depth_map
165+
img = cv2.imread('test.jpg')
166+
depth_img = cv2.imread('test-depth.png')
167+
result = gaussian_blur_with_depth_map(
168+
img,
169+
depth_map=depth_img,
170+
sigma=5,
171+
num_layers=10,
172+
min_blur=1,
173+
max_blur=50
174+
)
175+
cv2.imwrite('./output.png', result)
86176
```
87177

88-
![gaussian blur image](https://github.com/NatLee/Blur-Generator/blob/main/doc/gaussian.png?raw=true)
178+
![depth gaussian blur image](./doc/depth-gaussian-output.png)

doc/depth-gaussian-output.png

4.92 MB
Loading

doc/depth-lens-output.png

3.92 MB
Loading

doc/depth-motion-output.png

4.97 MB
Loading

doc/depth-output.jpg

-435 KB
Binary file not shown.

0 commit comments

Comments
 (0)