Copying pixels from ofImage performance issue

Hi,

I’m trying to copy columns of pixels from a source image to a destination image. I’m having performance issues with my implementation, the first problem I see is that I copy pixel by pixel but I don’t know how to copy all columns at once.

Any help or suggestions?

Thanks,
Santi.

This my implementation:

  
  
void MyClass::copyVerticalPixels(ofImage const &sourceImage, int startColumn, int endColumn, ofImage &destinationImage)  
{  
	for(int i = startColumn; i <= endColumn; i++)  
	{  
		for(int j = 0; j < image.height; j++)  
		{  
			image.setColor(i, j, sourceImage.getColor(i,j));  
		}  
	}  
}  
  

you can use ofxCV and opencv cv::Mat class! they have some ready-to-use method for copying rows, columns, and whatever you like!

hope it helps!