General-purpose projective transforms
Hi,
I saw on the web a CS course paper by a Prof Chuck Stewart of RPI, about a simple mechanism for achieving projective transforms.
http://www.cs.rpi.edu/~stewart/math_vision/lec9.pdf
Basically you take 4 corners of a rectangle (like the corners of a selection marquee), a, b, c, d. Move one or more of the points to a', b', c', d'. Calculate the transform of the points (and the rectangle they describe) to the new points. Apply this to the selected object(s).
Once this generalized projective transform is working, it can be specialized to its various subclasses, such as perspective, affine, shear, skew, etc. An easy way to achieve this, IMHO, would be to constrain their movement via the keyboard.
Does this appear to be a valid new feature that we might want?
Bob
Here is a textified snippet of the paper:
Projective Transformations ==========================
The study of transformations and their properties (especially their invariants) is fundamental to geometry.
o A projective transformation is an invertible mapping that preserves colinearity.
o Projective transformations are also known as homographies, projectivities and colineations.
o Projective transformations may be represented by a 3x3 invertible matrix: x' = Hx Note that H is determined up to an arbitrary scale factor so it has 8 degrees of freedom.
o The perspective projection of a planar surface in the world reduces to a plane homography. The composition of two homographies is also a homography. Thus, two different images of a planar surface are related by a homography. --- These facts explain our practical interest in homographies.
o Even though the matrix is 3x3, this is still a transformation of two-dimensional objects.
Example: Computing Projective Transformations =============================================
Suppose we have an image of the face of a building that has severe perspective distortions. If we know, for example, the dimensions of a window or door that appears in the image, we can compute a transformation that removes these distortions.
o Suppose the width of the door is w and the height is h. Let the ratio be r = h/w.
o Find the four corners in the image. Call the locations x1 through x4.
o Designate four locations for these to map to: (0, 0, 1)T, (1, 0, 1)T, (0, r, 1)T, and (1, r, 1)T Note that we are creating an arbitrary Euclidean coordinate in the image.
o These four "correspondences" allow us to compute a unique transformation, H.
o We apply this transformation to the entire image. It undoes the effects of the projective distortion.
Projective Transformations of Lines and Conics ==============================================
o Using the basic result x' = Hx we can calculate the perspective transformations of lines and conics.
o Lines transform as l' = H(-T)l where H(-T) is the inverse of the transpose of H.
o Conics transform as C' = H(-T)CH(-1).
o Dual conics transform as C*' = HC*H.
On Wed, Apr 13, 2005 at 01:48:55PM -0500, Bob Jamison wrote:
Hi,
I saw on the web a CS course paper by a Prof Chuck Stewart of RPI, about a simple mechanism for achieving projective transforms.
http://www.cs.rpi.edu/~stewart/math_vision/lec9.pdf
Basically you take 4 corners of a rectangle (like the corners of a selection marquee), a, b, c, d. Move one or more of the points to a', b', c', d'. Calculate the transform of the points (and the rectangle they describe) to the new points. Apply this to the selected object(s).
Does this appear to be a valid new feature that we might want?
Sounds like a great feature to me. I've had a few users asking about this capability fairly recently. In one cases the need was to create a shadow for a mascot in a logo. You can get most of the way there just with skewing and fussing with it, but to get the distance perspective I think he ended up having to do node editing. A perspective transform tool would have achieved the same result in fewer steps.
Bryce
yeah I have to import the paths for the shape into gimp to do that type of transform with their tool and then I export them again back into svg for use in inkscape. sometimes you get malformed svg . its messy for the file and the workflow. this is basic functionality that is desperatley needed.
On 4/14/05, Bryce Harrington <bryce@...260...> wrote:
On Wed, Apr 13, 2005 at 01:48:55PM -0500, Bob Jamison wrote:
Hi,
I saw on the web a CS course paper by a Prof Chuck Stewart of RPI, about a simple mechanism for achieving projective transforms.
http://www.cs.rpi.edu/~stewart/math_vision/lec9.pdf
Basically you take 4 corners of a rectangle (like the corners of a selection marquee), a, b, c, d. Move one or more of the points to a', b', c', d'. Calculate the transform of the points (and the rectangle they describe) to the new points. Apply this to the selected object(s).
Does this appear to be a valid new feature that we might want?
Sounds like a great feature to me. I've had a few users asking about this capability fairly recently. In one cases the need was to create a shadow for a mascot in a logo. You can get most of the way there just with skewing and fussing with it, but to get the distance perspective I think he ended up having to do node editing. A perspective transform tool would have achieved the same result in fewer steps.
Bryce
SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Is this the same sort of stuff that verbalshadows been coding up? I thought the math he'd been doing was for envelope type deformations? could be wrong tho...
Cheers
John
--- Bryce Harrington <bryce@...260...> wrote:
On Wed, Apr 13, 2005 at 01:48:55PM -0500, Bob Jamison wrote:
Hi,
I saw on the web a CS course paper by a Prof Chuck Stewart of RPI, about a simple mechanism for achieving projective
transforms.
http://www.cs.rpi.edu/~stewart/math_vision/lec9.pdf
Basically you take 4 corners of a rectangle (like the corners of a selection marquee), a, b, c, d. Move one or more of the points to
a',
b', c', d'. Calculate the transform of the points (and the
rectangle
they describe) to the new points. Apply this to the selected object(s).
Does this appear to be a valid new feature that we might want?
Sounds like a great feature to me. I've had a few users asking about this capability fairly recently. In one cases the need was to create a shadow for a mascot in a logo. You can get most of the way there just with skewing and fussing with it, but to get the distance perspective I think he ended up having to do node editing. A perspective transform tool would have achieved the same result in fewer steps.
Bryce
SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
__________________________________ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/
the path deforming stuff i wrote should do this fine. i haven't read the wiki fully yet but, i will. hopefully once i finish my vacation i work on getting it in to inkscape.
josh verbalshadow
On 4/13/05, Bob Jamison <rjamison@...357...> wrote:
The math is really not a problem. What is the problem is how to implement it while remaining compliant with SVG which has only the regular affine transfroms. I wrote a plan long ago:
http://inkscape.org/cgi-bin/wiki.pl?PerspectiveObject
If someone's willing to implement it, you're welcome.
participants (6)
-
Andy Fitzsimon
-
Bob Jamison
-
Bryce Harrington
-
bulia byak
-
John Cliff
-
Joshua Blocher