Log in

View Full Version : Automated Colorization Script (Now ChromaJig)


Pages : 1 2 3 [4] 5

cork_OS
20th July 2016, 09:00
http://demos.algorithmia.com/colorize-photos/
http://i1376.photobucket.com/albums/ah1/Ivan_Nemow/52b568d28c0e6d224356fed37ee87e46_IceCold_BW0_zpssjbib6gx.png (http://s1376.photobucket.com/user/Ivan_Nemow/media/52b568d28c0e6d224356fed37ee87e46_IceCold_BW0_zpssjbib6gx.png.html) http://i1376.photobucket.com/albums/ah1/Ivan_Nemow/6c740146e6a1123790b63168bc031b39_SE_BW0_zpsgwabpgpv.png (http://s1376.photobucket.com/user/Ivan_Nemow/media/6c740146e6a1123790b63168bc031b39_SE_BW0_zpsgwabpgpv.png.html)

MWilson
21st July 2016, 03:43
Edit: Above script at post 151 is much better.

Full rewrite. ChromaJig v1 (or is it a million? )
:rolleyes:

Requirements:
defreq
Masktools
MedianBlur
GamMac

Optional:
F2Quiver



function cm1 (clip c, float weight)
{
c=c.converttoyv12()

v=c.gaussresize(256,256)##.unfilter(0,100).unfilter(100,100)
v


g=v.defreq(fy=-100,fx=100,sharp=0,dx=50,dy=50,cutx=0,cuty=0,info=false)

b=v.defreq(fy=-100,fx=0,sharp=0,dx=50,dy=50,cutx=0,cuty=0,fx2=0,fy2=0)

r=v.defreq(fy=0,fx=36,sharp=0,dx=50,dy=50,cutx=0,cuty=0)

g1=v.defreq(fy=-50,fx=49,sharp=0,dx=50,dy=50,cutx=0,cuty=0)

b1=v.defreq(fy=0,fx=49,sharp=0,dx=50,dy=50,cutx=0,cuty=0,fx2=0,fy2=0)

r1=v.defreq(fy=-50,fx=34,sharp=0,dx=50.0,dy=50.0,cutx=0,cuty=0)

x1=merge(r1,r)
y1=merge(g,g1)
z1=merge(b,b1)
x=mt_makediff(v,x1,y=3).converttorgb()
y=mt_makediff(v,y1,y=3).converttorgb()
z=mt_makediff(v,z1,y=3).converttorgb()
mergergb(x,y,z)
converttoyv12()
coloryuv(autowhite=true)
gaussresize(width(c),height(c))
ColorYUV(autogain=true,autowhite=false)
tweak(sat=3.5,interp=32)
invert("UV")
swapuv()
medianblur(0,5,5)
mergechroma(c,last,weight)
return last
}

function chromajig(clip g, float weight)
{
g=g.greyscale().converttoyv12()
converttorgb(g)
rgbadjust(g=0)
invert()
cm1(1)
invert("Y")
converttorgb()
rgbadjust(r=0,b=0)
merge(g.cm1(1),last.converttoyv12())
converttorgb()
gammac(-3)
converttoyv12()
coloryuv(cont_u=220,cont_v=220)
mergechroma(g,last,weight)
return last
}

I hope this can be useful.

:thanks:

Edit: Removed last line. - Added CMJ.
Edit: CMJ Removed.

MWilson
24th July 2016, 09:29
I'm finding some uses of cmfullshift out in the wild.

Large portions of Metropolis.

https://www.youtube.com/watch?v=AbH1cQUnh7U (https://www.youtube.com/watch?v=AbH1cQUnh7U)

The transformation scene.

https://www.youtube.com/watch?v=E99Gb7N2oIk

Deadly Earnest.

https://www.youtube.com/watch?v=6XxooEg9qxo (https://www.youtube.com/watch?v=6XxooEg9qxo)

Because I modified the first post, omitting the script, here it is warts and all.


