Mat::copyTo with different background color?

asked 2013-07-19 17:23:32 -0600

Hi forum,

I was using copyTo function to apply a binary mask to a color image so that I could obtain the pixels of interest. However, I realized that the default background color of copied image is black. I checked the function which states as "When the operation mask is specified, and the Mat::create call shown above reallocated the matrix, the newly allocated matrix is initialized with all zeros before copying the data."

My question is how to set the default color to white instead? I used a loop to switch black pixels to white, but it was too expensive that the speed was slower.

Thanks!

edit retag flag offensive close merge delete