looking for a way to do a simple non-linear image warp

5 次查看(过去 30 天)
i want to distort an image in a particular way. i want a rectangular selection of an image to map to a trapezoid. the top and bottom of the trapezoid are horizontal, just like the rectangle. the sides are tilted outwards when going from bottom to top of the trapezoid. i know the exact matrix conversion i need. it is:
[x1,y1,1]'= T*[x,y,xy,1]'
where T is [1,-1,2,0; 0,1,0,0; 0,0,0,1]
there is a term in the x1 part of the equation that has an 'xy' in it. i.e., the product of x and y. i think affine and projective transforms cannot do this. (please correct me if i'm wrong). i looked at geofit but i could not figure out how to get it to do it either. yet, the transformation seems fairly simple. just stretch x depending on what y is.
can anyone suggest a way to do this image warp?
thanks! j

回答(1 个)

Walter Roberson
Walter Roberson 2016-10-31
If it is a matter of display then you could use pcolor() or you could use surf() or patch(), feeding in the image and the transformed coordinates. That is you would be using texture mapping with a grid of transformed coordinates.
If you need to produce a new image matrix of the transformed data, then I am not sure at the moment what the best way to proceed would be.
  1 个评论
john greene
john greene 2016-11-13
i need an output image that has the text warped, so it is not a matter of display. i will give the output image to another person who is going to merge the text layer with other layers that are in a warped format. so i need the text to be warped, too.
i ended up writing a script (mfile) that stretches an image (can be an image with text in it) line by line. the script works, so i'm pretty much set for now. i still wonder, though - it seems like this distortion type is pretty standard (e.g., there is a function for it in gimp), but i couldn't find the function in matlab. i suspect it exists and i just didn't find it.
anyway, thanks for your suggestions

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Point Cloud Processing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by