ofxKinect. Can I change frame resolution for use in slow computers?

Hello again! :stuck_out_tongue:
I’m trying out ofxKinect examples with ofxOpenCv blob detection and I tried it on a Quad core and it works great at 60fps, but on an older computer it does run slower.
If the default kinect resolution for camera and depthcamera is 640x480. is is posible to change this default size to something smaller like 320x240? This in order to do an ofxOpenCv blob analysis on a smaller frame.

Thank you :slight_smile:
Forgot to add a picture. When I use something like the following I get what is in the attachment.
colorImage.setFromPixels(kinect.getPixels(), 320, 240);
Is looks like it is interlaced frames, and its not cropping correctly.

I found this:
http://groups.google.com/group/openni-dev/browse-thread/thread/d2ba7102b2a39779/e12ad37e30f539b7

It mentions debayering as a solution, but I’m not sure what the problem might be.

that has nothing to do with debayering, the problem is ofxKinect returns 640x480 so by copying a frame in a ofxCvImage you are actually messing up the proportions. try allocating a 640,480 cvImage and then copying it to a 320,240 like:

  
  
imgBig.allocate(640,480);  
imgSmall.allocate(320,240);  
  
imgBig.setFromPixels(kinect.getPixels(),640,480);  
imgSmall.scaleIntoMe(imgBig);  
  

Yeap there it is. Thank you Arturo.
I am left with a question. I was using the following command before which I thought would work almost like the one you proposed (which I had never used by the way):

  
  
tempcolorImage.allocate(640, 480);  
colorImage.allocate(320, 240);  
  
tempcolorImage.setFromPixels(kinect.getPixels(), 640, 480);  
colorImage.setFromPixels(tempcolorImage.getPixels(), 320, 240);  

So, not to be rude or anything, how was I messing with the proportions?. I ask this since I did get some weird proportions on another test I had, I could visually see what you mention but I had no ideas what was happening since I was sure I was using 4:3, like 640x480 is.

Thank you very much again! :smiley:

well not proportions actually but you are reading half a line of the original image and then another half in the next line, setFromPixels doesn’t resize, the size is to specify the dimensions of the pixels you are passing

Well that explains it perfectly.

Muchas gracias Arturo! :smiley: