Hi all. I think I'm losing my Midas touch here big time. I used to have this really good script that allowed me to protect lines and details while filtering flat areas and well...no idea where it went. And I can't remember for the life of me how to create one. This was years ago- but I'll be more careful now. Anyway, this is the script I have (the color orange is just to see where the actual filter would be applied. It's for testing purposes)
And below is what it's producing. Again, I'm simply attempting to protect my lines and filter the rest. Can anyone lend a hand here? ThanksCode:MPEG2Source("blah") Assumetff() TFM() TDecimate(mode=1) a=Last b=blankclip(a, color=color_orange) mask1=mt_binarize() mask2=mt_edge("cartoon") Overlay(mask1, mask2)
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 6 of 6
Thread
-
-
As usual, post a sample of the video.
One thing to note: mt_edge() and mt_binarize() have threshold values you can play with. Also, you can expand the mask with mt_expand() and inpand with mt_inpand(). It can be helpful to blur the mask too -- to soften the edge between process an unprocessed areas.Last edited by jagabo; 16th Jul 2021 at 22:22.
-
Code:
MPEG2Source("blah") Assumetff() TFM() TDecimate(mode=1) video=last Loadplugin("Plugins_JPSDR.dll") LevelLimit=(video.BitsPerComponent==8) ? 255 : 1023 IntensityMask=ConvertToY(video).Levels(0,2,LevelLimit,0,LevelLimit,coring=false) EdgeMask=aSobel(IntensityMask,chroma=0,thresh=255).invert.Levels(0,2,LevelLimit,0,LevelLimit,coring=false).Blur(1) FilteredVideo=invert(video) #USE YOUR OWN FILTERING HERE. INVERT IS JUST AN EXAMPLE! video=Overlay(video,FilteredVideo,mask=EdgeMask,opacity=1.0) return video
-
As usual, post a sample of the video.
One thing to note: mt_edge() and mt_binarize() have threshold values you can play with. Also, you can expand the mask with mt_expand() and inpand with mt_inpand(). It can be helpful to blur the mask too -- to soften the edge between process an unprocessed areas.
Atak, I do appreciate your help but your script is not exactly what I'm trying to do here. And it doesn't even load. -
First, a note on your script in the first post:
Code:mask1=mt_binarize() mask2=mt_edge("cartoon") Overlay(mask1, mask2)
Here's one way to animate the mask creation with mt_edge() so you can quickly determine what values you want to use:
Code:function anim_mask(clip c, int thresh) { mt_edge(c, "hprewitt", thy1=thresh, thy2=thresh) Subtitle(string(thresh)) # show threshold value } AviSource("bridge.avi") # RGB source? ConvertToYV12() Trim(22,0).Loop(100,0,0) # only frame 22, repeated 100 times emask = Animate(0,100, "anim_mask", last,0, last,100).GreyScale() return(emask)
http://avisynth.nl/index.php/MaskTools2/Mt_edge
mt_expand() can expand the mask to fill in small holes and cover areas near edges. You can soften the mask (to make the transition from masked to not masked areas less obvious:
Code:function anim_mask(clip c, int thresh) { mt_edge(c, "hprewitt", thy1=thresh, thy2=thresh) Subtitle(string(thresh)) # show threshold value } AviSource("bridge.avi") # RGB source? ConvertToYV12() Trim(22,0).Loop(100,0,0) # only frame 22, repeated 100 times emask = Animate(0,100, "anim_mask", last,0, last,100).mt_expand().Blur(1.0).GreyScale() return(emask)
[Attachment 59909 - Click to enlarge]
Conversely, you can use mt_inpand() to thin the mask and remove small dots.
Similar Threads
-
Divide each line of text into new subtitle line
By martanius in forum SubtitleReplies: 1Last Post: 11th Apr 2021, 16:21 -
Help with My Script Motion Mask for two videos
By Kuronoe in forum Newbie / General discussionsReplies: 5Last Post: 28th Jan 2021, 18:41 -
Help with My Scriot Motion Mask for two videos
By Kuronoe in forum Newbie / General discussionsReplies: 0Last Post: 28th Jan 2021, 09:46 -
Request for Youtube-dl command line assistance
By peteinoz in forum Video Streaming DownloadingReplies: 7Last Post: 20th Oct 2020, 10:55 -
Mask question
By Aludin in forum EditingReplies: 12Last Post: 11th Jan 2017, 23:31