예제 #1
0
//--------------------------------------------------------------
void testApp::draw() {
	ofBackground(0);
	
	ofSetColor(255);
	cvImgGrayscale.draw(0, 0);
	
	for(unsigned int i = 0; i < polylines.size(); i++) {
		ofNoFill();
	
		ofSetColor(255, 0, 0);
		drawWithNormals(polylines[i]);
		
		ofSetColor(0, 255, 0);
		drawWithNormals(smoothed[i]);
		
		ofSetColor(0, 0, 255);
		drawWithNormals(resampled[i]);
		
		ofSetColor(0, 255, 255);
		ofRect(boundingBoxes[i]);
		
		ofSetColor(255, 0, 0);
		ofLine(closestPoints[i], ofPoint(mouseX, mouseY));
		ofSetColor(0, 0, 255);
		ofLine(resampled[i][closestIndices[i]], ofPoint(mouseX, mouseY));
	}
	
	ofSetColor(255, 0, 0);	
	ofDrawBitmapString(ofToString((int) ofGetFrameRate()) + " fps", 10, 20);
	ofDrawBitmapString("Click and drag to set a new threshold.", 10, 40);
	ofDrawBitmapString("Hold down any key to invert the thresholding.", 10, 60);
}
예제 #2
0
//--------------------------------------------------------------
void testApp::draw() {
	ofBackground(0);

	ofSetColor(255);
//	glPushMatrix();
//	glScalef(scaleWidth, scaleHeight, 0);
	cvImgGrayscale.draw(0, 0);

	for (unsigned int i = 0; i < polylines.size(); i++) {
		ofNoFill();

		ofSetColor(255, 0, 0);
		drawWithNormals(polylines[i], 0, 0, true);

		ofSetColor(0, 255, 0);
		drawWithNormals(smoothed[i], 0, 0, false);

		ofSetColor(0, 0, 255);
		drawWithNormals(resampled[i], 0, 0, true);

//		ofSetColor(0, 255, 255);
//		ofRect(boundingBoxes[i]);

//		ofSetColor(255, 0, 0);
//		ofLine(closestPoints[i], ofPoint(mouseX, mouseY));
		ofSetColor(0, 0, 255);
		ofLine(resampled[i][closestIndices[i]], ofPoint(mouseX, mouseY));
	}
//	glPopMatrix();

	ofSetColor(255, 0, 0);
	ofDrawBitmapString(ofToString((int) ofGetFrameRate()) + " fps", 10, 20);
	ofDrawBitmapString("Click and drag to set a new threshold.", 10, 40);
//	ofDrawBitmapString("Hold down any key to invert the thresholding.", 10, 60);

//---------------------------------------

//	ofDrawBitmapString("hit spacebar to load image from web", 10, ofGetHeight()/2);
//	if(loading)
//		ofDrawBitmapString("loading...", 10, ofGetHeight()+20);
//	float divider = ofMap( mouseX, 0, ofGetWidth(), 1, 48, true );
//
//	if(img.bAllocated()){
//		for(int y = 0; y < img.getHeight(); y+= divider){
//			for(int x = 0; x < img.getWidth(); x+=divider){
//				ofColor c = img.getColor(x, y);
//
//				ofSetColor( c.r, c.g, c.b );
//				ofCircle( x, y, divider/2 );
//			}
//		}
//
//		ofSetColor(255);
//		img.draw(img.getWidth(), 0);
//	}

//	maskLayers.draw(0, 0, maskLayers.getWidth(), maskLayers.getHeight());

	if (doVideoWrite) {
//		saveScreen.grabScreen(0, 0, ofGetWidth(), ofGetHeight());
//		TIS.saveThreaded(saveScreen);
//		doVideoWrite != doVideoWrite;
	}

}