001/** 002 * Copyright (c) 2011, The University of Southampton and the individual contributors. 003 * All rights reserved. 004 * 005 * Redistribution and use in source and binary forms, with or without modification, 006 * are permitted provided that the following conditions are met: 007 * 008 * * Redistributions of source code must retain the above copyright notice, 009 * this list of conditions and the following disclaimer. 010 * 011 * * Redistributions in binary form must reproduce the above copyright notice, 012 * this list of conditions and the following disclaimer in the documentation 013 * and/or other materials provided with the distribution. 014 * 015 * * Neither the name of the University of Southampton nor the names of its 016 * contributors may be used to endorse or promote products derived from this 017 * software without specific prior written permission. 018 * 019 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 020 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 021 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 022 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 023 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 024 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 025 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON 026 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 027 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 028 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 029 */ 030package org.openimaj.tools.globalfeature; 031 032import org.kohsuke.args4j.CmdLineOptionsProvider; 033import org.openimaj.image.analysis.algorithm.EdgeDirectionCoherenceVector; 034import org.openimaj.image.feature.global.AvgBrightness; 035import org.openimaj.image.feature.global.Colorfulness; 036import org.openimaj.image.feature.global.ColourContrast; 037import org.openimaj.image.feature.global.HorizontalIntensityDistribution; 038import org.openimaj.image.feature.global.HueStats; 039import org.openimaj.image.feature.global.LRIntensityBalance; 040import org.openimaj.image.feature.global.LuoSimplicity; 041import org.openimaj.image.feature.global.ModifiedLuoSimplicity; 042import org.openimaj.image.feature.global.Naturalness; 043import org.openimaj.image.feature.global.ROIProportion; 044import org.openimaj.image.feature.global.RuleOfThirds; 045import org.openimaj.image.feature.global.SharpPixelProportion; 046import org.openimaj.image.feature.global.Sharpness; 047import org.openimaj.image.feature.global.WeberContrast; 048import org.openimaj.image.pixel.statistics.BlockHistogramModel; 049import org.openimaj.image.pixel.statistics.HistogramModel; 050import org.openimaj.image.processing.face.detection.HaarCascadeDetector; 051import org.openimaj.image.processing.face.detection.SandeepFaceDetector; 052import org.openimaj.tools.globalfeature.type.AverageBrightnessExtractor; 053import org.openimaj.tools.globalfeature.type.ColourContrastExtractor; 054import org.openimaj.tools.globalfeature.type.ColourFacesExtractor; 055import org.openimaj.tools.globalfeature.type.ColourfulnessExtractor; 056import org.openimaj.tools.globalfeature.type.EDCHExtractor; 057import org.openimaj.tools.globalfeature.type.HaarFacesExtractor; 058import org.openimaj.tools.globalfeature.type.HistogramExtractor; 059import org.openimaj.tools.globalfeature.type.HorizontalIntensityDistributionExtractor; 060import org.openimaj.tools.globalfeature.type.HueStatsExtractor; 061import org.openimaj.tools.globalfeature.type.LocalHistogramExtractor; 062import org.openimaj.tools.globalfeature.type.LrIntensityBalanceExtractor; 063import org.openimaj.tools.globalfeature.type.LuoSimplicityExtractor; 064import org.openimaj.tools.globalfeature.type.MaxHistogramExtractor; 065import org.openimaj.tools.globalfeature.type.ModifiedLuoSimplicityExtractor; 066import org.openimaj.tools.globalfeature.type.NaturalnessExtractor; 067import org.openimaj.tools.globalfeature.type.RoiProportionExtractor; 068import org.openimaj.tools.globalfeature.type.RuleOfThirdsExtractor; 069import org.openimaj.tools.globalfeature.type.SharpPixelProportionExtractor; 070import org.openimaj.tools.globalfeature.type.SharpnessExtractor; 071import org.openimaj.tools.globalfeature.type.WeberContrastExtractor; 072 073/** 074 * Different types of global image feature. 075 * 076 * @author Jonathon Hare (jsh2@ecs.soton.ac.uk) 077 */ 078public enum GlobalFeatureType implements CmdLineOptionsProvider { 079 /** 080 * Pixel histograms 081 * @see HistogramModel 082 */ 083 HISTOGRAM { 084 @Override 085 public GlobalFeatureExtractor getOptions() { 086 return new HistogramExtractor(); 087 } 088 }, 089 /** 090 * Using a pixel histogram (see {@link GlobalFeatureType#HISTOGRAM}) find 091 * the maximum bin. This can be interpreted as the image's dominant colour 092 */ 093 MAX_HISTOGRAM { 094 @Override 095 public GlobalFeatureExtractor getOptions() { 096 return new MaxHistogramExtractor(); 097 } 098 }, 099 /** 100 * Local (block-based) pixel histograms 101 * @see BlockHistogramModel 102 */ 103 LOCAL_HISTOGRAM { 104 @Override 105 public GlobalFeatureExtractor getOptions() { 106 return new LocalHistogramExtractor(); 107 } 108 }, 109 /** 110 * EDCH 111 * @see EdgeDirectionCoherenceVector 112 */ 113 EDGE_DIRECTION_COHERENCE_HISTOGRAM { 114 @Override 115 public GlobalFeatureExtractor getOptions() { 116 return new EDCHExtractor(); 117 } 118 }, 119 /** 120 * Average brightness 121 * @see AvgBrightness 122 */ 123 AVERAGE_BRIGHTNESS { 124 @Override 125 public GlobalFeatureExtractor getOptions() { 126 return new AverageBrightnessExtractor(); 127 } 128 }, 129 /** 130 * Sharpness 131 * @see Sharpness 132 */ 133 SHARPNESS { 134 @Override 135 public GlobalFeatureExtractor getOptions() { 136 return new SharpnessExtractor(); 137 } 138 }, 139 /** 140 * Colorfulness 141 * @see Colorfulness 142 */ 143 COLORFULNESS { 144 @Override 145 public GlobalFeatureExtractor getOptions() { 146 return new ColourfulnessExtractor(); 147 } 148 }, 149 /** 150 * Hue stats 151 * @see HueStats 152 */ 153 HUE_STATISTICS { 154 @Override 155 public GlobalFeatureExtractor getOptions() { 156 return new HueStatsExtractor(); 157 } 158 }, 159 /** 160 * Naturalness 161 * @see Naturalness 162 */ 163 NATURALNESS { 164 @Override 165 public GlobalFeatureExtractor getOptions() { 166 return new NaturalnessExtractor(); 167 } 168 }, 169 /** 170 * Sandeep faces 171 * @see SandeepFaceDetector 172 */ 173 COLOR_FACES { 174 @Override 175 public GlobalFeatureExtractor getOptions() { 176 return new ColourFacesExtractor(); 177 } 178 }, 179 /** 180 * Haar cascades 181 * @see HaarCascadeDetector 182 */ 183 HAAR_FACES { 184 @Override 185 public GlobalFeatureExtractor getOptions() { 186 return new HaarFacesExtractor(); 187 } 188 }, 189 /** 190 * Colour contrast 191 * @see ColourContrast 192 */ 193 COLOUR_CONTRAST { 194 @Override 195 public GlobalFeatureExtractor getOptions() { 196 return new ColourContrastExtractor(); 197 } 198 }, 199 /** 200 * Weber constrast 201 * @see WeberContrast 202 */ 203 WEBER_CONTRAST { 204 @Override 205 public GlobalFeatureExtractor getOptions() { 206 return new WeberContrastExtractor(); 207 } 208 }, 209 /** 210 * Left-right intensity balance 211 * @see LRIntensityBalance 212 */ 213 LR_INTENSITY_BALANCE { 214 @Override 215 public GlobalFeatureExtractor getOptions() { 216 return new LrIntensityBalanceExtractor(); 217 } 218 }, 219 /** 220 * Rule of thirds feature 221 * @see RuleOfThirds 222 */ 223 RULE_OF_THIRDS { 224 @Override 225 public GlobalFeatureExtractor getOptions() { 226 return new RuleOfThirdsExtractor(); 227 } 228 }, 229 /** 230 * ROI proportion 231 * @see ROIProportion 232 */ 233 ROI_PROPORTION { 234 @Override 235 public GlobalFeatureExtractor getOptions() { 236 return new RoiProportionExtractor(); 237 } 238 }, 239 /** 240 * Horizontal intensity distribution 241 * @see HorizontalIntensityDistribution 242 */ 243 HORIZONTAL_INTENSITY_DISTRIBUTION { 244 @Override 245 public GlobalFeatureExtractor getOptions() { 246 return new HorizontalIntensityDistributionExtractor(); 247 } 248 }, 249 /** 250 * Sharp pixel proportion 251 * @see SharpPixelProportion 252 */ 253 SHARP_PIXEL_PROPORTION { 254 @Override 255 public GlobalFeatureExtractor getOptions() { 256 return new SharpPixelProportionExtractor(); 257 } 258 }, 259 /** 260 * Luo's simplicity feature 261 * @see LuoSimplicity 262 */ 263 LUO_SIMPLICITY { 264 @Override 265 public GlobalFeatureExtractor getOptions() { 266 return new LuoSimplicityExtractor(); 267 } 268 }, 269 /** 270 * Modified version of Luo's simplicity feature 271 * @see ModifiedLuoSimplicity 272 */ 273 MODIFIED_LUO_SIMPLICITY { 274 @Override 275 public GlobalFeatureExtractor getOptions() { 276 return new ModifiedLuoSimplicityExtractor(); 277 } 278 } 279 ; 280 281 @Override 282 public abstract GlobalFeatureExtractor getOptions(); 283}