ok I've edited the script in post 139 to incorporate the mask/overlay method. You should be able to just open the second part of the script and try it directly. The overlay in the variable avgcap1cap2 is set to mode=blend. I'm not sure if that is best so you can try to change it to luma as well. I don't think it will make that much of a difference though.
*EDIT*
If it's mixing the wrong parts of the images just let me know and I'll switch things around in the script.