Enblend: limiting minimum levels

250 views
Skip to first unread message

John Eklund

unread,
Jul 30, 2013, 6:30:40 PM7/30/13
to hugi...@googlegroups.com
I have a suggestion for Enblend & Enfuse - how about if you could tell them to raise the minimum blending level used in the multi resolution spline blending?

Currently, you can limit the maximum number of levels but there's no way to limit the MINIMUM. If you could tell it "never use levels smaller than this", it could repeat / "clamp" the smallest level to this value for any finer details that would normally use a smaller blending level.

I think the result would be a smooth gradient also for the finest details. I know this could introduce ghost effects for non-perfect matching images but it would also hide the seam, eliminating ugly effects for images that are perfectly stitched but differ too much in lighting or focus.

Perhaps we could change its behavior when using negative numbers? Are anyone really using negative numbers? Frankly, I don't quite understand what negative numbers are good for. They don't do what I'm after anyway.

Here are two problematic examples which I suspect a minimum blending level of 6 or so could amend: (small crops of ugly details)

Example 1:
http://www.elmuseum.se/temp/stitchseam1.jpg

Enblend of several focus stacked images (pre-fused in Enfuse) facing the wall in a narrow passage in an old water tower. I missed a few spots when shooting the focus stack so some unsharp parts have to be used in the final panorama. The sharp seam makes it look like there's a diffuse plastic film hanging some distance from the wall.

Example 2:
http://www.elmuseum.se/temp/stitchseam2.jpg

Composited nadir shot of the floor in a pitch black culvert. Enblend output of several long exposures using flashlight. I usually take a couple of nadir shots with the panohead visible and then a final shot with the tripod moved, to fill in the center hole where the tripod and panohead was. I pre-stitch this to create the nadir shot which is later stitched with the rest of the images. Since I had to keep my foot on one of the tripod legs for the final shot, I was restricted in how far away I could reach when sweeping the flashlight. Therefore that image has a more narrow angle between the ground and the flashlight (and the camera) than any other images, giving the muddy ground a specular reflection which becomes disturbing when stitched into the other shots. Even though I counteracted this a lot through Lightroom exposure adjustments, blending layers of different shots and passing them through Enfuse, it is still "glossy" below a prominent diagonal seam.


Best regards
John Eklund, Sweden

Some of my work:
http://www.elmuseum.se/panorama/panorama.html?pano=daglosen_lokstall_1.xml
http://www.elmuseum.se/panorama/panorama.html?pano=gasklocka4_1.xml
http://www.angkraftverket.se/panorama/

cspiel

unread,
Jul 31, 2013, 10:25:03 AM7/31/13
to hugi...@googlegroups.com
Wish granted in rev d6c48c28dbbd
    http://hg.code.sf.net/p/enblend/code/rev/d6c48c28dbbd
though I don't see what it might be good for.

Your Enblend incantation will look something like
    enblend --levels=-30 --parameter=minimum-pyramid-levels=2 ...

Please keep in mind that *any* Enblend/Enfuse parameter
is an intrusive and more or less unchecked override.

HTH,
    Chris

John Eklund

unread,
Jul 31, 2013, 4:01:59 PM7/31/13
to hugi...@googlegroups.com
That was quick! Are there any "nightly builds" or similar available somewhere? Didn't try building it myself.

Well, if indeed it has the effect I'm hoping for, it's probably only useful if it can be applied selectively for seams between images that differ in sharpness or fine detail. Pre-stitching those few images into one using this parameter should work, I guess. Which I'm eager to try.

Monkey

unread,
Jul 31, 2013, 4:16:35 PM7/31/13
to hugi...@googlegroups.com
I may be getting my wires crossed but I don't think the change Chris has made will provide the effect John wants.

What I think is being requested is more complicated than just limiting or forcing the number of levels, but actually requires blurring the top level mask, so that the dividing line isn't so sharp. I don't know the Enblend code but I do have a handle on the process, and I don't think there's a simple way of achieving it with parameter bashing.

David

Monkey

unread,
Jul 31, 2013, 4:33:01 PM7/31/13
to hugi...@googlegroups.com
What you can do is use Enblend's --save-masks, blur the saved mask file(s), then blend again using --load-masks to use the blurred masks. Overlap corners may need to be checked for problems.

