本文整理汇总了Java中org.openimaj.image.feature.local.interest.InterestPointData类的典型用法代码示例。如果您正苦于以下问题:Java InterestPointData类的具体用法?Java InterestPointData怎么用?Java InterestPointData使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InterestPointData类属于org.openimaj.image.feature.local.interest包,在下文中一共展示了InterestPointData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: extractSubImage
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
private I extractSubImage(I image, InterestPointData point) {
// First extract the window around the point at the window size
// double scaleFctor = 5 * point.scale;
double scaleFctor = (int) Math.max(9, Math.round(3 * point.scale));
this.halfWindowSize = (int) scaleFctor;
this.featureWindowSize = halfWindowSize * 2;
I subImage = null;
Matrix transformMatrix = null;
if (this.affineInvariant) {
transformMatrix = calculateTransformMatrix(point);
} else {
transformMatrix = TransformUtilities.translateMatrix(-point.x,
-point.y);
}
subImage = extractSubImage(image, transformMatrix, halfWindowSize,
featureWindowSize);
return subImage;
}
示例2: main
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
public static void main(String args[]) throws IOException, ExperimentException{
String expBase = "/org/openimaj/image/feature/validator/graf";
String imgName = "img%d.ppm";
OxfordRepeatabilityExperiment exp = new OxfordRepeatabilityExperiment(
expBase, // The root of all the images and transforms
"H%dto%dp", // the name format of the transform
imgName, // the name format of the image
6, // the number of experiments to expect
new ExperimentFeatureExtraction.Harris()
);
for(int i = 1; i < 6;i++)
{
IPDRepeatability<InterestPointData> experiment = exp.experimentWith(i);
System.out.println(String.format(imgName + ": %f", i+1, experiment.repeatability(0.6f)));
}
// IPDRepeatability<InterestPointData> experiment1v2 = exp.experimentWith(1);
//
// System.out.println("Experiment 1 v 2");
// for(float error = 0.1f; error <= .9f; error +=0.1f){
// float overlap = 1.f - error;
// System.out.format("Minimum overlap %f (err=%f): %f\n",overlap,error,experiment1v2.repeatability(overlap));
// }
}
示例3: selectArea
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
private void selectArea(Rectangle rectangle) {
this.selectedArea = rectangle;
List<InterestPointData> pointsInsideRect = new ArrayList<InterestPointData>();
for (InterestPointData point : points) {
if (rectangle.isInside(point)) {
pointsInsideRect.add(point);
}
}
InterestPointVisualiser<Float[], MBFImage> visualiser = InterestPointVisualiser
.visualiseInterestPoints((MBFImage) image, pointsInsideRect);
MBFImage out = visualiser.drawPatches(RGBColour.RED, RGBColour.GREEN);
DisplayUtilities.display(out, this.displayFrame);
}
示例4: setImage
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
/**
* Set the image
* @param points
* @param image
*/
public synchronized void setImage(List<? extends InterestPointData> points, MBFImage image) {
this.image = image;
this.selectedArea = image.getBounds();
this.points = new ArrayList<InterestPointData>();
for (InterestPointData x : points) {
this.points.add(x);
}
}
示例5: mouseClicked
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
@Override
public synchronized void mouseClicked(MouseEvent e) {
if(this.points == null) return;
double dist = Double.MAX_VALUE;
Circle foundShape = null;
InterestPointKeypoint<InterestPointData> foundPoint = null;
Point2dImpl clickPoint = new Point2dImpl(e.getPoint().x,e.getPoint().y);
for(InterestPointKeypoint<InterestPointData> point : points){
Circle ellipse = new Circle(point.location.x, point.location.y, point.scale);
if(ellipse.isInside(clickPoint)){
// double pdist = Math.sqrt(clickPoint.x * clickPoint.x + clickPoint.y * clickPoint.y);
double pdist = point.scale;
if(pdist < dist){
foundShape = ellipse;
foundPoint = point;
dist = pdist;
}
}
}
if(foundShape!=null){
// PolygonExtractionProcessor<S, T> ext = new PolygonExtractionProcessor<S,T>(foundShape, image.newInstance(1, 1).getPixel(0,0));
FGaussianConvolve blur = new FGaussianConvolve (foundPoint.scale);
InterestPointImageExtractorProperties<S, T> extract = new InterestPointImageExtractorProperties<S,T>(image.process(blur),foundPoint.location);
if(frame== null){
frame = DisplayUtilities.display(extract.image.process(r));
}
else{
frame.dispose();
frame = DisplayUtilities.display(extract.image.process(r));
}
}
}
示例6: main
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public static void main(String[] args) throws IOException{
MBFImage image = ImageUtilities.readMBF(new File("/Users/ss/Development/descriptors/img1.png"));
FImage fimage = Transforms.calculateIntensity(image).multiply(255f);
File featureOut = new File("/Users/ss/Development/descriptors/img1-oi.features");
List<InterestPointData> kps = null;
boolean force = true;
float sd = (float) 1;
HarrisIPD harrisIPD = new HarrisIPD(sd*0.7f,sd*1f,0.01f);
if(!featureOut.exists() || force){
harrisIPD.findInterestPoints(fimage);
kps = new IPDSelectionMode.Threshold(10000).selectPoints(harrisIPD);
// kps = new IPDSelectionMode.All().selectPoints(harrisIPD);
IOUtils.writeBinary(featureOut,new ReadWriteableIPDList<InterestPointData>(kps){
@Override
protected InterestPointData createFeature() {
return new InterestPointData();
}
});
}
else{
kps = IOUtils.read(featureOut,ReadWriteableIPDList.class).value;
}
InterestPointVisualiser<Float[], MBFImage> visualiser = InterestPointVisualiser.visualiseInterestPoints(image, kps);
MBFImage out = visualiser.drawPatches(RGBColour.RED, RGBColour.GREEN);
JFrame f = DisplayUtilities.display(out,String.format("Showing %d feature", kps.size()));
FeatureClickListener l = new FeatureClickListener();
l.setImage(kps, image);
f.getContentPane().addMouseListener(l);
}
示例7: main
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
public static void main(String[] args) throws IOException {
MBFImage image = ImageUtilities.readMBF(ImageIPDSIFTEngine.class.getResourceAsStream("/org/openimaj/image/feature/validator/graf/img1.ppm"));
FImage fimage = Transforms.calculateIntensity(image);
File featureOut = new File("/tmp/img1.oi-sift-features");
LocalFeatureList<? extends InterestPointKeypoint<? extends InterestPointData>> kps = null;
boolean force = true;
HarrisIPD harrisIPD = new HarrisIPD(1.4f);
harrisIPD.setImageBlurred(true);
AffineAdaption affineIPD = new AffineAdaption(harrisIPD,new IPDSelectionMode.Threshold(250f));
affineIPD.setFastDifferentiationScale(true);
AbstractIPDSIFTEngine<EllipticInterestPointData> engine = new EllipticIPDSIFTEngine(affineIPD);
engine.setFinderMode(new FinderMode.Basic<EllipticInterestPointData>());
// engine.setFinderMode(new FinderMode.Basic<InterestPointData>());
// engine.setSelectionMode(new IPDSelectionMode.Threshold(10000f));
engine.setSelectionMode(new IPDSelectionMode.All());
engine.setAcrossScales(true);
if (!featureOut.exists() || force) {
kps = engine.findFeatures(fimage);
IOUtils.writeBinary(featureOut, kps);
} else {
kps = MemoryLocalFeatureList.read(featureOut,
CircularInterestPointKeypoint.class);
}
InterestPointVisualiser<Float[], MBFImage> visualiser = InterestPointVisualiser
.visualiseKeypoints(image, kps);
MBFImage out = visualiser.drawPatches(RGBColour.RED, RGBColour.GREEN);
JFrame f = DisplayUtilities.display(out);
FeatureClickListener l = new FeatureClickListener();
l.setImage(kps, image);
l.setDisplayFrame(f);
f.getContentPane().addMouseListener(l);
}
示例8: getNewEngine
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
private IPDSIFTEngine getNewEngine() {
final int derScale = 1;
final int intScale = 3;
final HarrisIPD ipd = new HarrisIPD(derScale, intScale);
engine = new IPDSIFTEngine(ipd);
engine.setSelectionMode(new IPDSelectionMode.Threshold(10000f));
engine.setFinderMode(new FinderMode.Characteristic<InterestPointData>());
// engine.setSelectionMode(new IPDSelectionMode.Count(10));
engine.setAcrossScales(true);
return engine;
}
示例9: keyPressed
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
@Override
public void keyPressed(KeyEvent key) {
if (key.getKeyCode() == KeyEvent.VK_SPACE) {
this.videoFrame.togglePause();
} else if (key.getKeyChar() == 'c' && this.polygonListener.getPolygon().getVertices().size() > 2) {
try {
final Polygon p = this.polygonListener.getPolygon().clone();
this.polygonListener.reset();
modelImage = capture.getCurrentFrame().process(
new PolygonExtractionProcessor<Float[], MBFImage>(p, RGBColour.BLACK));
if (modelFrame == null) {
modelFrame = DisplayUtilities.display(modelImage, "model");
modelFrame.addKeyListener(this);
// move the frame
final Point pt = modelFrame.getLocation();
modelFrame.setLocation(pt.x + this.videoFrame.getScreen().getWidth(), pt.y);
// configure the matcher
matcher = new ConsistentLocalFeatureMatcher2d<InterestPointKeypoint<InterestPointData>>(
new FastBasicKeypointMatcher<InterestPointKeypoint<InterestPointData>>(8));
matcher.setFittingModel(new RobustHomographyEstimator(10.0, 1500,
new RANSAC.PercentageInliersStoppingCondition(0.5), HomographyRefinement.NONE));
} else {
DisplayUtilities.display(modelImage, modelFrame);
}
final FImage modelF = Transforms.calculateIntensityNTSC(modelImage);
matcher.setModelFeatures(getNewEngine().findFeatures(modelF));
} catch (final Exception e) {
e.printStackTrace();
}
}
}
示例10: afterUpdate
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
@Override
public void afterUpdate(VideoDisplay<MBFImage> display) {
if (matcher != null && !videoFrame.isPaused()) {
final MBFImage capImg = videoFrame.getVideo().getCurrentFrame();
final LocalFeatureList<InterestPointKeypoint<InterestPointData>> kpl = engine.findFeatures(Transforms
.calculateIntensityNTSC(capImg));
final MBFImageRenderer renderer = capImg.createRenderer();
renderer.drawPoints(kpl, RGBColour.MAGENTA, 3);
MBFImage matches;
if (matcher.findMatches(kpl)) {
try {
final Shape sh = modelImage.getBounds().transform(
((MatrixTransformProvider) matcher.getModel()).getTransform().inverse());
renderer.drawShape(sh, 3, RGBColour.BLUE);
} catch (final RuntimeException e) {
}
matches = MatchingUtilities.drawMatches(modelImage, capImg, matcher.getMatches(), RGBColour.RED);
} else {
matches = MatchingUtilities.drawMatches(modelImage, capImg, null, RGBColour.RED);
}
if (matchFrame == null) {
matchFrame = DisplayUtilities.display(matches, "matches");
matchFrame.addKeyListener(this);
final Point pt = matchFrame.getLocation();
matchFrame.setLocation(pt.x, pt.y + matchFrame.getHeight());
} else {
DisplayUtilities.display(matches, matchFrame);
}
}
}
示例11: drawKeypoints
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
private void drawKeypoints(MBFImage frame) {
final MBFImage capImg = frame;
final LocalFeatureList<InterestPointKeypoint<InterestPointData>> kpl = engine.findFeatures(Transforms
.calculateIntensityNTSC(capImg));
this.featureClickListener.setImage(kpl, frame.clone());
final KeypointVisualizer<Float[], MBFImage> kpv = new KeypointVisualizer<Float[], MBFImage>(capImg, kpl);
final InterestPointVisualiser<Float[], MBFImage> ipv = InterestPointVisualiser.visualiseKeypoints(
kpv.drawPatches(null, RGBColour.GREEN), kpl);
frame.internalAssign(ipv.drawPatches(RGBColour.GREEN, RGBColour.BLUE));
}
示例12: foundInterestPoint
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
@Override
public void foundInterestPoint(FImage image,InterestPointData point){
InterestPointImageExtractorProperties<Float,FImage> property = new InterestPointImageExtractorProperties<Float,FImage>(image,point,false);
OrientedFeatureVector[] extracted = extractor.extractFeature(property);
for(OrientedFeatureVector feature : extracted){
features.add(new CircularInterestPointKeypoint(feature,point.clone()));
}
}
示例13: InterestPointImageExtractorProperties
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
public InterestPointImageExtractorProperties(I image,
InterestPointData point, boolean affineInvariant) {
this.affineInvariant = affineInvariant;
this.image = extractSubImage(image, point);
if (this.image == null)
System.out.println();
this.scale = point.getScale();
this.x = this.image.getWidth() / 2;
this.y = this.image.getHeight() / 2;
this.interestPointData = point;
}
示例14: calculateTransformMatrix
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
private Matrix calculateTransformMatrix(InterestPointData point) {
Matrix transform = point.getTransform();
this.halfWindowSize = (int) (this.halfWindowSize);
this.featureWindowSize = this.halfWindowSize * 2;
Matrix center = TransformUtilities.translateMatrix(-point.x, -point.y);
transform = transform.times(center);
return transform;
}
示例15: OxfordRepeatabilityExperiment
import org.openimaj.image.feature.local.interest.InterestPointData; //导入依赖的package包/类
OxfordRepeatabilityExperiment(String experimentRoot, String transformName, String imageName, int nImages, ExperimentFeatureExtraction expFE, String featureDumpPath) throws IOException{
this.nExperiments = nImages - 1;
this.transformName = transformName;
this.imageName = imageName;
this.experiemtnFeatureExtraction = expFE;
this.featureDumpPath = featureDumpPath;
transforms = new HashMap<String,Matrix>();
images = new HashMap<String, MBFImage>();
String imageNameFormated = String.format(imageName, 1);
String imageLocation = experimentRoot + "/" + imageNameFormated;
logger.debug("Loading image: " + imageLocation );
MBFImage im = ImageUtilities.readMBF(this.getClass().getResourceAsStream(imageLocation));
if(im == null){
throw new IOException("Can't load image: " + imageLocation);
}
images.put(imageNameFormated, im);
for (int i = 1; i < nImages; i++) {
String transformNameFormated = String.format(transformName, 1, i + 1);
String transformLocation = experimentRoot + "/" + transformNameFormated;
logger.debug("Loading trasnform: " + transformLocation);
transforms.put(transformNameFormated,IPDRepeatability.readHomography(this.getClass().getResourceAsStream(transformLocation)));
imageNameFormated = String.format(imageName, i+1);
imageLocation = experimentRoot + "/" + imageNameFormated;
logger.debug("Loading image: " + imageLocation );
images.put(imageNameFormated, ImageUtilities.readMBF(this.getClass().getResourceAsStream(imageLocation)));
}
this.features = new HashMap<String, List<InterestPointData>>();
}