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         *
082         * @see HistogramModel
083         */
084        HISTOGRAM {
085                @Override
086                public GlobalFeatureExtractor getOptions() {
087                        return new HistogramExtractor();
088                }
089        },
090        /**
091         * Using a pixel histogram (see {@link GlobalFeatureType#HISTOGRAM}) find
092         * the maximum bin. This can be interpreted as the image's dominant colour
093         */
094        MAX_HISTOGRAM {
095                @Override
096                public GlobalFeatureExtractor getOptions() {
097                        return new MaxHistogramExtractor();
098                }
099        },
100        /**
101         * Local (block-based) pixel histograms
102         *
103         * @see BlockHistogramModel
104         */
105        LOCAL_HISTOGRAM {
106                @Override
107                public GlobalFeatureExtractor getOptions() {
108                        return new LocalHistogramExtractor();
109                }
110        },
111        /**
112         * EDCH
113         *
114         * @see EdgeDirectionCoherenceVector
115         */
116        EDGE_DIRECTION_COHERENCE_HISTOGRAM {
117                @Override
118                public GlobalFeatureExtractor getOptions() {
119                        return new EDCHExtractor();
120                }
121        },
122        /**
123         * Average brightness
124         *
125         * @see AvgBrightness
126         */
127        AVERAGE_BRIGHTNESS {
128                @Override
129                public GlobalFeatureExtractor getOptions() {
130                        return new AverageBrightnessExtractor();
131                }
132        },
133        /**
134         * Sharpness
135         *
136         * @see Sharpness
137         */
138        SHARPNESS {
139                @Override
140                public GlobalFeatureExtractor getOptions() {
141                        return new SharpnessExtractor();
142                }
143        },
144        /**
145         * Colorfulness
146         *
147         * @see Colorfulness
148         */
149        COLORFULNESS {
150                @Override
151                public GlobalFeatureExtractor getOptions() {
152                        return new ColourfulnessExtractor();
153                }
154        },
155        /**
156         * Hue stats
157         *
158         * @see HueStats
159         */
160        HUE_STATISTICS {
161                @Override
162                public GlobalFeatureExtractor getOptions() {
163                        return new HueStatsExtractor();
164                }
165        },
166        /**
167         * Naturalness
168         *
169         * @see Naturalness
170         */
171        NATURALNESS {
172                @Override
173                public GlobalFeatureExtractor getOptions() {
174                        return new NaturalnessExtractor();
175                }
176        },
177        /**
178         * Sandeep faces
179         *
180         * @see SandeepFaceDetector
181         */
182        COLOR_FACES {
183                @Override
184                public GlobalFeatureExtractor getOptions() {
185                        return new ColourFacesExtractor();
186                }
187        },
188        /**
189         * Haar cascades
190         *
191         * @see HaarCascadeDetector
192         */
193        HAAR_FACES {
194                @Override
195                public GlobalFeatureExtractor getOptions() {
196                        return new HaarFacesExtractor();
197                }
198        },
199        /**
200         * Colour contrast
201         *
202         * @see ColourContrast
203         */
204        COLOUR_CONTRAST {
205                @Override
206                public GlobalFeatureExtractor getOptions() {
207                        return new ColourContrastExtractor();
208                }
209        },
210        /**
211         * Weber constrast
212         *
213         * @see WeberContrast
214         */
215        WEBER_CONTRAST {
216                @Override
217                public GlobalFeatureExtractor getOptions() {
218                        return new WeberContrastExtractor();
219                }
220        },
221        /**
222         * Left-right intensity balance
223         *
224         * @see LRIntensityBalance
225         */
226        LR_INTENSITY_BALANCE {
227                @Override
228                public GlobalFeatureExtractor getOptions() {
229                        return new LrIntensityBalanceExtractor();
230                }
231        },
232        /**
233         * Rule of thirds feature
234         *
235         * @see RuleOfThirds
236         */
237        RULE_OF_THIRDS {
238                @Override
239                public GlobalFeatureExtractor getOptions() {
240                        return new RuleOfThirdsExtractor();
241                }
242        },
243        /**
244         * ROI proportion
245         *
246         * @see ROIProportion
247         */
248        ROI_PROPORTION {
249                @Override
250                public GlobalFeatureExtractor getOptions() {
251                        return new RoiProportionExtractor();
252                }
253        },
254        /**
255         * Horizontal intensity distribution
256         *
257         * @see HorizontalIntensityDistribution
258         */
259        HORIZONTAL_INTENSITY_DISTRIBUTION {
260                @Override
261                public GlobalFeatureExtractor getOptions() {
262                        return new HorizontalIntensityDistributionExtractor();
263                }
264        },
265        /**
266         * Sharp pixel proportion
267         *
268         * @see SharpPixelProportion
269         */
270        SHARP_PIXEL_PROPORTION {
271                @Override
272                public GlobalFeatureExtractor getOptions() {
273                        return new SharpPixelProportionExtractor();
274                }
275        },
276        /**
277         * Luo's simplicity feature
278         *
279         * @see LuoSimplicity
280         */
281        LUO_SIMPLICITY {
282                @Override
283                public GlobalFeatureExtractor getOptions() {
284                        return new LuoSimplicityExtractor();
285                }
286        },
287        /**
288         * Modified version of Luo's simplicity feature
289         *
290         * @see ModifiedLuoSimplicity
291         */
292        MODIFIED_LUO_SIMPLICITY {
293                @Override
294                public GlobalFeatureExtractor getOptions() {
295                        return new ModifiedLuoSimplicityExtractor();
296                }
297        };
298
299        @Override
300        public abstract GlobalFeatureExtractor getOptions();
301}