1 /** 2 * Copyright (c) 2011, The University of Southampton and the individual contributors. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without modification, 6 * are permitted provided that the following conditions are met: 7 * 8 * * Redistributions of source code must retain the above copyright notice, 9 * this list of conditions and the following disclaimer. 10 * 11 * * Redistributions in binary form must reproduce the above copyright notice, 12 * this list of conditions and the following disclaimer in the documentation 13 * and/or other materials provided with the distribution. 14 * 15 * * Neither the name of the University of Southampton nor the names of its 16 * contributors may be used to endorse or promote products derived from this 17 * software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 20 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 21 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 23 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 26 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 28 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 /** 31 * 32 */ 33 package org.openimaj.image.processing.convolution; 34 35 import org.openimaj.image.FImage; 36 37 /** 38 * Compass operators that are used by the Liu and Samarabandu 39 * text extraction. 40 * 41 * @author David Dupplaw (dpd@ecs.soton.ac.uk) 42 * @created 9 Aug 2011 43 * 44 */ 45 public class CompassOperators 46 { 47 /** 48 * The Compass0 operator 49 * @author David Dupplaw (dpd@ecs.soton.ac.uk) 50 */ 51 static public class Compass0 extends FConvolution 52 { 53 /** 54 * Default constructor 55 */ 56 public Compass0() 57 { 58 super( new FImage( new float[][]{ 59 {-1,-1,-1}, 60 { 2, 2, 2}, 61 {-1,-1,-1} 62 })); 63 } 64 } 65 66 /** 67 * The Compass45 operator 68 * @author David Dupplaw (dpd@ecs.soton.ac.uk) 69 */ 70 static public class Compass45 extends FConvolution 71 { 72 /** 73 * Default constructor 74 */ 75 public Compass45() 76 { 77 super( new FImage( new float[][]{ 78 {-1,-1, 2}, 79 {-1, 2,-1}, 80 { 2,-1,-1} 81 })); 82 } 83 } 84 85 /** 86 * The Compass90 operator 87 * @author David Dupplaw (dpd@ecs.soton.ac.uk) 88 */ 89 static public class Compass90 extends FConvolution 90 { 91 /** 92 * Default constructor 93 */ 94 public Compass90() 95 { 96 super( new FImage( new float[][]{ 97 {-1, 2,-1}, 98 {-1, 2,-1}, 99 {-1, 2,-1} 100 })); 101 } 102 } 103 104 /** 105 * The Compass135 operator 106 * @author David Dupplaw (dpd@ecs.soton.ac.uk) 107 */ 108 static public class Compass135 extends FConvolution 109 { 110 /** 111 * Default constructor 112 */ 113 public Compass135() 114 { 115 super( new FImage( new float[][]{ 116 { 2,-1,-1}, 117 {-1, 2,-1}, 118 {-1,-1, 2} 119 })); 120 } 121 } 122 }