function cmfull(clip v2)
{
v2=v2.greyscale()
width=v2.width/2
height=v2.height/2
v=v2.sincresize(256,256).greyscale().addborders(width,height,width,height)

g=v.defreq(fy=0,fx=59,sharp=100,dx=50,dy=50,cutx=0,cuty=0,info=false)

b=v.defreq(fy=0,fx=65,sharp=100,dx=50,dy=50,cutx=0,cuty=0,info=false)

r=v.defreq(fy=0,fx=39,sharp=100,dx=50,dy=50,cutx=0,cuty=0)

g1=v.defreq(fy=0,fx=51,sharp=100,dx=50,dy=50,cutx=0,cuty=0)

b1=v.defreq(fy=0,fx=59,sharp=100,dx=50,dy=50,cutx=0,cuty=0,fx2=100,fy2=0)

r1=v.defreq(fy=0,fx=47,sharp=100,dx=50,dy=50,cutx=0,cuty=0)
x1=merge(r1,r)
y1=merge(g,g1)
z1=merge(b1,b1)
z2=overlay(v,z1,0,0,mode="multiply")
y2=overlay(v,y1,mode="multiply")
x2=overlay(v,x1,mode="multiply")
x=mt_makediff(v,x1).converttorgb().crop(width,height,-width,-height)
y=mt_makediff(v,y2).converttorgb().crop(width,height,-width,-height)
z=mt_makediff(v,z2).converttorgb().crop(width,height,-width,-height)
mergergb(x,y,z)
lanczos4resize(width(v2),height(v2))
converttoyv12()
ColorYUV(autogain=false,autowhite=true)
tweak(sat=1)
ax=last.sincresize(width(v2),height(v2))
bx=mergechroma(v2.greyscale(),ax,1)
coloryuv(bx,autowhite=true)
mergechroma(merge(last,last.invert("Y").invert("UV")),last,1)
mergechroma(v2.greyscale(),last,1)
return last
}



function cmfullshift (clip v)
{
v=v.converttoyv12().greyscale()##only addition
cmfull(v)
u=last.utoy()
v2=last.vtoy()
stackhorizontal(u,v2)
ytouv(u,v2,v)
tweak(sat=3.5,interp=32)
coloryuv(autowhite=true)
u3=repair(v.lanczosresize(width(v)/2,height(v)/2),u)
v3=repair(v.lanczosresize(width(v)/2,height(v)/2),v2)
ytouv(u3,v3,v)
tweak(sat=7.5,interp=32)
mergechroma(v,last,.33)
coloryuv(autowhite=true)
return last
}

RocketJet
24th July 2016, 12:13
I cannot find the gammac plugin needed for the ChromaJig script above. Google didn't help.

Can anyone point me to it?

MWilson
24th July 2016, 12:18
GamMac:

http://forum.doom9.org/showthread.php?t=173695

RocketJet
24th July 2016, 14:58
Thanks.

Reel.Deel
24th July 2016, 16:48
Interesting VideoHelp thread: Coloring Grey-Scale Image: Another triumph of deep learning AI (http://forum.videohelp.com/threads/378962-Coloring-Grey-Scale-Image-Another-triumph-of-deep-learning-AI)

MWilson
24th July 2016, 17:31
Thanks for the link Reel.Deel :)

function cmfullshift2 (clip v)
{
v=v.converttoyv12()
cmfull(v)
u=last.utoy()
v2=last.vtoy()
##stackhorizontal(u,v2)
ytouv(u,v2,v)
tweak(sat=3.5,interp=32)
coloryuv(autowhite=true)
##u3=repair(v.lanczosresize(width(v)/2,height(v)/2),u)
##v3=repair(v.lanczosresize(width(v)/2,height(v)/2),v2)
ytouv(u,v2,v)
tweak(sat=7.5,interp=32)
mergechroma(v,last,.33)
coloryuv(autowhite=true)
##vtoy()
u4=mt_merge(u.spline36resize(width(v),height(v)),u.invert().spline36resize(width(v),height(v)),v).lanczosresize(width(v)/2,height(v)/2)
v4=mt_merge(v2.spline36resize(width(v),height(v)),v2.invert().spline36resize(width(v),height(v)),v).lanczosresize(width(v)/2,height(v)/2)
ytouv(u4,v4,v)
tweak(sat=7.5)
mergechroma(v,last,.75)
return last
}

function cmshifter (clip y, float weight)
{
y=y.converttoyv12().greyscale()
gaussresize(y,192,108)
cmfullshift2()
coloryuv(cont_u=-96,cont_v=-96)
hqdn3d(8,16,0,4.5)
tweak(sat=7.5,interp=32)
gaussresize(width(y),height(y))
mergechroma(y.chromajig(1),last,.33)
mergechroma(y,last,weight)
return last
}

CMShifter comes (I think) as close as I have gotten.

Hope you guys like it!

Edit: Comparison Pic - cmfullshift (left) / cmshifter (right)

http://i1053.photobucket.com/albums/s461/Morgan_Dale_Wilson/cmfullshift%20vs%20cmshifter_zpsajnmvcf7.jpg (http://s1053.photobucket.com/user/Morgan_Dale_Wilson/media/cmfullshift%20vs%20cmshifter_zpsajnmvcf7.jpg.html)]

