![]() ![]() I had to fool around with the coordinates to get it right but you're more than welcome to modify this for your liking. Again, this will be in a 4 x 2 matrix and these are the coordinates of the trapezoid. Next, you need to specify a set of "fixed points" which are the points that you would like the moving points to move to in the end. I'm going to specify the top-left, top-right, bottom-left and bottom-right coordinates respectively. You place this into a 4 x 2 matrix where the first column is the column / x coordinates and the second column is the row / y coordinates. ![]() ![]() In this case, these are the four corner points of the original image you want to transform. You need to specify a set of "moving points", which are the points that you want to transform. Now the next part is to create a transformation object to warp the four corner points of the image to the trapezoid coordinates. The Mandrill image is stored in img, and we get: First load the dataset and because this is an indexed image with a specified colour map, ind2rgb is required to convert this to a colour image. You are using the infamous Mandrill image from the University of Southern California's SIPI (Signal and Image Processing Institute) Image Database and MATLAB has this as part of the image processing toolbox. Once you find this warped image, we display it on an image frame with respect to the original image coordinate system. If you don't, then the origin is with respect to the new image which will be cropped. Once you find this transformation, you warp the image with this transformation object, but make sure that you specify the coordinate system so that the origin is with respect to the top-left corner of the original image. What you need to do is create a transformation object that takes the four corner points of the image and places them to the corresponding corners of the trapezoid that you want. The process to warp the image to a "trapezoid" is quite simple. Just a warning that fitgeotrans is part of MATLAB R2013b and so this won't work for any versions below this. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |