As a rule, we perceive a dog's barking as a threat to scare and drive away its offender.
But this is not always the main reason.
A dog may bark for more than just showing off its strength and scaring you.
Why might a dog "raise its voice" at its owner?
A fit of joy
Experts note that an overly happy dog does not always control itself. For example, if a loved one returns after a long absence, the reaction may be unpredictable.
In a fit of happiness, a dog may well bark at its owner simply because it is too happy to see him.
Surprise
If the dog is relaxed and just resting, then a sudden movement or sound from a person may well frighten it. In this case, barking will simply become an automatic reaction to its own fear.
"Flirting"
It is worth remembering that almost all dog breeds are dependent on the attention of their owner. If a person ignores their pet for a long time, barking will become a kind of "flirting".