Cannot fix stitching/alignment errors

528 views
Skip to first unread message

SEMPERVIVUM1412

unread,
Aug 11, 2016, 11:44:15 AM8/11/16
to PTGui Support
Hallo,
I took photos for a panorama inside a church and unfortunately I get stitching errors. I tried to add control points in the region where one error occurs but this didn't help. I read the FAQs and checked the distance of the control points. There are distance above 5 to appr. 12. I checked the control points having a distance above 10 and they seemed to be OK.
I add a screenshot showing the control points at the left and the erroneous region in the output at the right.
Any help is appreciated.
Best regards - Ulrich Bangert

SEMPERVIVUM1412

unread,
Aug 11, 2016, 11:46:43 AM8/11/16
to PTGui Support
Sorry, forgot the attachment.
kontrollpunkte.jpg

SEMPERVIVUM1412

unread,
Aug 11, 2016, 11:51:34 AM8/11/16
to PTGui Support
PS: I used a tripod and a panorama adapter carefully adjusted.

SEMPERVIVUM1412

unread,
Aug 11, 2016, 12:03:40 PM8/11/16
to PTGui Support


Am Donnerstag, 11. August 2016 17:44:15 UTC+2 schrieb SEMPERVIVUM1412:
PPS: Sorry for the attachment. Admins please delete. You can view the screenshot here:

John Houghton

unread,
Aug 11, 2016, 3:09:58 PM8/11/16
to PTGui Support
It's not possible to diagnose the reason for the misalignment from your screenshot, but if you can supply a set of jpegs and your saved project file, I'm sure the cause can be very quickly identified.

John

SEMPERVIVUM1412

unread,
Aug 11, 2016, 3:25:29 PM8/11/16
to PTGui Support

John Houghton

unread,
Aug 11, 2016, 4:10:27 PM8/11/16
to PTGui Support
The problem was easy to spot: your zenith and nadir images were not in the same orientation as the others.  All should be in landscape or all in portrait.  You need to rotate the two images counterclockwise by 90 degrees.  The reason this causes problems is that the two images have a different horizontal angle of view.  The optimizer assumes the one fov parameter applies to all the images, which is inappropriate for a mixed set of images.  Turn off auto rotate in the camera, or rotate the images into the same orientation in raw conversion.  Note that orientation -90 is different to orientation +90, and all images must be rotated into the same orientation.  See my result at :https://www.sendspace.com/file/f437nu .  There is a little parallax visible.

John

SEMPERVIVUM1412

unread,
Aug 11, 2016, 4:42:45 PM8/11/16
to PTGui Support
Thank you for this info. Your result is perfect but unfortunately I was not able to reproduce it: I rotated the zenith and nadir image counterclockwise and ran the optimizer but still got alignment errors. When using your project file the result is fine. Did you do some more adjustments?
I updated the zenith and nadir image on my webspace and uploaded the new project file:

SEMPERVIVUM1412

unread,
Aug 11, 2016, 4:55:58 PM8/11/16
to PTGui Support

Sorry, I didn't adjust the lens parameters correctly. After doing that there is only a small error left. Will try to adjust the nodal point more precisely.

John Houghton

unread,
Aug 11, 2016, 5:59:46 PM8/11/16
to PTGui Support
On Thursday, August 11, 2016 at 9:55:58 PM UTC+1, SEMPERVIVUM1412 wrote:

Sorry, I didn't adjust the lens parameters correctly. After doing that there is only a small error left. Will try to adjust the nodal point more precisely.

Well, how small is small?  I try to get the optimization figures down to an average <1 and max <2-3.  This is a challenge for these images.  Viewpoint correction helps with the nadir shot and also the zenith.  See my tutorial: http://www.johnhpanos.com/epcalib.htm .  

John 

John Houghton

unread,
Aug 12, 2016, 2:26:56 AM8/12/16
to PTGui Support
On Thursday, August 11, 2016 at 9:55:58 PM UTC+1, SEMPERVIVUM1412 wrote:

Sorry, I didn't adjust the lens parameters correctly. After doing that there is only a small error left. Will try to adjust the nodal point more precisely.

While checking the nadir alignment, I noticed what seems to be a shift in the position of this tripod leg: https://www.sendspace.com/file/w4qb9m .  Maybe the tripod was accidentally knocked at some point when adjusting the head. This might be the cause of the alignment issues rather than the setup of the head, which is really quite good.

John

SEMPERVIVUM1412

unread,
Aug 12, 2016, 9:03:09 AM8/12/16
to PTGui Support

Hallo John, thanks for additional info. Yes, on your GIF it's obious that the position of the tripod leg changed. I didn't notice to have moved it but in order to adjust the camera I had to touch the head and might have moved unintensionally.
I intended to adjust my adapter more precisely but in the meantime I viewed your panorama again and the result is perfect while mine still has a small error:
I've marked it by two red crosses. Can you give me a hint where my settings difffer from yours and how I can improve my version?
Best regards- Ulrich Bangert

John Houghton

unread,
Aug 12, 2016, 10:18:25 AM8/12/16
to PTGui Support
My stitch is not perfect either.  There are glitches in the cords of four of the hanging lamps, and small glitches elsewhere.  The standard remedy is to assign more control points in the area of a glitch to encourage the optimizer to do a bit better in that area.  When parallax is responsible for the glitch, this may not solve the problem.  The horizontal row of shots align well, and so does the nadir when viewpoint correction is invoked. OTOH, the zenith is more problematical.  I can only guess that parallax is the root cause there too, even though it is relatively far away from the camera position.  The differences between your project file and mine are down to control point placement.  My distribution of points was the result of using the Delete Worst Points option and assigning additional points with the Create control points here option several times over, and no doubt my very long experience with PTGui tells in the end.

John

Roger Broadie

unread,
Aug 22, 2016, 10:16:21 AM8/22/16
to pt...@googlegroups.com

 

On Thu 11 Aug 2016 at 17:44:15 UTC+2 SEMPERVIVUM1412 (Ulrich Bangert) wrote seeking help with a spherical panorama with some recalcitrant stitching flaws and a conversation then ensued with John Houghton about how to resolve them.  John sought a full set of images and the project file and Ulrich kindly supplied links to them on Thu 11 Aug 2016 21:25:29 UTC+2.

I realise that this is now rather an old topic, and indeed some of the relevant files have already evaporated from the internet.  But I took advantage of the full information to look into the issue in more detail, because it gave me a chance to explore a type of stitching I am not familiar with and anyway I was interested in Ulrich’s subject-matter.  I did come up with some conclusions I think it is worth placing on the record, even though I think in the meantime John has guided Ulrich to a satisfactory solution.

When I looked at Ulrich’s pts file I was puzzled that John attributed his problems to mixing images in portrait and landscape modes.  True, there were stitching flaws in Ulrich’s panorama – that’s why he wrote.  But at an overall level the question is surely why his stitch was so successful.  If mixed orientations were the problem, one might have expected more catastrophic failures.  The answer, I think, is that, even though his images are rectangular, the lens type is specified as ‘circular fisheye’.  In that particular circumstance the images, though rectangular and in the different orientations, do not have different horizontal fields of view.  For both portrait and landscape modes the images have the same horizontal field of view, dependent, I think, on the diameter of the cropping circle.  Here, the cropping circle spills out beyond the sides of the portrait-mode images and also beyond the top and bottom of the landscape-mode images and yields a horizontal field of view that is the same for both portrait and landscape orientations. 

To check that it is possible to deal with the stitching flaws without rotating the landscape images I took Ulrich’s original images and pts file, including its control points and optimised afresh via the Advanced setting of the Optimizer tab.  The result is the project file a6_HDR_Panorama circ.pts, downloadable from here. It has average/max control-point distances of 1.2/2.9 pixels.   

Ulrich’s images can be obtained from the links he listed in his posting mentioned above.  But since then he has rotated the nadir and zenith images from their original landscape mode to agree with the portrait-mode orientation of the others.  If you are downloading the images as they are at present and want to try my pts files you will have to rotate the nadir and zenith images clockwise to obtain the images expected by the pts file.  The pts file listed there is (I think) still the original one using the landscape-mode nadir and zenith images; he has since revised it.  His revised version can be found from his posting of Thu 11 Aug 2016 22:42:45 UTC+2 (though this too may be a replacement).

