• Please use real names.

    Greetings to all who have registered to OPF and those guests taking a look around. Please use real names. Registrations with fictitious names will not be processed. REAL NAMES ONLY will be processed

    Firstname Lastname

    Register

    We are a courteous and supportive community. No need to hide behind an alia. If you have a genuine need for privacy/secrecy then let me know!
  • Welcome to the new site. Here's a thread about the update where you can post your feedback, ask questions or spot those nasty bugs!

Wide rectlinear Pano - straighten-possibility?

Michael Fontana

pro member
Rectilinear stitches wider than 110 degrees tend to be distorted at the left and right side; here's a example with 134 degs:

rectistitch_134degs.jpg


It's done for test purposes only, therefore handheld, and not elaborated for perspective, color, contrast, etc.

AFAIK, the distortion follows a tangens-function; but sources are really poor about that subject.

Now my question - is there any tool - ImageMagick or friends - that would allow to correct that distortion?
The correction has to be done more at the sides and less at the center.

Or can it be done even with PS' custom-filter?
Off course, it would need a defined set-up - a different wideness of the pano will require different settings.....

I'm not aware, if a choice of different lenses will influence the results as well, or if it's only depending on the amount of degrees.
 

Michael Fontana

pro member
"For flat panoramas, the pixel location is based on the tangent of the angle from the image center"

told me Kevin, aka Kekus, from the Panotools-plugins (Mac)

So now, I'm looking for a app/plugin to calculate this back, any idea?

It's clear, that it doesn't works for 180 degs, aka infinity.
But how about some settings for 110, 120 degs, 130 degs, 140 degs?

I would even install ImageMagick for it:

ImageMagick: Image calculator: apply a mathematical expression to an image or image channels.

Does it works with entire images as well? In 16 bit?
 
Last edited:

Ben Rubinstein

pro member
What software are you using? I find that adjusting the center point makes a huge difference when trying to get distortion under control in situations where you cannot level your camera completely side to side and up/down. Basically the same as perspective adjustment in PS but at the stage where you have more pixels to play with and before they are stretched/crushed to make the pano rectilinear in the first place.
 

Michael Fontana

pro member
Ben

you' re right: my example might be misleading; it is just a example for the situation; handheld and shows a screenshot of the non-optimised stitch.

But that's not the point: off course I will shoot & stitch it properly, once the extreme border distortions - at the right and left border - are resolved.
 
"For flat panoramas, the pixel location is based on the tangent of the angle from the image center"

told me Kevin, aka Kekus, from the Panotools-plugins (Mac)

That's correct, a rectilinear projection will try to project on a flat surface, which means that for an ultra wide angle projection things will be stretched towards infinity when we appoach a 180degree field of view. Generally, a 100-120 degrees FOV is considered the maximum for a realistic rendering, unless the viewing distance is relatively short. When we view a flat plane at an oblique angle, the exaggerated perspective is restored (e.g. signs on the road).

So now, I'm looking for a app/plugin to calculate this back, any idea?

It's clear, that it doesn't works for 180 degs, aka infinity.
But how about some settings for 110, 120 degs, 130 degs, 140 degs?

Unfortunately, especially for architecture with straight egdes, the only way to keep all straight edges straight is by using the rectilinear projection. When we only have to deal with vertical edges, we can use a cylindrical projection, but that will start to 'distort' the horizontal edges and lines into curves as we depart from the 'horizon'.

So, when we have to cover such wide angles of view, there are 2 possible 'cures' (which can be used simultaneously). However, anything other than rectilinear projection, will introduce distortions, although some distortions are preferred over certain others.
1. Although not always practical, reduce the viewing distance or increase the output size. When the output size versus the viewing distance maintains the same ratio as the physical shooting (sensor) size versus the focal length, then the observed perspective will be identical, i.e. correct. When we cannot (fully) achieve that scenario, then we need to (re)introduce some distortion.
2. Distortion can be done during the stitching/blending phase, and that's preferred because we'll lose less quality. Alternatively we can re-introduce some distortion as a second resampling operation, but this will probably lose additional FOV coverage and some image quality due to the two stage resampling.

