Exemplo n.º 1
0
	bool is_in_on(const Point_<vt, Dim>& p) const{
		if (Dim >= 2) {
			return this->is_in_on(p.x(), p.y());
		} else if (Dim >= 3) {
			return this->is_in_on(p.x(), p.y(), p.z());
		} else {
			return false;
		}
	}
Exemplo n.º 2
0
void ShapeModel::preparePatterns()
{
    // Fat or thin? determined by width/height
    cv::Rect_<double> r;
    double ratio;
    Mat_<double> cParam, pt;
    Mat_<double> sumParam;
    double sumW;
    
    sumW = 0;
    sumParam = Mat_<double>::zeros(nShapeParams, 1);
    
    for (int i=0; i<nTrain; i++){
        r = imageSet[i].shapeVec.getBoundRect();
        projectShapeToParam(imageSet[i].shapeVec, cParam);
        ratio = r.width / r.height;
//         printf("%f\n", ratio);
        if (ratio>0.7){
            pt = cParam * (ratio-0.7);
            sumParam += pt;
            sumW += ratio-0.7;
        }
    }
    sumParam /= sumW;
    sumParam = normalizeParam(sumParam);
    printf("Fat & Thin: ");
    for (int i=0; i<nShapeParams; i++)
        printf("%g, ", sumParam(i, 0));
    printf("\n");
    
    // Eye Size
    sumW = 0;
    sumParam = Mat_<double>::zeros(nShapeParams, 1);
    Point_<double> v;
    double l1, l2;
    for (int i=0; i<nTrain; i++){
        v = (imageSet[i].points[27]-imageSet[i].points[29]);
        l1 = v.dot(v);
        v = (imageSet[i].points[28]-imageSet[i].points[30]);
        l2 = v.dot(v);
        ratio = sqrt(l1*l2);
        projectShapeToParam(imageSet[i].shapeVec, cParam);
        printf("%f\n", ratio);
        if (ratio>350){
            pt = cParam * (ratio-350);
            sumParam += pt;
            sumW += ratio-350;
        }
    }
    sumParam /= sumW;
    sumParam = normalizeParam(sumParam);
    printf("eyeSize: ");
    for (int i=0; i<nShapeParams; i++)
        printf("%g, ", sumParam(i, 0));
    printf("\n");
}
Exemplo n.º 3
0
bool operator==(const Point_<T>& p1, const Point_<U>& p2)
{
    return p1.x() == p2.x() && p1.y() == p2.y();
}