Masking inside hugin

207 views
Skip to first unread message

T. Modes

unread,
Feb 16, 2010, 1:34:12 AM2/16/10
to hugin and other free panoramic software
Hi,

I implemented a masking tool inside hugin. It's now in the trunk.

Now you can create masks inside hugin, the masks are stored in the pto
file. It is possible to use negative and positive masking. The masks
are applied during stitching with nona. So also enblend can use them.

Some hints for usage of the editor:

Creating mask polygon: left mouse buttons sets one point, finish with
right mouse button or left double click
Select mask: left mouse click inside polygon or use rubberband, works
only when there are no points selected; or use the listbox
Selecting point(s): after selecting "add new mask" left mouse click on
point or use rubberband; when holding shift the new points are added
to an existing selection
Move point(s): drag with left mouse button
Move whole mask: drag with right mouse button
Adding points: left click while holding ctrl key on a line segment
Deleting points: right mouse click while holding ctrl key on a point
or drag with right mouse button and pressed ctrl button a rubber band
around the points (the remaining polygon must consist of at least
three points, otherwise the deleting is canceled), the delete key
deletes the selected points
Deleting mask: use delete mask button, the mask is also delete with
pressing the delete key when all or none point of the current mask are
selected

I hope this feature is helpful

Thomas

Lukáš Jirkovský

unread,
Feb 16, 2010, 1:43:14 AM2/16/10
to hugi...@googlegroups.com
Hi,

On 16 February 2010 07:34, T. Modes <Thomas...@gmx.de> wrote:
>
> I hope this feature is helpful
>
> Thomas
>

It's absolutely awesome. I can't wait to test it.

Lukas

T. Modes

unread,
Feb 16, 2010, 1:51:13 AM2/16/10
to hugin and other free panoramic software

Small error, inserted text on wrong position; it should be:

Creating mask polygon: after selecting "add new mask" left mouse


buttons sets one point, finish with right mouse button or left double
click

Selecting point(s): left mouse click on point or use rubberband; when

Jan Martin

unread,
Feb 16, 2010, 1:58:50 AM2/16/10
to hugi...@googlegroups.com
This might be obvious to you, I ask nevertheless:
What is masking good for?

Thanks.

Carl von Einem

unread,
Feb 16, 2010, 3:22:35 AM2/16/10
to hugi...@googlegroups.com
Standard (negative) masking: Make sure that certain areas of a source
image (a partial human body stepping into the frame, or parts of the
panohead) don't make it into the stitched image while you have enough
better background in another frame (e.g. a handheld nadir shot). The
'crop' tab is comparable but only allows to "mask" the outside of a
rectangle or a circle.

Positive masking: comparing two overlapping frames one feature might be
in both but looks better in frame B. You want to make sure that enblend
uses that nicer part so you can apply positive masking on that wanted part.

Bruno's tutorial shows both techniques using seperate vector masks:
http://hugin.sourceforge.net/tutorials/enblend-svg/en.shtml

Jan Martin schrieb am 16.02.10 07:58:

Bruno Postle

unread,
Feb 16, 2010, 3:35:57 AM2/16/10
to Hugin ptx
On Tue 16-Feb-2010 at 09:22 +0100, Carl von Einem wrote:
>Standard (negative) masking: Make sure that certain areas of a source
>image (a partial human body stepping into the frame, or parts of the
>panohead) don't make it into the stitched image while you have enough
>better background in another frame (e.g. a handheld nadir shot). The
>'crop' tab is comparable but only allows to "mask" the outside of a
>rectangle or a circle.
>
>Positive masking: comparing two overlapping frames one feature might be
>in both but looks better in frame B. You want to make sure that enblend
>uses that nicer part so you can apply positive masking on that wanted part.

I uploaded some screenshots, works great, thanks for this Thomas:

http://www.flickr.com/photos/36383814@N00/4359863335/

What it shows is that by flipping a mask from 'negative' to
'positive' masking you can remove or include a person in the scene
that would otherwise be cut in half.

--
Bruno

sebastien delcoigne

unread,
Feb 16, 2010, 3:37:59 AM2/16/10
to hugi...@googlegroups.com
Thanks Thomas,
It's a very practical feature to have directly inside Hugin.
I can't wait to try it.

-- Sebastien

--
You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugi...@googlegroups.com
To unsubscribe from this group, send email to hugin-ptx+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/hugin-ptx



--
Sébastien

Bart van Andel

unread,
Feb 16, 2010, 9:44:36 AM2/16/10
to hugin and other free panoramic software
On 16 feb, 09:35, Bruno Postle <br...@postle.net> wrote:
> http://www.flickr.com/photos/36383814@N00/4359863335/

This will save a lot of work: instead of first outputting all the
remapped images, editing masks by hand using a photo editor like GIMP
or Photoshop, and then blending, everything can now be done from
inside Hugin. Very nice work indeed!

--
Bart

cri

unread,
Feb 16, 2010, 1:25:48 PM2/16/10
to hugin and other free panoramic software
Thank you for this feature!!
I've just compiled Hugin from trunk and it works great!

Harry van der Wolf

unread,
Feb 16, 2010, 5:32:22 PM2/16/10
to hugi...@googlegroups.com
Hi Thomas,

Was on business trip. Saw the commits in hugin-cvs, read your mail in hugin-ptx.  Got home late tonight from the airport, hugged, kissed, talked with my wife (some things simply come first), modified the Xcode project and it works great. THANKS AGAIN for another very nice feature in hugin (cplean, updated structured tabbed fast preview, what do I forget?).

(Tomorrow an OSX build).

Harry


2010/2/16 cri <cri....@gmail.com>

Henri Chevallier

unread,
Feb 16, 2010, 8:36:46 PM2/16/10
to hugi...@googlegroups.com
> I hope this feature is helpful
This is definitely a great addition! Thanks a lot!

Emad ud din Butt

unread,
Feb 17, 2010, 3:05:36 AM2/17/10
to hugi...@googlegroups.com
wow really nice feature..........thanks for adding..



--
You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugi...@googlegroups.com
To unsubscribe from this group, send email to hugin-ptx+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/hugin-ptx



--
_________________________________
Asst Manager IT
Wazir Ali Industries Limited
Lahore

Tim Nugent

unread,
Feb 16, 2010, 8:23:13 AM2/16/10
to hugi...@googlegroups.com

Milan Knížek

unread,
Feb 17, 2010, 4:14:02 PM2/17/10
to hugi...@googlegroups.com
T. Modes píše v Po 15. 02. 2010 v 22:34 -0800:

> Hi,
>
> I implemented a masking tool inside hugin. It's now in the trunk.

I have to express my thanks, too!

regards,

Milan Knizek
knizek (dot) confy (at) volny (dot) cz
http://www.milan-knizek.net - About linux and photography (Czech
language only)

Zoran Zorkic

unread,
Feb 17, 2010, 8:34:57 PM2/17/10
to hugin and other free panoramic software
Awesome work! Very useful to the workflow.

Could you make it use the roll parameter?
I used some portrait photos, but in the mask(and crop) tab they were
in landscape, while in CP editor they were properly in portrait
orientation

It would also be great if some CP generators made use of masking.
PTmender would also rock if it supported masking.

Thanks you the feature!

Bruno Postle

unread,
Feb 18, 2010, 3:46:29 PM2/18/10
to hugin and other free panoramic software
On Wed 17-Feb-2010 at 17:34 -0800, Zoran Zorkic wrote:
>
>It would also be great if some CP generators made use of masking.

That would be useful, but also the Hugin optimiser could ignore
points in masked areas, and the photometric optimiser could be made
to only sample from unmasked areas.

--
Bruno

Bruno Postle

unread,
Feb 18, 2010, 6:59:02 PM2/18/10
to hugin and other free panoramic software
On Mon 15-Feb-2010 at 22:34 -0800, Thomas Modes wrote:
>
> Now you can create masks inside hugin, the masks are stored in the
> pto file. It is possible to use negative and positive masking. The
> masks are applied during stitching with nona. So also enblend can
> use them.

Some comments on the new mask functionality, though it is
practically complete, I'm not sure anything really needs to be
changed:

The phrases 'negative masking' and 'positive masking' - I'm probably
responsible for these, but I worry that they won't mean much to new
users, we should maybe look for something better:

Exclude region / Include region
Exclude area / Include area
Remove region / Add region
(not sure....)

I use Hugin over remote-X and showing photos in the Mask tab is
several times slower than showing them in the Crop tab (like 20
seconds for a 1:1 view) - Obviously remote-X isn't much of a
concern, but I wonder if the canvas is being redrawn multiple times.

Masks can be drawn outside the photo border. This is fine for
'negative' masks, as it makes it easier to select the right area,
but for 'positive' masks it results in holes in the final image.

--
Bruno

T. Modes

unread,
Feb 19, 2010, 1:48:20 AM2/19/10
to hugin and other free panoramic software
> That would be useful, but also the Hugin optimiser could ignore
> points in masked areas, and the photometric optimiser could be made
> to only sample from unmasked areas.

