You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MSRCP: Add option chroma_protect to attenuate chroma adjustment.
MSRCP: Intensity channel is calculated from average of R, G, B value
now, instead of weighted average.
Delete Specification.h.
Update README.md
Copy file name to clipboardExpand all lines: README.md
+21-7Lines changed: 21 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ The Retinex theory and algorithm mainly aims at simulating the color constancy f
14
14
15
15
The light perceived by visual receptors can be separated into illuminance and reflectance. Retinex estimates the illuminance and derive the reflectance from the light, the filtered result of which is an image represents the reflectance characteristics of the scene, regardless of the illuminance.
16
16
17
-
Retinex is a very powerful filter in dynamic range compression, contrast enhancement, color constancy, etc.
17
+
Retinex is a very powerful filter in dynamic range compression, contrast enhancement, color constancy, de-fog, etc.
18
18
19
19
## MSRCP
20
20
@@ -28,10 +28,12 @@ As MSRCP preserves chromaticity, it is excellent for dynamic range compression a
28
28
29
29
This function accept 8-16bit integer Gray/YUV/RGB/YCoCg input. Sub-sampled format is not supported. If you want to process YUV420/YUV422 clip, convert it to YUV444 or RGB first.
30
30
31
+
For processing in YUV444 and RGB, the filtering results are different. MSR is applied to intesity channel, which is Y for YUV444 input and (R+G+B)/3 for RGB input. Since Y is a weighted average of R, G, B, processing in YUV444 may produce imbalanced chromaticity preservation. Also when chroma_protect is larger than 1 (default 1.2), the saturation of YUV444 processing result will be different from that of RGB processing result.
Determine the value range of output clip. True means full range/PC range, and False means limited range/TV range.<br />
61
-
Set different value for fulls and fulld will result in range conversion.<br />
62
-
When fulls and fulld are the same, it is safe to assign either True or False for any kinds of input clip except YUV. When fulls=False it will automatically determine the Floor and Ceil of input image, which may produce a stronger filter result under some circumstances.
63
+
Set different value for fulls and fulld will result in range conversion.
64
+
65
+
- chroma_protect: (Default: 1.2)<br />
66
+
The base of log function to attenuate chroma adjustment. It could avoid extreme chroma amplifying, while the saturation of the result is changed.<br />
67
+
Available range is [1, +inf), 1 means no attenuation.<br />
68
+
It is only available for YUV/YCoCg input.
63
69
64
70
### Example
65
71
66
-
TV range YUV420P8 input, filter in TV range YUV444P16
72
+
TV range YUV420P8 input, filtered in TV range YUV444P16 with chroma protect, output TV range YUV444P16
67
73
68
74
```python
69
75
v = core.fmtc.resample(v, csp=vs.YUV444P16)
70
-
v = core.retinex.MSRCP(v)
76
+
v = core.retinex.MSRCP(v, chroma_protect=1.2)
71
77
```
72
78
73
-
JPEG image(PC range YUV420P8 with MPEG-1 chroma placement) input, filter in PC range RGB48
79
+
JPEG image(PC range YUV420P8 with MPEG-1 chroma placement) input, filtered in PC range YUV444P16 without chroma protect, output PC range RGB48
74
80
75
81
```python
76
82
i = core.lsmas.LWLibavSource(r'Image.jpg')
77
83
i = core.fmtc.resample(i, csp=vs.YUV444P16, fulls=True, cplace="MPEG1")
84
+
i = core.retinex.MSRCP(i, fulls=True, chroma_protect=1)
78
85
i = core.fmtc.matrix(i, mat="601", fulls=True, csp=vs.RGB48)
86
+
```
87
+
88
+
PNG image(PC range RGB24) input, filtered in PC range RGB48, output PC range RGB48
0 commit comments