The Opening ends when you have ocmpleted yoour opening principles:
Control the center.
Develop minor pieces toward the center.
Castle.
Connect your rooks.
The middlegame ends when:
Most of the major, and or minor pieces are traded off.
Of course this is all subjective.
So I'm aware that chess is often divided in the opening, the middle game and the end game.
I kind of get the "sense" of what are they and when do they happen but I'd like to know if there is a strict definition of each of them or are they an ambiguous phase of the game?