To improve the actual stitching I optimised all the lens/camera parameters a to e and carried out repeated rounds of deleting the worst control points (via the Control Points menu) and then reoptimising.  I don’t suggest this is anything subtle and I think that approach is already included in Ulrich’s latest revision.  Deleting the worst control points pruned a good number of presumably questionable control points.

 Finally, I added a few control points to quench the vestiges of a stitching flaw in the front of the top gallery immediately to the right of the altar (i.e. at the top of the seam between images 0 and 3 as numbered in the pts file).

I did give the nadir and zenith images special treatment.  As the portrait-mode images seemed pretty satisfactory I treated then as a set, optimising their parameters globally.  But I gave the nadir and zenith images individual parameters, first to accommodate some possible parallax that had been suggested, and secondly because I was concerned about the horizontal and vertical shift parameters, which I think are measured against physical axes determined by the camera body.  That means their values do depend on the actual orientations of the images.  Tat , at least, is what I have understood from some of John’s earlier posts, though it is not the factor he was relying on here. 

It is worth examining the Image Parameters tab.  It shows that all the images, whether in portrait or landscape mode, have the same horizontal field of view of 142 degrees. I think we can conclude that Ulrich’s stitching problems stem not from the orientation of the images but, rather more mundanely, from the way optimisation has been applied and achieved.

For comparison, I converted the circular fisheye pts file into one specifying full-frame fisheye, which is what I think the lens actually is, and then reoptimised (a6_HDR_Panorama ff.pts).  I made no other changes to the pts file before optimising and got average/max control-point differences of 1.2/2.9, which was just about identical to the circular case. The stitch that resulted was not significantly different from that for the circular fisheye, though I noticed a slightly different seam position between images 3 and 5 that exposed a few slight glitches in the divisions between the floor-boards.  No doubt they could be removed if desired by suitable masking.  However, with a cropping rectangle that followed the edges of the images, the horizontal fov of the portrait-mode images was now 104 degrees and that of the landscape-mode images 156 degrees – rather more in line with what one might expect.

In both cases making all the lens/camera parameters separately optimisable pushed the average cp distance below the magic 1 pixel, but with no obvious improvement in the stitched panorama.  I have kept off viewpoint correction to keep the file compatible with the non-Pro version of PTGui.  At any rate, both files open satisfactorily in PTGui 9, which I retain on my PC.

There is no absolute ban on mixing images of different orientations, provided that, as here, individual lens parameters are used – see the final paragraph here.   But that is not to say that John’s recommendation to avoid mixed orientations is not good practical advice, amongst other reasons because it clears some of the issues out of the way before optimising is started.  It’s just that the example here – of a full-frame fisheye treated as a circular fisheye – seems a remarkably special case, to which the normal considerations relating to horizontal and vertical fields of view of a rectangular image do not apply. 

So my question to Ulrich would be whether he chose to specify the lens as a circular fisheye for some special reason and if so what.  I also wonder what considerations led to his choice of diameter for the cropping circle.  In general, is specifying a full-frame fisheye lens as circular a well-recognised technique?

 Roger Broadie

John Houghton

unread,
Aug 22, 2016, 1:35:36 PM8/22/16
to PTGui Support
Roger, You are correct in pointing out that a mixture of image orientations can be processed by PTGui, provided that you are careful with the way the optimization parameters are selected.  PTGui does not know directly from the image file content the type of lens used, but Tools->Options>EXIF contains rules that can be modified by the user to ensure that the correct choice is automatically made.  It is perfectly fine to choose circular fisheye for processing fullframe fisheye images.  This is commonly done when it's desirable to cut off poor quality corners that you don't want to make their way into the finished panorama.  And it is possible to specify a crop circle just touching the corners, in which case you can have a mixture of landscape and portrait images, provided that individual lens shift parameters are assigned to cope with an offset lens axis. This will also deal with the problem of upside down images. Nevertheless, the simple recommendation to supply images to PTGui all in the same orientation will generally enable straightforward stitching without recourse to advanced features that many users are not familiar with and never use.

John
Message has been deleted

SEMPERVIVUM1412

unread,
Aug 22, 2016, 2:57:53 PM8/22/16
to PTGui Support
Hallo Roger, thanks for the very detailed explanation, it is much appreciated. I was unsure whether to choose fullframe or circular fisheye. I tried both and was not able to spot a significant difference in the result.
My lens is a 8mm Walimex Pro II. I assume that fullframe fisheye is the correct choice?
Yet I do not know how to handle the cropping. Is it advisable to use cropping in order to exclude the outer regions of the images where the quality might be lower?
One issue being not yet clarified to me is why adding additional control points in the region of a stitching error had no effect on the result. Can anyone explain?
In the next day I'm going to take photos of a scenery outdoors and stitch them.
Best regards - Ulrich
BTW: This is my final version of the panorama of the church online:

John Houghton

unread,
Aug 22, 2016, 4:24:36 PM8/22/16
to PTGui Support
On Monday, August 22, 2016 at 7:57:53 PM UTC+1, SEMPERVIVUM1412 wrote:
Hallo Roger, thanks for the very detailed explanation, it is much appreciated. I was unsure whether to choose fullframe or circular fisheye. I tried both and was not able to spot a significant difference in the result.

That is to be expected.  Either choice will give equally good results.
 
My lens is a 8mm Walimex Pro II. I assume that fullframe fisheye is the correct choice?

Fullframe is the usual choice, as no part of the edge of the image circle is visible in the images.

Yet I do not know how to handle the cropping. Is it advisable to use cropping in order to exclude the outer regions of the images where the quality might be lower?

Well, you have the images, so you can see whether the corners are of poor quality such that you would want to exclude them.
 
One issue being not yet clarified to me is why adding additional control points in the region of a stitching error had no effect on the result. Can anyone explain?

Adding control points in the general area of a stitching error will encourage the optimizer to align the images better in that area.  But whether it does or doesn't improve things depends on what is causing the glitch.  If it is parallax, then it is impossible to align the nearer objects perfectly and align features in the background also perfectly at the same time. The images are not locally warped to bend features into alignment.  Remember that there is no single no-parallax point for a fisheye lens, as the apparent entrance pupil position varies with the angle of incidence of the light rays.  So parallax cannot be eliminated entirely.  Likewise for things subject to movement.  Eg the lamps hanging from the ceiling might be swinging slightly due to air currents or vibrations, and that might be the cause of the very slight misalignments in some of those.  Otherwise, some misalignments might be caused by things happening in other parts of the panorama, where there may be some poorly placed control points, perhaps. Moving an image to fix a glitch in one area might simply generate a new glitch elsewhere where there was previously good alignment.
 
In the next day I'm going to take photos of a scenery outdoors and stitch them.

Good luck!

John

Roger Broadie

unread,
Aug 22, 2016, 4:42:17 PM8/22/16
to pt...@googlegroups.com

Ulrich, thanks.  I’m delighted you have put the panorama on your website.  I think it makes a splendid pair with your panorama of the Marienkirche in Wolfenbüttel – a couple of churches some century apart in date, I think, but one still basically a gothic structure despite the wealth of renaissance detail and the other immediately recognisable as baroque.  Rather naively I had not realised the style had made itself felt so far north.    

I was interested in John Houghton’s comment that people commonly treat full-frame fisheye lenses as circular when they want the advantage of the cropping circle for cropping – rather, that is, than simply for defining the field of view.  But, like you, I didn’t detect any significant difference between these formats in the case of your images, so I guess you use whichever seems to work best in the circumstances.  I think the rectangular corners of the full-frame are not a problem in your case, because they are lost in the overlap. 

I tried cropping circles of the size you had, of the default size that just reaches the short sides of the image, one even larger, so that it passes through the corners of the image, and one small enough to touch the long sides of the image.  But I couldn’t really detect any difference between them, other than that the final one was too small since it left little black triangles where the cropped images failed to overlap.  There were also differences in the magnitude of the parameters a, b and c, though they did not appear to effect the quality of the stitch.  That did lead me to wonder what they represent.  They can’t be lens distortion parameters in the normal sense that applies to a rectilinear lens.  My supposition is that there is actually an invisible function that transforms the fisheye image into something that can be projected onto the panosphere and, for this and probably other non-rectilinear lenses, a, b and c are merely correcting factors to be applied to that function. Perhaps somebody knowledgeable can comment.

Roger


On 22 August 2016 at 19:55, SEMPERVIVUM1412 <ulr...@arcor.de> wrote:
Hallo Roger, thanks for the very detailed explanation, it is much appreciated. I was unsure whether to choose fullframe or circular fisheye. I tried both and was not able to spot a significant difference in the result.
My lens is a 8mm Walimex Pro II. I assume that fullframe fisheye is the correct choice?
Yet I do not know how to handle the cropping. Is it advisable to use cropping in order to exclude the outer regions of the images where the quality might be lower?
One issue being not yet clarified to me is why adding additional control points in the region of a stitching error had no effect on the result. Can anyone explain?
In the next day I'm going to take photos of a scenery outdoors and stitch them.
Best regards - Ulrich
BTW: This is my final version of the panorama of the church online:

--
Many people are reading this forum via email and get every post delivered to their inbox. To limit the amount of data please do not add attachments or images to your posts; instead upload your files at a file sharing site (for example http://sendspace.com// ) and include a link in your message.
---
You received this message because you are subscribed to the Google Groups "PTGui Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ptgui+unsubscribe@googlegroups.com.
To post to this group, send email to pt...@googlegroups.com.
Visit this group at https://groups.google.com/group/ptgui.
To view this discussion on the web visit https://groups.google.com/d/msgid/ptgui/4516311e-0089-41dd-9ca6-7f4c00a9d766%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Erik Krause

unread,
Aug 22, 2016, 5:35:41 PM8/22/16
to pt...@googlegroups.com
Am 22.08.2016 um 22:42 schrieb Roger Broadie:
> There were
> also differences in the magnitude of the parameters a, b and c, though they
> did not appear to effect the quality of the stitch. That did lead me to
> wonder what they represent. They can’t be lens distortion parameters in
> the normal sense that applies to a rectilinear lens.

They are lens distortion parameters same as for rectilinear lenses. The
difference is the underlying projection formula. The distortion
parameters determine a polynomial which represents the deviation from
the ideal projection, no matter whether fisheye or rectilinear.

> My supposition is
> that there is actually an invisible function that transforms the fisheye
> image into something that can be projected onto the panosphere and, for
> this and probably other non-rectilinear lenses, a, b and c are merely
> correcting factors to be applied to that function. Perhaps somebody
> knowledgeable can comment.

Good supposition :-) In fact all transformations are carried out in one
go. The original panotools (which PTGui is based on) use a function
stack to perform all operations. In more detail:
http://wiki.panotools.org/Lens_correction_model and
http://wiki.panotools.org/Panotools_internals

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

John Houghton

unread,
Aug 22, 2016, 5:47:42 PM8/22/16
to PTGui Support
On Monday, August 22, 2016 at 9:42:17 PM UTC+1, Roger Broadie wrote:

 My supposition is that there is actually an invisible function that transforms the fisheye image into something that can be projected onto the panosphere and, for this and probably other non-rectilinear lenses, a, b and c are merely correcting factors to be applied to that function. Perhaps somebody knowledgeable can comment.


The invisible function is in fact the lens model, and different fisheye lenses more-or-less conform to one or other of the standard models.  See this Wiki article: http://wiki.panotools.org/Lens_correction_model .

John 

Roger Broadie

unread,
Aug 23, 2016, 4:00:59 PM8/23/16
to pt...@googlegroups.com
Erik,

Thanks for your helpful reply.  I think I had seen the first reference you cited (and thanks, too, to John  Houghton for mentioning it),  though I hadn't read the fisheye section, which wasn't relevant to me at the time.  Looking back, I think my initial misconception was that the parameters a. b and c were (or at least included) what it took to get from the normal rectilinear lens to a fisheye.

Now I look forward to reading the second reference.

Roger Broadie

--
Many people are reading this forum via email and get every post delivered to their inbox. To limit the amount of data please do not add attachments or images to your posts; instead upload your files at a file sharing site (for example http://sendspace.com// ) and include a link in your message.
--- You received this message because you are subscribed to the Google Groups "PTGui Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ptgui+unsubscribe@googlegroups.com.
To post to this group, send email to pt...@googlegroups.com.
Visit this group at https://groups.google.com/group/ptgui.
Reply all
Reply to author
Forward
0 new messages