the foreground mask obtained there is 8bit, your captured image is probabably 24bit(3channels). so, to apply it on your actual image , you need to convert the mask to 3 channels as well:
Mat maskrgb;
cvtColor(mask,maskrgb,CV_GRAY2BGR);
// now , apply it:
Mat draw = imagergb & (maskrgb > 0);
imshow("lalala", draw );