I have seen many examples of using the median of a stack in Photoshop to remove variable foreground elements like tourists in vacation photos. (https://photoshoptrainingchannel.com/remove-tourists-stack-mode/)
I am wondering if there is a way to do the opposite in photoshop or another tool? In the tourist example this would mean keeping all of the variable elements (the people moving in the stack) but removing the median background (the buildings and scenery).