// Path: openCVTutorial1CameraPreview/src/main/java/es/ava/aruco/exceptions/CPException.java
// public class CPException extends Exception{
// 
// 	private static final long serialVersionUID = 1L;
// 	private String message;
// 
// 	public CPException(String string) {
// 		message = string;
// 	}
// 	
// 	public String getMessage(){
// 		return message;
// 	}
// }


import android.util.Log;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.StringTokenizer;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.MatOfDouble;
import org.opencv.core.Size;
import es.ava.aruco.exceptions.CPException;
package es.ava.aruco;





/**
 * Camera parameters needed to 3d rendering. They will be loaded from a file
 * in xml format generated by the OpenCV's calibration algorithm.
 * The parameters used are the camera matrix and the distorsion coefficient matrix.
 * @author Rafael Ortega
 *
 */
public class CameraParameters {

	// cameraMatrix will be of the form
	// | Fx 0  Cx |
	// | 0  Fy Cy |
	// | 0  0   1 |
	private Mat cameraMatrix;
	private MatOfDouble distorsionMatrix;
	private Size camSize;
	
	public CameraParameters(){
		cameraMatrix = new Mat(3,3,CvType.CV_32FC1);
		distorsionMatrix = new MatOfDouble();
	}
	
    /**Indicates whether this object is valid
     */
    public boolean isValid(){
    	if(cameraMatrix != null)
    		return cameraMatrix.rows()!=0 && cameraMatrix.cols()!=0  && 
    		distorsionMatrix.total() > 0;
    	else
    		return false;
    }
	
	public Mat getCameraMatrix(){
		return cameraMatrix;
	}
	
	public MatOfDouble getDistCoeff(){
		return distorsionMatrix;
	}
	
// Path: openCVTutorial1CameraPreview/src/main/java/es/ava/aruco/exceptions/CPException.java
// public class CPException extends Exception{
// 
// 	private static final long serialVersionUID = 1L;
// 	private String message;
// 
// 	public CPException(String string) {
// 		message = string;
// 	}
// 	
// 	public String getMessage(){
// 		return message;
// 	}
// }


// Path: openCVTutorial1CameraPreview/src/main/java/es/ava/aruco/CameraParameters.java
import android.util.Log;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.util.HashMap;
import java.util.StringTokenizer;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.MatOfDouble;
import org.opencv.core.Size;
import es.ava.aruco.exceptions.CPException;

package es.ava.aruco;





/**
 * Camera parameters needed to 3d rendering. They will be loaded from a file
 * in xml format generated by the OpenCV's calibration algorithm.
 * The parameters used are the camera matrix and the distorsion coefficient matrix.
 * @author Rafael Ortega
 *
 */
public class CameraParameters {

	// cameraMatrix will be of the form
	// | Fx 0  Cx |
	// | 0  Fy Cy |
	// | 0  0   1 |
	private Mat cameraMatrix;
	private MatOfDouble distorsionMatrix;
	private Size camSize;
	
	public CameraParameters(){
		cameraMatrix = new Mat(3,3,CvType.CV_32FC1);
		distorsionMatrix = new MatOfDouble();
	}
	
    /**Indicates whether this object is valid
     */
    public boolean isValid(){
    	if(cameraMatrix != null)
    		return cameraMatrix.rows()!=0 && cameraMatrix.cols()!=0  && 
    		distorsionMatrix.total() > 0;
    	else
    		return false;
    }
	
	public Mat getCameraMatrix(){
		return cameraMatrix;
	}
	
	public MatOfDouble getDistCoeff(){
		return distorsionMatrix;
	}
	
	public void resize(Size size) throws CPException{