If we have to resort to introducing some deliberate distortion because we cannot match the viewing distance/focal length ratio in our output size, then we need to use a projection method other than rectilinear. Depending on the subject, there are different candidates that produce better looking results than others. A method I occasionally use, is the Mercator projection, but not all stitching programs offer it as an option. Programs based on "Panotools" generally do offer it, including multiple others. Unfortunately Autopano Pro is lacking in this respect.


I would even install ImageMagick for it:

ImageMagick: Image calculator: apply a mathematical expression to an image or image channels.

Does it works with entire images as well? In 16 bit?

Although I wouldn't recommend multistep distortions/resampling, ImageMagick would allow to distort the stitched image. However, because ImageMagick tries to apply the image math as correct as possible (incl. 16-bit/channel or more, depending on the version), it is going to be very slow on such very large files. It has a distort command which works similar to Photoshop's displace filter, and a very slow "-fx" command option that allows to apply mathematical manipulations.

Bart
 

Michael Fontana

pro member
thanks, Bart

I agree on using the rectilinear pano.

1) ok.... not possible...
Practically, it would be possible to stitch with a 50 mm instead a wide, but bringing it into a print size for magazines will not be the right cure....

2) looks finer, I agree for the lose of additional HFOV; but this can be gained again by adding another shot at the left and right... well, here's my unmatured idea of a second resampling:

cutting the rectilinear 140 deg- image in two sections, with 70 degs each, as the tangens-function starts at the center of the image. At the end of the correction, they will be added to one picture again...

By displacing the outside pixels (towards the center) more than the close to the center-ones, it should be possible, to get less distortions at the border. The displacement should follow the tangens-function, but horizontally only!

When looking at ImageMagick's usage site and at "Perspective Distortions" we read:

"and works by asking IM to move as set of four image coordinates from one position to another position."

I might not have fully understood these functions, and need first IM to get correctly installed ;-) but somehow, it should be possible to:

tell IM -... to set pixel 100 to 99, 200 to 195 and 2000 to 1700... (just a example) while starting at the center... and doing it in a tangens °manner°.

That's all... I want. Do I ask to much?

This would allow for the first time to have true wide angle-rectilinear panos!
For practical reasons there shoud be a defined setup; as the commands in IM are pixelrelated, that means depending on the pano's size.

Just adding a screenshot showing the pixels displacements:

idea.jpg


And yes I have been trying the Mercator projection prior to start that thread....
 

Klaus Esser

pro member
Rectilinear stitches wider than 110 degrees tend to be distorted at the left and right side; here's a example with 134 degs:

hello michael!

There´s one way around that problem: shooting very highres - means very much pictures with a longer lens - and rendering at 50% or even just 25%.
The point is to scale down inner pixels instead of scaling up outer ones during the rendering.
When you choose the rendersize in a way that the outer pixels are rendered at 100% they´re ok and your loss of quality will be minimal.

With rendersettings global at 100% the inner pixels are rendered in their original size but the outer pixels are heavily stretched and interpolated.

Generally 110-120deg is the maximum for planar-projection. You won´t expect any superwide lens to produce 130deg without heavy distortion and bad quality in the outer regions won´t you . . . :)

Anpther way is to shoot a far wider range than is used afterwards - let´s say shoot 150deg and use just 130deg of it. Important is to shoot enough rows and cells so the stitcher can generate a wider picture of which you then use only a fraction. This fraction might be cleaner.

You also can shoot the outer ranges of a superwide picture wit a longer lens than the inner range - of course you have to shoot more pictures for the outer range then ;-) - and collect more information of the outer range which by downscaling keeps more quality as being shot in lesser amount.

best, Klaus
 

Michael Fontana

pro member
Hi Klaus

good to hear from you!
Thanks for your help; but that's a hell of a work!

the problem is not only the pixel degredation, but the overdone perspective, as well.

But I'm on the way to a solution, which will resolve both oh these problems, this example here is a single photo from a 17 mm; the subtle corrected beeing the right one:


corr.jpg


Still the images are small, you might observe that at the center, you'll find no corrections, meanwhile at the upper and lower side, they' re obvious.

So following the initial idea reduces pixel degredation as well, as the UW-look, with the exaggeratet perspective.

Thinkingto be on the right track, still there are more things to understand....
 

Klaus Esser

pro member
Hi Klaus

good to hear from you!
Thanks for your help; but that's a hell of a work!

the problem is not only the pixel degredation, but the overdone perspective, as well.

But I'm on the way to a solution, which will resolve both oh these problems, this example here is a single photo from a 17 mm; the subtle corrected beeing the right one:

Still the images are small, you might observe that at the center, you'll find no corrections, meanwhile at the upper and lower side, they' re obvious.

So following the initial idea reduces pixel degredation as well, as the UW-look, with the exaggeratet perspective.

Thinkingto be on the right track, still there are more things to understand....

Hi Michael!

Yes - good to hear you too! :)

What´s really interesting: i recently took two shots with an analogue Bessa L with a 12mm lens on it, sanned them and stitched them in APP. I had app. 140deg fov.
Without degredation of pixels because the planarprojection wasn´t so extreme.
The same i did with a 6x17 - two shots are enough for an extreme wide pano and they don´t produce pixelproblems. Of course not - projecting two shots on a plane surface isn´t really difficult . . ;-)

But the way of making a bunch of redundant shots for stitching and rendering and cutting them away in the end takes nothing more than the additional shots - which don´t take long - and a larger amount of images to stitch . . which takes additional time for the stitcher/renderer.
But the result is worth it.

best, Klaus
 

Michael Fontana

pro member
Klaus

any chances to see the 140 degs from the Bessa?

Apart from the pixel degredation; the UW feel - look at the wall at the right side of my first image - isn't really pleasing.
 
Apart from the pixel degredation; the UW feel - look at the wall at the right side of my first image - isn't really pleasing.

Michael,

I think that what you are looking for (a perceptual reduction of 'exaggerated' UW view) can be implemented as a postprocessing step (and the inherent effects of multi-step resampling on microdetail) with the Photoshop 'Displace' distortion filter. Just make a distortion map file, which basically is a horizontal or vertical Black-to-White gradient with the same size as the original stitched image, saved as a separate file. You can change the linear gradient into something more tuned by adding a Curves layer to the distortion map file.

Accuracy is within the boundaries given by Photoshop. I haven't figured out the ImageMagick syntax for the equivalent command yet.

Bart
 

Klaus Esser

pro member
Klaus

any chances to see the 140 degs from the Bessa?

Apart from the pixel degredation; the UW feel - look at the wall at the right side of my first image - isn't really pleasing.

Hi Michael!

On the UWW feel you can use the "warp" tool in CS2/3 on exaggerated side parts - which allows you to undistort the outer ranges of a picture without touching the inner ranges also.
Wprks fine on too "heavy" WW feelings.

best, Klaus

here´s a app 140x130deg shot with a Canon 20D and a Nikon 20mm in app 30 shots, stitched and planprojected in APP and rendered with just 10% size. It´s exaggrated of course - but the pixels are clean to the edges!
rendering_10proz.jpg
 

Michael Fontana

pro member
Bart

exactly, "a perceptual reduction of 'exaggerated' UW view" is one of the two key-words.

I did figure out a potential solution, based on a mathematical model, which seems to work, just look at the chairs and the wall at the right side. As for the different amount of corrections, just look at the red PS guidelines....

origvscorr.jpg


The correction looks not to bad. No corrections on the vertical axis.
Funny enough, the amount of correction depends much on the image situation; in a rather small interior - with its flushed (??) perspective, visually one has to correct much more., for the °perceptual reduction of 'exaggerated' UW °


