Google on pin-hole camera for an explanation of the optical effect. Pin-hole cameras are slow because they let very little light through, and the images they make are a bit soft.
As for your eyes, by restricting the angle of incidence in incoming light (looking through a pin-hole) you're minimizing the errors in your eyes' lenses. You may have noticed that when the light is dim and your pupils dilate as a result, your vision gets even worse than in daylight. This is typical.