You realize that this is only an approximation even for a linear (equidistant) fisheye lens. The resulting panoram is equally spaced (pixels) in angular units and does not conform to true perspective geometry. If it is other formats such as equalarea (equisolid), orthographic and stereographic, you will get other vertical distortions remaining.
A better approach is to do a proper fisheye to perspective view on a subsection of the fisheye image rather than rectifying the full image into a panorama and then cropping it to the desired subsection. I may get around to modifying my current defisheye script do to that as well as make proper panoramas for all of the above fisheye types.
In the meantime, Anthony and I are discussing implementation of the rect2polar and polar2rect scripts as true IM distorts. Hopefully we can add that soon. We are in the process of adding quite a few new distorts. Anthony can give you more details about what is currently under way and plans for the near term.
polar to rectangular cordinates
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: polar to rectangular cordinates
while Anthony is working on Polar Depolar as an IM -distort, I have developed a new script that does the same, polar and another one, just posted today that additionally corrects for perspective distortion, called, fisheye2pano. When Anthony finishes polar/depolar, I should be able to combine a number of IM functions together to do the depolar, then correct for aspect ratio and center and also adjust for perspective. This will be a sequence of IM commands and so should run fast.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: polar to rectangular cordinates
In the next release of IM (v6.4.2-8), the Polar and DePolar distorts have been completed.
However please note that Area-Resampling is turned off for DePolar as it can not area sample a circular arc, which DePolar needs for high quality working. Instead it is recommended that for higher quality distorts involving DePolar that an Super-Sampling method be used.
As part of the recent updates to -distort a special export option
-set option:distort:scale N can be used to make super sampling easy. And example of this is given in IM examples under the section (De)Polar Tricks which should appear in a few days.
Until the official IM examples website updates, (and the above section appears) the examples may not represent the final implementation which will appear in IM v6.4.2-8.
However please note that Area-Resampling is turned off for DePolar as it can not area sample a circular arc, which DePolar needs for high quality working. Instead it is recommended that for higher quality distorts involving DePolar that an Super-Sampling method be used.
As part of the recent updates to -distort a special export option
-set option:distort:scale N can be used to make super sampling easy. And example of this is given in IM examples under the section (De)Polar Tricks which should appear in a few days.
Until the official IM examples website updates, (and the above section appears) the examples may not represent the final implementation which will appear in IM v6.4.2-8.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: polar to rectangular cordinates
Area resampling is off by default in these functions, but -distort polar and -distort depolar are still on and available for IM versions 6.4.2-6 or later. It has nothing to do with -set options.millau12 wrote:Hello Every body !
But when I tell you "try to install correctly" is fact that I want to have Polar and DePolar functions installed !!!
but I search for a long time on google and others, and I have read the Anthony message :
"However please note that Area-Resampling is turned off for DePolar"
So if I understand well this sentence, these functions (Polar & DePolar) are turned OFF !
So I want to turned ON these functions but HOW I DO ?
You can choose which sampling method using the -filter option.
See
http://www.imagemagick.org/script/comma ... hp#distort
http://www.imagemagick.org/script/comma ... php#filter
http://www.imagemagick.org/Usage/distorts/#polar
http://www.imagemagick.org/Usage/distorts/#depolar
http://www.imagemagick.org/Usage/distorts/#polar_tricks
to check if you have polar/depolar in the distorts,
convert -list distort
Anthony's comment about supersampling does need the -set option:distort:scale X. See http://www.imagemagick.org/Usage/distorts/#distort under Output Scaling for an example. But you can do -distort polor or depolar without needing to use supersampling.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: polar to rectangular cordinates
CC of my response to millau12 private mail to me...
Polar and Depolar is NOT turned off. They are available but you will need a fairly recent version of IM, as they were only recent additions. The typical linux repositories are very old releases of IM and missing a lot of the newer features.
If lists the functions then your version of IM is new enough to have them available. Otherwise you will need to upgrade your IM yourself.
The comment... "However please note that Area-Resampling is turned off for DePolar" if you follow the links to the general discussion on how distortions work, is more about how the colors of the source image is transfered to the destination image.
Area-resampling is about merging a large area of color from the source image into a single pixel in the destination when the image in that area 'shrinks' to a much smaller size. This improves the look of the resulting image, remove 'dotty' or 'aliasing' effects when distortions become sever.
however the area resampling technique is not very good for 'arcs' of pixels that you get with then operators, so it is turned off. that is the image improvement method is disabled, NOT the distortions operator.
Super-Sampling techniques can still be used to improve the resulting images, and these are demonstrated in IM examples.
'N' is a number, and this scales the output image generated by that amount. It is used on the CONVERT command before the -distort operation. As suchwill generate a image that is twice as large (4 times the area) than you would normally get from the -distort operator.
The larger the number the better the larger the output distorted image, and the better the final resized resultimg image. But it will also typically take N^2 more time. Good values to use are 4 (with a final 25% resize) or 10 (with a final 10% resize). It really depends on just how GOOD you want the result.
Remember this is used as a replacement to the more automatic area-resampling method that is unable to be used for a depolar distortion.
Polar and Depolar is NOT turned off. They are available but you will need a fairly recent version of IM, as they were only recent additions. The typical linux repositories are very old releases of IM and missing a lot of the newer features.
If
Code: Select all
convert -list distort
The comment... "However please note that Area-Resampling is turned off for DePolar" if you follow the links to the general discussion on how distortions work, is more about how the colors of the source image is transfered to the destination image.
Area-resampling is about merging a large area of color from the source image into a single pixel in the destination when the image in that area 'shrinks' to a much smaller size. This improves the look of the resulting image, remove 'dotty' or 'aliasing' effects when distortions become sever.
however the area resampling technique is not very good for 'arcs' of pixels that you get with then operators, so it is turned off. that is the image improvement method is disabled, NOT the distortions operator.
Super-Sampling techniques can still be used to improve the resulting images, and these are demonstrated in IM examples.
'N' is a number, and this scales the output image generated by that amount. It is used on the CONVERT command before the -distort operation. As such
Code: Select all
convert .... -set option:distort:scale 2 -distort ...
The larger the number the better the larger the output distorted image, and the better the final resized resultimg image. But it will also typically take N^2 more time. Good values to use are 4 (with a final 25% resize) or 10 (with a final 10% resize). It really depends on just how GOOD you want the result.
Remember this is used as a replacement to the more automatic area-resampling method that is unable to be used for a depolar distortion.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/