Manually cherry-pick generateEdgeImage function which is magically working now, and add church test image