Re: Correcting for a curved film plane?
Posted: 2011-06-06T22:55:58-07:00
I will probably also need the slope of the formula for EWA resampling, and that may be a bit trickier.
Use https://github.com/ImageMagick/ImageMagick/discussions instead.
https://imagemagick.com/discourse-server/
https://imagemagick.com/discourse-server/viewtopic.php?t=18864
The only really firm characteristic of a film-based pinhole camera is the focal length. The angle of view may vary, as especially with roll film many cameras allow this to be changed when you load the film, and scans may not cover the entire frame.fmw42 wrote:Actually the specs on the reference page say it is nearly 90 degree field of view and give a specific focal length of 57. So one has to believe what they say and not infer too much. The f stop is well defined and so is the focal length which is related to it. So I would tend to believe that rather than assuming that the fov is truly 90 degrees.I would not be surprised it may be that it is actually engineered to be 90 degrees, but with 57mm being a near approximation (for advertising). We would need to know for certain!
My formula converted it to pixels in the process of evaluating the exact fov, but required knowledge of the width of the image in mm (or cm).So focal length is the safest number. But it's generally measured in millimeters, and we need it in pixels.
Is that a problem?fmw42 wrote:Also see my numbers above on how fast the image size grows with fov. By 160 degrees its area is about 16 times as big as the input.
Mark Sirota wrote:Is that a problem?fmw42 wrote:Also see my numbers above on how fast the image size grows with fov. By 160 degrees its area is about 16 times as big as the input.
Except that they are mapping sphere angles to a cylinder. we are mapping a cylinder to a flat plain!fmw42 wrote:references http://mathworld.wolfram.com/CylindricalProjection.html at the bottom where it says
"Cylindrical projection at Mathworld[*] shows an example and gives details on the mathematics"
click the asterisk to see the diagram of the projection
anthony wrote:Except that they are mapping sphere angles to a cylinder. we are mapping a cylinder to a flat plain!fmw42 wrote:references http://mathworld.wolfram.com/CylindricalProjection.html at the bottom where it says
"Cylindrical projection at Mathworld[*] shows an example and gives details on the mathematics"
click the asterisk to see the diagram of the projection
As such their use of 'tan' for the y axis is not needed, and instead we get a scaling (that varies with x)
Unfortunately we get a new tan from the x axis mapping instead.
No. it only becomes a problem if you try for 180, or an offset center in the distortion.Mark Sirota wrote:Is that a problem?fmw42 wrote:Also see my numbers above on how fast the image size grows with fov. By 160 degrees its area is about 16 times as big as the input.
I believe that one can live with the center of distortion corresponding to the center of fov (curve of cylinder), i.e. no offsets.anthony wrote:No. it only becomes a problem if you try for 180, or an offset center in the distortion.Mark Sirota wrote:Is that a problem?fmw42 wrote:Also see my numbers above on how fast the image size grows with fov. By 160 degrees its area is about 16 times as big as the input.
That is you want the center of the projection to be 45 degrees to the right, instead of in the middle.
I'd like the input the center of distortion, as it means given a 360 (or slightly more) arc image, I can then convert that into a set of 4 'cube view' images of 90 degree arcs. each face with have a different center of distortion.fmw42 wrote:I believe that one can live with the center of distortion corresponding to the center of fov (curve of cylinder), i.e. no offsets.
I am not sure how close to 180 you want to allow as it probably grows very fast near 180. Image size and memory or speed if using -limit are the practical limits.
In my opinion, this P90 transformation does not work for a full circle, it fails at theta = 90 from the center. So if you break this into quadrants of the circle, and do each separately, you won't get a full circle or quadrant for each side and the sides will be huge. The referenced article by Wolfgang was a totally different transformation.Anthony wrote:I'd like the input the center of distortion, as it means given a 360 (or slightly more) arc image, I can then convert that into a set of 4 'cube view' images of 90 degree arcs. each face with have a different center of distortion.
Code: Select all
infile="P90achop.jpg"
inname=`convert $infile -format "%t" info:`
arc=convert $infile -ping -format "%[fx:57/90]" info:` # coeff[0]
rr=`convert $infile -ping -format "%[fx:w*$arc]" info:` # coeff[1]
w2=`convert $infile -ping -format "%[fx:w/2]" info:` # coeff[2]
h2=`convert $infile -ping -format "%[fx:h/2]" info:` # coeff[3]
ww=`convert xc: -format "%[fx:[color=#800000]ceil[/color](2*$rr*tan(0.5/$arc))]" info:`
hh=`convert xc: -format "%[fx:[color=#800000]ceil[/color](2*$h2/cos(0.5/$arc))]" info:`
ww2=`convert xc: -format "%[fx:$ww/2]" info:` # coeff[4]
hh2=`convert xc: -format "%[fx:$hh/2]" info:` # coeff[5]
convert -size ${ww}x${hh} xc: $infile -virtual-pixel black \
-fx "xx=(i-$ww2+0.5); yy=(j-$hh2+0.5);
aa=atan(xx/$rr); uu=$rr*aa; vv=yy*cos(aa);
v.p{ uu+$w2-0.5, vv+$h2-0.5 }" \
${inname}_corrected6.jpg