MWilson
29th July 2016, 05:37
ChromaJig v1.6a - 8/15/2016

Requirements:
Defreq
Masktools2
HQDN3d

function fc1(clip v,float weight)
{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364
v=v.greyscale().converttoyv12()
af=v.defreq(fy=-.29,fx=.29,sharp=0,dx=.50,dy=.50,fy2=-.88,fx2=.88,dx2=.50,dy2=.50)
av=v.defreq(fy=-29,fx=29,sharp=0,dx=50,dy=50,fy2=-88,fx2=88,dx2=50,dy2=50)
ax=v.defreq(fy2=-88,fx2=88,sharp=0,dx2=50,dy2=50,fy=-58,fx=58,dx=0,dy=50)
a=mt_makediff(merge(af,av),v).converttorgb().converttoyv12()
m1=ytouv(av,a).converttoyv12().sincresize(width(v),height(v))
y2=ytouv(m1.invert(),av).converttoyv12().sincresize(width(v),height(v))
merge(m1,y2,.35)
converttoyv12(last)
coloryuv(autowhite=true)
tweak(sat=5,maxsat=59.5,interp=20)
merge(v.invert().converttoyv12(),last.converttoyv12())
converttorgb()
sb=showblue(last).invert()
sr=showred(last).invert()
sg=showgreen(last).invert()
mergergb(sb,sr,sg)
ConvertToYV12()
sx=last.converttorgb().invert("G").converttoyv12()
sy=last.converttoyv12()
mergechroma(sy,sx,.50).converttoyv12()
merge(last,v.invert().converttoyv12()).invert("UV").swapuv()
tweak(sat=7.5,maxsat=59.5,interp=20)
mergechroma(v.converttoyv12(),last,weight)
coloryuv(autowhite=true)
converttorgb24()
return last
}

function fc2(clip v)
{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364
v=v.converttoyv12()
merge(v.invert().fc1(1).converttoyv12().coloryuv(cont_u=-128,cont_v=-128),v.fc1(1).converttoyv12())
converttoyv12()
tweak(sat=5,interp=32)
mergechroma(v,last.awarpsharp2(depth=48,chroma=4),.333)
return last
}

function chromajig(clip y)
{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364
y=y.greyscale().converttoyv12()
y1=y.gaussresize(72,48)
y1
fc2()
hqdn3d(0,28,0,4.5)
gaussresize(width(y),height(y))
subtract(y.fc2(),last)
mergeluma(y)
return last
}

