1 module rip.processing.filters.kirsch; 2 3 private 4 { 5 import rip.processing.filters.directions; 6 import rip.processing.filters.linear; 7 } 8 9 10 class KirschFilter : LinearFilter 11 { 12 this(CardinalDirection direction) 13 { 14 apertureWidth = 3; 15 apertureHeight = 3; 16 apertureDivider = 1.0f; 17 apertureOffset = 0.0f; 18 19 final switch (direction) with (CardinalDirection) 20 { 21 case NORTH: 22 flattenKernel = flatten( 23 [ 24 [ -3.0f, -3.0f, 5.0f ], 25 [ -3.0f, 0.0f, 5.0f ], 26 [ -3.0f, 3.0f, 5.0f ], 27 ] 28 ); 29 break; 30 31 case NORTH_WEST: 32 flattenKernel = flatten( 33 [ 34 [ -3.0f, 5.0f, 5.0f ], 35 [ -3.0f, 0.0f, 5.0f ], 36 [ -3.0f, -3.0f, -3.0f ], 37 ] 38 ); 39 break; 40 41 case WEST: 42 flattenKernel = flatten( 43 [ 44 [ 5.0f, 5.0f, 5.0f ], 45 [ -3.0f, 0.0f, -3.0f ], 46 [ -3.0f, -3.0f, -3.0f ], 47 ] 48 ); 49 break; 50 51 case SOUTH_WEST: 52 flattenKernel = flatten( 53 [ 54 [ 5.0f, 5.0f, -3.0f ], 55 [ 5.0f, 0.0f, -3.0f ], 56 [ -3.0f, -3.0f, -3.0f ], 57 ] 58 ); 59 break; 60 61 case SOUTH: 62 flattenKernel = flatten( 63 [ 64 [ 5.0f, -3.0f, -3.0f ], 65 [ 5.0f, 0.0f, -3.0f ], 66 [ 5.0f, -3.0f, -3.0f ], 67 ] 68 ); 69 break; 70 71 case SOUTH_EAST: 72 flattenKernel = flatten( 73 [ 74 [ -3.0f, -3.0f, -3.0f ], 75 [ 5.0f, 0.0f, -3.0f ], 76 [ 5.0f, 5.0f, -3.0f ], 77 ] 78 ); 79 break; 80 81 case EAST: 82 flattenKernel = flatten( 83 [ 84 [ -3.0f, -3.0f, -3.0f ], 85 [ -3.0f, 0.0f, -3.0f ], 86 [ 5.0f, 5.0f, 5.0f ], 87 ] 88 ); 89 break; 90 91 case NORTH_EAST: 92 flattenKernel = flatten( 93 [ 94 [ -3.0f, -3.0f, -3.0f ], 95 [ -3.0f, 0.0f, 5.0f ], 96 [ -3.0f, 5.0f, 5.0f ], 97 ] 98 ); 99 break; 100 } 101 } 102 }