コード例 #1
0
ファイル: ofApp.cpp プロジェクト: arcoyk/yellowkitten
//--------------------------------------------------------------
void ofApp::setup(){
    //we can now get back a list of devices.
    vector<ofVideoDevice> devices = vidGrabber.listDevices();
    
    for(int i = 0; i < devices.size(); i++){
        cout << devices[i].id << ": " << devices[i].deviceName;
        if( devices[i].bAvailable ){
            cout << endl;
        }else{
            cout << " - unavailable " << endl;
        }
    }
    vidGrabber.setDeviceID(1);

    
    
    vidGrabber.setVerbose(true);
    vidGrabber.initGrabber(width, height);
    recorded = (unsigned char*)malloc(3 * height * width * record_size);
    tmp = (unsigned char*)malloc(3 * height * width);
    back = (unsigned char*)malloc(3 * height * width);
    merged = (unsigned char*)malloc(3 * height * width);
    show = vidGrabber.getPixels();
    udpConnection.Create();
    udpConnection.Bind(1511);
    udpConnection.SetNonBlocking(true);
    for (int i = 0; i < trackers_cnt; i++) {
        tracker t = tracker(i);
        trackers.push_back(t);
    }
    outfile.open("/users/yui/desktop/yellow_imgs/teacher/log.txt", std::ios_base::app);
    
}
コード例 #2
0
ファイル: main.cpp プロジェクト: kashimAstro/MouseController
		void update(){
			char udpMessage[100000];
		        udp.Receive(udpMessage,100000);
		        string message=udpMessage;
		        if(message!="") {
				vector<string> res = ofSplitString(message, ",");
				mouse = ofVec2f(ofToInt(res[0]),ofToInt(res[1]));
				if(ofTrim(res[1])=="click") {
					click(1);
				}else{
					position(mouse);
				}
			}
		}
コード例 #3
0
ファイル: ofApp.cpp プロジェクト: arcoyk/yellowkitten
void ofApp::udp_rcv() {
    type_Mocap_Info *data = (type_Mocap_Info *)malloc(sizeof(type_Mocap_Info));
    char recvData[28];
    udpConnection.Receive(recvData, 28);
    data = (type_Mocap_Info *)recvData;
    int* id = (int *)data->id;
    float* x = (float *)data->x;
    float* y = (float *)data->y;
    float* z = (float *)data->z;
    float* roll= (float *)data->roll;
    float* pitch= (float *)data->pitch;
    float* yaw= (float *)data->yaw;
    // printf("%2d\t%3.3fm\t%3.3fm\t%3.3fm\t%3.2f\t%3.2f\t%3.2f\n",*id,*x,*y,*z,*roll,*pitch,*yaw);
}
コード例 #4
0
ファイル: main.cpp プロジェクト: kashimAstro/MouseController
		void setup(){
			udp.Create();
		        udp.Bind(11999);
		        udp.SetNonBlocking(true);
			//keyboard(disp, XK_A, 0);
		}