Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Development

Reply
 
Thread Tools Search this Thread Display Modes
Old 31st January 2012, 12:38   #41  |  Link
joka
Registered User
 
Join Date: May 2010
Posts: 19
TheoRi, I like this idea. Maybe you should open a separate thread in Avisynth usage section.

However, nobody seems to have a solution "ready to use" for your problem. Maybe this can help - not tested.

a = your first clip
b = your second clip


c = Interleave(a, b)

# tweak the darker and the brighter clip (play with a_cont, b_cont, may be different thresholds)
# so, that the results are similar as possible
# (special clip borrowed from Fred)
# maybe you need .converttoYv12() before tweak
a_ref = a.tweak(cont=a_cont).MT_binarize(threshold=80).greyscale().invert()
b_ref = b.tweak(cont=b_cont).MT_binarize(threshold=80).greyscale().invert()
c_ref = Interleave(a_ref, b_ref).crop(32, 24, -32, -24)


# calculate stabilization data
mdata = DePanEstimate(c_ref,trust=1.0,dxmax=20,dymax=20)


# stabilize
c_stab = DePanInterleave(c, data=mdata)


# Select the required frames
# may be you have to crop the borders (consider aspect ration)
b_stab = c_stab.SelectEvery(6, 2)
a_stab = a


Good Luck! If it works show a sample.
joka is offline   Reply With Quote
Old 12th August 2012, 02:15   #42  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 782
I've taken two differently exposed photos of a scene and wanted to join them.
After spending two hours learning how to use GIMP and googling for plugins, I can't seem to get satisfactory results. Then I remembered this thread.
I still use GIMP to align the photos perfectly, but the fusing is done so much better here in Avisynth. Could you make this work with (or at least output) stacked 16-bit clips?

This might be the wrong place to ask, but is there a similar plugin for GIMP that I just fail to find?
ajp_anton is offline   Reply With Quote
Old 12th August 2012, 14:00   #43  |  Link
Atak_Snajpera
RipBot264 author
 
Atak_Snajpera's Avatar
 
Join Date: May 2006
Location: Poland
Posts: 7,074
Quote:
Originally Posted by ajp_anton View Post
I've taken two differently exposed photos of a scene and wanted to join them.
After spending two hours learning how to use GIMP and googling for plugins, I can't seem to get satisfactory results. Then I remembered this thread.
I still use GIMP to align the photos perfectly, but the fusing is done so much better here in Avisynth. Could you make this work with (or at least output) stacked 16-bit clips?

This might be the wrong place to ask, but is there a similar plugin for GIMP that I just fail to find?
regarding photos i use fusion program
http://fusion.ns-point.com/
Atak_Snajpera is offline   Reply With Quote
Old 12th August 2012, 14:34   #44  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
Quote:
Could you make this work with (or at least output) stacked 16-bit clips?
Is there a standard format that everyone uses for that kind of clip?

David
wonkey_monkey is offline   Reply With Quote
Old 12th August 2012, 14:56   #45  |  Link
cretindesalpes
͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿
 
cretindesalpes's Avatar
 
Join Date: Feb 2009
Location: No support in PM
Posts: 610
Not really for RGB. Currently the Dither tools can handle fake RGB48 clips by separating the R, G and B channels and storing them into the luma planes of 3 Y(UV) stack16 clips (top part of the picture with upper 8 bits, bottom part with the lower 8 bits). Pretty awkward… I’m currently thinking about implementing 16-bit 3D-LUTs in these Dither tools but haven’t made up my mind about which format to use for RGB48.
__________________
dither 1.27.2 for AviSynth | avstp 1.0.3 for AviSynth development | fmtconv r19 for Vapoursynth | trimx264opt segmented encoding
cretindesalpes is offline   Reply With Quote
Old 12th August 2012, 14:57   #46  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 782
Quote:
Originally Posted by davidhorman View Post
Is there a standard format that everyone uses for that kind of clip?

David
Nothing official, but "everyone" uses stacked MSB/LSB (most/least significant bits) format. The image is truncated to 8-bit, and the discarded 8 bits are displayed (mostly garbage-looking) stacked below it. RGB48 is still a bit awkward, but it works.

Check out the "dither" package of plugins and scripts.
edit: beaten...

Last edited by ajp_anton; 12th August 2012 at 14:59.
ajp_anton is offline   Reply With Quote
Old 24th September 2012, 10:18   #47  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 782
Should the output sometimes have pixel values outside of the input range?
For example, one exposure with white clouds and another with a completely overexposed and white sky will occasionally output ugly dark spots in those clouds.
ajp_anton is offline   Reply With Quote
Old 24th September 2012, 13:06   #48  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
Quote:
Originally Posted by ajp_anton View Post
Should the output sometimes have pixel values outside of the input range?
For example, one exposure with white clouds and another with a completely overexposed and white sky will occasionally output ugly dark spots in those clouds.
That shouldn't happen - all values should be clipped before output. Can you post a screenshot or some sample files?

