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

boofcv.struct.geo.PairLineNorm 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.5
Show newest version
/*
 * Copyright (c) 2022, 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.struct.geo;

import georegression.struct.point.Vector3D_F64;
import lombok.Getter;
import lombok.Setter;

/**
 * A pair of line observations found in two different images. The line is described by a vector, which is the normal
 * of the plane defined by the line on the image plane and the camera's origin. The cross product of the two end
 * points (in homogeneous pixels) would define a line in this manor.
 *
 * @author Peter Abeles
 */
public class PairLineNorm {
	/**
	 * Location of the feature in the first image
	 */
	@Getter @Setter public Vector3D_F64 l1;
	/**
	 * Location of the feature in the second image.
	 */
	@Getter @Setter public Vector3D_F64 l2;

	public PairLineNorm() {
		l1 = new Vector3D_F64();
		l2 = new Vector3D_F64();
	}

	/**
	 * Creates a new instance by copying the values of the two lines.
	 *
	 * @param l1 image 1 location
	 * @param l2 image 2 location
	 */
	public PairLineNorm( Vector3D_F64 l1, Vector3D_F64 l2 ) {
		this(l1, l2, true);
	}

	/**
	 * Creates a new instance by either copying or saving a reference to the two lines
	 *
	 * @param l1 image 1 location
	 * @param l2 image 2 location
	 * @param newInstance Should it create new lines or save a reference to these instances.
	 */
	public PairLineNorm( Vector3D_F64 l1, Vector3D_F64 l2, boolean newInstance ) {
		if (newInstance) {
			this.l1 = l1.copy();
			this.l2 = l2.copy();
		} else {
			this.l1 = l1;
			this.l2 = l2;
		}
	}

	/**
	 * Sets the value of p1 and p2 to be equal to the values of the passed in objects
	 */
	public void setTo( Vector3D_F64 l1, Vector3D_F64 l2 ) {
		this.l1.setTo(l1);
		this.l2.setTo(l2);
	}

	public PairLineNorm setTo( PairLineNorm src ) {
		this.l1.setTo(src.l1);
		this.l2.setTo(src.l2);
		return this;
	}

	public void zero() {
		this.l1.zero();
		this.l2.zero();
	}

	/**
	 * Sets p1 and p2 to reference the passed in objects.
	 */
	public void assign( Vector3D_F64 l1, Vector3D_F64 l2 ) {
		this.l1 = l1;
		this.l2 = l2;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy