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

Reply
 
Thread Tools Search this Thread Display Modes
Old 19th December 2021, 19:32   #221  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,080
Yeah, I processed the clip in question, removed a lot of emulsion chips, but not as many as I would like,
however the purpose was to do only very little denoise, and it did that as the purpose was to to avoid frame global changes.
Need to figure out at least one more conditional restriction so as to be able to relax YTh and CTh restriction a little.
I still want only a very light touch.
[The frames I was processing needed maybe up to about 3 small chips/dots removed on SOME frames only].
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 19th December 2021 at 19:43.
StainlessS is offline   Reply With Quote
Old 20th December 2021, 08:28   #222  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 133
My thinking is, fresh pot of coffee helped, do not restore if mask object(what you call the white blob) or any other means, doesn't exist in adjacent frames.

ns=no spot
s=spot
b=ball

Code:
frame 1      2      3
         ns    s      ns
         b      b     b
Spot in frame 2 removed and since nothing exist in either 1 or 3 then do not restore. If object like a ball exist in 1 or 3 then restore.
Spot are motionless and the ball isn't.
coolgit is offline   Reply With Quote
Old 20th December 2021, 09:08   #223  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,080
All you did is move the problem.
Quote:
Spot are motionless and the ball isn't.
How do you tell if ball exists in frames 1,and 2, and 3, as you say, ball isnt motionless.
[And if MoComp could tell, then ball would not disappear in the first place via Spotless]
I'm less concerned with balls, more with hands and feet, and arms and legs (but balls would be nice too).
EDIT: Anyways, have not given up yet, still plugging away at it.

EDIT: What I got right now, take comments with pinch of salt, and havta figure out what its doin'.
Code:
#AviSource(".\10Bit_Standard8_Scan_16FPS.avi")
#AviSource(".\IG18.avi")
#AviSource(".\AMOLAD.demuxed.m2v.AVI")
AviSource("D:\DVD\PBDeSpot_1.avi")
ConvertToYV24
#ConvertToYUV444
#Return last.info
#ConvertBits(16)
Src=Last
Filtered=SpotLess(RadT=1)
YTH8     = 8
CTH8     = 12
YNOISETH8 = 2
SHOW = True
SpotTest(Src,Filtered,YTH8,CTH8,YNOISETH8,SHOW)
Return Last.ConvertToRGB32