David
wonkey_monkey is offline   Reply With Quote
Old 24th September 2012, 13:22   #49  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 782
Didn't find the cloud example, but here's a frame (cropped) with snowy mountains.
edit: actually the cloud is also a bit darker, but not as noticeably as it sometimes is (or as the snow).

http://ajpanton.se/light.png
http://ajpanton.se/dark.png
http://ajpanton.se/fuse.png

Code:
a = imagesource("light.png",end=0,pixel_type="rgb32")
b = imagesource("dark.png",end=0,pixel_type="rgb32")

m = fusemask(a,b,.5)
fuse(a,b,m)

interleave(a,b,last)

Last edited by ajp_anton; 24th September 2012 at 13:28.
ajp_anton is offline   Reply With Quote
Old 24th September 2012, 19:25   #50  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
I think that's a side effect of the process - at the lowest level, the darker parts of the mountain in the dark image have blurred into the problem area, decreasing its brightness, and there isn't enough "detail" to bring it back up to white when the pyramid gets collapsed.

Please download this new DLL and try:

Code:
fuse(a,b,m,clamp=true)
David
wonkey_monkey is offline   Reply With Quote
Old 24th September 2012, 20:04   #51  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 782
Thanks, now it works.
But if this shouldn't happen, simply clamping the output feels like an ugly workaround for a bug in the algorithm. Or maybe that's how it's supposed to work?
ajp_anton is offline   Reply With Quote
Old 24th September 2012, 20:21   #52  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
Quote:
But if this shouldn't happen
It's not really a bug, just an undesirable consequence of the maths. Now with an undesirable fix

David
wonkey_monkey is offline   Reply With Quote
Old 5th March 2013, 05:15   #53  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 782
I've used this a lot recently for photos since I just like its results better than anything else.
However, using it for (hi-res) panoramas is quite taxing on RAM. Could you make a 64-bit version of this?
ajp_anton is offline   Reply With Quote
Old 5th March 2013, 18:09   #54  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
I've never compiled a 64 bit plugin before, but this seems to work:

http://horman.net/fusionx64.zip

Avisynth isn't really an ideal way to be fusing panoramas, though, and one day I intend to write a fuser to complement multiblend.

David
wonkey_monkey is offline   Reply With Quote
Old 5th March 2013, 23:43   #55  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 782
A replacement for enfuse used by Hugin would be great, as that's the program/GUI I use to stitch the panoramas together into two different exposures, as well as align single bracketed photos.
I don't like enfuse's results, so I always import the aligned photos/panos into Avisynth for this plugin.

The 64-bit version works, thanks. 64-bit Avisynth is a bit buggy though when I try to preview the fuse in lower res, but at full res it's fine.

Last edited by ajp_anton; 5th March 2013 at 23:45.
ajp_anton is offline   Reply With Quote
Old 1st May 2013, 10:11   #56  |  Link
ajp_anton
Registered User
 
ajp_anton's Avatar
 
Join Date: Aug 2006
Location: Stockholm/Helsinki
Posts: 782
Another weird behavior that I'm wondering about...

Threshold set to
1.00, 0.70, 0.65, 0.00
(The 0.00 and 1.00 are basically just the original images.)

You can see that when the sky starts to fill up, it does so in segments and leaves noticeable edges, and the fact that they are so grid-like with straight lines and straight edges makes them look very artificial. Can this be avoided?

Last edited by ajp_anton; 1st May 2013 at 10:17.
ajp_anton is offline   Reply With Quote
Old 2nd May 2013, 12:31   #57  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
Fusion cheats a little by using a very simple, very fast, but discontinuous function for downsizing/upsizing - I think what you're seeing is the result of that. Enfuse uses a slower but continuous function, so probably wouldn't exhibit this effect (or not to this degree).

Limiting the number of levels might help, but I don't seem to have included that parameter during the rewrite. You could try the old version for now.
wonkey_monkey is offline   Reply With Quote
Old 23rd November 2014, 21:30   #58  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,115
@davidhorman

I'm just wondering what's the recommended (latest) version?

fusion.zip is dated 2012-09-24
fusion2.zip is dated 2011-11-31

The first post says that fusion2.zip is the latest version? Is that correct?
Reel.Deel is offline   Reply With Quote
Old 24th November 2014, 18:13   #59  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 1,810
It looks like I overwrote fusion.zip when I wrote this post, so that's the one to use. I've deleted fusion2.zip.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 24th November 2014, 18:29   #60  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,115
Ok, thanks. Out of curiosity what does the clamp really parameter do? I really can't see a difference between true or false.

Last edited by Reel.Deel; 24th November 2014 at 18:45. Reason: add comment
Reel.Deel is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:06.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.