SHEAR Rotation of a Picture Simple Rotation The Simplest method is by using a rotation matrix § cos D ¨¨ © sin D sin D · ¸¸ cos D ¹ Simple Rotation § x · § cos D sin D ·§ x - x0 · § x0 · ¨¨ ¸¸ ¨¨ ¸¸¨¨ ¸¸ ¨¨ ¸¸ D D y sin cos y y0 © ¹ © ¹© ¹ © y0 ¹ § cos D sin D ·§ x · § cos D sin D ·§ x0 · § x0 · ¨¨ ¸¸¨¨ ¸¸ ¨¨ ¸¸¨¨ ¸¸ ¨¨ ¸¸ D D D D sin cos y sin cos © ¹© ¹ © ¹© y0 ¹ © y0 ¹ § x cosD - y sinD · § x0 cosD - y0 sinD x 0 · ¸¸ ¸¸ ¨¨ ¨¨ © x sinD y cos D ¹ © x0 sinD y0 cos D y0 ¹ Simple Rotation We can calculate incrementally, for x+1 we get § x 1 cosD - y sinD · § x0 cosD - y0 sinD x 0 · ¨¨ ¸¸ ¨¨ ¸¸ © x 1 sinD y cos D ¹ © x0 sinD y0 cos D y0 ¹ § x cosD - y sinD · § x0 cosD - y0 sinD x 0 · § cosD ¸¸ ¨¨ ¸¸ ¨¨ ¨¨ x sin D y cos D x0 sin D y 0 cos D y0 ¹ © sinD ¹ © © · ¸¸ ¹ Simple Rotation § cos D · © sin D ¹ For each increment in x we¨¨ add¸¸ § sin D · © cos D ¹ ¨¨ add ¸¸ For each increment in y we Simple Rotation Origin Simple Rotation Result Simple Rotation Solutions • Filter • Backward Mapping Backword Mapping Original Calculation §u· ¨¨ ¸¸ © v¹ §x· M¨¨ ¸¸ © y¹ Backward mapping §x· ¨¨ ¸¸ © y¹ §u· M -1 ¨¨ ¸¸ © v¹ Shear Shear Shear Shear-and-Scale Shear Filter is still necessary, because of holes Shear Advantages • Filter - line by line, faster • Lines calculations instead of Matrix calculation, can be implemented with special computer for better performance Shear Shear Transformation §u· ¨¨ ¸¸ © v¹ §r· ¨¨ ¸¸ ©s¹ §u· B¨¨ ¸¸ © v¹ §x· A¨¨ ¸¸ © y¹ § § x ·· B¨¨ A¨¨ ¸¸ ¸¸ © © y¹¹ §x· T¨¨ ¸¸ © y¹ Shear T is the Rotation Matrix §r· ¨¨ ¸¸ ©s¹ §x· T¨¨ ¸¸ © y¹ § x cosD - y sinD · ¨¨ ¸¸ x sin D y cos D © ¹ Shear A preserve columns §u· ¨¨ ¸¸ © v¹ §x· A¨¨ ¸¸ © y¹ § x · ¨¨ ¸¸ © f(x, y) ¹ B preserve rows §r· ¨¨ ¸¸ ©s¹ §u· B¨¨ ¸¸ © v¹ § g(u, v) · ¸¸ ¨¨ © v ¹ Shear From §r· ¨¨ ¸¸ ©s¹ §u· B¨¨ ¸¸ © v¹ § § x ·· B¨¨ A¨¨ ¸¸ ¸¸ © © y¹¹ § x · ¸¸ B¨¨ © f(x, y) ¹ § g(x, f(x, y)) · ¨¨ ¸¸ © f(x, y) ¹ We get f(x, y) s x sinD y cosD §r· §x· ¨¨ ¸¸ T¨¨ ¸¸ ©s¹ © y¹ § x cosD - y sinD · ¨¨ ¸¸ x sin D y cos D © ¹ Shear Finding g(u,v) g(u, v) x cosD y sinD We need to express it in terms of u,v We know that x=u, and v We get y f(x, y) v - x sinD cosD x sinD y cosD v - u sinD cosD Shear We put it all together and get g(u, v) u cosD - v - u sinD sin D cos D u secD v tan D Shear At last we get §x· A¨¨ ¸¸ © y¹ x § · ¨¨ ¸¸ © x sinD y cosD ¹ §u· B¨¨ ¸¸ © v¹ § u secD v tanD · ¨¨ ¸¸ v © ¹ Shear Using a large angle (80 degree) Shear Using a large angle First Pass Shear Using a large angle Second Pass Shear Using a large angle Second Pass With Backward Mapping Shear Solution: • First, rotate in 90 degree • Second, use shear with a small angle Shear We still have a scale factor in the shear which create holes one solution is to use filter Shear The other solution is by using three shear transformations § cosD ¨¨ © sin D sin D · ¸ cos D ¸¹ § 1 tan D / 2 ·§ 1 ¨¨ ¸¸¨¨ 0 1 © ¹© sin D 0 ·§ 1 tan D / 2 · ¸¨ ¸¸ 1 ¸¹¨© 0 1 ¹ We need Three passes instead of Two Shear Advantages • No scale, No filter • Much Faster, only moving lines Disadvantages • We need Three passes instead of Two Shear Three shears Shear Shear Shear Shear Shear