コード例 #1
0
ファイル: ofApp.cpp プロジェクト: 119/ofxIpVideoGrabber
//------------------------------------------------------------------------------
void ofApp::setup()
{
    ofSetLogLevel(OF_LOG_VERBOSE);
    ofSetFrameRate(30);
    loadCameras();
    
    // initialize connection
    for(std::size_t i = 0; i < NUM_CAMERAS; i++)
    {
        IPCameraDef& cam = getNextCamera();
        
        SharedIPVideoGrabber c = IPVideoGrabber::makeShared();

        // if your camera uses standard web-based authentication, use this
        // c->setUsername(cam.username);
        // c->setPassword(cam.password);
        
        // if your camera uses cookies for authentication, use something like this:
        // c->setCookie("user", cam.username);
        // c->setCookie("password", cam.password);
        
        c->setCameraName(cam.getName());
        c->setURI(cam.getURL());
        c->connect(); // connect immediately

        // if desired, set up a video resize listener
        ofAddListener(c->videoResized, this, &ofApp::videoResized);
        
        grabbers.push_back(c);

    }
}
コード例 #2
0
ファイル: ofApp.cpp プロジェクト: leoneckert/alter-reality
void ofApp::setup()
{
    ofSetLogLevel(OF_LOG_VERBOSE); //what does that mean?
    ofSetFrameRate(30);
//    int wi = 800;
//    int he = 600;
    int wi = 620;
    int he = 480;
//    int wi = 640;
//    int he = 360;
    
//    int wi = 1280;
//    int he = 960;
    alteredReality.allocate(wi, he, OF_IMAGE_COLOR);
    background.allocate(wi, he, OF_IMAGE_COLOR);
    movement.allocate(wi, he, OF_IMAGE_COLOR_ALPHA);
    
        
    loadCameras();
    
    IPCameraDef& cam = ipcams[0];
    
    auto c = std::make_shared<Video::IPVideoGrabber>(); //make_shared ???
    

    c->setURI(cam.getURL());
    c->connect(); // connect immediately


    grabbers.push_back(c);

}
コード例 #3
0
ファイル: testApp.cpp プロジェクト: dasaki/cvcinema
///*****************************************************************
///
///                        SETUP
///
///*****************************************************************
void testApp::setup(){
   // ofSetLogLevel(OF_LOG_NOTICE);
    bLiveVideo = true;
    bShowGui = false;
    selOutput = OUTPUT_IMAGE;
    bRecording = false;
    bMovieAudio = false;
    bFullScreen = false;
	saveFrame = false;
	threshold = 50;
    // if we set BG subtraction as default (no. 2) there is a segmentation fault because the background image is not set for the first frame
	algorithm = 1;
	cropping = '6';
	bZoomTarget = false;
	cols = 1;
	rows = 1;
	lastTime = ofGetElapsedTimeMillis();
	currFrameNum = 0;
	videoFPS = 0;
	imgLogos.loadImage("faldon-logos.bmp");
	imgLogos.resize(ofGetWidth(), round(imgLogos.height*((float)ofGetWidth()/(float)imgLogos.width)));
	//ofEnableAlphaBlending();
    ofSetVerticalSync(true);
    ofSetFrameRate(30);
    string devfile = "/dev/video"+ofToString(VIDEO_DEVICE_ID);
    settings.setup(devfile);

    vidGrabber.setVerbose(true);
    vidGrabber.setDeviceID(VIDEO_DEVICE_ID);
    vidGrabber.setDesiredFrameRate(30);
    if (bLiveVideo) setupLiveVideo();
    else loadMovie();
    setupGui();
#ifdef OFX_FENSTER
	outWinListener.setup();
	outWinListener.setImage(&blendImg);
#endif
    //recorder.setupRecordWindow(0,0,1024,576,24,"capture.mp4",ofxGstVideoRecorder::H264,30);
    //recorder.setupRecordWindow((DRAW_SPACE*2+320),(DRAW_SPACE*2+240+out_H_gap),analysisW*2,analysisH,24,"bg_sub_vs_bg&fd_01.mp4",ofxGstVideoRecorder::H264,30);

    setupOSC();
    blendMode = OF_BLENDMODE_ADD;//OF_BLENDMODE_ALPHA;
    alphaValues[0] = alphaValues[1] = alphaValues[2] = alphaValues[3] = 64;
    loadCameras();
}
コード例 #4
0
ファイル: testApp.cpp プロジェクト: bakercp/mawUtils
//--------------------------------------------------------------
void testApp::setup(){
    ofSetFrameRate(30);
    
    loadCameras();
    
    rs = new RandomSampler(ipcams.size());

    
    // initialize connection
    for(int i = 0; i < NUM_CAMERAS; i++) {
        IPCameraDef* cam = getRandomCamera();
        ipGrabber[i].setUsername(cam->username);
        ipGrabber[i].setPassword(cam->password);
        URI uri(cam->uri);
        ipGrabber[i].setURI(uri);
        ipGrabber[i].connect();
        // set up the listener!
        ofAddListener(ipGrabber[i].videoResized, this, &testApp::videoResized);
    }
    

}
コード例 #5
0
ファイル: testApp.cpp プロジェクト: andybiar/WhoLetTheDogsOut
//--------------------------------------------------------------
void testApp::setup(){
    ofSetLogLevel(OF_LOG_VERBOSE);
    ofSetFrameRate(30);
    loadCameras();
    
    // initialize connection
    for(int i = 0; i < NUM_CAMERAS; i++) {
        IPCameraDef& cam = getNextCamera();
        
        ofxSharedIpVideoGrabber c( new ofxIpVideoGrabber());
        
        c->setCameraName(cam.name);
        c->setURI(cam.url);
        c->connect(); // connect immediately

        // if desired, set up a video resize listener
        ofAddListener(c->videoResized, this, &testApp::videoResized);
        
        ipGrabber.push_back(c);

		music.loadSound("dogs.mp3");
    }
}
コード例 #6
0
ファイル: ofApp.cpp プロジェクト: leoneckert/alter-reality
void ofApp::loadNextCamera(){
    
    int wi = 620;
    int he = 480;
    num_measurements = 1;
    
    avColors.clear(); //might now even need
    first = true;
    background.allocate(wi, he, OF_IMAGE_COLOR);
    movement.allocate(wi, he, OF_IMAGE_COLOR_ALPHA);
    drawing = false;
    hideMovement = false;
    
    loadCameras();
    IPCameraDef& cam = ipcam;
    
    auto c = std::make_shared<Video::IPVideoGrabber>(); //make_shared ???
    c->setURI(cam.getURL());
    c->connect(); // connect immediately
    
    the_stream = c;
    
}