Resize a Video Crap

(sry for my english)

Hey, i have a problem and need your help. All i want is to grab images (sequences) from my camera and display them on screen with a size of 640/240. In addition i want to “save” and display a copy in half the size. (320/240) I just tried to copy the Grab by using

colorImg2 = colorImg; and resize it with

but this doesnt work… it displays only a quarter (the top-left corner) of the original Grab.

Here’s the code…

void testApp::setup(){	   
	grabW = vidGrabber.width;  
	grabH = vidGrabber.height;  
void testApp::update(){  
    bool bNewFrame = false;  
	bNewFrame = vidGrabber.isFrameNew();  
	if (bNewFrame){  
		colorImg.setFromPixels(vidGrabber.getPixels(), grabW, grabH);  
		colorImg2 = colorImg;  
		colorImg2.resize(grabW/2, grabH/2);  
void testApp::draw(){  

this is what i got:

Where is the Mistake?

I think what’s happening is this: you’re allocating the image with 320x240, then copying the 640x480 in, then “resizing” the 320x240 image to 320x240. So, during the copy you just get the corner – then during the resize nothing happens.

Try changing this line:


To this:


I changed the line, but nothing different happend. I get the same result.

I dont understand why this does not work. When i resize an static image (jpg for example) it works. And here i am just saving an sequence from my cam to an image, why i can resize it normally? :frowning:

Another ideas?

Looking at the source for ofImage, it looks like what Kyle says should work.

After the resize, colorImg2 should only be 320x240 in size.

hi kamil,

i came across the same problem,
resize() doesn’t do what you’d expect it to.
so try using,

resizeImg.allocate( 320, 240 );
resizeImg.scaleIntoMe( sourceImg );


Thanks! That’s it!