Esempio n. 1
0
void Test()
{
    Gearless::StateMachine<InitState, TransitionTbl> sm;
    sm.Start();
    sm.ProcessEvent(OpenClose());
    sm.ProcessEvent(OpenClose());
    sm.ProcessEvent(CdDetected("Bee Gees Spirits Having Flown", DiskType::Cd));
    sm.ProcessEvent(Play());
    sm.ProcessEvent(Pause());
    sm.ProcessEvent(Stop());
    sm.ProcessEvent(Stop());
    sm.Stop();
}
Esempio n. 2
0
int main( int argc, char** argv )
{
    char* filename = 0;

    help();

    filename = argc == 2 ? argv[1] : (char*)"baboon.jpg";
    if( (src = cvLoadImage(filename,1)) == 0 )
    {
        printf("Cannot load file image %s\n", filename);
        help();
        return -1;
    }



    dst = cvCloneImage(src);

    //create windows for output images
    cvNamedWindow("Open/Close",1);
    cvNamedWindow("Erode/Dilate",1);

    open_close_pos = erode_dilate_pos = max_iters;
    cvCreateTrackbar("iterations", "Open/Close",&open_close_pos,max_iters*2+1,OpenClose);
    cvCreateTrackbar("iterations", "Erode/Dilate",&erode_dilate_pos,max_iters*2+1,ErodeDilate);

    for(;;)
    {
        int c;

        OpenClose(open_close_pos);
        ErodeDilate(erode_dilate_pos);
        c = cvWaitKey(0);

        if( (char)c == 27 )
            break;
        if( (char)c == 'e' )
            element_shape = CV_SHAPE_ELLIPSE;
        else if( (char)c == 'r' )
            element_shape = CV_SHAPE_RECT;
        else if( (char)c == 'c' )
            element_shape = CV_SHAPE_CROSS;
        else if( (char)c == ' ' )
            element_shape = (element_shape + 1) % 3;
    }

    //release images
    cvReleaseImage(&src);
    cvReleaseImage(&dst);

    //destroy windows
    cvDestroyWindow("Open/Close");
    cvDestroyWindow("Erode/Dilate");

    return 0;
}
Esempio n. 3
0
int main( int argc, char** argv )
{
    char* filename = argc == 2 ? argv[1] : (char*)"baboon.jpg";
    if( (src = cvLoadImage(filename,1)) == 0 )
        return -1;

    printf( "Hot keys: \n"
        "\tESC - quit the program\n"
        "\tr - use rectangle structuring element\n"
        "\te - use elliptic structuring element\n"
        "\tc - use cross-shaped structuring element\n"
        "\tSPACE - loop through all the options\n" );

    dst = cvCloneImage(src);

    //create windows for output images
    cvNamedWindow("Open/Close",1);
    cvNamedWindow("Erode/Dilate",1);

    open_close_pos = erode_dilate_pos = max_iters;
    cvCreateTrackbar("iterations", "Open/Close",&open_close_pos,max_iters*2+1,OpenClose);
    cvCreateTrackbar("iterations", "Erode/Dilate",&erode_dilate_pos,max_iters*2+1,ErodeDilate);

    for(;;)
    {
        int c;

        OpenClose(open_close_pos);
        ErodeDilate(erode_dilate_pos);
        c = cvWaitKey(0);

        if( (char)c == 27 )
            break;
        if( (char)c == 'e' )
            element_shape = CV_SHAPE_ELLIPSE;
        else if( (char)c == 'r' )
            element_shape = CV_SHAPE_RECT;
        else if( (char)c == 'c' )
            element_shape = CV_SHAPE_CROSS;
        else if( (char)c == ' ' )
            element_shape = (element_shape + 1) % 3;
    }

    //release images
    cvReleaseImage(&src);
    cvReleaseImage(&dst);

    //destroy windows
    cvDestroyWindow("Open/Close");
    cvDestroyWindow("Erode/Dilate");

    return 0;
}
Esempio n. 4
0
int morphy1(char*filename)  
{  
	//char *filename =argc ==2?argv[1]:(char *)"lena.jpg";      
	if( (src = cvLoadImage(filename,1)) == 0 )  
		return -1;  
	dst=cvCloneImage(src);  

	cvNamedWindow("Open/Close",1);  
	cvNamedWindow("Erode/Dilate",1);  
	open_close_pos = erode_dilate_pos = max_iters;  //初始设置,然后往两边偏移
	cvCreateTrackbar("iterations","Open/Close",&open_close_pos,max_iters*2+1,OpenClose);  
	cvCreateTrackbar("iterations","Erode/Dilate",&erode_dilate_pos,max_iters*2+1,ErodeDilate);  
	for (;;)  
	{  
		int c;  
		OpenClose(open_close_pos);  
		ErodeDilate(erode_dilate_pos);  
		c= cvWaitKey(0);  
		if (c==27) {  
			break;  
		}  
		switch(c)
		{  
		case 'e':  
			element_shape=CV_SHAPE_ELLIPSE;  
			break;  
		case 'r':  
			element_shape=CV_SHAPE_RECT;  
			break;  
		case 't':  
			element_shape=(element_shape+1)%3;  
			break;
		case 'c':  
			element_shape=CV_SHAPE_CROSS;  
			break;
		default:  
			break;   
		}  
	}  
	cvReleaseImage(&src);  
	cvReleaseImage(&dst);  

	cvDestroyWindow("Open/Close");  
	cvDestroyWindow("Erode/Dilate");  
	return 0;  
}  
Esempio n. 5
0
TEST(BasicDaemon, OpenCloseDelay)
{
  usrsocktest_daemon_config = usrsocktest_daemon_defconf;
  usrsocktest_daemon_config.delay_all_responses = true;
  OpenClose(&usrsocktest_daemon_config);
}
Esempio n. 6
0
TEST(BasicDaemon, OpenClose)
{
  usrsocktest_daemon_config = usrsocktest_daemon_defconf;
  OpenClose(&usrsocktest_daemon_config);
}