The photometric optimiser should only sample from unmasked area. As
far as I understood, I did the changes.
Regarding the optimiser it should be easy possible to remove cps in
masked areas.

> The phrases 'negative masking' and 'positive masking' - I'm probably
> responsible for these, but I worry that they won't mean much to new
> users, we should maybe look for something better:
>
>    Exclude region / Include region
>    Exclude area / Include area
>    Remove region / Add region
>    (not sure....)
>

If there is a consense, it should be easy to change the phrases.

> I use Hugin over remote-X and showing photos in the Mask tab is
> several times slower than showing them in the Crop tab (like 20
> seconds for a 1:1 view) - Obviously remote-X isn't much of a
> concern, but I wonder if the canvas is being redrawn multiple times.
>

I will have a look on this in the next days.

> Masks can be drawn outside the photo border.  This is fine for
> 'negative' masks, as it makes it easier to select the right area,
> but for 'positive' masks it results in holes in the final image.

I could in the internal mask processing positive masks clip at the
image bounderies. But this would not show up in the mask editor.
Or I could force to clip the created mask. But I have no good idea at
which stage this could be done - maybe when switching to positive
mask. (Alternatively an additional button with clip to image, but this
approach I don't like, because there are enough buttons.)
What do you think?

Thomas

Kornel Benko

unread,
Feb 19, 2010, 3:45:05 AM2/19/10
to hugi...@googlegroups.com
Am Friday 19 February 2010 schrieb T. Modes:
> > That would be useful, but also the Hugin optimiser could ignore
> > points in masked areas, and the photometric optimiser could be made
> > to only sample from unmasked areas.
>
> The photometric optimiser should only sample from unmasked area. As
> far as I understood, I did the changes.
> Regarding the optimiser it should be easy possible to remove cps in
> masked areas.
>
> > The phrases 'negative masking' and 'positive masking' - I'm probably
> > responsible for these, but I worry that they won't mean much to new
> > users, we should maybe look for something better:
> >
> >    Exclude region / Include region
> >    Exclude area / Include area
> >    Remove region / Add region
> >    (not sure....)
> >
>
> If there is a consense, it should be easy to change the phrases.

How about "prefer region" and maybe "penalize region" (But exclude or remove seems better)

...

>
> Thomas
>

Kornel

--
Kornel Benko
Kornel...@berlin.de

signature.asc

Erik Krause

unread,
Feb 19, 2010, 5:28:44 AM2/19/10
to hugi...@googlegroups.com
Am 19.02.2010 07:48, schrieb T. Modes:

> I could in the internal mask processing positive masks clip at the
> image bounderies. But this would not show up in the mask editor.

What about show the crop (if there is any) and draw the mask line in a
fainter color if it's outside?

Another issue: It is very nice and convenient to select a single point
and move it. I even found the possibility to select multiple points by
area (something I want in the CP editor since many years). There even
seems to be a way to select the whole mask, but this is not completely
repeatable. Sometimes it gets selected if I double click then right
click inside the mask. Sometimes the whole mask gets selected if I click
a single point after I right click inside a selected mask.

Naming: I'd prefer simply "include" and "exclude".

--
Erik Krause
http://www.erik-krause.de

Seb Perez-D

unread,
Feb 19, 2010, 5:50:44 AM2/19/10
to hugi...@googlegroups.com
On Tue, Feb 16, 2010 at 07:34, T. Modes <Thomas...@gmx.de> wrote:
> I implemented a masking tool inside hugin. It's now in the trunk.

This is a great feature. Many many thanks.

One issue I found: if I include two times the same image, there is one
single mask for these two images.

Why would one want to do that? for example to stitch in one part the
horizon/objects far away, and in an independent way an object too
close to the camera to fit in one single picture. For example:
http://www.flickr.com/photos/sbprzd/4144268175/

Cheers,

Seb

Bruno Postle

unread,
Feb 19, 2010, 12:40:51 PM2/19/10
to hugi...@googlegroups.com
On 19 February 2010 06:48, T. Modes <Thomas...@gmx.de> wrote:

> I could in the internal mask processing positive masks clip at the
> image bounderies. But this would not show up in the mask editor.

I think that would be fine. It is useful to be able to draw part of
the mask outside the edge of the photo, but this 'outside' part of the
region can only do bad things in the 'positive mask' situation.

--
Bruno

imm...@gmail.com

unread,
Feb 19, 2010, 2:39:28 PM2/19/10
to hugin and other free panoramic software
This is great!! By far the the most important addition for me. It
greatly simplifies my work flow.

Thank you Thank you

Now if only gimp would make it to 16bit!!

T. Modes

unread,
Feb 19, 2010, 4:02:02 PM2/19/10
to hugin and other free panoramic software
@Bruno

> > I could in the internal mask processing positive masks clip at the
> > image bounderies. But this would not show up in the mask editor.
>
> I think that would be fine. It is useful to be able to draw part of
> the mask outside the edge of the photo, but this 'outside' part of the
> region can only do bad things in  the 'positive mask' situation.

It should be fixed in trunk. I also changed the text for the mask type
to "exclude" and "include".

@Erik


> Another issue: It is very nice and convenient to select a single point
> and move it. I even found the possibility to select multiple points by
> area (something I want in the CP editor since many years). There even
> seems to be a way to select the whole mask, but this is not completely
> repeatable. Sometimes it gets selected if I double click then right
> click inside the mask. Sometimes the whole mask gets selected if I click
> a single point after I right click inside a selected mask.

This issue should also be fixed. Now it should be possible to select
all points of the active mask with the right mouse button.

@Seb


> One issue I found: if I include two times the same image, there is one
> single mask for these two images.

Only the fast preview is affected by this bug. The normal preview and
the output should be ok. Until it is fixed use the normal preview or
work with a copy of the image with an other filename.

Thomas

James Legg

unread,
Feb 19, 2010, 7:16:37 PM2/19/10
to hugi...@googlegroups.com
On Fri, 2010-02-19 at 13:02 -0800, T. Modes wrote:
> @Seb
> > One issue I found: if I include two times the same image, there is one
> > single mask for these two images.
>
> Only the fast preview is affected by this bug. The normal preview and
> the output should be ok. Until it is fixed use the normal preview or
> work with a copy of the image with an other filename.

I fixed this in rev 5000.

There is another bug I have noticed:
If you make an include mask on an image, the image opposite it on a
spherical panorama disappears from both previews and the output.
For example: if you have image 0 at yaw 90, pitch 0 with a positive
mask, and image 1 at yaw -90, pitch 0, image 1 disappears.

-James


T. Modes

unread,
Feb 20, 2010, 3:39:22 AM2/20/10
to hugin and other free panoramic software
Hi James,

> > Only the fast preview is affected by this bug. The normal preview and
> > the output should be ok. Until it is fixed use the normal preview or
> > work with a copy of the image with an other filename.
>
> I fixed this in rev 5000.
>

Thanks for fixing.

> There is another bug I have noticed:
> If you make an include mask on an image, the image opposite it on a
> spherical panorama disappears from both previews and the output.
> For example: if you have image 0 at yaw 90, pitch 0 with a positive
> mask, and image 1 at yaw -90, pitch 0, image 1 disappears.

Fixed in rev 5002.

Thomas

Emad ud din Butt

unread,
Feb 22, 2010, 6:32:53 AM2/22/10
to hugi...@googlegroups.com
Is it available now or have to wait. If available ? than from where i can download? I am really stuck with Black mask errors and cant generate final files. Masking my images manually is surely going to help a lot. 

Is there any need of feather addition in masks? 




--
You received this message because you are subscribed to the Google Groups "hugin and other free panoramic software" group.
A list of frequently asked questions is available at: http://wiki.panotools.org/Hugin_FAQ
To post to this group, send email to hugi...@googlegroups.com
To unsubscribe from this group, send email to hugin-ptx+...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/hugin-ptx



--
_________________________________
Emaad
www.flickr.com/emaad

Bruno Postle

unread,
Feb 22, 2010, 9:38:23 AM2/22/10
to hugi...@googlegroups.com
On 22 February 2010 11:32, Emad ud din Butt <xyz...@gmail.com> wrote:
>
> Is there any need of feather addition in masks?

This isn't really how it works, you can't use the mask tool for
compositing or placing a foreground object on different background.
For this you need an image editor.

Enblend can and does use any part of an image overlap to place a seam,
by excluding an area using a mask you are telling enblend to exclude
that region from consideration both when placing the seam and when
blending.

The result is that you can remove a person or object only if some
other photo shows the same part of the scene without that object.

When you 'include' an object with a mask the opposite happens, this
simply removes that part of the scene from all other photos, enblend
then has no choice but to use the region in the photo you selected.

Cristian Marchi has posted a nice tutorial showing the 'positive'
(include region) masking:
http://www.flickr.com/groups/hugin/discuss/72157623472700076/

--
Bruno

Reply all
Reply to author
Forward
0 new messages