DNM: implement object map for tracking used image objects

Branch based up wip-8902 branch (#2699). Unique commits start at 38ebaa7.