Cycles noise reduction with VapourSynth

Yes, I can compile it from git without errors as shown here:

But I must also run it as:

PYTHONPATH=/usr/local/lib/python3.4/site-packages LD_LIBRARY_PATH=/usr/local/lib ./vsedit

(not installed, just running the binary)

the script evaluation output is:

Failed to evaluate the script:
Python exception: Read: No files matching the given pattern exist
Traceback (most recent call last):
File “vapoursynth.pyx”, line 1469, in vapoursynth.vpy_evaluateScript (src/cython/vapoursynth.c:23703)
File “/home/yafu/VaporS/script.vpy”, line 4, in <module>
ret = core.imwri.Read(‘jpg-50/%04d.jpg’, firstnum=1, alpha=False)
File “vapoursynth.pyx”, line 1368, in vapoursynth.Function.call (src/cython/vapoursynth.c:22272)
vapoursynth.Error: Read: No files matching the given pattern exist

So I do not know exactly how it should be the pattern in the names of images.

EDIT:
Ok, now I understand what you say. I modified the script to read one image and yes, I get this error in the editor too.

Judging from the format string ‘jpg-50/%04d.jpg’ (not having actually used or tested it):

jpg-50/0001.jpg
jpg-50/0002.jpg

… and so on.

Yes that was my guess, %04d ought to mean a 4-digit integer where firstnum=1 makes it start from 0001. Good to know YAFU cleared the imwri problems but i can’t find any tangible info on the next one…

I think I have tried with those patterns in names. I must be doing something wrong.

However, related to “fmtc” (fmtconv):

It is a plugin/filter. You need to compile it. If you install in default location, then you move them or link to the vapoursynth path:

sudo ln -s /usr/local/lib/libfmtconv.so /usr/local/lib/vapoursynth/libfmtconv.so

sudo ln -s /usr/local/lib/libfmtconv.la /usr/local/lib/vapoursynth/libfmtconv.la

Well, now there is a problem related to “fft3dfilter”!

This is exhausting, I think I’ll give up for today.

EDIT:
for fft3dfilter just compile and install. (./configure, make and sudo make install)

Now “No attribute with the name mv exists”…

Installed vapoursynth-mvtools. With this you also need link after install:

sudo ln -s /usr/local/lib/libmvtools.so /usr/local/lib/vapoursynth/libmvtools.so

sudo ln -s /usr/local/lib/libmvtools.la /usr/local/lib/vapoursynth/libmvtools.la

And finally this is the end!

It never ends… Who in their right mind would deal with this headache…

There I edit the previous post. Finally it finishes !!!
Now I need to learn how to use the script in order to obtain an image with the noise reduction applied.

EDIT:
Ohh !! There is the “Preview” in vapuorsynth editor! It seems to work pretty well the noise reduction.

Comparison, the first is the original. Click on the image to view in real size:

[ATTACH=CONFIG]395135[/ATTACH]

Edit: I do not know why the forum says it is an invalid attachment. If you have problems, this is the image:
http://www.shareimages.com/images/pics/0/0/4/81203-pJyYl5WfmpymlqWSm6c-comparison.jpg

The result is very nice! Very good preservation of edges and details.
I see some banding, perhaps because the “jpg” (I applied it over a jpg obtained from Blender, and then again the comparison re-saved as jpg in GIMP)

It would be great to have this integrated with Blender. Would it be more useful to be able to apply it in render passes?

I can’t see the attachment, upload to pasteall? Try BMP and see if you get any banding.

And damn, this gives me motivation to try and fight with this thing some more tomorrow. The best way to integrate something like this would be as a Compositing node, under “Filters”, with a name like “Denoise”. But considering how many obscure libraries this depends on, i doubt integration into Blender is that feasible. Maybe having it as an add-on that’s designed to work with that super-standard vapoursynth package from the PPA would be adequate. Most of the imagemagick issues may be eliminated if the image data is piped in directly somehow.

Ideally, someone would have to look at what this plugin is doing and make an implementation specifically for blender…

There I edited the previous message. I do not know why this happens in the forum. I had seen this problem with other users.

The result is pretty good, if you don’t consider the banding! Can you try a low amount of samples? On the video a filtered 50-sample image was nearly identical to a plain rendered 300-sample image.

I’m getting the image from “Copy to clipboard” or “Save snapshot” in Preview window of vapoursynth editor. Maybe that gives a lower quality copy. I will try to do more tests and try to learn how to use the script and vapoursynth.

Edit:
The script with these values do not remove the coarse grain, it only removes the fine grain. But I suppose that it can be configured with different values for different grain sizes. And surely when bigger the grain to remove, the more detail will be lost with noise reduction. Here is another example with the render I had obtained with the scene from renderman thread (Open the images separately to view real size):

[ATTACH=CONFIG]390703[/ATTACH]

[ATTACH=CONFIG]395159[/ATTACH]

Mmm, again the problem with attachment in this thread:
Here is the image:
http://www.blenderartists.org/forum/showthread.php?375734-Pixar-RenderMan-for-Blender!&p=2921695&viewfull=1#post2921695

And I have a question: With regard to noise reduction, what part of the work is performed by VapourSynth and which by ImageMagick or the other components?

Hi everyone.

Vapoursunth work with plug-ins
http://www.vapoursynth.com/doc/pluginlist.html

Basically this is mvtools,
http://forum.doom9.org/showthread.php?t=171207

I install all software from gentoo overlay


May be it helps you find a way to compile for other distros

For windows there are binares


https://bitbucket.org/mystery_keeper/vapoursynth-editor/downloads

… find it on github or bitbucket

Scripts it’s almost identical to the avisynth, but now it’s python style
There are user-friendly editor - vsedit
The script consists of a algoritm of filters
imwri.Read
fmtc
mv
fft3dfilter
StackVertical - (commited) this is for compare two frames

http://forum.doom9.org/showthread.php?t=165771

MVTools compare frames (7 - in my script) and detect noise, this is very super cool thing! Because it don’t blured image!
I used wavelet filter FFT3D too (this is for hard denoise method) - this filter may blur image.

Hi.
I was able to make some videos and noise reduction is excellent. The problem is that in some cases the banding is noticeable. I really do not know why the bandig occurs. I’ve done some tests with OpenGL render (no noise) and there is no banding issues.
Noise reduction is not magic, it does not work well with excessive noise. And if you intentionally have materials or a particle system with fine grain, noise reduction will kill the grain. But I guess this would happen with any filter to reduce noise applied to the final image obtained when rendering.
I’m happy with the noise reduction, but we must see how to solve the problem of banding. I have seen that there are some plugins for debanding in VapourSynth, but I have no idea how it is used.
By the way, ‘jpg-50/%04d.jpg’ means the path to your images. If you have images in “/home/Your_User/images” in the script must be ‘/home/Your_User/images/%04d.jpg’ (at least in Linux)

Maybe as in photoshop, adding back a barely noticeable noise throughout the whole picture? Usually it is not annoying the eyes but it kills the banding (as dithering does)

Hi.
The idea is to do everything with VapourSynth. This is the plugin for debanding:
https://f3kdb.readthedocs.org/en/latest/index.html

I’ve experimented a little and in some cases must be added too much noise for the banding disappears. That’s not good if our main goal was to eliminate the noise. Anyway, I have not experienced much yet with the plugin options.

But what I want to first investigate is why the banding appears. If this occurs by the noise reduction, or if it is because we are using something wrong in the script, as some bad video format.

Hi YAFU, does VapourSynth also work with single images?

Cheers, mib

Hi mib2berlin.
Some filters work by comparing more than one frame at a time, so I guess that the best result is obtained in videos using many images.
Anyway, the examples that I mentioned in the post #27 and #31 have been obtained using only one image.

Edit:
And the noise reduction is much better if you render with random seed noise. So I think the comparison between more than one frame is important.

@mib2berlin
Definitely the best noise reduction is when many frames are compared. I rendering eight frames from Sponza with random noise seed. Only 150 samples each image. You know that with Sponza are needed at least 3000 samples to obtain an acceptable result, so only 150 samples is a hard example to show the noise reduction capability but impossible to use in practice.

So 8 frames with random noise pattern, but I copied these set of images a couple of times to obtain a set of more images (just in case). I use the last frame of the sequence in the comparison:

This is the original render:

And this is the last frame extracted from “vsedit” GUI:

Thanks but is it not the same as take this 8 pictures and composite it in Blender with mix nodes?

CHeers, mib

that’ why it makes sense for video