Extracting partial pixel data.

Here’s a question. Let’s say that I have an ofTexture, an ofImage or just an unsigned char * pixel array. Is there an easy way to extract just part of the pixel data and turn it into a smaller ofTexture or ofImage?

For example, in Cinder, there is a method for a Surface called clone. You feed it an area of pixels(upper left and lower right coordinates) and it gives you a copy of a smaller Surface.

  
Surface mLilSurface = mSurface.clone( const Area &area, bool copyPixels = true );  

Anyone have an idea how to efficiently accomplish this in OF?

This is pseudo-code but how I typically do something simliar with the ofxOpenCv addon

  
	  
	ofxCvColorImage testImage;  
	testImage.allocate(videoWidth, videoHeight);  
	testImage = videoGrabber.getPixels();  
	testImage.setROI(0, 0, 100, 100);  
	ofImage colorSection;	  
	colorSection.setFromPixels(testImage.getRoiPixels(), 100, 100, OF_IMAGE_COLOR, true);  
	testImage.resetROI();