Log in

View Full Version : How to clean this kind of artifact?


Undead Sega
6th December 2009, 22:44
Im not entirely sure wat kind of artifact this is, either resulted from poor encoding or being highly compressed, but i get this kind fo artifact from a miniDVD camcorder recording at various quality recordings i.e. XP, SP, LP etc.

http://www.dvdtimes.co.uk/protectedimage.php?image=DavidMackenzie/flea_2dnr4.jpg

Even with noise being cleaned off, this kind still remains and i was wondering if this can be removed or even reduced. It has been awhile since i have made a post here and i might have lost my touch in some filtering matters, however i was wondering if anyone can help me on this, even with Avisynth if that can be possible.

wonkey_monkey
6th December 2009, 22:52
Is that the right image? It's only 90x37.

David

Undead Sega
7th December 2009, 00:13
well at this current moment of time i cannot do any kind fo capturing, however this image which i saw from a site emulates almost exactly wat im talking about, and i just realised that its absolutely tiny, seems to be a protected image, but not to worry, i managed to save it myself and i hope it shall load up fine over here...now.

Nightshiver
7th December 2009, 03:44
That's ringing. It's from over-compression.

thetoof
7th December 2009, 07:08
try msmooth, helped me a lot in the past with this kind of problem

Here's the part of the script that helped on an overly compressed source, without the deblocking sections (slightly overkill and not sure I'd do the same today... but you may get a few ideas)
msmooth(threshold=5,strength=1)
fft3dfilter(plane=3,bt=3,sigma=1.5,bw=32,bh=32,ow=16,oh=16)
dfttest(smode=0,sbsize=5,tbsize=3,sigma=.5,u=false,v=false)
dehalo_alpha(darkstr=.2,rx=.2,ry=2, brightstr=1.9) #you may not need this, but removing ringing may reveal halos
awarpsharp2(24, type=1) #a tad killer
#+ some crazy ass (and maybe useless) sharpening, a simple lsfmod might be sufficient
soothe(last.nnedi2_rpow2(rfactor=2,cshift="spline36resize",qual=3).sssharp(strength=2).automttap3(640,360),last)
edit: oh, and you will want defreq for those lines + a higher sigma of chroma filtering via fft3dfilter to remove those sploches

MatLz
7th December 2009, 07:12
You can also use my old hqd function:

http://forum.doom9.org/showpost.php?p=1331387&postcount=33

LaTo
7th December 2009, 07:40
MCTemporalDenoisePP has also a dering function...

For example:
MCTemporalDenoisePP(edgeclean=true,ECrad=4,ECthr=16,ECmode="dfttest().dehalo_alpha()")

Look at the documentation for tweaking ECrad & ECthr ;)

TheRyuu
7th December 2009, 09:17
Try:
edgecleaner(strength=16) #raise strength too if you want

# EdgeCleaner() v1.03 (06/08/2008)
# - a simple edge cleaning and weak dehaloing function
#
# Description:
# Functions have been briefly tested to work with MT on mode 1 and 2 without any problems
#
# Requirements:
# aWarpSharp, mt_masktools, Repair (optional), RemoveGrain (optional) and Deen (optional) plugins required
# YV12 input required and mod16 or even mod32 input is preferred since aWarpSharp borks sometimes
#
# Parameters:
# strength (float) - specifies edge denoising strength (8.0)
# rep (boolean) - actives Repair for the aWarpSharped clip (true; requires Repair)
# rmode (integer) - specifies the Repair mode; 1 is very mild and good for halos,
# 16 and 18 are good for edge structure preserval on strong settings but keep more halos and edge noise,
# 17 is similar to 16 but keeps much less haloing, other modes are not recommended (17; requires Repair)
# smode (integer) - specifies what method will be used for finding small particles, ie stars; 0 is disabled,
# 1 uses RemoveGrain and 2 uses Deen (0; requires RemoveGrain/Repair/Deen)
# hot (boolean) - specifies whether removal of hot pixels should take place (false)
# fix (boolean) - fixes an aWarpSharp bug by overlaying a healthy pixel from the source clip;
# good idea to set to false when over-cropping afterwards (true)

function EdgeCleaner(clip c, float "strength", bool "rep", int "rmode", int "smode", bool "hot", bool "fix") {

strength = default(strength, 8.0)
rep = default(rep, true)
rmode = default(rmode, 17)
smode = default(smode, 0)
hot = default(hot, false)
fix = default(fix, true)

c = (c.isYV12()) ? c : c.ConvertToYV12()
strength = (smode==0) ? strength : strength+4

main = c.aWarpSharp(strength,1)
main = (rep) ? Repair(main,c,rmode) : main

mask = c.mt_edge("prewitt",4,32,4,32).mt_invert().mt_convolution()

final = (!hot) ? mt_merge(c,main,mask) : Repair(mt_merge(c,main,mask),c,2)
final = (fix) ? Overlay(final,c.ConvertToRGB24().Crop(0,1,-c.width+1,-c.height+2),x=0,y=1) : final
final = (smode != 0) ? mt_merge(final,c,c.StarMask(smode)) : final

return final

}

function StarMask(clip c, int "mode") {

mode = default(mode, 1)

clean = (mode==1) ? c.RemoveGrain(17) : Repair(c.Deen("a3d",4,12,0),c,15).RemoveGrain(21)
diff = (mode==1) ? mt_makediff(c,clean) : NOP

final = (mode==1) ? diff.Greyscale().Levels(40,0.350,168,0,255).removegrain(7,-1).mt_edge("prewitt",4,16,4,16) : \
Subtract(mt_merge(clean,c,c.mt_edge("roberts",0,2,0,2).mt_expand(mode=mt_circle(1)).mt_invert()),c).mt_edge("roberts",0,0,0,0).mt_deflate()

return final

}

# Changelog:
# 06/08/2008 v1.03
# - improved mask that leaves less warping and more original line structure, therefore higher strengths are now safe to use
# - improved StarMask()
# - removed super mode
# - removed srep, sshiqloc, some smodes and VD_SmartSmoothHiQ() due to StarMask() changes
# 01/06/2008 v1.02
# - added srep parameter
# - improved particle masking
# 01/06/2008 v1.01
# - added masking for particles with two parameters; smode and sshiqloc
# 12/05/2008 v1.00
# - removed line darkening, mode 2 mask, RemoveGrain
# - assert changed to colorspace conversion to yv12
# - fixed some logic problems
# - "fixed" the aWarpSharp black pixel bug
# - added Repair

Undead Sega
7th December 2009, 21:54
hi everyone, thanks very much for clearing that up for me, yes, 'ringing' is the word i was looking for which is from compression itself.

i will try some out, but i managed to get a sample clip on board, this was directly ripped and trimmed from a recording on a MiniDVD camcorder (at SP or LP and definately not HQ/XP mode) and while it may not seem that good it is decent at the same time and i am looking for ways to try and improve it.

The reason why i chose this particular scene is because it has a few object edges which one can analyze for 'ringing' artifacts, also there are many moving objects in the scene including that the camera is moving itself.

I am aware of the interlacing, dont worry that i can sort out by deinterlacing it with TGMC at low noise removal settings:

http://www.mediafire.com/?eaywwwrzomz

hope this helps. its only 13-14MB in filesize.

EuropeanMan
7th December 2009, 23:10
MCTemporalDenoise should work wonders...good luck

Undead Sega
7th December 2009, 23:44
Did u have a look at the sample clip?

What does MCTemporalDenoise do exactly then? Would anyone else agree that MCTemporalDenoise would do 'wonders' as EuropeanMan states?

MatLz
8th December 2009, 00:05
Did u have a look at the sample clip?

What does MCTemporalDenoise do exactly then? Would anyone else agree that MCTemporalDenoise would do 'wonders' as EuropeanMan states?as I can't download at mediafire, I can't confirm that!:D

Undead Sega
8th December 2009, 00:08
thats strange though, it works perfectly fine for me, all u have to do is click on start download after a few seconds.

anyone else may i ask?

Undead Sega
8th December 2009, 20:22
anyone at all may i ask?

poisondeathray
8th December 2009, 20:35
I had a look at it , and MCTemporalDenoise does a decent job. You can play with the settings to balance how much detail you are willing to use vs. how much you want to clean

Default tgmc settings actually do a worse job on most of the sections than nnedi2 for deinterlacing on this clip. Changing the edimode didn't help much

You would be better off testing it out for yourself, because no one here can determine what is "acceptable" for you. Some people want more detail, and can accept some noise, some people like it noise free looking like "plastic dolls"....and there are shades in between

An easy way for your comparisons, is to use avsp, use a different script for each tab, and switch between tabs to compare frames. You could also use interleave()

MatLz
8th December 2009, 21:51
Give a chance to hqd....good filtering, details retension and even on my crapold dualcore, it works at realtime on MD(1024x576)

Didée
8th December 2009, 22:25
Default tgmc settings actually do a worse job on most of the sections than nnedi2 for deinterlacing on this clip.
Care to explain in which respect "worse"? Since the clip is, erhm, not quite "high quality", it's a bit difficult to decide what is good or worse in this case. However, just quickly trying out reveals things like

( bob frames 70..74)
http://img51.imageshack.us/img51/6391/bobframe70tgmcvsnnedi2.th.png (http://img51.imageshack.us/i/bobframe70tgmcvsnnedi2.png/)
http://img130.imageshack.us/img130/7466/bobframe71tgmcvsnnedi2.th.png (http://img130.imageshack.us/i/bobframe71tgmcvsnnedi2.png/)
http://img339.imageshack.us/img339/7679/bobframe72tgmcvsnnedi2.th.png (http://img339.imageshack.us/i/bobframe72tgmcvsnnedi2.png/)
http://img339.imageshack.us/img339/2374/bobframe73tgmcvsnnedi2q.th.png (http://img339.imageshack.us/i/bobframe73tgmcvsnnedi2q.png/)
http://img37.imageshack.us/img37/2299/bobframe74tgmcvsnnedi2.th.png (http://img37.imageshack.us/i/bobframe74tgmcvsnnedi2.png/)

FYI, TGMC settings were (1,1,2,EdiMode="NNEDI2",SVthin=0.0,SLrad=2)
(1,1,2) is appropriate for fast motion, "NNEDI2" is for comparing with the same spatial interpolator, SVThin is off because it doesn't fit to sources with EdgeEnhancement, SLrad=2 to grab as much as possible from the neighbor frames)

Browsing through the sample further, I see little evidence of TGMC doing a worse job than NNEDI2, but quite some for the inverse. The most I see is TGMC reducing more artifacts, having more detail, and being more calm. It arguably might lose some detail on the stone and street textures (but so will do any other denoising one might choose), and introduce a few small artifacts on its own (but that's subliminal compaired to the artifacts the source comes shipping with, as well as in respect to the achieved improvement).

poisondeathray
8th December 2009, 22:52
Care to explain in which respect "worse"? Since the clip is, erhm, not quite "high quality", it's a bit difficult to decide what is good or worse in this case. However, just quickly trying out reveals things like


I agree and know better than to argue with the great Didee! :) and I am ready to be schooled!

Yes, in itself, TGMC provides a cleaner image, but there are horizontal aliasing in the images and distortions around eyes, faces etc...that are not there with NNEDI2. That is what I was specifically referring

IMO the job of a deinterlacer is to deinterlace, not to denoise. IMO, other filters are better suited at denoising.

When combined with other filters - in this case MCTemporalDenoise, I found the overall image was better using NNEDI2. The extra aliasing introduced by TGMC was more difficult to get rid of, but the standard macroblocking and crud in the source was easier to get rid of by filtering.

But I'm sure with your wizardry you could find optimum filter chaing settings that do even better.

FYI, I only used TGMC defaults and edimode="nnedi2" switches, no other settings

EDIT: and much of the aliasing I was referring to has vanished using your TGMC settings. OK chalk this up to user error. I have to learn more & experiment with the TGMC settings/switches. The section I was referring to was the running sequence around 80-130 (bobbed).

Undead Sega
10th December 2009, 03:23
Hi everyone, thank you all for the comments and they are greatly appreciated. To Didée, ur captures are highly appreciated and it definately gives a good insight of comparision, i did the same myself with TGMC and i assume that u left it to its default settings, this meaning not adjusting the built in noise-removal function? However, my TGMC script is intregated with NNEDI2, therefore when i adjusted the noise-removal function to the lowest it can (1,1,0,0,0) i saw the results to be exactly the same as NNEDI2 from one of the samepl frames captured.

As it does provide very pleasing results, as one can notice, there is still some quite noticable 'ringing' artifacts on the letterings and on the human subject. Another factor that is quite visible is the amount of blocking, surely there is a way to remove this naturally? That meaning removing the correct amount for each frame if its possible?

Because of its somewhat poor source of recording, there is a small lack in detail because of all these mishaps, is there such thing as a detail enhancer in avisynth? inwhich case would probably boost the visibility of all these artifacts, but they can always be cleanly removed as if such filter (detail enhancer) wasnt applied?

poisondeathray
10th December 2009, 04:29
Hi everyone, thank you all for the comments and they are greatly appreciated. To Didée, ur captures are highly appreciated and it definately gives a good insight of comparision, i did the same myself with TGMC and i assume that u left it to its default settings, this meaning not adjusting the built in noise-removal function? However, my TGMC script is intregated with NNEDI2, therefore when i adjusted the noise-removal function to the lowest it can (1,1,0,0,0) i saw the results to be exactly the same as NNEDI2 from one of the samepl frames captured.

As it does provide very pleasing results, as one can notice, there is still some quite noticable 'ringing' artifacts on the letterings and on the human subject. Another factor that is quite visible is the amount of blocking, surely there is a way to remove this naturally? That meaning removing the correct amount for each frame if its possible?

Because of its somewhat poor source of recording, there is a small lack in detail because of all these mishaps, is there such thing as a detail enhancer in avisynth? inwhich case would probably boost the visibility of all these artifacts, but they can always be cleanly removed as if such filter (detail enhancer) wasnt applied?

Did you try MCTemporalDenoise? Which denoisers have you tried so far? To get rid of the edge artifacts, use something after the deinterlacer

You can use the deblock in MPEG2Source , cpu=3 , or MCTemporalDenoise has a couple deblock options as well, or you can use another deblock option

Getting rid of more the ringing and edge artifacts means losing more detail. Pick your poison or something in between. Play with the settings until you find acceptable. You can't recover details from nothing

Before Didee's reply I had been testing NNEDI2 + some filters.

e.g. here is a strong denoise, but it gets rid of the edge noise. This is too smooth for my tastes, but some people might like it. Change the filters or strengths etc... until you find something you like

http://i47.tinypic.com/2qkpm52.png

MPEG2Source("PLAN A No Limits Footage.d2v", cpu=3)
NNEDI2(field=3)
MCTemporalDenoise(settings="high", edgeclean=true,ECrad=4,ECthr=16,ECmode="dfttest().dehalo_alpha()")

Undead Sega
11th December 2009, 01:47
I just saw the image from the link u provided, and yes even though the setting is set to 'high' it does provide a nice clean image, reminds me abit of Neat Video which i have done myself but it would do as well as MCTemporalDenoise on deringing, deblocking and dehaloing as it was not made for it but it still provided a good job.

With the image set to 'high' i would probably take it down by one notch but as far as i can tell, not alot of detail has been taken away, admittingly i knwo the source is not that good itself. This is where i mentioned about a 'Detail Enhancer', is there such thing in Avisynth around here (besides for 'SeeSaw' which i discovered both ways in the search)? With that, details can be enhanced and then cleaned even though it may loose some detail itself, there would still be there to remain like the oringal (or better) like if none didnt wash away at all.

For the Deblocking, how does it work exactly? does it work all in one go? or does it analyze the frames and knows what to Deblock? The same i will ask for EdgeClean as i can note in the script.

In addition, couldnt one deinterlace the footage using TGMC + NNEDI2 at its lowest (or bypass) DeNoise setting (to retain the footage's quality as much as possible, TGMC is the best right? :D) and then apply MCTemporalDenoise to clean or restore the footage itself? If i am correct, filters such as NNEDI2 is an external filter and is an Interpolator? Does TGMC need this or does it have it own?

Lyris
11th December 2009, 20:37
Hey, whadda-ya-know - I took that image back when I reviewed hardware for DVD Times.
The box was an Algolith Flea compression artefact remover.

Undead Sega
12th December 2009, 00:31
Indeed :D it was the perfect example for me to explain my situation at the brief time when i couldnt do video capturing.

Undead Sega
13th December 2009, 05:12
anyone may i ask?

by the way, i cannot make up my mind which option to use in Deblocking, either through MPEG2Source cpu=3 or 4 OR using another external filter such as Deblock/Deblock_QED? Is there any difference in quality or on what job it does exactly? like affect the edges or disturb the image in any way for it not to become adequte (in a negative way) anymore to do further filtering to improve it?

If that was the case, would i just bob deinterlace the footage with TGMC on low denoise settings (1,1,2,EdiMode="NNEDI2",SVthin=0.0,SLrad=2)? and then apply MCTemporalDenoise afterwards to do the final job?

Undead Sega
15th December 2009, 01:30
anyone at all may i ask? :(

(sorry for bumping).

Undead Sega
18th December 2009, 02:59
Hi everyone, sorry once again for the bumping, i tried out the scripts and they do seem to good results, however i tried out one of tem and it seems that DeHalo doesnt work for me for some strange reason. I also started to think (although i could be wrong) but is it me or is it that NNEDI2 isnt great an Antialiasing?

In addition, as i have mentioned before, i somewhat want to enhanced the detail, can anyone tell me if this is possible with any Avisynth filters? Although i am aware this may also enhance some of the artifacts, but (if i am correct) this can be just sorted by the sugested filters?

StainlessS
21st December 2009, 14:32
Could be wrong but this is my take,

You cannot enhance or put back something that is not there to begin with. You can mess with the colors,
and you can sharpen (msharpen is quite good for sharpening only edges without sharpening other areas,
does the opposite of msmooth [already mentioned], can even use them together, brilliant for anime).
Any 'enhancement to detail, will as you say; enhance artifacts, and if you use filters to remove artifacts,
then they are more than likely to remove the 'enhanced' details too. Perhaps someone can correct me on
this.