A resident of a YMCA in Somerville has been accused of taking photos of a woman from behind a bathroom stall while she was changing her clothes.