John Eklund

unread,
Aug 3, 2013, 8:31:44 PM8/3/13
to hugi...@googlegroups.com
Good idea. I saved the questionable masks, gaussian-blurred them with 64 pixels radius (2^6 should correspond to level 6) and reinserted them. The results were exactly as I was hoping - a smooth transition that hid the seam. If I used too large blur radius (tried up to 512) there were problems when the original seams were too close to the edge of the image (or image's alpha channel limits) so I had to be more generous when masking unwanted parts. Some ghosting problems appeared peripherally but I just cloned the good parts I needed into the old image. The same examples as before now look like this improved:

http://www.elmuseum.se/temp/stitchseam1_maskblur64.jpg
http://www.elmuseum.se/temp/stitchseam2_maskblur64.jpg

Here are the final panoramas:

http://www.elmuseum.se/panorama/panorama.html?pano=asea_kulvert.xml
(Nightmarish 4-hour photo session in pitch black culvert wearing particulate mask. About 130 focus stacked half-minute exposures in total. I was hell-bent on doing this as a personal challenge).

http://www.elmuseum.se/panorama/panorama.html?pano=vasteras_gamla_vattentorn.xml
(Seams not yet fixed here as of writing this but hardly visible in this magnification anyway)

Gnome Nomad

unread,
Aug 3, 2013, 9:02:55 PM8/3/13
to hugi...@googlegroups.com
On 08/03/2013 02:31 PM, John Eklund wrote:
> Good idea. I saved the questionable masks, gaussian-blurred them with 64
> pixels radius (2^6 should correspond to level 6) and reinserted them.
> The results were exactly as I was hoping - a smooth transition that hid
> the seam. If I used too large blur radius (tried up to 512) there were
> problems when the original seams were too close to the edge of the image
> (or image's alpha channel limits) so I had to be more generous when
> masking unwanted parts. Some ghosting problems appeared peripherally but
> I just cloned the good parts I needed into the old image. The same
> examples as before now look like this improved:
>
> http://www.elmuseum.se/temp/stitchseam1_maskblur64.jpg
> http://www.elmuseum.se/temp/stitchseam2_maskblur64.jpg
>
> Here are the final panoramas:
>
> http://www.elmuseum.se/panorama/panorama.html?pano=asea_kulvert.xml

Hmm, tried to go there in FF22 and got error message:
"FATAL ERROR
./projections-contextmenu.xml - xml parsing failed!"

Got same error on the other XML link below.

> (Nightmarish 4-hour photo session in pitch black culvert wearing
> particulate mask. About 130 focus stacked half-minute exposures in
> total. I was hell-bent on doing this as a personal challenge).
>
> http://www.elmuseum.se/panorama/panorama.html?pano=vasteras_gamla_vattentorn.xml
> (Seams not yet fixed here as of writing this but hardly visible in this
> magnification anyway)

--
David W. Jones
gnome...@gmail.com
wandering the landscape of god
http://dancingtreefrog.com
http://www.clanjones.org/david/
http://dancing-treefrog.deviantart.com/
http://www.cafepress.com/otherend/

Terry Duell

unread,
Aug 3, 2013, 9:11:28 PM8/3/13
to hugi...@googlegroups.com
On Sun, 04 Aug 2013 11:02:55 +1000, Gnome Nomad <gnome...@gmail.com>
wrote:

[snip]

>> Here are the final panoramas:
>>
>> http://www.elmuseum.se/panorama/panorama.html?pano=asea_kulvert.xml
>
> Hmm, tried to go there in FF22 and got error message:
> "FATAL ERROR
> ./projections-contextmenu.xml - xml parsing failed!"

Opened that one OK, using Opera.

Cheers,
--
Regards,
Terry Duell

John Eklund

unread,
Aug 3, 2013, 9:15:49 PM8/3/13
to hugi...@googlegroups.com
I suspect Monkey was right - if that hack limits those levels from being blended at all, it's pretty useless. I guess that would result in all finer details being lost and only the lower frequency components being visible in the image? Editing the masks by hand works but it becomes a lot of work for more than a couple of images. The ideal solution would be if Enblend somehow could determine when this treatment is called for and apply it selectively along certain seams. The criteria in example image 1 could be: when one image is more detailed than the other, turn this feature on for that seam. Example 2 presents a greater challenge as both images have about the same level of fine detail. Perhaps a straight per-pixel image comparison taking spatial placement in consideration would do it, with a threshold?:

foreach pixel in area of interest {
 match += sqrt ((image1.red - image2.red)^2 + (image1.red - image2.red)^2 + (image1.red - image2.red)^2)
 if (image1.pixel != black) nonblacks1++;
 if (image2.pixel != black) nonblacks2++;
}
avgblacks=(nonblacks1+nonblacks2)/2;
match=match/(avgblacks*441.672943); // Max vector length: 441.672943 = sqrt(255*255 + 255*255 + 255*255 = 195075)

if (match > threshold) { turn feature on }

(That's how I compare images in my own utility PicStack that identifies and merges similar images. It's somewhat superceded by Enfuse though...)

John Eklund

unread,
Aug 3, 2013, 9:40:21 PM8/3/13
to hugi...@googlegroups.com
On Sunday, August 4, 2013 3:02:55 AM UTC+2, GnomeNomad wrote:
On 08/03/2013 02:31 PM, John Eklund wrote:

Hmm, tried to go there in FF22 and got error message:
"FATAL ERROR
./projections-contextmenu.xml - xml parsing failed!"

Interesting. I do not get any error although it must be krpano that's printing the message so it should be browser independent. It seems there was a non-terminated comment in that XML file. Try again please.
 

John Eklund

unread,
Aug 3, 2013, 9:57:40 PM8/3/13
to hugi...@googlegroups.com

 match += sqrt ((image1.red - image2.red)^2 + (image1.red - image2.red)^2 + (image1.red - image2.red)^2)

Oops. That line was meant to be:

match += sqrt ((image1.red - image2.red)^2 + (image1.green - image2.green)^2 + (image1.blue - image2.blue)^2)
 

Gnome Nomad

unread,
Aug 4, 2013, 2:09:51 AM8/4/13
to hugi...@googlegroups.com
OK, works now. Just dog slow and I only seem to get the right half of
either image. If there's some kind of navigation or movement tools being
generated, I don't see them.

http://www.elmuseum.se/panorama/panorama.html?pano=asea_kulvert.xml

http://www.elmuseum.se/panorama/panorama.html?pano=vasteras_gamla_vattentorn.xml

Good think I just ordered a new laptop. Looks like simply browsing the
internet is too much for the current machine!

Monkey

unread,
Aug 4, 2013, 4:23:46 AM8/4/13
to hugi...@googlegroups.com


On Sunday, 4 August 2013 02:15:49 UTC+1, John Eklund wrote:
I suspect Monkey was right - if that hack limits those levels from being blended at all, it's pretty useless.

I think that's where the misunderstanding lies. I think the hack just puts a lower limit on the number of levels. As you say, skipping upper levels would result in the final result being blurred as all the details would be lost.

John Eklund

unread,
Aug 4, 2013, 7:20:34 AM8/4/13
to hugi...@googlegroups.com
On Sunday, August 4, 2013 8:09:51 AM UTC+2, GnomeNomad wrote:

OK, works now. Just dog slow and I only seem to get the right half of
either image. If there's some kind of navigation or movement tools being
generated, I don't see them.

Not sure how you mean "right half". Is that something that's particular for my panoramas or every panorama you view with that old machine?

Since the early days of QTVR I was perhaps wrong thinking that everyone knows that Shift and Ctrl on the keyboard zooms in / out so I left the menu out not to interfere with the picture.

Gnome Nomad

unread,
Aug 5, 2013, 4:48:01 AM8/5/13
to hugi...@googlegroups.com
On 08/04/2013 01:20 AM, John Eklund wrote:
> On Sunday, August 4, 2013 8:09:51 AM UTC+2, GnomeNomad wrote:
>
>
> OK, works now. Just dog slow and I only seem to get the right half of
> either image. If there's some kind of navigation or movement tools
> being
> generated, I don't see them.
>
> Not sure how you mean "right half".

Sorry - the left half of the browser window is black. The right half has
what looks like the side of a culvert.

> Is that something that's particular
> for my panoramas or every panorama you view with that old machine?

I've only seen it on your panoramas. Maybe a krpano thing? I don't know
what other panoramas I've looked at that might also be using krpano.

> Since the early days of QTVR I was perhaps wrong thinking that everyone
> knows that Shift and Ctrl on the keyboard zooms in / out so I left the
> menu out not to interfere with the picture.

Well, mousing around over the image and trying to drag the image around
didn't do anything.

Probably this little old 2.8GHz Celeron laptop with 2GB RAM is a bit
underpowered to handle Firefox running complex Javascript?

Thomas Pryds

unread,
Aug 5, 2013, 7:41:10 AM8/5/13
to hugin-ptx


Den 04/08/2013 08.10 skrev "Gnome Nomad" <gnome...@gmail.com>:
>
> http://www.elmuseum.se/panorama/panorama.html?pano=asea_kulvert.xml
>
> http://www.elmuseum.se/panorama/panorama.html?pano=vasteras_gamla_vattentorn.xml
>
> Good think I just ordered a new laptop. Looks like simply browsing the internet is too much for the current machine!

Both work fine and rather smooth here on Chrome on an Android phone.

Thomas

Gnome Nomad

unread,
Aug 6, 2013, 5:09:12 AM8/6/13
to hugi...@googlegroups.com
On 08/05/2013 01:41 AM, Thomas Pryds wrote:
>
> Den 04/08/2013 08.10 skrev "Gnome Nomad":
> >
> > http://www.elmuseum.se/panorama/panorama.html?pano=asea_kulvert.xml
> >
> http://www.elmuseum.se/panorama/panorama.html?pano=vasteras_gamla_vattentorn.xml
> >
> > Good think I just ordered a new laptop. Looks like simply browsing
> the internet is too much for the current machine!
>
> Both work fine and rather smooth here on Chrome on an Android phone.

I suspect your Android phone has a multicore processor and more powerful
video hardware. And might also be running in 64-bit mode? This little
old Sempron processor only has a single core and 128KB of processor
cache ... Yah, little old laptop!

And Chrome is much faster at Javascript than current Firefox!

I'm also straining the little old laptop's video capabilities, running a
1920x1080 HD display on a laptop designed for 1024x768 native
resolution. The video hardware has great difficulty throwing around that
many pixels since it has to dip into main memory to handle it.

Thomas Pryds

unread,
Aug 8, 2013, 8:34:29 AM8/8/13
to hugin-ptx


Den 06/08/2013 11.09 skrev "Gnome Nomad" <gnome...@gmail.com>:
> I suspect your Android phone has a multicore processor and more powerful video hardware. And might also be running in 64-bit mode? This little old Sempron processor only has a single core and 128KB of processor cache ... Yah, little old laptop!

It's a Galaxy Nexus, so yes, a dual-core ARM processor running at 1.2 GHz and a 384 MHz GPU. I don't know whether it's 32 or 64 bits.

> And Chrome is much faster at Javascript than current Firefox!

Just tried with Firefox on the same device. Black screen. Then Firefox closes down.

Thomas

Gnome Nomad

unread,
Aug 8, 2013, 3:38:01 PM8/8/13
to hugi...@googlegroups.com
On 08/08/2013 02:34 AM, Thomas Pryds wrote:
>
> Den 06/08/2013 11.09 skrev "Gnome Nomad" <gnome...@gmail.com
> <mailto:gnome...@gmail.com>>:
> > I suspect your Android phone has a multicore processor and more
> powerful video hardware. And might also be running in 64-bit mode? This
> little old Sempron processor only has a single core and 128KB of
> processor cache ... Yah, little old laptop!
>
> It's a Galaxy Nexus, so yes, a dual-core ARM processor running at 1.2
> GHz and a 384 MHz GPU. I don't know whether it's 32 or 64 bits.

Either way, more horsepower in many ways.

> > And Chrome is much faster at Javascript than current Firefox!
>
> Just tried with Firefox on the same device. Black screen. Then Firefox
> closes down.

Would be interesting to report that to Mozilla.
Reply all
Reply to author
Forward
0 new messages