Commit c9ee2c7d authored by Andrey Filippov's avatar Andrey Filippov
Browse files

working on cartesian-defined multi-cameras

parent 1e8f23fb
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -412,6 +412,7 @@ public static MatchSimulatedPattern.DistortionParameters DISTORTION =new MatchSi
    public static EyesisCameraParameters EYESIS_CAMERA_PARAMETERS=new EyesisCameraParameters(
    public static EyesisCameraParameters EYESIS_CAMERA_PARAMETERS=new EyesisCameraParameters(
    		1,    //int numStations,
    		1,    //int numStations,
    		true, //false, // boolean isTripod=false; // when true - make goniometerHorizontal rotation around "vertical" axis and "goniometerAxial" - around
    		true, //false, // boolean isTripod=false; // when true - make goniometerHorizontal rotation around "vertical" axis and "goniometerAxial" - around
    		false, //	boolean cartesian,
	    	0.0, // double goniometerHorizontal, // goniometer rotation around "horizontal" axis (tilting from the target - positive)
	    	0.0, // double goniometerHorizontal, // goniometer rotation around "horizontal" axis (tilting from the target - positive)
	    	0.0, // double goniometerAxial, // goniometer rotation around Eyesis axis (clockwise in plan - positive 
	    	0.0, // double goniometerAxial, // goniometer rotation around Eyesis axis (clockwise in plan - positive 
			1, // 26, // 1,   // int numSubCameras,
			1, // 26, // 1,   // int numSubCameras,
+92 −39

File changed.

Preview size limit exceeded, changes collapsed.

+16 −2

File changed.

Preview size limit exceeded, changes collapsed.

+207 −18

File changed.

Preview size limit exceeded, changes collapsed.

+50 −1
Original line number Original line Diff line number Diff line
@@ -25,12 +25,17 @@ import java.util.Properties;


    public class EyesisSubCameraParameters{
    public class EyesisSubCameraParameters{
    	// origin is on the rotation axis of the tube body closest to the goniometer horizontal axis
    	// origin is on the rotation axis of the tube body closest to the goniometer horizontal axis
    	public boolean cartesian = false; // cartesian coordinates mode (false - cylindrical)
    	public int    lensDistortionModel=0;
    	public int    lensDistortionModel=0;
    	public boolean enableNoLaser=true; // enable images for this channel w/o matched laser pointer
    	public boolean enableNoLaser=true; // enable images for this channel w/o matched laser pointer
    	public double right;   // distance to the right (radius*sin(azimuth))
    	public double forward; // distance forward (radius*cos(azimuth))
    	public double heading;   // absolute heading in degrees (used in cartesian mode)

    	public double azimuth; // azimuth of the lens entrance pupil center, degrees, clockwise looking from top
    	public double azimuth; // azimuth of the lens entrance pupil center, degrees, clockwise looking from top
    	public double radius;  // mm, distance from the rotation axis
    	public double radius;  // mm, distance from the rotation axis
    	public double height;       // mm, up - from the origin point
    	public double height;       // mm, up - from the origin point
    	public double phi;     // degrees, optical axis from azimuth/r vector, clockwise
    	public double phi;     // degrees, optical axis from azimuth/r vector, clockwise (absolute if cylindrical = false)
    	public double theta;   // degrees, optical axis from the eyesis horizon, positive - up
    	public double theta;   // degrees, optical axis from the eyesis horizon, positive - up
    	public double psi;     // degrees, rotation (of the sensor) around the optical axis. Positive if camera is rotated clockwise looking to the target
    	public double psi;     // degrees, rotation (of the sensor) around the optical axis. Positive if camera is rotated clockwise looking to the target
		public double focalLength=4.5;
		public double focalLength=4.5;
@@ -68,8 +73,12 @@ import java.util.Properties;
		*/		
		*/		
		
		
    	public EyesisSubCameraParameters(
    	public EyesisSubCameraParameters(
    			boolean cartesian,
    			int lensDistortionModel,
    			int lensDistortionModel,
    			boolean enableNoLaser,
    			boolean enableNoLaser,
    	    	double right,   // distance to the right (radius*sin(azimuth))
    	    	double forward, // distance forward (radius*cos(azimuth))
    	    	double heading, // used in cartesian mode
    			double azimuth, // azimuth of the lens entrance pupil center, degrees, clockwise looking from top
    			double azimuth, // azimuth of the lens entrance pupil center, degrees, clockwise looking from top
    			double radius,  // mm, distance from the rotation axis
    			double radius,  // mm, distance from the rotation axis
    			double height,  // mm, up from the origin point
    			double height,  // mm, up from the origin point
@@ -92,8 +101,13 @@ import java.util.Properties;
				double [][] r_od,     // elongation for c,b,a,a5,a6,a7,a8
				double [][] r_od,     // elongation for c,b,a,a5,a6,a7,a8
    			double channelWeightDefault
    			double channelWeightDefault
    	){
    	){
    		this.cartesian = cartesian;
    		this.lensDistortionModel=lensDistortionModel;
    		this.lensDistortionModel=lensDistortionModel;
    		this.enableNoLaser=enableNoLaser;
    		this.enableNoLaser=enableNoLaser;
    		this.right =   right;
    		this.forward = forward;
    		this.heading = heading;
    		
    		this.azimuth=azimuth;
    		this.azimuth=azimuth;
    		this.radius=radius;
    		this.radius=radius;
    		this.height=height;
    		this.height=height;
@@ -123,12 +137,17 @@ import java.util.Properties;
    		this.defectsXY=null; // pixel defects coordinates list (starting with worst)
    		this.defectsXY=null; // pixel defects coordinates list (starting with worst)
    		this.defectsDiff=null; // pixel defects value (diff from average of neighbors), matching defectsXY
    		this.defectsDiff=null; // pixel defects value (diff from average of neighbors), matching defectsXY


    		updateCartesian(); // set alternative
    	}
    	}
    	// defects are not cloned!
    	// defects are not cloned!
    	public EyesisSubCameraParameters clone() {
    	public EyesisSubCameraParameters clone() {
    		return new EyesisSubCameraParameters(
    		return new EyesisSubCameraParameters(
    	    		this.cartesian,
    				this.lensDistortionModel,
    				this.lensDistortionModel,
    				this.enableNoLaser,
    				this.enableNoLaser,
    	    		this.right,
    	    		this.forward,
    	    		this.heading,
    				this.azimuth,
    				this.azimuth,
    				this.radius,
    				this.radius,
    				this.height,
    				this.height,
@@ -160,8 +179,12 @@ import java.util.Properties;
    	}
    	}
// TODO: add/restore new properties
// TODO: add/restore new properties
    	public void setProperties(String prefix,Properties properties){
    	public void setProperties(String prefix,Properties properties){
    		properties.setProperty(prefix+"cartesian",this.cartesian+"");
    		properties.setProperty(prefix+"lensDistortionModel",this.lensDistortionModel+"");
    		properties.setProperty(prefix+"lensDistortionModel",this.lensDistortionModel+"");
    		properties.setProperty(prefix+"enableNoLaser",this.enableNoLaser+"");
    		properties.setProperty(prefix+"enableNoLaser",this.enableNoLaser+"");
    		properties.setProperty(prefix+"right",this.right+"");
    		properties.setProperty(prefix+"heading",this.heading+"");
    		properties.setProperty(prefix+"forward",this.forward+"");
    		properties.setProperty(prefix+"azimuth",this.azimuth+"");
    		properties.setProperty(prefix+"azimuth",this.azimuth+"");
    		properties.setProperty(prefix+"radius",this.radius+"");
    		properties.setProperty(prefix+"radius",this.radius+"");
    		properties.setProperty(prefix+"height",this.height+"");
    		properties.setProperty(prefix+"height",this.height+"");
@@ -194,8 +217,17 @@ import java.util.Properties;
    		getProperties(prefix,properties, -1);
    		getProperties(prefix,properties, -1);
    	}
    	}
    	public void getProperties(String prefix,Properties properties, int channel){
    	public void getProperties(String prefix,Properties properties, int channel){
    		if (properties.getProperty(prefix+"cartesian")!=null)
    			this.cartesian=Boolean.parseBoolean(properties.getProperty(prefix+"cartesian"));
    		if (properties.getProperty(prefix+"lensDistortionModel")!=null)
    		if (properties.getProperty(prefix+"lensDistortionModel")!=null)
    			this.lensDistortionModel=Integer.parseInt(properties.getProperty(prefix+"lensDistortionModel"));
    			this.lensDistortionModel=Integer.parseInt(properties.getProperty(prefix+"lensDistortionModel"));
    		if (properties.getProperty(prefix+"right")!=null)
    			this.right=Double.parseDouble(properties.getProperty(prefix+"right"));
    		if (properties.getProperty(prefix+"forward")!=null)
    			this.forward=Double.parseDouble(properties.getProperty(prefix+"forward"));
    		if (properties.getProperty(prefix+"heading")!=null)
    			this.heading=Double.parseDouble(properties.getProperty(prefix+"heading"));

    		if (properties.getProperty(prefix+"azimuth")!=null)
    		if (properties.getProperty(prefix+"azimuth")!=null)
    			this.azimuth=Double.parseDouble(properties.getProperty(prefix+"azimuth"));
    			this.azimuth=Double.parseDouble(properties.getProperty(prefix+"azimuth"));
    		if (properties.getProperty(prefix+"radius")!=null)
    		if (properties.getProperty(prefix+"radius")!=null)
@@ -264,4 +296,21 @@ import java.util.Properties;
    	public double getChannelWeightDefault(){
    	public double getChannelWeightDefault(){
    		return this.channelWeightDefault;
    		return this.channelWeightDefault;
    	}
    	}
    	
    	public void updateCartesian(){ // set alternative parameters
    		if (cartesian) {
    			this.azimuth = Math.atan2(this.right, this.forward)*180.0/Math.PI;
    			this.radius = Math.sqrt(this.forward*this.forward + this.right*this.right);
    			this.phi = this.heading - this.azimuth; 
    		} else {
    			this.forward = this.radius * Math.cos(Math.PI*this.azimuth/180.0); 
    			this.right =   this.radius * Math.sin(Math.PI*this.azimuth/180.0); 
    			this.heading = this.phi +  this.azimuth;
    		}
    	}
    	public void setCartesian(boolean cartesian){
    		if (this.cartesian == cartesian) return; // already in this mode
    		updateCartesian();
    		this.cartesian = cartesian;
    	}
    }
    }
Loading