Klaus; yep, I know it; but wharp isn't precise enough, as you only have a few points to move.
The required correction has to be done as a tangens-function.

And now, how does your Bessa-shot looks?

Edit: I agree: of course, accumulating pixels helps; that's one point of the problem.
Once the other one is resolved, I would not have problems to collect pixels...

BTW: I personally don't like to much the exaggerated ones; it distracts me from reading the image.
 

Ben Rubinstein

pro member
In your original post you question whether different lenses could help your problem, with a shift lens you can effectively make a truly flat stitch thereby avoiding the need to 'unwrap' a stitch and all the problems that causes. You also avoid any messing about with the pixels, all you are doing in essence is placing the 3 images next to each other and joining them.

Autopano Pro has a feature where you can specify which lines in an image, horzontal and vertical, need to be straight. It is possible that once the lines are straight everything else falls into place though I've never really gone into it as a newby in stitching.
 

Michael Fontana

pro member
Hi Ben

thanks for your suggestions:

there isn't any PC-lens providing the required HFOV and VFOV: A 28 mm-shiftlens provides - with a flatstich - about 93 x 46 degs; beeing a 18 mm in width and 28 mm in height!

We are talking here about a capture of 130 degs x 85 degs.

I have been flatstitching for a good while, but no sitcher app can correct its assymetric distortions, unless you recalculate the x, y - the sensor's position.

At the image circle border, the shiftlenses don't look to nice, either - especially if the shiftlens is wide.
 

Klaus Esser

pro member
Hi Ben

thanks for your suggestions:

there isn't any PC-lens providing the required HFOV and VFOV: A 28 mm-shiftlens provides - with a flatstich - about 93 x 46 degs; beeing a 18 mm in width and 28 mm in height!

We are talking here about a capture of 130 degs x 85 degs.

I have been flatstitching for a good while, but no sitcher app can correct its assymetric distortions, unless you recalculate the x, y - the sensor's position.

At the image circle border, the shiftlenses don't look to nice, either - especially if the shiftlens is wide.



Again, Michael: Put an 85mm lens (or something from 50mm on) on your camera, adjust VERY carefully your NPP in both axis, take around 30% overlap and shoot a bigger area than you need.
Then choose planar-projektion in APP`s editor and correct vertical and horizontal lines.

You have a real big one now to render - render the whole picture (including the obsolete regions) with 25 or 50% (some say there are special preferable uneven numbered scalings, i didn´t try).

The crop of the region you need should be fine! It´s really worth a try.

best, Klaus
 

Michael Fontana

pro member
Thanks for the hint, Klaus

I'll test it.
As the pano shot will be taken at a different day than the interiors - due to the daylights requirements - I might even test it on that very subject.
 

Michael Fontana

pro member
ok, here's the final image.. 4 shots, with 3 different WB; for interior, fassade, and sky... and bracket shots, each....

It has about 120 x 80 degs, and is pretty proportional to the plan. Unfortunatly, there wasn't enough time to apply Klauses hint. But its been enough work, with the upper configuration, only...

The dusk was used to show better the new big windows, as prior to the remodelling, there were just small ones.


nightpano.jpg
 
ok, here's the final image.. 4 shots, with 3 different WB; for interior, fassade, and sky... and bracket shots, each....

It has about 120 x 80 degs, and is pretty proportional to the plan.

It looks fine, although it seems that you didn't (need to) adjust the rectilinear 'stretching' afterall. Using a dusk shot did emphasize the window sizes as intended, well done.

Thanks for showing the final result, appreciated.
Bart
 

Michael Fontana

pro member
Bart, I did the stretching in the last image, already.

As the stretching is making rectangles out of squares, I did correct for the height as well, using the architects fassade plan as a transparent layer.

It's not a bad stitch; the roof is buckled. Although, the building isn't a fancy new WOW, the architect though made a nice work; balancing between old and new, the atmosphere of the heritage and the clarity of design:


interior.jpg
 
Top