Edit: New - Version 1.6a
Edit: Minor Changes
Edit: New - Version 1.5b - Removed Link to video
Edit: New - Version 1.5a - Removed Extra Calls - Output is the same
Edit: Remove Old Pics
Edit: Link to script and all requirements :ChromaJig (https://drive.google.com/folderview?id=0B72PmD8lKDzSQmxaTTdhV0VnRDQ&usp=sharing)

MWilson
15th August 2016, 21:35
I apologize for the last script. It wasn't even working for me :(
I've posted a new version (3 scripts in 1), but I'm having trouble getting much further than this. Any ideas would be appreciated.
I hope this can be helpful. I'm taking a break :rolleyes:

RocketJet
20th August 2016, 10:52
I tried running ChromaJig under AviSynth MT and it is MUCH faster.

Also, to get better skin tones, I use VirtualDub gradation curves filter to limit saturation.

MWilson
20th August 2016, 10:57
I tried running ChromaJig under AviSynth MT and it is MUCH faster - about 8x.

Also, to get better skin tones, I use VirtualDub gradation curves filter to limit saturation.

Thanks for the tip! I'll check out a MT build.And I've been using colormill for similar reasons.

RocketJet
20th August 2016, 11:12
I used the AviSynth MT version and instructions from the following page:

http://forum.doom9.org/showthread.php?t=148782

RocketJet
20th August 2016, 15:17
I didn't notice at first that part of the speed up in processing was from the latest version of ChromaJig. But still, using AviSynth MT certainly helped too.

real.finder
20th September 2016, 17:06
ChromaJig v1.6a - 8/15/2016

Requirements:
Defreq
Masktools2
HQDN3d

function fc1(clip v,float weight)
{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364
v=v.greyscale().converttoyv12()
af=v.defreq(fy=-.29,fx=.29,sharp=0,dx=.50,dy=.50,fy2=-.88,fx2=.88,dx2=.50,dy2=.50)
av=v.defreq(fy=-29,fx=29,sharp=0,dx=50,dy=50,fy2=-88,fx2=88,dx2=50,dy2=50)
ax=v.defreq(fy2=-88,fx2=88,sharp=0,dx2=50,dy2=50,fy=-58,fx=58,dx=0,dy=50)
a=mt_makediff(merge(af,av),v).converttorgb().converttoyv12()
m1=ytouv(av,a).converttoyv12().sincresize(width(v),height(v))
y2=ytouv(m1.invert(),av).converttoyv12().sincresize(width(v),height(v))
merge(m1,y2,.35)
converttoyv12(last)
coloryuv(autowhite=true)
tweak(sat=5,maxsat=59.5,interp=20)
merge(v.invert().converttoyv12(),last.converttoyv12())
converttorgb()
sb=showblue(last).invert()
sr=showred(last).invert()
sg=showgreen(last).invert()
mergergb(sb,sr,sg)
ConvertToYV12()
sx=last.converttorgb().invert("G").converttoyv12()
sy=last.converttoyv12()
mergechroma(sy,sx,.50).converttoyv12()
merge(last,v.invert().converttoyv12()).invert("UV").swapuv()
tweak(sat=7.5,maxsat=59.5,interp=20)
mergechroma(v.converttoyv12(),last,weight)
coloryuv(autowhite=true)
converttorgb24()
return last
}

function fc2(clip v)
{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364
v=v.converttoyv12()
merge(v.invert().fc1(1).converttoyv12().coloryuv(cont_u=-128,cont_v=-128),v.fc1(1).converttoyv12())
converttoyv12()
tweak(sat=5,interp=32)
mergechroma(v,last.awarpsharp2(depth=48,chroma=4),.333)
return last
}

function chromajig(clip y)
{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364
y=y.greyscale().converttoyv12()
y1=y.gaussresize(72,48)
y1
fc2()
hqdn3d(0,28,0,4.5)
gaussresize(width(y),height(y))
subtract(y.fc2(),last)
mergeluma(y)
return last
}

Edit: New - Version 1.6a
Edit: Minor Changes
Edit: New - Version 1.5b - Removed Link to video
Edit: New - Version 1.5a - Removed Extra Calls - Output is the same
Edit: Remove Old Pics
Edit: Link to script and all requirements :ChromaJig (https://drive.google.com/folderview?id=0B72PmD8lKDzSQmxaTTdhV0VnRDQ&usp=sharing)

wow, this is very good, I test it in damaged VCR home made video that lost the colour and it work but there is some Artifacts (like blue big halo)

StainlessS
20th September 2016, 23:18
Yes, M Wilson made some real strange but good investigations into that area.

Mostly inexplicable (un - explainable, but still seem to work, against all odds).

Floatingshed
23rd September 2016, 23:06
I'm trying to have a play with chromajig_15 but cannot get past: There is no function called F2Quiver
It is there, in the plugins folder... and libfftw3f-3.dll is in system32 and syswow64.
Any ideas please?

Also what is "cmfull" and "cmfullshift"? There seem to be various bits of code scattered throughout this thread. How should this be used?

Thanks.

MWilson
24th September 2016, 04:48
I'm stumped on the first question :mad:
As for the second, I was (am) very disorganized! I'm pretty happy with the script real.finder quoted a couple of posts up, FWIW.
:thanks:

Floatingshed
24th September 2016, 20:18
I have tried the script posted by real.finder and I'm now having trouble with a different filter: "unable to load awarpsharp.dll Module not found, install missing library.
Can anyone suggest what might be happening here. I have tried the dll in my avisynth plugins folder (which gives: no function called awarpsharp2) and elsewhere specifically loaded (which gives the above error). I have 32bit avisynth 2.6mt under win7 64bit. Using x86 version of awarpsharp2 dll

Its really frustrating when this sort of stuff stops you playing with an interesting script grrr!

raffriff42
24th September 2016, 20:33
>cannot get past: There is no function called F2Quiver...
Make sure you have a valid source clip.

If you call any filter without giving it a source clip, you get an error message; usually either
Invalid arguments to function "<filter>"
or
I don't know what "<filter>" means


>unable to load awarpsharp.dll Module not found, install missing library.
From the wiki page (http://avisynth.nl/index.php/AWarpSharp2#Requirements), you need
Microsoft Visual C++ 2015 Redistributable Package (vcredist_x86.exe) (http://www.microsoft.com/en-us/download/details.aspx?id=52982)

Floatingshed
24th September 2016, 21:12
Thanks, clearly I had an older version. Sorted now, although I still can't get F2Quiver to work (same errors as above). I guess a different runtime is needed but there's no mention of which one on the wiki.

Now the script is working without errors it isn't producing anything like the results posted in this thread, everything I try is just cepia with a blue halo!

Taurus
24th September 2016, 21:24
Amazing, truly amazing!
Tried CromaJig for the first time.
Everything went smooth.
I must have been lucky, all dependancies are working right out of the box.
Took some greyscales and sepia toned clips,
....and wow!
What a surprise.
Colors, real colors in the results.
Thank you MWilson and of course StainlessS and all others who made this magic happened:thanks::thanks:

Floatingshed
24th September 2016, 21:38
Amazing, truly amazing!
Tried CromaJig for the first time.
Everything went smooth.
I must have been lucky, all dependancies are working right out of the box.
Took some greyscales and sepia toned clips,
....and wow!
What a surprise.
Colors, real colors in the results.
Thank you MWilson and of course StainlessS and all others who made this magic happened:thanks::thanks:

Would you please post exactly what you did to get good results?
Just please copy your script.
Thanks.

MWilson
24th September 2016, 23:56
Amazing, truly amazing!
Tried CromaJig for the first time.
Everything went smooth.
I must have been lucky, all dependancies are working right out of the box.
Took some greyscales and sepia toned clips,
....and wow!
What a surprise.
Colors, real colors in the results.
Thank you MWilson and of course StainlessS and all others who made this magic happened:thanks::thanks:

Taurus, I'm glad you like it! You just made my day :D

Floatingshed
25th September 2016, 00:37
Please explain how to make this work.

The script posted by real.finder gives this: http://www.floatingshed.com/temp/1.jpg
The downloaded chromajig-15.avsi gives this: http://www.floatingshed.com/temp/2.jpg

MWilson
25th September 2016, 01:20
The only thing I can think of at the moment is to downscale before the script.

Try the following:

Y=Clip
Y.GaussResize(192,76).ChromaJig().GBlur(2).GaussResize(width(Y),height(Y))
MergeChroma(Y,Last)


Edit: I didn't even like the results of 1.5 and it will be replaced with the latest ASAP.

Floatingshed
25th September 2016, 01:48
Still not right...

http://www.floatingshed.com/temp/3.jpg

MWilson
25th September 2016, 02:15
Still not right...


Floatingshed, it's not perfect. If you just want rid of the halos, somebody else may be able to help :)

Floatingshed
25th September 2016, 02:23
Oh, I don't expect miracles! Is this now working as it should? I have had so many stumbles with this I am not sure...
Other folks earlier in this thread seemed to be getting far better results.

MWilson
25th September 2016, 02:30
From what I see it is. If you could point me to the images you like, I can most likely post the script used :)

raffriff42
25th September 2016, 05:12
Still not right...

http://www.floatingshed.com/temp/3.jpg

Simply limiting the maximum chroma/saturation helps a lot.
https://www.dropbox.com/s/vn7s6y0j5vbfgit/autochroma-sample103-limited.jpg?raw=1
Limiter (http://avisynth.nl/index.php/Limiter)(0, 255, 128-12, 128+12)

MWilson
25th September 2016, 05:30
Simply limiting the maximum chroma/saturation helps a lot.
:goodpost:

Limiter had slipped my mind, that's going to come in handy!

TheFluff
25th September 2016, 19:01
I really wouldn't put too much effort into a filter that by definition gives essentially random results. Just sayin'

MWilson
25th September 2016, 19:36
I really wouldn't put too much effort into a filter that by definition gives essentially random results. Just sayin'

There are plenty of problems, but those problems seem to be fairly consistent. So I will have to disagree :)

AzraelNewtype
25th September 2016, 20:55
Oh, I don't expect miracles! Is this now working as it should? I have had so many stumbles with this I am not sure...
Other folks earlier in this thread seemed to be getting far better results.

The best results shown in this thread were from when the script was being used on clips that had chroma, and the script was buggy and reusing that information instead of purely the random noise that you're getting.

MWilson
25th September 2016, 21:29
The best results shown in this thread were from when the script was being used on clips that had chroma, and the script was buggy and reusing that information instead of purely the random noise that you're getting.

A) The images you're talking about are gone, and have been for months.

B) Random noise is going too far, if you don't like the results you have every right to say so. But it plain and simply isn't what you're describing.

real.finder
25th September 2016, 21:53
The only thing I can think of at the moment is to downscale before the script.

Try the following:

Y=Clip
Y.GaussResize(192,76).ChromaJig().GBlur(2).GaussResize(width(Y),height(Y))
MergeChroma(Y,Last)


Edit: I didn't even like the results of 1.5 and it will be replaced with the latest ASAP.

gblur need 3 and up (odd number) (http://www.avisynth.nl/users/vcmohan/GBlur/GBlur.html)

do you use another GBlur?

TheFluff
25th September 2016, 21:57
No, seriously though, this particular bit of dumb has gone on for far too long. Your script is based on not just one, but a entire series of fundamental misunderstandings of the underlying technology (the most egregious ones being how measuring chromatic information actually works and what the frequency domain actually is). This has been pointed out to you several times already but still you persist in using the same method. This entire thread is one big tribute to the remarkable ability of the human perception to see what it wants to see. You're literally adding random colors (there is no correlation whatsoever between the information you're basing the colors on and the actual color of the object, so you're picking the colors at random - it's not even an educated guess) and when the almost correct shade happens to fall out of the slot machine for some important foreground object you claim that this is a success, never mind that literally everything else in the background is utter garbage and you get a whole truckload of bizarre artifacts to go along with it (hint: stop these dumb frequency domain operations already). The entire thing is nonsense that usually results in coloring the entire scene either vaguely orange or vaguely green. Just drop it.

MWilson
25th September 2016, 22:01
gblur need 3 and up (odd number) (http://www.avisynth.nl/users/vcmohan/GBlur/GBlur.html)

do you use another GBlur?

I most likely am. I'm away from my main computer so I can't give you the exact plugin (or version of ?). The idea is the same, I'd just go with whatever gives you the best results.

MWilson
25th September 2016, 22:08
Just drop it.

Exactly.

Navarre66
25th September 2016, 23:15
Really to do this correctly you would need to use a neural network. There just isn't enough information there. In reality most stars were wearing green makeup in the black and white TV shows so you are never going to want to show the real colors anyway.

Here are a couple articles that seems to be much better results, but still has work to go.

http://tinyclouds.org/colorize/

https://techcrunch.com/2016/03/31/this-neural-network-hallucinates-the-right-colors-into-black-and-white-pictures/

However I still wish you luck with this technique.

Navarre66

MWilson
25th September 2016, 23:26
Really to do this correctly you would need to use a neural network. There just isn't enough information there. In reality most stars were wearing green makeup in the black and white TV shows so you are never going to want to show the real colors anyway.

Here are a couple articles that seems to be much better results, but still has work to go.

http://tinyclouds.org/colorize/

https://techcrunch.com/2016/03/31/this-neural-network-hallucinates-the-right-colors-into-black-and-white-pictures/

However I still wish you luck with this technique.

Navarre66

Thank you, and I agree about the neural network approach :)

real.finder
27th September 2016, 06:32
I most likely am. I'm away from my main computer so I can't give you the exact plugin (or version of ?).

I am waiting :)

