VittorioAccomazzi / Artist

The artist which will paint your pictures before your eyes !
0 stars 0 forks source link

Fine tune painter #9

Closed VittorioAccomazzi closed 3 years ago

VittorioAccomazzi commented 3 years ago

The current implementation of the painter generates sometime sharp transaction on relative smooth areas of the image, for instance the face. This effectively creates artifacts in the image.

VittorioAccomazzi commented 3 years ago

Tensor Shock Filter

the main responsible for this artefact seems the tau values in the tensor shock filter which determines the area in which the filter has to be applied. Here below it shows that it is applied to the LoG value, and determines when the delation or erosion has to take place.

                let logVal = logImage.get(x,y)
                let majMag = majVec[0] * majVec[0] + majVec[1]*majVec[1]
                if( Math.abs(logVal)> tau && majMag > 0 ){
                    let min = Number.MAX_VALUE
                    let max = -min
                    for( let l=-radius; l<= radius; l++){
                        let xSample = x + majVec[0] * l
                        let ySample = y + majVec[1] * l
                        let val1 = this.Sample(inImage, xSample, ySample, minVec, 0.0 )
                        let val2 = this.Sample(inImage, xSample, ySample, minVec, 0.5 )
                        let val3 = this.Sample(inImage, xSample, ySample, minVec, -0.5)
                        max = Math.max(val1, val2, val3, max)
                        min = Math.min(val1, val2, val3, min)
                    }

the value seems to low and affect the area which are perceived by the human eye not to have boundaries, like the face below. On the left the tau value of 10 on the right of 5:

Screen Shot 2021-03-14 at 2 54 25 PM

and here below is an animation which switch between the same two settings: Screen Recording 2021-03-14 at 2 48 19 PM

VittorioAccomazzi commented 3 years ago

Other Parameters

Directional vs Non Directional Smoothing

In comparing the results of TensorSmoothing vs TensorDirSmoothing I don't see any real difference.

Number of iteration

Increasing the number of iteration doesn't provide a real difference. Ot appears that the image reach a stable condition after 5 or 8 iterations. Right now the value is set to 6

VittorioAccomazzi commented 3 years ago

version deployed

Screen Shot 2021-03-14 at 4 17 31 PM
VittorioAccomazzi commented 3 years ago

Shock Filter

implemented a shock filter which seems to work correctly:

Screen Shot 2021-03-16 at 7 21 58 PM

however when applied multiple time on the same image, it generates very strong artefact. So it is not use for the abstraction.

       let [lImg, aImg, bImg ] = CanvasUtils.toLab(canvas)
       let shkImg = ShockFilter.Run(lImg, 2, 0.0001, 4) as ImageFloat32
VittorioAccomazzi commented 3 years ago

I don't see any further improvement option