Ever have the feeling that your dog knows you're upset before you've said a word? There may be some truth behind that intuition. Scientists have now looked inside dogs' brains as they watched human faces and found that canine brains respond differently to some of the emotions we display.

This study involved pet dogs that had undergone special training to remain awake and still inside an MRI scanner. The researchers wanted to move beyond a question previous studies had asked: "Can dogs tell a happy human face from an unhappy one?" They wanted to know whether dogs could make finer distinctions.

Thousands of years of domestication appear to have shaped dogs to become unusually adept at interpreting human behavior.

The University of Vienna research team began by observing eight dogs as they were shown photographs of unfamiliar people while the animals lay awake in the scanner. Some faces were happy, others were neutral. The people pictured were the same gender as each dog's primary caregiver.

The dogs' brains responded more strongly to the smiling faces in areas involved in visual and cognitive processing, including the temporal cortex, as well as the caudate nucleus, a region associated with reward. That raised an intriguing possibility: Perhaps a human smile means something special to a dog?

The next question was whether the canine brain could do more than recognize "happy" versus "not happy." So, the researchers brought in 12 dogs for a second experiment. This time, the animals viewed unfamiliar human faces showing four expressions: happiness, sadness, fear and anger.

The scientists then used machine-learning techniques to look for patterns in the dog's brain activity. The results were nuanced. In the brain regions identified during the first experiment — areas involved in visual and cognitive processing and reward — the researchers could reliably distinguish happy faces from each of the three negative expressions. Those regions could not reliably tell one negative emotion from another.

When the researchers broadened their analysis to the dog's entire brains, however, something interesting emerged. Brain-activity patterns differed when the dogs viewed fearful faces compared with angry faces and when they viewed fearful faces compared with sad faces.

Anger and sadness, on the other hand, were not reliably distinguishable from each other. That doesn't mean a dog necessarily experiences fear, anger or sadness in exactly the way a human does. Nor does it mean dogs rely on facial expressions alone. In everyday life, a dog has many other clues available including a person's posture, voice and scent. Still, the findings suggest that dogs may be doing more sophisticated emotional processing than simply deciding whether a human looks pleasant or unpleasant.

Humans are good at picking up small details of facial expressions, and so are dogs, explained researcher Raul Hernandez-Perez, first author of the study. "This makes dogs very interesting. By studying their brains, we can understand what adaptations have developed to support their remarkable social and emotional understanding of humans,” he said in a press release.

Dogs may be doing more sophisticated emotional processing than simply deciding whether a human looks pleasant or unpleasant.

It's important to keep in mind that the dogs studied in this project were family pets. The findings may not apply to strays and dogs living in very different circumstances. And a photograph in an MRI scanner is a far cry from the messy, noisy, full body interactions of everyday life.

Even so, the research adds another piece to the puzzle of how dogs become such attentive companions. Their evolutionary history is very different from ours, yet thousands of years of domestication appear to have shaped dogs to become unusually adept at interpreting human behavior.

For dog owners, it may offer a fresh way to think about the familiar experience of being watched by a dog. That gaze may contain more information processing than we once imagined. We still don't know exactly what dogs think when they look at us. But this research suggests their brains are doing considerably more than simply looking back.

The study is published in Cell Press.