Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

ofVideoGrabber and ofFbo - Capturing and and drawing only part of the video

$
0
0

@cklkaren wrote:

Hi, I’m using a webcam and would like to capture and draw only the left part of the image captured (WindowWidth/2, WindowHeight) whilst the programme is running fullscreen. However, with my code below, it does draw the left part of half of the screen but my image would be narrowed at the same time as well.

Is there a way or addon for me to obtain my desire result please?

In my ofApp.h, I have:

	ofVideoGrabber		simpleCam;
	ofFbo				cameraFbo;

In my ofApp.cpp, I have:

void ofApp::setup(){

	simpleCam.setup(ofGetWindowWidth(), ofGetWindowHeight(), true);
	cameraFbo.allocate(ofGetWindowWidth(), ofGetWindowHeight());
}

void ofApp::update(){

	simpleCam.update();
	if (simpleCam.isFrameNew()) {
		cameraFbo.begin();
        simpleCam.draw(cameraFbo.getWidth()/2, 0, -cameraFbo.getWidth()/2, cameraFbo.getHeight());  // draw flipped
		cameraFbo.end();
		
		opticalFlow.setInput(cameraFbo.getTexture());
	}
}

Cheers,
Karen

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles