1 / 5

x 1

The green polygon represents the position of an image after it has been arbitrarily translated, rotated, and scaled with respect to the original x1y1 coordinate system. All of the values shown here are known. Note the width of the polygon is (xmax-xmin) and the height is (ymax-ymin). x 1. ymin.

jimbo
Download Presentation

x 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. The green polygon represents the position of an image after it has been arbitrarily translated, rotated, and scaled with respect to the original x1y1 coordinate system. All of the values shown here are known. Note the width of the polygon is (xmax-xmin) and the height is (ymax-ymin) x1 ymin xmax - xmin p py ymax h x2 y2 ymax - py xmin px xmax - px xmax y1 w

  2. The green polygon now represents the new position of the image after it has been auto-scaled and auto-translated such that it has the maximum size possible in order to fit within the window as well as to be centered within the window. The position q of the polygon’s origin at x2y2 with respect to x1y1 is unknown, as are the distances d and e. e x1 d q qy d x2 y2 s’ (ymax – py) qx s’ (xmax – px) y1 e

  3. We know the new scale factor s’ from min( h/(ymax-ymin), w/(xmax-xmin) ). Applying this scale factor, the total width of the scaled image is s’(xmax-xmin) and the total height is s’(ymax-ymin). The distances shown in blue are also just the scaled values we knew from before. e x1 d q qy d x2 y2 s’ (ymax – py) qx s’ (xmax – px) y1 e

  4. Solving for qx and qy Known quantities: xmax, xmin, ymax, ymin, px, py, w, h Computed quantities: s’=min( w/(xmax-xmin), h/(ymax-ymin) 4 unknown quantities: d, e, qx, qy From inspection: w = qx + s’(xmax-px) + d h = qy + s’(ymax-py) + e Also: w = 2d + s’(xmax-xmin) or d = ½ (w – s’(xmax-xmin) ) h = 2e + s’(ymax-ymin) or e = ½ (h – s’(ymax-ymin) ) 4 equations in 4 unknowns can be solved by substituting the equations for d and e into the first two equations above: w = qx + s’(xmax-px) + ½ (w – s’(xmax-xmin) ) h = qy + s’(ymax-py) + ½ (h – s’(ymax-ymin) ) Rearranging terms: qx = w - s’(xmax-px) - ½ (w – s’(xmax-xmin) ) qy = h - s’(ymax-py) - ½ (h – s’(ymax-ymin) )

  5. Final step Now that qx and qy are solved for, you can use them to replace the values px and py in the transformation matrix. However, the computed scaling factor s’ should not simply be substituted into the existing scaling matrix, since the original scaling matrix already contains some existing scaling factor s. Instead, the new scaling factor should be computed as s * s’. The value of this product becomes the new scaling factor in the scaling matrix.

More Related