![]() |
|
Deoldify Vapoursynth filter - Printable Version +- Selur's Little Message Board (https://forum.selur.net) +-- Forum: Talk, Talk, Talk (https://forum.selur.net/forum-5.html) +--- Forum: Small Talk (https://forum.selur.net/forum-7.html) +--- Thread: Deoldify Vapoursynth filter (/thread-3595.html) Pages:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
RE: Deoldify Vapoursynth filter - Dan64 - 03.03.2024 (03.03.2024, 09:16)Selur Wrote: @zspeciman: In Hybrid DeOldify (like ddcolor) will be applied to the video, DeOldifys 'Video'-Model was meant for video. Both of them are nowhere near perfect, so on some content it might work good, while on others not so much. Just to be more precise, Hybrid can used also to colorize single images, procedure is the follow: 1) In main window check the box "image sequence" 2) After clicking the upper right arrow will be displayed a dialog box. Select as the first frame the image, then check the box "single image" and then push "Accept". 3) Apply the DeOldify filter or better the "DDeOldify" (new version), in: Filtering->Vapoursynth->Color->Basic page 4) Finally push the preview icon (with the image on an eye) Wait some seconds (the loading of all libraries takes a lot of time) and will be visualized the "VsViewer" window, by clicking with the mouse on the right of the image you can save the colorized image on the folder. Dan @Selur: there is a bug in the dev version where the conversion to RGB24 format is not applied in case of "image sequence" RE: Deoldify Vapoursynth filter - Selur - 03.03.2024 Quote:@Selur: there is a bug in the dev version where the conversion to RGB24 format is not applied in case of "image sequence"Have you tried this, or did you just take a fast look at the generated script? Usually image sequences should be imported as RGB24, so there should be no need to convert to RGB24. Side note: else:
clipa = clip.std.ModifyFrame(clip, ddeoldify_colorize)
clipa = Tweak(clip=clipa.resize.Bicubic(format=vs.YUV444PS, matrix_s="709", range_s="limited"), hue=hue[0], sat=sat[0], cont=1.00, coring=True)
color_clip = clipa.resize.Bicubic(format=vs.RGB24, range_s="limited")should only be used when sat != 1 and hue != 0 (analog in the ddcolor section). Cu Selur RE: Deoldify Vapoursynth filter - Dan64 - 03.03.2024 I released a new version: https://github.com/dan64/vs-deoldify/releases/tag/v1.1.2 The input parameters are the same, but I changed the default of dd_strenght to 3, because the auto selection will selected an higher value, improving the quality but slow down significantly the speed. I performed a code clean-up (also fixing the issue with sat and hue). In my version there is the problem of "image sequence". I attached an archive with the test image and the generated script. Thanks, Dan RE: Deoldify Vapoursynth filter - Selur - 03.03.2024 Ah, okay, your image gets imported as Gray8. Quote:Image-> Not sure, atm. whether I want to support such images or whether I'll throw an error message. Quote:Color space : Yhints that the image is just Gray8, but Quote:Color primaries : BT.709doesn't really make sense for gray scale,... Cu Selur RE: Deoldify Vapoursynth filter - Selur - 03.03.2024 Send you a link to a dev version which should support those Gray8 input images. Cu Selur RE: Deoldify Vapoursynth filter - Dan64 - 03.03.2024 The new "Coloring" page is amazing!, maybe 3 digit for Weight are too much 2 should be enough (with step 0.05). I found a problem when I select the DDColor ModelScope, in this case the generated code is: clip = ddeoldify(clip=clip, model=0, sat=[1.00,1.00], hue=[0.00,0.00], dd_method=0, dd_weight=0.250, dd_model=-1)The possible values for this parameter are specified in __init__.vpy :param dd_model: ddcolor model (default = 0):
0 = ddcolor_modelscope,
1 = ddcolor_artisticFor the moment I don't have found any other problem. Thanks, Dan RE: Deoldify Vapoursynth filter - Selur - 03.03.2024 "dd_model=-1" Ah, I accidentally left the offset I used for vsDeOldifyDDCCombine. -> fill fix and adjust the weight precision. Cu Selur RE: Deoldify Vapoursynth filter - Selur - 03.03.2024 Send you a new link, which should fix both problems. Cu Selur RE: Deoldify Vapoursynth filter - Dan64 - 03.03.2024 With the new dev version, the problem regarding the ddcolor model has been solved. The fix introduced regarding the conversion to RGB24 when input is GRAY8 caused a lot of problems on other filters. For example selecting Tewak to de-saturate an image to B&W before ddeoldify is not more working. Please revert the code back. I'm will apply the transformation to RGB24 directly in the filter if necessary. I'm doing so many colorspace conversion in the filter that one more will not create any problem. Thanks, Dan P.S. I will release a new version with the patch. RE: Deoldify Vapoursynth filter - Selur - 03.03.2024 Can't reproduce the problem here, the code Hybrid produces: # Imports
import vapoursynth as vs
# getting Vapoursynth core
core = vs.core
# Loading Plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libimwri.dll")
# source: 'C:/Users/Selur/Desktop/TestBW1.jpg'
# current color space: GRAY8, bit depth: 8, resolution: 1280x870, fps: 25, scanorder: progressive, yuv luminance scale: full, matrix: 709
# Loading C:\Users\Selur\Desktop\TestBW1.jpg using vsImageReader
clip = core.imwri.Read(["C:/Users/Selur/Desktop/TestBW1.jpg"])
clip = core.std.Loop(clip=clip, times=100)
frame = clip.get_frame(0)
# Setting detected color matrix (709).
clip = core.std.SetFrameProps(clip, _Matrix=1)
# Setting color transfer (709), if it is not set.
if '_Transfer' not in frame.props or not frame.props['_Transfer']:
clip = core.std.SetFrameProps(clip, _Transfer=1)
# Setting color primaries info (to 709), if it is not set.
if '_Primaries' not in frame.props or not frame.props['_Primaries']:
clip = core.std.SetFrameProps(clip, _Primaries=1)
# Setting color range to PC (full) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=0)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
# adjusting color space from GRAY8 to RGB24 for vsDeOldify
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, range_s="full")
# adding colors using DeOldify
from vsdeoldify import ddeoldify
clip = ddeoldify(clip=clip, model=0, sat=[0.50,1.00], hue=[0.00,5.00], dd_method=0, dd_weight=0.50, dd_model=1)
# adjusting output color from: RGB24 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="full")
# set output frame rate to 25fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()Quote:For example selecting Tewak to de-saturate an image to B&W before ddeoldify is not more working.Works fine here, tried: # Imports
import vapoursynth as vs
# getting Vapoursynth core
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'F:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll")
# Import scripts
import adjust
# source: 'G:\TestClips&Co\files\test.avi'
# current color space: YUV420P8, bit depth: 8, resolution: 640x352, fps: 25, scanorder: progressive, yuv luminance scale: limited, matrix: 470bg
# Loading G:\TestClips&Co\files\test.avi using LWLibavSource
clip = core.lsmas.LWLibavSource(source="G:/TestClips&Co/files/test.avi", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0)
frame = clip.get_frame(0)
# Setting detected color matrix (470bg).
clip = core.std.SetFrameProps(clip, _Matrix=5)
# Setting color transfer (170), if it is not set.
if '_Transfer' not in frame.props or not frame.props['_Transfer']:
clip = core.std.SetFrameProps(clip, _Transfer=6)
# Setting color primaries info (to 470), if it is not set.
if '_Primaries' not in frame.props or not frame.props['_Primaries']:
clip = core.std.SetFrameProps(clip, _Primaries=5)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
# Color Adjustment
clip = adjust.Tweak(clip=clip, hue=0.00, sat=0.00, cont=1.00, coring=False)
# adjusting color space from YUV420P8 to RGB24 for vsDeOldify
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="470bg", range_s="limited")
# adding colors using DeOldify
from vsdeoldify import ddeoldify
clip = ddeoldify(clip=clip, model=0, sat=[0.50,1.00], hue=[0.00,5.00], dd_method=0, dd_weight=0.50, dd_model=1)
# adjusting output color from: RGB24 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="470bg", range_s="limited")
# set output frame rate to 25fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()Using another image sequence: # Imports
import vapoursynth as vs
# getting Vapoursynth core
import sys
import os
core = vs.core
# Import scripts folder
scriptPath = 'F:/Hybrid/64bit/vsscripts'
sys.path.insert(0, os.path.abspath(scriptPath))
# Loading Plugins
core.std.LoadPlugin(path="F:/Hybrid/64bit/vsfilters/Support/libimwri.dll")
# Import scripts
import adjust
# source: 'G:/clips/image sequence/ED-360-png/10940.png'
# current color space: RGB24, bit depth: 8, resolution: 640x360, fps: 25, scanorder: progressive, yuv luminance scale: full, matrix: 709
# Loading G:\clips\image sequence\ED-360-png\10940.png using vsImageReader
clip = core.imwri.Read(["G:/clips/image sequence/ED-360-png/10940.png"])
clip = core.std.Loop(clip=clip, times=100)
frame = clip.get_frame(0)
# Setting color transfer (170), if it is not set.
if '_Transfer' not in frame.props or not frame.props['_Transfer']:
clip = core.std.SetFrameProps(clip, _Transfer=6)
# Setting color primaries info (to 470), if it is not set.
if '_Primaries' not in frame.props or not frame.props['_Primaries']:
clip = core.std.SetFrameProps(clip, _Primaries=5)
# making sure frame rate is set to 25
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # progressive
# adjusting color space from RGB24 to YUV444PS for vsTweak
clip = core.resize.Bicubic(clip=clip, format=vs.YUV444PS, matrix_s="709", range_s="full")
# Color Adjustment
clip = adjust.Tweak(clip=clip, hue=0.00, sat=0.00, cont=1.00, coring=False)
# adjusting color space from YUV444PS to RGB24 for vsDeOldify
clip = core.resize.Bicubic(clip=clip, format=vs.RGB24, matrix_in_s="709", range_s="full", dither_type="error_diffusion")
# adding colors using DeOldify
from vsdeoldify import ddeoldify
clip = ddeoldify(clip=clip, model=0, sat=[0.50,1.00], hue=[0.00,5.00], dd_method=0, dd_weight=0.50, dd_model=1)
# adjusting output color from: RGB24 to YUV420P10 for NVEncModel
clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, matrix_s="709", range_s="full")
# set output frame rate to 25fps (progressive)
clip = core.std.AssumeFPS(clip=clip, fpsnum=25, fpsden=1)
# Output
clip.set_output()Cu Selur |