Loading ...
Sorry, an error occurred while loading the content.

PVFlat?

Expand Messages
  • Philipp B. Koch
    On the Panini-image-pool on Flickr (http://www.flickr.com/groups/vedutismo/pool/) I ve read that some images have been processed with PVFlat . Could anyone
    Message 1 of 13 , Feb 23, 2009
    • 0 Attachment
      On the Panini-image-pool on Flickr
      (http://www.flickr.com/groups/vedutismo/pool/) I've read that some
      images have been processed with "PVFlat".
      Could anyone please tell me what software that is and/or where it can be
      found? It seems to be used to remove some of the curvature from
      panoramic images?

      Thanks in advance, Philipp
    • Bruno Postle
      ... It s the second mathmap script here: http://flickr.com/groups/vedutismo/discuss/72157611915013208/ ..though I haven t had a chance to test it yet. -- Bruno
      Message 2 of 13 , Feb 23, 2009
      • 0 Attachment
        On Mon 23-Feb-2009 at 23:53 +0100, Philipp B. Koch wrote:
        >On the Panini-image-pool on Flickr
        >(http://www.flickr.com/groups/vedutismo/pool/) I've read that some
        >images have been processed with "PVFlat".
        >Could anyone please tell me what software that is and/or where it can be
        >found? It seems to be used to remove some of the curvature from
        >panoramic images?

        It's the second mathmap script here:

        http://flickr.com/groups/vedutismo/discuss/72157611915013208/

        ..though I haven't had a chance to test it yet.

        --
        Bruno
      • Philipp B. Koch
        ... Hhm, that script is far beyond my understanding, but as the dumb user that I am :-) I might just try to try it ... I ve no clue how to use this, since I m
        Message 3 of 13 , Feb 23, 2009
        • 0 Attachment
          Bruno Postle schrieb:
          > On Mon 23-Feb-2009 at 23:53 +0100, Philipp B. Koch wrote:
          >
          >> On the Panini-image-pool on Flickr
          >> (http://www.flickr.com/groups/vedutismo/pool/) I've read that some
          >> images have been processed with "PVFlat".
          >> Could anyone please tell me what software that is and/or where it can be
          >> found? It seems to be used to remove some of the curvature from
          >> panoramic images?
          >>
          > It's the second mathmap script here:
          >
          > http://flickr.com/groups/vedutismo/discuss/72157611915013208/
          >
          > ..though I haven't had a chance to test it yet.
          Hhm, that script is far beyond my understanding, but as the dumb user
          that I am :-) I might just "try to try it"...
          I've no clue how to use this, since I'm not a GIMP user, but apparently
          there is Mathmap plugin for GIMP,
          so I'll just see how far I come along...

          Thanks for the info, Philipp
        • Philipp B. Koch
          ... Hhm, I have installed the GIMP (Windows 7 x64 beta) and MathMap. I ve also adjusted my region settings to English like advised in MathMap s install
          Message 4 of 13 , Feb 23, 2009
          • 0 Attachment
            Bruno Postle schrieb:
            > On Mon 23-Feb-2009 at 23:53 +0100, Philipp B. Koch wrote:
            >
            >> On the Panini-image-pool on Flickr
            >> (http://www.flickr.com/groups/vedutismo/pool/) I've read that some
            >> images have been processed with "PVFlat".
            >> Could anyone please tell me what software that is and/or where it can be
            >> found? It seems to be used to remove some of the curvature from
            >> panoramic images?
            >>
            >
            > It's the second mathmap script here:
            >
            > http://flickr.com/groups/vedutismo/discuss/72157611915013208/
            >
            > ..though I haven't had a chance to test it yet.

            Hhm, I have installed the GIMP (Windows 7 x64 beta) and MathMap. I've
            also adjusted my region settings to "English" like advised in MathMap's
            install instructions.
            All the examples work perfectly. But when I choose "PVFlat" (I copy &
            pasted the second script from the resource you mentioned), nothing
            happens, and GIMP shows a little warning in the status bar on the lower
            edge, telling me: "Unable to resolve invocation of __div." I've
            double-checked my pasted text, it seems to be exactly as the original
            (nothing cut off or so). Hhm, maybe that's why one should not mess
            around with things one doesn't understand? ;-)

            Philipp
          • Bruno Postle
            ... Probably flickr mangled it, Tom can you upload a copy somewhere else? -- Bruno
            Message 5 of 13 , Feb 24, 2009
            • 0 Attachment
              On Tue 24-Feb-2009 at 01:15 +0100, Philipp B. Koch wrote:
              >>
              >> It's the second mathmap script here:
              >>
              >> http://flickr.com/groups/vedutismo/discuss/72157611915013208/
              >>
              >> ..though I haven't had a chance to test it yet.
              >
              >All the examples work perfectly. But when I choose "PVFlat" (I copy &
              >pasted the second script from the resource you mentioned), nothing
              >happens, and GIMP shows a little warning in the status bar on the lower
              >edge, telling me: "Unable to resolve invocation of __div."

              Probably flickr mangled it, Tom can you upload a copy somewhere
              else?

              --
              Bruno
            • Philipp B. Koch
              ... That would be great :-) Maybe the best thing would be to upload the script as .txt (or directly as MathMap format .mm) file which is known to work.
              Message 6 of 13 , Feb 24, 2009
              • 0 Attachment
                Bruno Postle schrieb:
                > On Tue 24-Feb-2009 at 01:15 +0100, Philipp B. Koch wrote:
                >
                >>> It's the second mathmap script here:
                >>>
                >>> http://flickr.com/groups/vedutismo/discuss/72157611915013208/
                >>>
                >>> ..though I haven't had a chance to test it yet.
                >>>
                >> All the examples work perfectly. But when I choose "PVFlat" (I copy &
                >> pasted the second script from the resource you mentioned), nothing
                >> happens, and GIMP shows a little warning in the status bar on the lower
                >> edge, telling me: "Unable to resolve invocation of __div."
                >>
                >
                > Probably flickr mangled it, Tom can you upload a copy somewhere
                > else?
                That would be great :-) Maybe the best thing would be to upload the
                script as .txt (or directly as MathMap format .mm) file which is known
                to work. Because, if it stills fails, it's definitely my fault then, haha.
              • tksharpless
                ... can be ... I put a copy of PVFlat.mm at ftp://tksharpless.net/tksftp/Mathmap/, and it is attached below in plain text. However I must warn you that this
                Message 7 of 13 , Feb 24, 2009
                • 0 Attachment
                  --- In PanoToolsNG@yahoogroups.com, "Philipp B. Koch" <pk@...> wrote:
                  >
                  > On the Panini-image-pool on Flickr
                  > (http://www.flickr.com/groups/vedutismo/pool/) I've read that some
                  > images have been processed with "PVFlat".
                  > Could anyone please tell me what software that is and/or where it
                  can be
                  > found? It seems to be used to remove some of the curvature from
                  > panoramic images?
                  >
                  > Thanks in advance, Philipp
                  >

                  I put a copy of PVFlat.mm at ftp://tksharpless.net/tksftp/Mathmap/,
                  and it is attached below in plain text. However I must warn you that
                  this copy does not work on Mathmap 2 (which is all I can try right now
                  as I am on Windows). I developed it on Mathmap 3 under Linux, and
                  suspect that the code is just beyond the MM 2 compiler. So at worst
                  you might have to fix newlines or some such to get it to work on MM 3.

                  Quick usage notes:
                  I assume you know how to load an image and a filter into Mathmap.
                  PVFlat is meant to flatten floor and ceiling in "single point
                  perspective" views in Pannini projection. The HFOV and eyeDistance
                  parameters describe that projection. EyeDistance would be 1 if the
                  pannini was made with a non adjustable tool, hugin or PTAssembler.
                  PCX and PCY -- offsets of projection center -- should be 0 unless you
                  made the Pannini with Panini using framing shifts, or otherwise
                  de-centered the Pannini projection.
                  VPX, VPY is how you place the vanishing point that is common to the 4
                  "vee edges", two above and two below. You set the slopes of those
                  edges with the 4 bottom controls, so they approximate the edges of the
                  floor and ceiling.
                  It can be quite hard to see where the edges are since the image
                  matches exactly across them. If you put in a vertical shift with the
                  PCY control, then the edges don't match and become very obvious. Now
                  you can easily set the VP and edge slopes with reference to the
                  "walls" (unmodified part of the image). Then set PCY back to zero.
                  Finally adjust the strength of the straightening effect with HFOV, and
                  possible eyeDistance.

                  Enjoy!
                  -- Tom
                  ---------------------------------------------------------------------

                  filter PVFflat( image in, # a Pannini view...
                  float hfov: 30-250 (150), # true angular width
                  float eyeDist: 0-2 (1), # projection parameter
                  float PCX: -0.2-0.2 (0), # pano center
                  float PCY: -0.2-0.2 (0),
                  float VPX: -0.3-0.3 (0), # vanishing point
                  float VPY: -0.3-0.3 (0),
                  float ULangl: 0-90 (45), # angles of the vee edges...
                  float LLangl: 0-90 (45),
                  float URangl: 0-90 (45),
                  float LRangl: 0-90 (45)
                  )
                  ### Flattens upper and lower Vees in a Panini projection ###
                  # copyright (c) 2009 TKSharpless, all rights reserved #
                  # 4 vee edges intersect at the vanishing point, which is not #
                  # necessarily at the projection center, which need not be at #
                  # the center of the image. #
                  ### ###

                  # vee valid flags
                  amin = 3.0; # minimum valid vee angle
                  uok = 90 - ULangl >= amin && URangl >= amin;
                  lok = 90 - LLangl >= amin && LRangl >= amin;

                  # slopes and normals of the vee lines
                  # normals point inside the vee
                  th = deg2rad(180 - ULangl);
                  st = sin(th); ct = cos(th);
                  uln = v2:[ st, -ct ];
                  uls = if uok then st / ct else 0 end;
                  th = deg2rad(90 - URangl);
                  st = sin(th); ct = cos(th);
                  urn = v2:[ -st, ct ];
                  urs = if uok then st / ct else 0 end;
                  th = deg2rad(-180 + LLangl);
                  st = sin(th); ct = cos(th);
                  lln = v2:[ -st, ct ];
                  lls = if lok then st / ct else 0 end;
                  th = deg2rad(-90 + LRangl);
                  st = sin(th); ct = cos(th);
                  lrn = v2:[ st, -ct ];
                  lrs = if lok then st / ct else 0 end;

                  # Pannini distance parameters
                  ed = eyeDist + 1; # eye to pic, pano radians
                  # eye distance from picture plane in pixels
                  edp = 0.5 * W / tan( 0.5 * deg2rad( hfov ) / ed );
                  # panosphere radius in pixels
                  Rp = edp / ed;

                  #image coordinates of PC and VP
                  pcx = PCX * W; pcy = PCY * H; # projection center
                  vpx = VPX * W; vpy = VPY * H; # vanishing point

                  # coords relative to projection center
                  # in eye radians = pano radians / ed
                  evx = (vpx - pcx) / edp; evy = (vpy - pcy) / edp;
                  ptx = (x - pcx) / edp; pty = (y - pcy) / edp;
                  # coords relative to VP
                  pdx = ptx - evx; pdy = pty - evy;
                  evec = v2:[ pdx, pdy ];

                  # slant of cross lines
                  slu = evx;

                  # select upper or lower vee
                  if pdy > 0 then
                  vok = uok;
                  vln = uln; vrn = urn;
                  vls = uls; vrs = urs;
                  slp = slu;
                  else
                  vok = lok;
                  vln = lln; vrn = lrn;
                  vls = lls; vrs = lrs;
                  slp = -slu;
                  end;

                  ty = y; # default remapped Y

                  # correct Y if this point is in a valid vee
                  if vok && dotp( evec, vln )> 0 && dotp( evec, vrn ) > 0 then
                  # intersections of line thru pt with vee lines (vp-org)
                  ldx = (pdy - slp * pdx )/ (vls - slp);
                  ldy = vls * ldx;
                  rdx = (pdy - slp * pdx) / (vrs - slp);
                  rdy = vrs * rdx;
                  # map img points to cylinder (pc-org)
                  lth = ed * atan( ldx + evx );
                  lcz = cos( lth );
                  lcy = (ldy + evy) * (ed - 1 + lcz) / ed;
                  lcx = sin( lth );
                  rth = ed * atan( rdx + evx );
                  rcz = cos( rth );
                  rcy = (rdy + evy) * (ed - 1 + rcz) / ed;
                  rcx = sin( rth );
                  pth = ed * atan( ptx );
                  ptz = cos( pth );
                  # pano plane on the intersection pts (unit normal)
                  ppn = normalize(crossp( v3:[rcx, rcy, rcz], v3:[lcx, lcy, lcz]));
                  # pano point on that plane at this point's azimuth
                  spt = crossp(ppn, v3:[ ptz, 0, -sin(pth) ] );
                  # map pano point y to image
                  pcy = spt[1] / abs(v2:[spt[0], spt[2]]); # cylinder y
                  piy = pcy * ed / ( ed - 1 + ptz );

                  ty = edp * piy;


                  end;

                  in(xy:[x,ty])
                  end

                  ----------------------------------------------------------------------
                • tksharpless
                  ... lower ... Just did that, both here and on my website.
                  Message 8 of 13 , Feb 24, 2009
                  • 0 Attachment
                    --- In PanoToolsNG@yahoogroups.com, Bruno Postle <bruno@...> wrote:
                    >
                    > On Tue 24-Feb-2009 at 01:15 +0100, Philipp B. Koch wrote:
                    > >>
                    > >> It's the second mathmap script here:
                    > >>
                    > >> http://flickr.com/groups/vedutismo/discuss/72157611915013208/
                    > >>
                    > >> ..though I haven't had a chance to test it yet.
                    > >
                    > >All the examples work perfectly. But when I choose "PVFlat" (I copy &
                    > >pasted the second script from the resource you mentioned), nothing
                    > >happens, and GIMP shows a little warning in the status bar on the
                    lower
                    > >edge, telling me: "Unable to resolve invocation of __div."
                    >
                    > Probably flickr mangled it, Tom can you upload a copy somewhere
                    > else?
                    >
                    > --

                    Just did that, both here and on my website.
                  • tksharpless
                    Sorry, to access my ftp site you need to give the following password: TKSpwd1. Or go to http://tksharpless.net and click on the download link near the top,
                    Message 9 of 13 , Feb 24, 2009
                    • 0 Attachment
                      Sorry, to access my ftp site you need to give the following password:
                      TKSpwd1. Or go to http://tksharpless.net and click on the "download"
                      link near the top, then go into directory Mathmap.

                      -- Tom
                    • Philipp B. Koch
                      ... Thanks for that! However, I found the Mathmap folder on your server to be empty? Anyway, I ll try to copy and paste the script from below. ... Ah, OK, so
                      Message 10 of 13 , Feb 24, 2009
                      • 0 Attachment
                        tksharpless schrieb:
                        > I put a copy of PVFlat.mm at ftp://tksharpless.net/tksftp/Mathmap/,
                        > and it is attached below in plain text.
                        Thanks for that! However, I found the Mathmap folder on your server to
                        be empty?
                        Anyway, I'll try to copy and paste the script from below.

                        > However I must warn you that
                        > this copy does not work on Mathmap 2 (which is all I can try right now
                        > as I am on Windows). I developed it on Mathmap 3 under Linux, and
                        > suspect that the code is just beyond the MM 2 compiler. So at worst
                        > you might have to fix newlines or some such to get it to work on MM 3.
                        >
                        Ah, OK, so maybe this is just my problem; I'm also on Windows, and I
                        downloaded the Windows binary of Mathmap 1.2.4.
                        It's the latest pre-compiled version I could find on
                        http://www.complang.tuwien.ac.at/schani/mathmap/. I did not find
                        anything about MM2, not to speak of MM3?

                        > Quick usage notes:
                        > I assume you know how to load an image and a filter into Mathmap.
                        > PVFlat is meant to flatten floor and ceiling in "single point
                        > perspective" views in Pannini projection. The HFOV and eyeDistance
                        > parameters describe that projection. EyeDistance would be 1 if the
                        > pannini was made with a non adjustable tool, hugin or PTAssembler.
                        > PCX and PCY -- offsets of projection center -- should be 0 unless you
                        > made the Pannini with Panini using framing shifts, or otherwise
                        > de-centered the Pannini projection.
                        > VPX, VPY is how you place the vanishing point that is common to the 4
                        > "vee edges", two above and two below. You set the slopes of those
                        > edges with the 4 bottom controls, so they approximate the edges of the
                        > floor and ceiling.
                        > It can be quite hard to see where the edges are since the image
                        > matches exactly across them. If you put in a vertical shift with the
                        > PCY control, then the edges don't match and become very obvious. Now
                        > you can easily set the VP and edge slopes with reference to the
                        > "walls" (unmodified part of the image). Then set PCY back to zero.
                        > Finally adjust the strength of the straightening effect with HFOV, and
                        > possible eyeDistance.
                        >
                        Thanks for the explanation! If I ever get this to run (I don't have
                        Linux), it'll be a perfect guide :-)

                        Regards, Philipp
                      • tksharpless
                        OooPs, sorry again. Forgot to post the file -- it is there now. I guess you really need MM3 (or is it MM2? anyhow the latest one) on Linux to run it. Regards,
                        Message 11 of 13 , Feb 25, 2009
                        • 0 Attachment
                          OooPs, sorry again. Forgot to post the file -- it is there now.
                          I guess you really need MM3 (or is it MM2? anyhow the latest one) on
                          Linux to run it.

                          Regards, Tom

                          --- In PanoToolsNG@yahoogroups.com, "Philipp B. Koch" <pk@...> wrote:
                          >
                          > tksharpless schrieb:
                          > > I put a copy of PVFlat.mm at ftp://tksharpless.net/tksftp/Mathmap/,
                          > > and it is attached below in plain text.
                          > Thanks for that! However, I found the Mathmap folder on your server to
                          > be empty?
                          > Anyway, I'll try to copy and paste the script from below.
                          >
                          > > However I must warn you that
                          > > this copy does not work on Mathmap 2 (which is all I can try right now
                          > > as I am on Windows). I developed it on Mathmap 3 under Linux, and
                          > > suspect that the code is just beyond the MM 2 compiler. So at worst
                          > > you might have to fix newlines or some such to get it to work on MM 3.
                          > >
                          > Ah, OK, so maybe this is just my problem; I'm also on Windows, and I
                          > downloaded the Windows binary of Mathmap 1.2.4.
                          > It's the latest pre-compiled version I could find on
                          > http://www.complang.tuwien.ac.at/schani/mathmap/. I did not find
                          > anything about MM2, not to speak of MM3?
                          >
                          > > Quick usage notes:
                          > > I assume you know how to load an image and a filter into Mathmap.
                          > > PVFlat is meant to flatten floor and ceiling in "single point
                          > > perspective" views in Pannini projection. The HFOV and eyeDistance
                          > > parameters describe that projection. EyeDistance would be 1 if the
                          > > pannini was made with a non adjustable tool, hugin or PTAssembler.
                          > > PCX and PCY -- offsets of projection center -- should be 0 unless you
                          > > made the Pannini with Panini using framing shifts, or otherwise
                          > > de-centered the Pannini projection.
                          > > VPX, VPY is how you place the vanishing point that is common to the 4
                          > > "vee edges", two above and two below. You set the slopes of those
                          > > edges with the 4 bottom controls, so they approximate the edges of the
                          > > floor and ceiling.
                          > > It can be quite hard to see where the edges are since the image
                          > > matches exactly across them. If you put in a vertical shift with the
                          > > PCY control, then the edges don't match and become very obvious. Now
                          > > you can easily set the VP and edge slopes with reference to the
                          > > "walls" (unmodified part of the image). Then set PCY back to zero.
                          > > Finally adjust the strength of the straightening effect with HFOV, and
                          > > possible eyeDistance.
                          > >
                          > Thanks for the explanation! If I ever get this to run (I don't have
                          > Linux), it'll be a perfect guide :-)
                          >
                          > Regards, Philipp
                          >
                        • Philipp B. Koch
                          ... Thanks again, Tom. Unfortunately, as expected, also with that .mm-file you provided, it s not working on Windows... Best regards, Philipp
                          Message 12 of 13 , Feb 25, 2009
                          • 0 Attachment
                            tksharpless schrieb:
                            > OooPs, sorry again. Forgot to post the file -- it is there now.
                            > I guess you really need MM3 (or is it MM2? anyhow the latest one) on
                            > Linux to run it.
                            >
                            > Regards, Tom
                            >
                            Thanks again, Tom. Unfortunately, as expected, also with that .mm-file
                            you provided, it's not working on Windows...

                            Best regards, Philipp
                          • tksharpless
                            ... Having now actually looked, I see that the latest version of MathMap is 1.3 and the one available for Windows is 1.2. PVFlat does require version 1.3. --
                            Message 13 of 13 , Feb 26, 2009
                            • 0 Attachment
                              --- In PanoToolsNG@yahoogroups.com, "tksharpless" <TKSharpless@...> wrote:
                              >
                              > OooPs, sorry again. Forgot to post the file -- it is there now.
                              > I guess you really need MM3 (or is it MM2? anyhow the latest one) on
                              > Linux to run it.
                              >

                              Having now actually looked, I see that the latest version of MathMap
                              is 1.3 and the one available for Windows is 1.2. PVFlat does require
                              version 1.3.

                              -- Tom
                            Your message has been successfully submitted and would be delivered to recipients shortly.