Log in

View Full Version : avisynth - convert 2d to 3d anaglyph movies


toli
10th March 2010, 21:39
Hello Guys,
I am trying to change a script which I found in other forum that converts 2d movies to 3d - for anaglyph red-cyan glasses.
The final script I have :

SetMTMode(2,0)


video2d = DirectShowSource("movie1.mov")
video2d = ConvertToRGB32(video2d)

videoW = width(video2d)
videoH = height(video2d)
ResW = videoW + (videoW / 100)
CropW = (ResW - videoW) / 2


f1 = video2d
f2 = DeleteFrame(video2d, 0)


f1 = LanczosResize(f1, ResW, videoH)
f1 = Crop(f1, 0, 0, videoW, videoH)

f2 = LanczosResize(f2, ResW, videoH)
f2 = Crop(f2, CropW, 0, videoW, videoH)

f1 = f1.RGBAdjust(0, 0.7, 0.3)
f1_1 = MergeRGB(f1.ShowGreen, f1.ShowRed, f1.ShowRed)
f1_2 = MergeRGB(f1.ShowBlue, f1.ShowRed, f1.ShowRed)
f1_3 = Merge(f1_1, f1_2)
f1_3 = f1_3.RGBAdjust(1.0,0,0)

f2 = f2.RGBAdjust(0, 1, 1)
f2 = f2.ConvertToYV12.Tweak(Bright=30)
f2 = f2.ConvertToRGB

Merge(f1_3, f2)

The script should implement the formula for optimized anaglyps from the next links:
http://www.3dtv.at/knowhow/AnaglyphComparison_en.aspx
http://mitglied.multimania.de/stereo3d/anaglyphcomparison.htm

So I have mistake in my implementation because I cannot get similar results.
May anybody can help me here ...
Thanks in advance

Wilbert
10th March 2010, 21:47
ResW = videoW + (videoW / 100)

ResW = videoW + (float(videoW) / 100)

toli
11th March 2010, 09:05
ResW = videoW + (float(videoW) / 100)

Thanks I will try it.
The problem which I saw is related to color from in f1_3 clip it should be only red computed from original green and blue channels but this new red clip is not enough contrast maybe or bright.
I cannot get a picture like this:
http://mitglied.multimania.de/stereo3d/OptimizedAnaglyph.jpg
Mine are darker and with bad colors.

Gavino
11th March 2010, 12:28
The problem which I saw is related to color from in f1_3 clip it should be only red computed from original green and blue channels but this new red clip is not enough contrast maybe or bright.
I don't think Wilbert's 'correction' is right.
The problem is with the code:
f1_3 = Merge(f1_1, f1_2)
f1_3 = f1_3.RGBAdjust(1.0,0,0)

Since Merge gives a 50% weighting to each clip, the second line needs, to fit with the formula, to be:
f1_3 = f1_3.RGBAdjust(2.0,0,0)

You may also need something similar at the end of the script following the final Merge.

toli
11th March 2010, 14:11
I don't think Wilbert's 'correction' is right.
The problem is with the code:
f1_3 = Merge(f1_1, f1_2)
f1_3 = f1_3.RGBAdjust(1.0,0,0)

Since Merge gives a 50% weighting to each clip, the second line needs, to fit with the formula, to be:
f1_3 = f1_3.RGBAdjust(2.0,0,0)

You may also need something similar at the end of the script following the final Merge.

I will try it later today and will post the result.

JK1974
4th October 2010, 16:20
I also tried to make an anaglyph version of a video, and I have used the original left and right images from http://www.3dtv.at/Knowhow/DeAnaglyph_de.aspx.

This is my script - you can see clearly that the lower part is partly taken from toliīs script:

f1=ImageReader("C:\Users\jk\Desktop\sample1left.jpg")
f2=ImageReader("C:\Users\jk\Desktop\sample1right.jpg")
f1=ConvertToRGB32(f1)
f2=ConvertToRGB32(f2)

f1 = RGBAdjust(f1,0, 0.7, 0.3)
f1_1 = MergeRGB(f1.ShowGreen, f1.ShowRed, f1.ShowRed)
f1_2 = MergeRGB(f1.ShowBlue, f1.ShowRed, f1.ShowRed)
f1_3 = Merge(f1_1, f1_2)
f1_3 = RGBAdjust(f1_3,2.0,0,0)
f1_3 = Levels(f1_3,0,1.5,255,0,255,coring=false)

f2 = RGBAdjust(f2,0, 1, 1)

final=Merge(f1_3, f2)
final=RGBAdjust(final,2.0,2.0,2.0)

return final

I think, the result looks the same as on the examples at http://mitglied.multimania.de/stereo3d/anaglyphcomparison.htm.

3D cinema
10th October 2010, 13:19
Hello toli!

Why do you want an "optimized" anaglyph? I use an usual color anaglyph and it looks good. You can download my anaglyph reels from "Demo" part of my site http://www.teleport-1m.ru

JK1974
10th October 2010, 21:19
Hi,
the advantages are explained at the 3dtv.at/multimania.de site. One of the main problems is some kind of "flickering" in red areas because the one eye then sees red while the other eye get black which is not really convenient. This is called "Retinal rivalry". Using optimized anaglyphs, this effect is reduced which *might* result in a less straining watching experience. Just check out the Stereoscopic Player from 3dtv.at which offers all the options mentioned at the 3dtv.at/multimania.de site - or the script above.

3D cinema
11th October 2010, 18:33
Hi!

What for we must use an anaglyph method at all? Have you seen modern 3D LED TVs "Samsung" in a store? I have seen. In my opinion it is more convenient method of viewing of 3D videos.

Do you know that modern 3D LED TVs can play 3D videos from USB 2.0 flash card? You can download my 3D videos prepared for 3D LED TVs from "Demo" part of my site.

JK1974
11th October 2010, 23:55
Hi!

What for we must use an anaglyph method at all? Have you seen modern 3D LED TVs "Samsung" in a store? I have seen. In my opinion it is more convenient method of viewing of 3D videos.

Do you know that modern 3D LED TVs can play 3D videos from USB 2.0 flash card? You can download my 3D videos prepared for 3D LED TVs from "Demo" part of my site.

You first need to get a 3D TV. Even if prices are going down, you still have to spend lots of money in the shutterglasses. So, if you want to watch a movie with the whole family, itīs getting quite expensive. Furthermore, a lot of people have bought a 2D flatscreen within the last two years - do you think they are going to buy a new one this christmas just for watching 10 or 20 movies per year, most of them being animation movies and documentaries? I wonīt (I would do immediately if I won in a lottery).
Additionally, shutter glasses wonīt be the best technology in the future: Toshiba is coming with a TV set where you are said not to need any glasses at all, and if this is not satisfying, there will also be solutions based on polarization for sure (you already get this on Zalman, Acer and Hyundai PC monitors at 22"/24" sizes).

So, I would prefer using side-by-side encoding for archiving, but for watching it in the living room on the 2D TV set right now, I will have to make an anaglyph version because neither the TV set, nor the streaming client nor a Blu-ray player will give me an anaglyph output, just PowerDVD and Stereoscopic Player on a connected PC.

And everyone, whom I have shown a 3D-Blu-ray played back with PowerDVD with anaglyphs turned on, said, that the result is quite good (or even "impressing") - apart from the problem with the missing colours. So I think, this anaglyph output is an underestimated solution for the time until 3D TVs are common and/or glasses become cheap or obsolete.
If you can and want to spend the money, the result will indeed be better - but BTW: I would recommend Panasonic plasmas ;)