pfstmo_mantiuk06: Not converged (hit maximum iterations) with low equalize-contrast values

93 views
Skip to first unread message

Markku Tavasti

unread,
Apr 22, 2018, 4:41:26 PM4/22/18
to pfstools
Hi!

I am trying to create exaggerated hdr picures (artistic, not realistic) with pfstmo_mantiuk06, using low --equalize-contrast option. Unfortunately, that does not work. I allways get error like:
pfstmo_mantiuk06: Warning: Not converged (hit maximum iterations), error = 0.222209 (should be below 0.001)

And resulting image is very dark in bottom right corner area.

I have put example files to http://vuo.ro/~tavasti/pfs_bugrep_2018-04-20/

SAM_*.JPG are original files.
AIS_*.tif are alligned tif files from which real pfs work starts.

What I've been running:

pfsinhdrgen pfs_updated.hdrgen | pfshdrcalibrate -c none -r gamma | pfsclamp --rgb | pfsout pfs.hdr
pfsin --quiet pfs.hdr | pfstmo_mantiuk06 -e 0.1 -s 1 | pfsoutimgmagick HDR4_artistic.jpg

Using pfstools-2.1.0 on ubuntu 16.04

Is there something I could change in code (raise number of max iterations?) to get this fixed?

--Tavasti

Markku Tavasti

unread,
Apr 23, 2018, 3:47:53 PM4/23/18
to pfstools
I found out how to change number of max iterations, but it doesn't seem to help. I raised it from 200 to 900, and number in error is same, and resulting picture is equally bad.

So this needs something else.

--Tavasti

Rafal

unread,
Apr 24, 2018, 5:10:51 PM4/24/18
to pfstools
Indeed, the solver does not converge on this HDR image. You can try "-f" instead. 

There is a commented out switch "-b" in the code. It changes the algorithm from conjugate to biconjugate gradient. The former is faster, but the later is guaranteed to converge. However, it does not help much as the number of iterations could be as large as the number of pixels. 

But the problem seems to be somewhere else. Something seems to be wrong with the HDR image. It does not seem to be linear to photometric units and dynamic range is very low.  If you could make JPEG images readable (I get "Forbidden" error), I could try to take a look.

Best,

Rafal

Markku Tavasti

unread,
Apr 25, 2018, 1:27:59 PM4/25/18
to pfstools
Sorry for permissions, now they are fixed.

This problem is not only with this set, but it happens with all of my pictures. Just guessing, might it be auto align which will leave 'holes' on the edges of the some pictures?

BR, Tavasti

Markku Tavasti

unread,
Apr 26, 2018, 5:30:43 AM4/26/18
to pfstools
Looks like auto-allign is not the problem. Added 'crop' option to align_image_stack command, and still --equalize-contrast I get black right bottom corner. And reason to spicificly to use -e is to get weird looking artistic images.

--Tavasti

Markku Tavasti

unread,
Apr 28, 2018, 4:23:06 AM4/28/18
to pfstools
Uncommented some options from code, and tried:

pfsin --quiet pfs.hdr | time nice pfstmo_mantiuk06 -b -e 0.1 -s 1 -m 9000 -t 0.01 | pfsoutimgmagick testi.jpg
completed 70%
pfstmo_mantiuk06: Warning: Not converged (hit maximum iterations), error = 0.0623085 (should be below 0.01).
39261.53user 185.69system 11:21:35elapsed 96%CPU (0avgtext+0avgdata 1170668maxresident)k

So it converging would definitely need really high number of iterations, and huge amount of time.

--Tavasti

Rafal

unread,
Apr 30, 2018, 4:41:42 AM4/30/18
to pfstools
There are two problems:

1. It is not possible to recover a valid camera response function from the 3 JPEG pages. 

The response function I get do not look right:


Note that the first JPEG image is blurry and second is strongly overexposed. Only the last one contains a useful image. 


There could be many reasons why it was impossible to recover the response curve. It could be because there were too few JPEG images, the image quality was not sufficient, or the camera alters response curve every exposure and thus breaks the assumptions of the algorithm.


It could be possible to recover a camera response curve on one sequence of exposures (possibly more than 3 images) and reuse it on other sequences. 


I would recommend to either capture RAW images or more JPEG exposures. For this particular sequence, I would suggest to fake HDR with:


pfsin SAM_5545.JPG | pfsgamma.exe -i 2.2 | pfsclamp.exe --min 0.001 | pfsout trees.hdr


2. Indeed the optimization gets stuck on this image and does not converge. I did not have time to investigate it. But I got useful images with:


pfsin SAM_5545.JPG | pfssize.exe -r 0.25 | pfsgamma.exe -i 2.2 | pfsclamp.exe --min 0.001 | pfstmo_mantiuk06.exe -v -e 0.5 | pfsout trees_ce.exr


or 

pfsin SAM_5545.JPG | pfssize.exe -r 0.25 | pfsgamma.exe -i 2.2 | pfsclamp.exe --min 0.001 | pfstmo_mantiuk06.exe -b -v -f 0.1 | pfsout trees_cc.exr

Obviously pfssize should be removed for the full resolution image. I would also recommend storing the result in EXR images so that gamma and exposure can be fine-tuned in pfsview and then the result saved with ctrl+S. 

Rafal




Reply all
Reply to author
Forward
0 new messages