Log in

View Full Version : Any descreening filter for vapoursynth?


lansing
4th June 2018, 15:14
Screening are those pattern when you scan an image that was printed by an inkjet printer. There wasn't many talk about how to remove it in this forum, the only one that I can find is this one (https://forum.doom9.org/showthread.php?t=158242) from 8 years ago.

The general concept of removing them I've found is to use a fft transform. In the fft image, all the screening patterns will appear as little diamonds across the image, then all you have to do is to cover the center of those little diamond with black.

Then there're the better approach where you have to scan the same image at different angles, in which I have no idea how it works.

In photoshop there is this top of the line plugin Sattva Descreen (http://www.descreen.net/eng/soft/descreen/descreen.htm) that can do this. It was able to separate screen removal and moiré pattern reduction into two parts.

So I was wondering does anyone who is familiar with this stuff knows how they do that? Or maybe implement it for vapoursynth?

WolframRhodium
5th June 2018, 01:12
I suppose fft-screen (https://github.com/6o6o/fft-descreen/blob/master/descreen.py) might be a lightweight start point?

lansing
5th June 2018, 13:59
I suppose fft-screen (https://github.com/6o6o/fft-descreen/blob/master/descreen.py) might be a lightweight start point?

I tried it, it doesn't work with python 3.6, I got an error



python descreen.py example.png example_result.png
Traceback (most recent call last):
File "descreen.py", line 36, in <module>
middle = np.pad(ellipse(ew, eh), ((ph,rows-ph-eh*2-1), (pw,cols-pw-ew*2-1)),
'constant')
File "C:\Users\myname\AppData\Local\Programs\Python\Python36\lib\site-packages\
numpy\lib\arraypad.py", line 1298, in pad
raise TypeError('`pad_width` must be of integral type.')
TypeError: `pad_width` must be of integral type.


update: I got it work changing "/" to "//" in line 34 and 35, following the solution in the issue page.

Though the results weren't good, I used the sample images from Sattva Descreen's website

This is black and white descreen:

original:
https://i.imgur.com/zXTXcda.jpg

fft_descreen:
https://i.imgur.com/0mbBWBb.jpg

sattva descreen:
https://i.imgur.com/KGYF9uF.png


Color image descreen

original:
https://i.imgur.com/ywZGQPj.png

fft_descreen:
https://i.imgur.com/s7Fm2Je.png

sattva descreen:
https://i.imgur.com/pjYEO1k.png

foxyshadis
5th June 2018, 21:10
Not an inkjet, but an offset press.

I spent far too much time trying to make AviSynth descreen well, and I started out with exactly what you mentioned: Manually picking out peaks in DeFreq, which is incredibly time consuming but gives excellent results. I made some decent progress into something automatic, and I'll dig out my old computer tonight and try to find those scripts, and translate them to VS.

The Sattva results are odd; even in their test photos, they seem to unnaturally brighten the image. Clarity-wise, it definitely gives the best definition for the resolution I've seen.