If I have an image (IplImage 8-bit) and a binary mask (which is also an 8-bit IplImage of the same size, where every pixel has a value of either 0 or 255), how can I make every
You can simply use bitwise_and() function.
bitwise_and()
Check the documentation.