Could you provide more information? What do you mean by you "can't seem to get the foreground image"? How do you realize that you "don't have it"? Is it empty? Is it just black when you try to display it?
I'm using C++, but also had an issue with the foreground image when I tried to display it along other images in one window. I first had to convert the image from gray- to rgb-colorspace (in C++ there is the method cvtColor(InputArray src, OutputArray dst, int code, int dstCn=0)
for this). Maybe trying this could help you, but maybe not since I don't know what your precise problem is ;-)