All Downloads are FREE. Search and download functionalities are using the official Maven repository.

boofcv.abst.feature.detdesc.DetectDescribeSingleToMulti Maven / Gradle / Ivy

Go to download

BoofCV is an open source Java library for real-time computer vision and robotics applications.

There is a newer version: 1.1.7
Show newest version
/*
 * Copyright (c) 2011-2017, Peter Abeles. All Rights Reserved.
 *
 * This file is part of BoofCV (http://boofcv.org).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package boofcv.abst.feature.detdesc;

import boofcv.struct.feature.TupleDesc;
import boofcv.struct.image.ImageGray;
import georegression.struct.point.Point2D_F64;

/**
 * Allows {@link DetectDescribePoint} to be used as a {@link DetectDescribeMulti}.
 *
 * @author Peter Abeles
 */
public class DetectDescribeSingleToMulti, TD extends TupleDesc>
	implements DetectDescribeMulti
{
	DetectDescribePoint alg;
	Wrap set = new Wrap();

	public DetectDescribeSingleToMulti(DetectDescribePoint alg) {
		this.alg = alg;
	}

	@Override
	public void process(T image) {
		alg.detect(image);
	}

	@Override
	public int getNumberOfSets() {
		return 1;
	}

	@Override
	public PointDescSet getFeatureSet(int setIndex) {
		if( setIndex != 0 )
			throw new IllegalArgumentException("Only one set");
		return set;
	}

	@Override
	public TD createDescription() {
		return alg.createDescription();
	}

	@Override
	public Class getDescriptionType() {
		return alg.getDescriptionType();
	}

	private class Wrap implements PointDescSet {

		@Override
		public int getNumberOfFeatures() {
			return alg.getNumberOfFeatures();
		}

		@Override
		public Point2D_F64 getLocation(int featureIndex) {
			return alg.getLocation(featureIndex);
		}

		@Override
		public TD getDescription(int index) {
			return alg.getDescription(index);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy