Exemplo n.º 1
0
int nl2_send_rule(int action, int swport)
{
    int rc;
#ifdef SANE_ZNL2
    int i;
    /*
     * Their stupid API has overlapping type values, which makes
     * packet debugging really suck. The "sane znl2" has distinct type
     * values, for use when debugging packet construction. Ordinarily
     * this section is disabled.
     */
    static const char* enum2s(int i);
    for (i = 0; i < TCF_A_LB_CONFORM; i++)
        fprintf(stderr, "    %2d 0x%02x %s\n", i, i, enum2s(i));
#endif

    pretend_count = 0;          /* debug only */

    /*
     * The Netlink2 delete API: if the switch port is left
     * unspecified, it's a wildcard and we have to delete all matching
     * rules. However, each NL2 message only deletes one rule.
     * Repeatedly send the delete request until we get back a
     * ZNL2_NOFIL, which indicates all matching rules have been
     * removed.
     */

    do {
        rc = send_rule(action, swport);
    } while (action == DELETE && swport == UNSPEC && rc == 0);

    save_sequence(sequence);
    return rc;
}
Exemplo n.º 2
0
int main (int argc, char *argv[])
{
	CvHMM *models;
	char *win = "hand";
	int num, count=0, curr=1; 
	ptseq seq;
	
	parse_args(argc,argv);
	seq = ptseq_init();
	
	for (;;) {
		IplImage *depth, *tmp, *body, *hand;
		CvSeq *cnt;
		CvPoint cent;
		int z, p, k; 
		
		depth = freenect_sync_get_depth_cv(0);
		body = body_detection(depth);
		hand = hand_detection(body, &z);
		
		if (!get_hand_contour_basic(hand, &cnt, &cent))
			continue;
		
		if ((p = basic_posture_classification(cnt)) == -1)
			continue;
		
		if (cvhmm_get_gesture_sequence(p, cent, &seq)) {
			ptseq_draw(seq, 0);
			if ((k = cvWaitKey(0)) == 's') {
				save_sequence(outfile, seq, N);
				break;
			}
			seq = ptseq_reset(seq);
		}
		
		hand = draw_depth_hand(cnt, p);
		cvShowImage("hand", hand);

		if ((k = cvWaitKey(T)) == 'q')
			break;
	}

	freenect_sync_stop();
	cvDestroyAllWindows();

	return 0;
}