Multiblend on a Mac

113 views
Skip to first unread message

Dr. Kurt

unread,
Nov 4, 2017, 12:03:42 AM11/4/17
to hugin and other free panoramic software
Maybe all of the Mac users of Hugin have already figured out how to get multiblend (http://horman.net/multiblend/) to work - if you haven't you should really try it, it's *much* faster than enblend, at least for the kind of panoramas I create.  But it's not optimized for OSX, and the build instructions for Linux need some tweaking before they will work.  So if you're a Mac user like me and want to get it running, here are a few notes on what I did:

I've made a few minor tweaks to the code to make it a bit easier to use:

1) In  globals.cpp  replace:
    bool g_wideblend=false;
    bool g_bgr=false;
  with:
    bool g_wideblend=true;

    #ifdef __APPLE__

        bool g_bgr=true;

    #else

        bool g_bgr=false;

    #endif


I admit I'm not sure whether changing the default for g_wideblend makes any significant difference, but it seems to work well for me.  The #ifdef eliminages the need to specify "--bgr" as a command line option on Mac systems.


2) In  multiblend.cpp  replace:

    else if (!strcmp(argv[i],"--bgr")) g_bgr=true;

    else if (!strcmp(argv[i],"--wideblend")) g_wideblend=true;

  with:
    else if (!strcmp(argv[i],"--bgr")) g_bgr=!g_bgr;
    else if (!strcmp(argv[i],"--wideblend")) g_wideblend=!g_wideblend;

The help text for the --wideblend option should also be updated to reflect the change.  Note that the changes in these two files are independent; if you don't change globals.cpp then multiblend will retain its current behavior for these two options.


To compile multiblend, you must have libtifflibjpeg and libpng installed (typically in /opt/local/lib - there are several ways to get these if you don't already have them).  You can then build multiblend with this command:

g++ -L/opt/local/lib -I/opt/local/include -msse2 -O2 multiblend.cpp -ltiff -ljpeg -lpng -o multiblend


if you've installed libjpeg-turbo then change the "-ljpeg" to "-lturbojpeg" - you might need to add another -L option depending on where it resides .
If you've got the various libs and header files in /usr/local or other places rather than (or as well as) /opt/local then you should add the appropriate "-L" and "-I" options to the command line.
There will be two "comparison of unsigned expression >= 0 is always true" warnings generated, but these can be ignored.

Once multiblend is built and tested (try the command "./multiblend --help"), you can go into Hugin's preferences and add it as an alternative to enblend.


I haven't yet figured out how to propagate the ICC profile info from the input files to the output file; enblend does this quite nicely, but I'm not sufficiently fluent in C++ (I'm an old FORTRAN guy from way back...) to know just what should be cut-n-pasted to add this to multiblend.  If anyone else would like to give it a shot, I'd love to see this!


Mikko Kuutti

unread,
Nov 6, 2017, 2:27:55 PM11/6/17
to hugin and other free panoramic software
I tried this. The compilation was uneventful with only two warnings. The newly compiled multiblend also seems quite fast
– only problem is the resulting file has quite weird colours: reds turns purple and yellows turn blue.

I'm working with 8-bit tiffs.

Any idea how to fix this?

Mikko

Mikko Kuutti

unread,
Nov 6, 2017, 2:32:37 PM11/6/17
to hugin and other free panoramic software
Fixed it myself: seems the changes to --bgr shouldn't be done. Or at least I could counteract this problem by passing --bgr to multiblend.

Kurt Hillig

unread,
Nov 7, 2017, 3:15:51 AM11/7/17
to hugin and other free panoramic software
The code changes I posted basically reverse the meaning of the --bgr option on Apple systems - the first change makes g_bgr true by default for Macs (and also makes g_wideblend true by default for all systems), while the second change allows the --bgr and --wideblend command line options invert the value of the corresponding variables (T to F or F to T) rather than explicitly making them true.

So if you make these changes but still specify "--bgr" on the command line, then you will see the behavior that you got.

OTOH I only tested with 16-bit TIFF files, not 8-bit - so it may be that these don't order the color data the same way.
I guess I'll have to run some more tests...

Mikko Kuutti

unread,
Nov 7, 2017, 6:46:25 AM11/7/17
to hugin and other free panoramic software
I did make the changes as suggested, and had to provide --bgr to make it work. So it seems that in my case I should not have touched the default. I was working with 8bit tiffs. 
Reply all
Reply to author
Forward
0 new messages