1 | initial version |
Because it's not supposed to. According to the documentation:
SelectROI()
Selects ROI on the given image. Function creates a window and allows user to select a ROI using mouse. Controls: use space or enter to finish selection, use key c to cancel selection
So pressing space simply finishes the selection, it doesn't close the window. The solution is to manually delete the window, just as you did.