001package org.openimaj.picslurper.client; 002 003import java.io.File; 004import java.io.IOException; 005import java.util.List; 006 007import org.openimaj.feature.local.filter.ByteEntropyFilter; 008import org.openimaj.image.FImage; 009import org.openimaj.image.ImageUtilities; 010import org.openimaj.image.feature.local.engine.DoGSIFTEngine; 011import org.openimaj.image.feature.local.keypoints.Keypoint; 012import org.openimaj.image.processing.resize.ResizeProcessor; 013import org.openimaj.util.filter.FilterUtils; 014 015public class SIFTTrendFeatureMode implements TrendDetectorFeatureExtractor { 016 017 018 private DoGSIFTEngine engine; 019 020 public SIFTTrendFeatureMode() { 021 engine = new DoGSIFTEngine(); 022 engine.getOptions().setDoubleInitialImage(false); 023 } 024 @Override 025 public List<Keypoint> extractFeatures(File imageFile) throws IOException { 026 final ByteEntropyFilter filter = new ByteEntropyFilter(); 027 028 final FImage image = ResizeProcessor.resizeMax(ImageUtilities.readF(imageFile), 150); 029 final List<Keypoint> features = engine.findFeatures(image); 030 return FilterUtils.filter(features, filter); 031 } 032 @Override 033 public boolean logScale() { 034 return true; 035 } 036 @Override 037 public int nDimensions() { 038 return 128; 039 } 040}