Ejemplo n.º 1
0
void qr(cv::Mat input, cv::Mat &q, cv::Mat &r){
	Eigen::Matrix3Xd* A = toMatrix3Xd(input);
	Eigen::HouseholderQR<Eigen::MatrixXd> qr(*A);
	Eigen::MatrixXd R = qr.matrixQR().triangularView<Eigen::Upper>();
	Eigen::MatrixXd Q = qr.householderQ();

	q = toMat(Q);
	r = toMat(R);
}
Ejemplo n.º 2
0
Archivo: RVec.cpp Proyecto: mpppk/EMat
	cv::Mat RVec::toMat(const vector<double>& content){
		vector<string> strContent;
		for(const double &value : content){
			strContent.push_back( toString<double>( value ) );
		}
		return toMat(strContent);
	}
Ejemplo n.º 3
0
void Vertex::rotateInPlace(const Matrix3d& rotmat)
{
	auto vecmat = toMat();
	auto res = rotmat * vecmat;
	x(res.get(0, 0));
	y(res.get(1, 0));
	z(res.get(2, 0));
}
Ejemplo n.º 4
0
void Chair::draw(glm::vec3 Scale, glm::vec3 Rotate, float RotAngle, glm::vec3 Translate)
{
	//Start with identity matrix
	modelMatrix = toMat(Scale, Rotate, RotAngle, Translate);

	modelMatrix =  localMatrix * modelMatrix;

	for(int i=0; i<subGeometry->children.size(); ++i)
	{
		subGeometry->children.at(i)->visitChildren(modelMatrix);
	}


}
Ejemplo n.º 5
0
std::vector<cv::Rect> MxArray::toVector() const
{
    if (isNumeric()) {
        std::vector<cv::Rect> vr;
        if (numel() == 4)
            vr.push_back(toRect());
        else
            toMat(CV_32S).reshape(4, 0).copyTo(vr);
        return vr;
    }
    else {
        return toVector(
            std::const_mem_fun_ref_t<cv::Rect, MxArray>(&MxArray::toRect));
    }
}
Ejemplo n.º 6
0
	ofMatrix4x4 estimateAffine3D(vector<ofVec3f>& from, vector<ofVec3f>& to, vector<unsigned char>& outliers, float accuracy) {
		Mat fromMat(1, from.size(), CV_32FC3, &from[0]);
		Mat toMat(1, to.size(), CV_32FC3, &to[0]);
		Mat affine;
		estimateAffine3D(fromMat, toMat, affine, outliers, 3, accuracy);
		ofMatrix4x4 affine4x4;
		affine4x4.set(affine.ptr<double>());
		affine4x4(3, 0) = 0;
		affine4x4(3, 1) = 0;
		affine4x4(3, 2) = 0;
		affine4x4(3, 3) = 1;
		Mat affine4x4Mat(4, 4, CV_32F, affine4x4.getPtr());
		affine4x4Mat = affine4x4Mat.t();
		affine4x4.set(affine4x4Mat.ptr<float>());
		return affine4x4;
	} 
Ejemplo n.º 7
0
std::vector<cv::Vec4f> MxArray::toVector() const
{
    if (isNumeric()) {
        std::vector<cv::Vec4f> vv;
        if (numel() == 4)
            vv.push_back(toVec<float,4>());
        else
            toMat(CV_32F).reshape(4, 0).copyTo(vv);
        return vv;
    }
    else {
        return toVector(
            std::const_mem_fun_ref_t<cv::Vec4f, MxArray>(
                &MxArray::toVec<float,4>));
    }
}
Ejemplo n.º 8
0
std::vector<cv::Vec3i> MxArray::toVector() const
{
    if (isNumeric()) {
        std::vector<cv::Vec3i> vv;
        if (numel() == 3)
            vv.push_back(toVec<int,3>());
        else
            toMat(CV_32S).reshape(3, 0).copyTo(vv);
        return vv;
    }
    else {
        return toVector(
            std::const_mem_fun_ref_t<cv::Vec3i, MxArray>(
                &MxArray::toVec<int,3>));
    }
}
Ejemplo n.º 9
0
std::vector<cv::Point3d> MxArray::toVector() const
{
    if (isNumeric()) {
        std::vector<cv::Point3d> vp;
        if (numel() == 3)
            vp.push_back(toPoint3_<double>());
        else
            toMat(CV_64F).reshape(3, 0).copyTo(vp);
        return vp;
    }
    else {
        return toVector(
            std::const_mem_fun_ref_t<cv::Point3d, MxArray>(
                &MxArray::toPoint3_<double>));
    }
}
Ejemplo n.º 10
0
std::vector<cv::Point2f> MxArray::toVector() const
{
    if (isNumeric()) {
        std::vector<cv::Point2f> vp;
        if (numel() == 2)
            vp.push_back(toPoint2f());
        else
            toMat(CV_32F).reshape(2, 0).copyTo(vp);
        return vp;
    }
    else {
        return toVector(
            std::const_mem_fun_ref_t<cv::Point2f, MxArray>(
                &MxArray::toPoint_<float>));
    }
}
Ejemplo n.º 11
0
Chair::Chair(glm::vec3 Scale, glm::vec3 Rotate, float RotAngle, glm::vec3 Translate)
{
	localMatrix = toMat(Scale, Rotate, RotAngle, Translate);
	setCube(new HECube(vec3(1, 1, 1), vec3(0, 1, 0), 0.0f, vec3(0, 0, 0)));
	glm::mat4 xform;
	xform = toMat(Scale, glm::vec3(0,1,0), RotAngle, Translate);
	Node* chair = new Node(xform, NULL);

	xform = toMat(glm::vec3(1, 0.1, 1), glm::vec3(0,1,0), 0.0f, glm::vec3(0, 1, 0));//Top
	chair->children.push_back(new Node(xform, cube));

	xform = toMat(glm::vec3(0.1, 1, 0.1), glm::vec3(0,1,0), 0.0f, glm::vec3(0.45, 0, 0.45));//Legs
	chair->children.push_back(new Node(xform, cube));
	xform = toMat(glm::vec3(0.1, 1, 0.1), glm::vec3(0,1,0), 0.0f, glm::vec3(-0.45, 0, 0.45));
	chair->children.push_back(new Node(xform, cube));
	xform = toMat(glm::vec3(0.1, 1, 0.1), glm::vec3(0,1,0), 0.0f, glm::vec3(0.45, 0, -0.45));
	chair->children.push_back(new Node(xform, cube));
	xform = toMat(glm::vec3(0.1, 1, 0.1), glm::vec3(0,1,0), 0.0f, glm::vec3(-0.45, 0, -0.45));
	chair->children.push_back(new Node(xform, cube));
	xform = toMat(glm::vec3(1, 1, 0.1), glm::vec3(0,1,0), 0.0f, glm::vec3(0, 1, -0.45));//Back
	chair->children.push_back(new Node(xform, cube));

	subGeometry = chair;
}
Ejemplo n.º 12
0
Archivo: RVec.cpp Proyecto: mpppk/EMat
	RVec::RVec(const vector<double>& content) : mat_(toMat(content)){
		if(!isValid())	throw invalid_argument( getErrorMessage() );
	}
Ejemplo n.º 13
0
fileToMat::fileToMat()
{
    Logger::getLogger()->write(3, "Inside fileToMat constructor");
    checkFileExists();
    toMat();
}