/*
    SpotTest(),
    Purpose:
        Spotless produces frame global changes [most pixels are changed], here we want to try alter only real spots where there is significant change in spotless Y [by YTh8]
        and also that are near grey in source [by CTh8], these targeted pixels are then overlayed from Spotless result onto original src.

    Src,       Pre-Spotless source
    Filtered,  Spotless result
    YTh8,      threshold for Y in 8 bit range.
    CTh8,      threshold for Chroma in 8 bit range.
    YNoiseTh8, ?????
    Show,      Show Masks.Mask is the final mask made from MaskY and MaskC.

*/
Function SpotTest(clip Src,clip Filtered,int "YTh8",int "Cth8",int "YNoiseTh8",Bool "Show") { # 8 -> 16 bit YUV444 only
    YTh8      = Min(Max(Default(YTh8,12),0),255)
    CTh8      = Min(Max(Default(CTh8,12),0),255)
    YNoiseTh8 = Min(Max(Default(YNoiseTh8,8),0),255)
    Show = Default(Show,False)
    try {bpc = Src.BitsPerComponent} catch(msg) {bpc=8}
    try {Y444=Src.IsYV24||Src.Is444} catch(msg) {Y444=false}
    Assert(Y444,"SpotTest: Must be YV24/YUV444")
    YTh      = BitLShift(YTh8,bpc-8).String
    CTh      = BitLShift(CTh8,bpc-8).String
    YNoiseTh = BitLShift(YNoiseTh8,bpc-8).String
    SY  = Src.ExtractY
    FY  = Filtered.ExtractY
    PSY = SY.SelectEvery(1,-1)
    NSY = SY.SelectEvery(1, 1)
    MaskN   = Mt_Lutxyz(PSY,SY,NSY,"x "+ YNoiseTh + " - y <= y z "+ YNoiseTh + " + <= & z "+ YNoiseTh + " - y <= y x "+ YNoiseTh + " + <= & | 0 range_max ?")
                                                                                       # ( ((x-YNoiseTh <= y) & (y <= z+YNoiseTh)) | ((z-YNoiseTh <= y) & (y <= x+YNoiseTh)) )  ? 0 : 255 ## Infix @ 8 bit
                                                                                       # ((YPrv-YNoiseTh <= YCur <= YNxt+YNoiseTh) || (YNxt-YNoiseTh <= YCur <= YPrv+YNoiseTh)) ? 0 : 255

    MaskY   = Mt_Lutxy(SY,FY,"x y - abs " + YTh + " > range_max 0 ?")                  # "(abs(x-y) > YTh) ? 255 : 0"
    MU      = Mt_Lut(Src.ExtractU,"x range_half - abs")                                # "abs(x - 128)"
    MV      = Mt_Lut(Src.ExtractV,"x range_half - abs")                                # "abs(x - 128)"
    MaskC   = Mt_Lutxy(MU,MV,"x 2 ^ y 2 ^ + .5 ^ round " + CTh + " <= range_max 0 ?")  # "(round(((x^2)+(y^2))^0.5) <= CTh) ? 255 : 0"    # 2D chroma distance from grey (by Pythagoras)
    MaskN = MaskN.mt_Expand
    MaskY = MaskY.mt_Expand
    MaskC = MaskC.mt_Expand
    MaskAnd = MaskC.Mt_Logic(MaskY,"and")                                                               #
    MaskAnd = MaskAnd.Mt_Logic(MaskN,"and")                                                                #
    MaskSelect = MaskAnd.mt_Expand.Blur(1.0)
    #
    Overlay(Src,Filtered,Mask=MaskSelect,Opacity=1.0)
    CGREY = MaskSelect.Mt_lut("range_half")
    SEP=$FF0000
    HBAR=Src.BlankClip(length=1,Height=4,color=SEP)
    LFT=StackVertical(Src.Subtitle("Src"),HBAR,Filtered.Subtitle("Filt"),HBAR,Last.Subtitle("Result"))
    MID=StackVertical(YtoUV(CGrey,CGrey,MaskN).Subtitle("MaskN"),HBAR,YtoUV(CGrey,CGrey,MaskY).Subtitle("MaskY {abs(SrcY-FiltY) > YTh}"),HBAR,YtoUV(CGrey,CGrey,MaskSelect).Subtitle("MaskSelect=MaskAnd.mt_Expand.Blur(1.0) {Blk=Src used : Wht=Filt used}"))
    RGT=StackVertical(YtoUV(CGrey,CGrey,MaskC).Subtitle("MaskC {Src Chroma distance from Grey <= Cth8"),HBAR,YtoUV(CGrey,CGrey,MaskAnd).Subtitle("MaskAnd {MaskN & MaskC & MaskY}"),HBAR,YtoUV(CGrey,CGrey,CGrey))
    VBAR=LFT.BlankClip(length=1,width=4,color=SEP)
    STK = StackHorizontal(LFT,VBAR,MID,VBAR,RGT)
    (Show) ? STK : Last
}
EDIT: some cosmetic changes.
I'm gonna get some sleep soon.

MaskN (noiseMask) shows no noise = BLACK, noise = WHITE for current frame Cur yPixel where,
(PrvY - NoiseTh) <= CurY <= (NxtY + NoiseTh) OR (NxtY - NoiseTh) <= CurY <= (PrvY + NoiseTh) Then BLACK Else WHITE
If pixel lies between corresponding pixels in previous and next frames (with a little tolerance by NoiseTh), then not noise, else noise.
[ie No spot if BLACK, and MAYBE spot (or ball) if WHITE]

Currently, MaskC is the main problem [BLACK is colored ie dont use BALL/HAND/LEG from Filt clip, and WHITE if Copy from filt clip].
Detecting colored ball as BLACK, also tends to stop detect of what looks like white spots at high luma level (but with chroma distance above CTh).
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 20th December 2021 at 20:42.
StainlessS is offline   Reply With Quote
Old 20th December 2021, 12:12   #224  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 133
What I was thinking was the ball would exist in the previous or next frame, as in your example post 217, by searching a part of the frame (previous or next) for similar object, say 50 by 50 pixels search area (freedom to change the variables according to video), colour shouldn't be an issue. Where the ball disappeared would be the centre of 50 by 50. Surely this would narrow down the search and mistaken identifying of details by not searching the whole frame. If it was a spot then nothing would be found and therefore not restored. In your post 217 mask y frames made it clear where the ball was and is. Comparing the ball real colour from the source frames would be the final confirmation before restoring. Neither ball in Mask y and colour have to be 100% the same in both frames, perhaps 80% is enough. Obviously this would apply to hand and foot.
coolgit is offline   Reply With Quote
Old 20th December 2021, 19:36   #225  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,080
OK, then please supply script code to do that, and then we is cookin'.
[If it works as well as you say, then maybe can look forward to MvTools algo update, and then this script (or parts of it) may not be needed at all]

EDIT: At present, the function is only looking to target single pixels, [EDIT: blob-ish objects are also made up of single pixels] it is possible that it may extend to blob-ish objects,
but original requirement is for fast, simple, de-speckler, which causes little global frame changes, later other main denoiser may be also used.
Its definitely just experimental at the moment.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 20th December 2021 at 21:22.
StainlessS is offline   Reply With Quote
Old 20th December 2021, 21:11   #226  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,080
https://academic.microsoft.com/paper...)&f=&orderBy=0

Quote:
Color space normalization: Enhancing the discriminating power of color spaces for face recognition
Abstract

This paper presents the concept of color space normalization (CSN) and two CSN techniques, i.e., the within-color-component normalization technique (CSN-I) and the across-color-component normalization technique (CSN-II), for enhancing the discriminating power of color spaces for face recognition. Different color spaces usually display different discriminating power, and our experiments on a large scale face recognition grand challenge (FRGC) problem reveal that the RGB and XYZ color spaces are weaker than the I"1I"2I"3, YUV, YIQ, and LSLM color spaces for face recognition. We therefore apply our CSN techniques to normalize the weak color spaces, such as the RGB and the XYZ color spaces, the three hybrid color spaces XGB, YRB and ZRG, and 10 randomly generated color spaces. Experiments using the most challenging FRGC version 2 Experiment 4 with 12,776 training images, 16,028 controlled target images, and 8,014 uncontrolled query images, show that the proposed CSN techniques can significantly and consistently improve the discriminating power of the weak color spaces. Specifically, the normalized RGB, XYZ, XGB, and ZRG color spaces are more effective than or as effective as the I"1I"2I"3, YUV, YIQ and LSLM color spaces for face recognition. The additional experiments using the AR database validate the generalization of the proposed CSN techniques. We finally explain why the CSN techniques can improve the recognition performance of color spaces from the color component correlation point of view.
Basically, Color Space Normalizing of YUV just involves forgetting all about the Y channel.
Used in Facial recognition, because skin tones have similar-ish U and V range values, no matter how light / dark the skin tone.

Some, above maybe of some use. [we are using only U and V in the chroma distance thingy].

EDIT: I did see a pdf saying similar to above for YUV but deleted it.
Maybe Color Space Normalizing of YUV or Facial recognition in YUV is specifically what we want, so above extract is maybe not the one we ideally want.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 21st December 2021 at 00:29.
StainlessS is offline   Reply With Quote
Old 20th December 2021, 23:58   #227  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 133
Just chucking in ideas, was thinking of the top of my head. Obviously i don't know the full capabilities of avisynth.
coolgit is offline   Reply With Quote
Old 21st December 2021, 00:34   #228  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,080
Quote:
Obviously i don't know the full capabilities of avisynth.
Obviously, Nobody knows the full capabilities of avisynth.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 12th January 2022, 22:40   #229  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 133
Stainless - tried to message you but your inbox is full.
coolgit is offline   Reply With Quote
Old 13th January 2022, 03:12   #230  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,080
Coolgit, sorry, bit involved,
I is a bit busy,
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Reply

Tags
denoise, despot, prefilter

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


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