Make object detector more foolproof.

Some instance variable and method names were changed to be more clear.
Also, the image loading method (set_image) now resets the foreground
masks--it makes little sense to retain masks from previous images.