RocketJet
27th September 2016, 10:03
No, seriously though, this particular bit of dumb has gone on for far too long. .

On the contrary, I find it works quite well for me. I have colorized a bunch of stuff, including Fireball XL5 and the B/W seasons of Superman. Bottom line, if you don't like, then don't use it. I like it.

color
27th September 2016, 18:46
I think this works great on old movies. I do have to change the levels, contrast and brightness a bit on some scenes to make it work better. But the best result is when its outdoor, its the sky is blue and colors are great. Often the things that should be red becomes green, but I can live with that.

And about the off topic on colorization with learning, I would love to see this work somehow with avisynth, but I think its hard job and hard to do. But it looks awesome. Still I do like the ChromaJig and I do like it and its faster than other projects like:

http://people.cs.uchicago.edu/~larsson/colorization/
http://colorize.ttic.edu/

http://demos.algorithmia.com/colorize-photos/ (free to do one picture online but otherwise it cost)

https://github.com/satoshiiizuka/siggraph2016_colorization
http://colorize.dev.kaisou.misosi.ru/

https://github.com/Eiji-Kb/macacon

color
3rd October 2016, 18:31
Floatingshed

I do try to change the levels to get the best "colors" when its not good colored., but mostly they are okey.

I did change the levels but I think it could be mutch better if you do it. I just did this in a few secounds:

ImageSource("C:\where_ever\the_image.jpg").ConvertToYUY2(matrix="Rec601", interlaced=false)
Levels(0, 1.390, 191, 0, 170)
chromajig(1)

when merging the color/chroma(?) with the black and white image or movie then its so mutch better.

B=(ImageSource("C:\where_ever\the_image.jpg"))
C=(ImageSource("C:\where_ever\the_image.jpg").Levels(0, 1.390, 191, 0, 170).chromajig(1))
Overlay(B, C.BicubicResize(B.Width, B.Height), mode="chroma")

The only problem I have is the green color that sometimes want to color the face.

MWilson
26th October 2016, 04:02
function cjb(clip v)
{
v=v.converttoyv12().greyscale()
v1=v.spline36resize(240,240)
y=v1.converttorgb()
y.pointresize(8,8)
invert()
pointresize(16,16)
chromajig()
blur(1,1)
invert()
swapuv()
temporalsoften(10,0,20)
spline36resize(width(y),height(y))
a=last
y.pointresize(32,32)
chromajig()
blur(1,1)
invert()
spline36resize(width(y),height(y))
b=last
y.pointresize(128,128)
chromajig()
blur(1,1)
invert()
swapuv()
spline36resize(width(y),height(y))
c=last

subtract(a,b)
subtract(last,c)
invert()
temporalsoften(10,0,25)
mergechroma(y.converttoyv12().greyscale(),last,.75)
coloryuv(autowhite=true)
hqdn3d(0,6,0,4.5)
spline36resize(width(v),height(v))
blur(1,1)
mergechroma(v,last)
return last
}

function cjc(clip y)
{
y=y.greyscale().converttoyv12()
a=y.cjb().invert().tweak(hue=-90).invert().invert("U").swapuv()
b=y.cjb()
merge(a,b)
return last
}

Edit: Removed some extra lines

This is giving me some promising results, as always adjust as necessary.

:thanks:

MWilson
6th November 2016, 11:22
function ChromaJig3 (clip y, float weight)
{
y=y
weight=Default (weight,1)
y.gaussresize(240,240)
blur(1,1)
blur(1,1)
blur(1,1)
gaussresize(120,120)
blur(1,1)
blur(1,1)
gaussresize(42,42)
blur(1,1)
blur(1,1)
blur(1,1)
blur(1,1)
blur(1,1)
chromajig()
swapuv()
invert()
gaussresize(width(y),height(y))
subtract(last,y.chromajig())
a=last
a.gaussresize(36,36).chromajig().gaussresize(width(y),height(y))
b=last
c=subtract(a,b).swapuv()
d=subtract(b,a)
subtract(c,d)
merge(a,last)
merge(c,last)
invert("V")
mergechroma(y,last)
mergechroma(last,d,.75)
mergechroma(y,last,weight)
}



function fcjig(clip y)
{
y=y.converttoyv12()
y
gaussresize(80,60)
converttoyv12()
y1=last
y1
chromajig3(1)
converttorgb()
invert("G")
converttoyv12()
invert("UV")
swapuv()
blur(1,1)
blur(1,1)
blur(1,1)
merge(y1.chromajig(),last)
bilinearresize(width(y),height(y))
subtract(last,y.greyscale())
tweak(hue=-90)
merge(y.chromajig(),last)
gaussresize(80,80)
blur(1,1)
blur(1,1)
bilinearresize(width(y),height(y))
mergechroma(y,last)
return last
}


function chroma(clip v,float "Weight")
{
Weight= Default (Weight,.75)
v=v.greyscale().converttoyv12()
y=v.linearresize(240,240).greyscale()
y.fcjig()
mt_makediff(vtoY(),last.reduceby2(),u=3,v=3)
#chromajig3b()
invert()
coloryuv(autowhite=true)
linearresize(width(v),height(v))
mergechroma(v,last,Weight)
}


I know this could be shortened. If you don't have LinearResize, change it to whatever you tend to use :)

I hope you folks will enjoy it as much as I am.

You might want to use rgbadjust (Broken Record, I know). But it's fairly close from the get-go with everything I've tried.

Here's two short clips that haven't been corrected or graded, one is from a color source converted to greyscale, and one that was originally colorized and then converted to greyscale.


https://vimeo.com/190428169

Usage:
Chroma()

Thanks folks!

MWilson
7th November 2016, 14:00
function fc1(clip v,float weight)

{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364

v=v.greyscale().converttoyv12()
af=v.defreq(fy=-.29,fx=.29,sharp=0,dx=.50,dy=.50,fy2=-.88,fx2=.88,dx2=.50,dy2=.50)
av=v.defreq(fy=-29,fx=29,sharp=0,dx=50,dy=50,fy2=-88,fx2=88,dx2=50,dy2=50)
ax=v.defreq(fy2=-88,fx2=88,sharp=0,dx2=50,dy2=50,fy=-58,fx=58,dx=0,dy=50)
a=mt_makediff(merge(af,av),v).converttorgb().converttoyv12()
m1=ytouv(av,a).converttoyv12().sincresize(width(v),height(v))
y2=ytouv(m1.invert(),av).converttoyv12().sincresize(width(v),height(v))
merge(m1,y2,.35)
converttoyv12(last)
coloryuv(autowhite=true)
tweak(sat=5,maxsat=59.5,interp=20)
merge(v.invert().converttoyv12(),last.converttoyv12())
converttorgb()
sb=showblue(last).invert()
sr=showred(last).invert()
sg=showgreen(last).invert()
mergergb(sb,sr,sg)
ConvertToYV12()
sx=last.converttorgb().invert("G").converttoyv12()
sy=last.converttoyv12()
mergechroma(sy,sx,.50).converttoyv12()
merge(last,v.invert().converttoyv12()).invert("UV").swapuv()
tweak(sat=7.5,maxsat=59.5,interp=20)
mergechroma(v.converttoyv12(),last,weight)
coloryuv(autowhite=true)
converttorgb24()

return last

}



