The present participle in a non-finite relative clause can occur if the preceding noun is the subject of the participle. Present participle clauses correspond to finite relative clauses in the active voice:
The doer of the action expressed by the participle is usually the subject of the sentence or the main clause:
A dog was barking in the distance.
How often do you go swimming? Grumbling to himself, Ted left the room. Having seen the film before, I didn't feel like going to the cinema. The car was parked outside the building. Taken daily, these pills can be highly effective.
Have you ever tried skiing?