ofxHighDim

//--------------------------------------------------------------
void ofApp::draw(){
    // 배경 검정색.
    ofBackground(100, 100, 25);
   
    ofPushMatrix();
    // 마우스에 따라 이동
    ofTranslate(-ofGetMouseX() * (scale - 0.5), -ofGetMouseY() * (scale - 0.5));
   
    // 각 이미지 디스플레이
    for (int i=0; i<imagePoints.size(); i++) {
        float x = ofMap(imagePoints[i][0], 0, 1, 0, scale * ofGetWidth());
        float y = ofMap(imagePoints[i][1], 0, 1, 0, scale * ofGetHeight());
       
        // 이미지 디스플레이
        ofSetColor(255,255,255);
        images[i].draw(x, y, imageSize * images[i].getWidth(), imageSize * images[i].getHeight());
    }
   
    ofNoFill();
    for (int i=0; i<imagePoints.size(); i++) {
        float x = ofMap(imagePoints[i][0], 0, 1, 0, scale * ofGetWidth());
        float y = ofMap(imagePoints[i][1], 0, 1, 0, scale * ofGetHeight());

        // 테두리 그리기
        if(imgType[i] == 0) {
            ofSetColor(0,0,0);  // 0 이면 흑색.
            ofSetLineWidth(4);
            ofDrawRectangle(x-1, y-1, imageSize * images[i].getWidth()+1, imageSize * images[i].getHeight()+1);
        }else {
            ofSetColor(255,255,255);  // 1이면 백색
            ofSetLineWidth(4);
            ofDrawRectangle(x-1, y-1, imageSize * images[i].getWidth()+1, imageSize * images[i].getHeight()+1);
        }
    }
    ofPopMatrix();
   
    gui.draw();
}

댓글

댓글 쓰기

이 블로그의 인기 게시물

파이썬으로 Homomorphic Filtering 하기

파이썬으로 2D FFT/iFFT 하기: numpy 버전