Experiment - reducing aliasing in post using optical flow

Started by a1ex, November 19, 2017, 07:49:22 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Levas

@Alex

Tested out median, I think it has a little edge compared to average, you get some fine noise/grain in the frame which gives it a little more sharpness perception.

I have uploaded all the 16 aligned PNG files, and the original PPM file for this particular frame on google drive:
Just in case you come up with some other methods of combining those 17 frames ;)
https://drive.google.com/drive/folders/1w9kYw-TgVdiJriVpnfkZ1J1PNv17n5mI?usp=sharing
I've also included the average and the Median files on google drive

Median:

Danne

@Levas
For comparison reasons I tested your png files by transcoding them to tiffs and ran them against this script(enfuse/hugin). It will average 6 files not all the 17 png files:
http://www.magiclantern.fm/forum/index.php?topic=21089.msg193629#msg193629

enfuse/hugin


Original


Levas

@Alex,

Just curious, don't know if, and how much you did dive into the source files for pyflow (the 15 files in the SRC directory).
I see the files are readable code, so easy editable.
But do you know if it is possible to alter some settings in these files that motion is more blurred or something ?
When motion is in the frame, walking person for example, I end up with sharp curvy lines through the image, due to how the allignment and averaging is done.

Here's an example with lot's of those sharp curvy lines around the frame:

a1ex

Didn't dig much. There are some parameters, you can edit the source to adjust them, but to figure out what they do, one has to read the papers linked in the README. I've only skimmed the website.

For your issue, maybe some sort of thresholding (comparing the images before blending, to discard areas with differences above the noise floor) could work. You don't need to change the optical flow code for that - just the blending stage (I've used "convert -average"). You may even consider writing it from scratch (e.g. in octave).

Levas

ah yes, you're right, the whole average step is done in the makefile written by you...the alignment is done by the pyflow code and creates the aligned images, doesn't put them together.

Enough info for me to dig some further into the average step.

# average
%-a.png: %.ppm %-n.png %-p.png %-n2.png %-p2.png %-n3.png %-p3.png %-n4.png %-p4.png %-n5.png %-p5.png %-n6.png %-p6.png
convert -average $^ $@


Thanks  :D

Levas

For now, this seems like a quick solution that gives rather good results:

I added the bold tekst to the convert line.
convert -average -despeckle -statistic minimum 3x3 blur 2x2 $^ $@
-Despeckle helps a little and since the curvy lines are mostly highlights, the statistic minimum works rather well, after that a little blur is added and most of it is gone.



Levas

Hope somebody is reading this:

I wanted to mess around with pyflow again, but I can't get it to work anymore  :-\

I get this error message when running the make command:

Traceback (most recent call last):
  File "/Users/magic_lantern/pyflow/flow.py", line 45, in <module>
    import cv2
ImportError: dlopen(/usr/local/lib/python2.7/site-packages/cv2.so, 2): Library not loaded: /usr/local/opt/ilmbase/lib/libImath-2_2.23.dylib
  Referenced from: /usr/local/Cellar/opencv/3.4.2/lib/libopencv_imgcodecs.3.4.dylib
  Reason: image not found
[\code]

When I look into the directory mentioned in the error (Library not loaded: /usr/local/opt/ilmbase/lib/libImath-2_2.23.dylib)
I find a file named "libImath-2_4.24.0.0.dylib" so apparently I only have a newer version of the library on my system.

Error message says it's  "Referenced from: /usr/local/Cellar/opencv/3.4.2/lib/libopencv_imgcodecs.3.4.dylib"

How to solve this error ?

Levas

Sorry for your time, got it working again  :P

Used "brew uninstall --force opencv"
So all versions of opencv were deleted.
After that reinstalled opencv "brew install opencv3"