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 Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 31st October 2006, 12:56   #1  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Image enhancement using watershed technique

I have recently authored two plugins using Segmentation by watershed algorithm.

SegmentedAmp plugin smooths image within the basin boundaries and also accentuates the boundaries. By preprocessing the image to reduce over_segmentation, image can be enhanced.

ReTouch plugin in addition to segmentation uses flood fill technique to stretch image values within the basin boundaries or shifts or replaces by the lowest or highest value within each basin.
I have used an image which appeared in one of the threads and didee wove a magic spell around it. http://forum.doom9.org/showthread.php?t=115181

The result from using segmentedAmp are :

Top row are inputs with various preprocessing plugins.
Result with ReTouch is :

On right is processed using retouch and other plugins.
Only spatial processing has been done.
More details are at my plugin page.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 31st October 2006, 13:06   #2  |  Link
unskinnyboy
Registered User
 
unskinnyboy's Avatar
 
Join Date: Feb 2004
Location: NTSC R1
Posts: 2,046
Could you also tag each image with how it was processed and using what parameters, maybe using the subtitle() function? It is much easier to compare that way.
__________________
unskinnyboy is offline   Reply With Quote
Old 31st October 2006, 14:14   #3  |  Link
G_M_C
Registered User
 
Join Date: Feb 2006
Posts: 1,076
Quote:
Originally Posted by vcmohan View Post
I have recently authored two plugins using Segmentation by watershed algorithm.

SegmentedAmp plugin smooths image within the basin boundaries and also accentuates the boundaries. By preprocessing the image to reduce over_segmentation, image can be enhanced.

ReTouch plugin in addition to segmentation uses flood fill technique to stretch image values within the basin boundaries or shifts or replaces by the lowest or highest value within each basin.
[...]


Hmmm, I try to understand what your explination actually means, but im at a loss. May I ask for some some extra info/explination (read this as a request for a noob-translation )
G_M_C is offline   Reply With Quote
Old 31st October 2006, 19:45   #4  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
Both plugins are still 404 on the site. So I'm recompiling from source in the meantime.

I'm looking at this as another way to implement clouded's cel-foreground idea, which is boss.
foxyshadis is offline   Reply With Quote
Old 31st October 2006, 20:03   #5  |  Link
Pookie
Registered User
 
Join Date: Apr 2005
Posts: 1,339
Foxyshadis -

http://www.avisynth.org/vcmohan/ReTouch/ReTouch.zip

http://www.avisynth.org/vcmohan/Segm...gmentedAmp.zip
Pookie is offline   Reply With Quote
Old 1st November 2006, 04:39   #6  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Quote:
Originally Posted by unskinnyboy View Post
Could you also tag each image with how it was processed and using what parameters, maybe using the subtitle() function? It is much easier to compare that way.
The script used for processing is at my plugins page. Since I used for preprocessing my other plugins, I thought it will be best to direct to my plugins page.

Quote:
G_M_C wrote Hmmm, I try to understand what your explination actually means, but im at a loss. May I ask for some some extra info/explination (read this as a request for a noob-translation
I am not sure which part is to be explained more. You may kindly visit my plugins page and see the watershed, SegmentedAmp and Retouch plugins for a more detailed explanation. However simply watershed assumes the image values as elevations and based on certain criterion draws watershed lines (just as a civil engineer does on land) and numbers individual basins. Retouch and SegmentedAmp are built over this segmentation, to alter the image values.
Watershed in more detail is availble through Google search.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 1st November 2006, 05:58   #7  |  Link
Fizick
AviSynth plugger
 
Fizick's Avatar
 
Join Date: Nov 2003
Location: Russia
Posts: 2,183
vcmohan,
please replace 'ZIP' to 'zip' extention in your new web page links.

Also check (and fix) your new 'JPG' links, such as
http://www.avisynth.org/vcmohan/Reform/Reskewed2.JPG
__________________
My Avisynth plugins are now at http://avisynth.org.ru and mirror at http://avisynth.nl/users/fizick
I usually do not provide a technical support in private messages.

Last edited by Fizick; 1st November 2006 at 06:08.
Fizick is offline   Reply With Quote
Old 1st November 2006, 08:25   #8  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Yes. Corrected. As on my windows system capitalization has no effect my testing it did not catch it. Thanks for pointing out.
Instead of downloading the dlls the writeup can be seen at
http://www.avisynth.org/vcmohan/ReTouch/ReTouch.html

http://www.avisynth.org/vcmohan/Segm...mentedAmp.html
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 1st November 2006, 09:44   #9  |  Link
G_M_C
Registered User
 
Join Date: Feb 2006
Posts: 1,076
Quote:
Originally Posted by vcmohan View Post
The script used for processing is at my plugins page. Since I used for preprocessing my other plugins, I thought it will be best to direct to my plugins page.



I am not sure which part is to be explained more. You may kindly visit my plugins page and see the watershed, SegmentedAmp and Retouch plugins for a more detailed explanation. However simply watershed assumes the image values as elevations and based on certain criterion draws watershed lines (just as a civil engineer does on land) and numbers individual basins. Retouch and SegmentedAmp are built over this segmentation, to alter the image values.
Watershed in more detail is availble through Google search.

Thx, i think i get the general idea now. I'll look into the plugins for more info too
G_M_C is offline   Reply With Quote
Old 1st November 2006, 10:06   #10  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
A couple minor bugs in SegmentedAmp:
The docs seem slightly out of date. useclip is default true, not false, and connect4 is now c4. Also, uv=false doesn't actually disable chroma processing.

Neat effect though. Occasionally corrupts avisynth's memory (goofy errors like can't locate decompressor, entirely black screen, that sort of thing), but not very reproducable and hasn't crashed yet.

Last edited by foxyshadis; 1st November 2006 at 10:08.
foxyshadis is offline   Reply With Quote
Old 3rd November 2006, 03:10   #11  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Quote:
Originally Posted by foxyshadis View Post
A couple minor bugs in SegmentedAmp:
The docs seem slightly out of date. useclip is default true, not false, and connect4 is now c4. Also, uv=false doesn't actually disable chroma processing.
Thanks for pointing out. I have corrected the mistakes. It should work correctly now.

Quote:
Neat effect though. Occasionally corrupts avisynth's memory (goofy errors like can't locate decompressor, entirely black screen, that sort of thing), but not very reproducable and hasn't crashed yet.
I did not get any such message or error so far in my testing. Will continue to go thru my code to see if theres a bug.
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Old 4th March 2007, 14:07   #12  |  Link
foxyshadis
Angel of Night
 
foxyshadis's Avatar
 
Join Date: Nov 2004
Location: Tangled in the silks
Posts: 9,559
In testing lots of filters for this one extremely difficult image (a print scan with a great deal of halftoning patterns), SegmentedAmp performed the best by far in concert with some other filters. The memory allocation pattern won't work for this sort of image, but I can work around that no prob with a quick change. (Probably wasn't expecting many 4000x2000 frames...)

But the problem I'm running into is that it doesn't do any smoothing at all on the segment lines. Removegrain is a great help, but it still comes out looking like cracking paint on canvas. Here's a progression to show how it goes, with the effect exaggerated with levels:

Otherwise, it's the only thing that can take care of screening without objectionable artifacts. (Although AdaptiveMedian made some pretty neat-o brush-stroke artifacts.)

If I have to I'll just mod the filter to output a mask of the segment divisions, but since you're the master, I figure you'd know of a better way.

If it matters, the exact use is:
Code:
clip2=removegrain(17).removegrain(17).mipsmooth(preset="AnimeLQ",temporal=255,temporal_chroma=255,spatial = 255).fft3dfilter(bt=1,sigma=10,sigma2=10,sigma3=10,sigma4=5,plane=4)
SegmentedAmp(sclip=clip2,useclip=true,c4=false)
clip2=removegrain(17).removegrain(17).mipsmooth(preset="AnimeLQ",temporal=255,temporal_chroma=255,spatial = 255).fft3dfilter(bt=1,sigma=10,sigma2=10,sigma3=10,sigma4=5,plane=4)
SegmentedAmp(sclip=clip2,useclip=true,c4=false)
foxyshadis is offline   Reply With Quote
Old 5th March 2007, 03:18   #13  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
Just plain watershed filter outputs basins or basin boundaries or both. May be you may be able to get a mask from it. Using a blurred image for input to watershed will reduce number of segments. The sharpen parameter is to treat the segment boundary lines. Try using different values.
__________________
mohan
my plugins are now hosted here

Last edited by vcmohan; 6th March 2007 at 03:55.
vcmohan is offline   Reply With Quote
Old 7th October 2015, 13:18   #14  |  Link
vcmohan
Registered User
 
Join Date: Jul 2003
Location: India
Posts: 890
SegmentedAmp is now available for avisynth+ also
__________________
mohan
my plugins are now hosted here
vcmohan is offline   Reply With Quote
Reply


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 08:47.


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