function fc2(clip v)

{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364

v=v.greyscale().converttoyv12()
merge(v.invert().fc1(1).converttoyv12().coloryuv(cont_u=-128,cont_v=-128),v.fc1(1).converttoyv12())
converttoyv12()
tweak(sat=5,interp=32)
mergechroma(v,last.awarpsharp2(depth=48,chroma=4),.333)

return last

}



function chromajig(clip y)

{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364

y=y.greyscale().converttoyv12()
y1=y.gaussresize(72,48)
y1
fc2()
#hqdn3d(0,28,0,4.5)
gaussresize(width(y),height(y))
subtract(y.fc2(),last)
mergeluma(y)
return last
}


function cjbx(clip v)

{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364

v=v.converttoyv12().greyscale()
v1=v.spline36resize(240,240)
y=v1.converttorgb()
y.pointresize(8,8)
invert()
pointresize(16,16)
chromajig()
blur(1,1)
invert()
swapuv()
#temporalsoften(10,0,20)
spline36resize(width(y),height(y))

a=last

y.pointresize(32,32)
chromajig()
blur(1,1)
invert()
spline36resize(width(y),height(y))

b=last

y.pointresize(180,180)
chromajig()
blur(1,1)
invert()
swapuv()
spline36resize(width(y),height(y))

c=last

subtract(a,b)
subtract(last,c)
invert()
spline36resize(width(y),height(y))
mergechroma(y.converttoyv12().greyscale(),last,.75)
coloryuv(autowhite=true)
spline36resize(width(v),height(v))
blur(1,1)
mergechroma(v,last)
return last
}



function colorfox(clip y)
{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364
y=y.greyscale().converttoyv12()
y.cjbx()
a=last
c1=a.converttorgb()

r=showred(c1)
g=showgreen(c1)
b=showblue(c1)

c=merge(r,merge(g,b).invert())
m=merge(g,merge(r,b).invert())
ye=merge(b,merge(r,g).invert())

mergergb(ye,m,c)

subtract(last,c1)
converttoyv12()
invert("UV")
subtract(a,last)
swapuv()
}


function colorjig(clip v, float "Weight")
{# (c) MWilson, http://forum.doom9.org/showthread.php?t=173364
Weight= Default(Weight,1)
v=v.greyscale().converttoyv12()
b=v.greyscale().colorfox().tweak(hue=90).invert("UV").coloryuv(autowhite=true).invert("V").converttoyv12()

merge(b,b.chromajig())
coloryuv(autowhite=true)
mergechroma(v,last,Weight)
}


Usage:
ColorJig()

Edit: Quick Test using ColorJig().Autolevels()
https://vimeo.com/190554882

Edit: Commented out HQDN3D and temporalsoften calls, it was painfully slow. Using a denoiser after the fact is really just about as good.

MWilson
8th November 2016, 11:33
This one is very close as far as I can see. I apologize for the posts, I just had to get some stuff out there.

function cfcf2(clip y)
{
y=y.greyscale().converttoyv12().invert().turnleft()
a=y.cjbx().utoy()
b=y.invert().TurnLeft().cjbx().TurnRight().invert().utoy()
ytouv(a,b,y)
mergechroma(y,last,.45)
converttoyv12()
c=last
subtract(c,y.cjbx())
invert("UV")
medianblur(0,10,10)
mergechroma(c,last,.33)
turnright()
invert("Y")
return last
}


http://i1053.photobucket.com/albums/s461/Morgan_Dale_Wilson/Porkysavs008533_zpst3eic1na.png
http://i1053.photobucket.com/albums/s461/Morgan_Dale_Wilson/Porkysavs000946_zpsrub89jmc.png
http://i1053.photobucket.com/albums/s461/Morgan_Dale_Wilson/Star_Trek_The_Cage_hybrid_vs_full_version_part_2_3_hd1080017063_zpshzw6ylp9.png
http://i1053.photobucket.com/albums/s461/Morgan_Dale_Wilson/Porkysavs004610_zps1un54eqv.png