android - Perspective correction of imageview -
i'm working on app needs apply perspective distortion correction photo taken phone's camera. once photo taken, idea show on imageview , let user mark 4 corners of document (a card, sheet of paper, etc.) , apply correction based on points. example of im trying achieve:
http://1.bp.blogspot.com/-ro9hnipj52e/tkom0ktleni/aaaaaaaaabq/c2r5vrgmc_w/s640/s4.jpg
any ideas on how on android?
what want goes under various names of art, "corner-pin" being 1 commonly used in visual effects industry. need proceed in 2 steps:
- compute mapping the desired, rectified image, original, distorted, image
- actually warp original image according mapping computed in (1).
the 4 (non-collinear, perspective-distorted) corners of original image, , 4 corners of target (undistorted) image, define mapping. mapping called "homography" - read pointed wikipedia page details. once mapping known, warping @ step (2) can computed interpolation: every pixel in target image, find corresponding pixel in original image. typically not @ integer coordinates, interpolate color neighbors. various interpolation schemes used, common ones being nearest-neighbor, bilinear , bicubic (in increasing order of smoothness in results).
for android, i'd recommend installing opencv sdk , , use geometry transformation routines (getperspectivetransform , warpperspective 2 steps above).
Comments
Post a Comment